<?php
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
//error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);

chdir(dirname(__DIR__));

require_once('./REST/config.php');
require_once('./REST/functions.php');
if ($_GET['key'] != $restConfig['e5Key']) {
    echo 'Unauthorized';
    exit;
}
// Enable SugarCRM features
if(!defined('sugarEntry'))define('sugarEntry', true);
require_once('./include/entryPoint.php');
// Make action
switch ($_GET["action"]) {
    case 'getInvoice': 
        sendInvoice($_GET['record']);
        break;
    case 'getProduct':
        sendProduct($_GET['record']);
        break;
    case 'copySaleFromTwinpol':
        copySaleFromTwinpol($_GET['record']);
        break;
}
?>