2025-05-12 15:44:39 +00:00
|
|
|
<?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');
|
|
|
|
|
|
|
|
|
|
$GLOBALS['mailLog'] = '';
|
|
|
|
|
|
|
|
|
|
if ($_GET['key'] != $restConfig['twinpolKey']) {
|
|
|
|
|
echo 'Unauthorized';
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
require_once('./REST/functions.php');
|
2025-10-21 17:04:15 +02:00
|
|
|
require_once('./REST/bimai.php');
|
2025-05-12 15:44:39 +00:00
|
|
|
// Enable SugarCRM features
|
|
|
|
|
if(!defined('sugarEntry'))define('sugarEntry', true);
|
|
|
|
|
require_once('./include/entryPoint.php');
|
|
|
|
|
require_once ('data/SugarBean.php');
|
|
|
|
|
require_once ('include/utils.php');
|
|
|
|
|
// fix db, but why?
|
|
|
|
|
$GLOBALS['db']->query("USE preDb_0dcc87940d3655fa574b253df04ca1c3;");
|
|
|
|
|
|
|
|
|
|
switch ($_GET["action"]) {
|
|
|
|
|
case 'createPzFromInvoice':
|
|
|
|
|
createPzFromInvoice($_GET['record'], $_GET['stock_id']);
|
|
|
|
|
break;
|
|
|
|
|
case 'getSale':
|
|
|
|
|
sendSale($_GET['record']);
|
|
|
|
|
break;
|
|
|
|
|
case 'getStocks':
|
|
|
|
|
sendStocks();
|
|
|
|
|
break;
|
|
|
|
|
case 'updateSaleE5Number':
|
|
|
|
|
updateSaleE5Number($_GET['record'], $_GET['e5_record'], $_GET['e5_document_no']);
|
|
|
|
|
break;
|
2025-06-05 20:02:44 +00:00
|
|
|
case 'createCostDocumentFromInvoice':
|
|
|
|
|
createCostDocumentFromInvoice($_GET['record']);
|
|
|
|
|
break;
|
2025-08-22 17:10:42 +02:00
|
|
|
case 'createCSVReports':
|
|
|
|
|
createCSVReports();
|
|
|
|
|
break;
|
2025-10-21 17:04:15 +02:00
|
|
|
case 'bimai.export.ecommerce':
|
|
|
|
|
bimai_exportEcommerceDate($_GET['since']);
|
|
|
|
|
break;
|
2025-05-12 15:44:39 +00:00
|
|
|
}
|
2025-10-21 17:04:15 +02:00
|
|
|
// https://crm.twinpol.com/REST/index.php?key=d68dac4c-f784-4e1b-8267-9ffcfa0eda4c&action=createCostDocumentFromInvoice&record=c3f6eaa6-0cbd-8c89-1a8c-683ff19a36db
|