mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 12:07:15 +01:00
587 lines
19 KiB
PHP
587 lines
19 KiB
PHP
<?php
|
|
use Xentral\Core\LegacyConfig\ConfigLoader;
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
if(!class_exists('Conf')){
|
|
include_once(dirname(__DIR__) . '/conf/main.conf.php');
|
|
}
|
|
include_once(dirname(__DIR__) . '/phpwf/plugins/class.mysql.php');
|
|
if(!class_exists('Secure')){
|
|
include_once(dirname(__DIR__) . '/phpwf/plugins/class.secure.php');
|
|
}
|
|
if(!class_exists('User')){
|
|
include_once(dirname(__DIR__) . '/phpwf/plugins/class.user.php');
|
|
}
|
|
if(!class_exists('FormHandler')){
|
|
include_once(dirname(__DIR__) . '/phpwf/plugins/class.formhandler.php');
|
|
}
|
|
if(!class_exists('FPDFWAWISION')){
|
|
if(file_exists(dirname(__DIR__).'/conf/user_defined.php')){
|
|
include_once dirname(__DIR__) . '/conf/user_defined.php';
|
|
}
|
|
if(defined('USEFPDF3') && USEFPDF3 && file_exists(dirname(__DIR__) . '/www/lib/pdf/fpdf_3.php')){
|
|
require_once dirname(__DIR__) . '/www/lib/pdf/fpdf_3.php';
|
|
}else if(defined('USEFPDF2') && USEFPDF2 && file_exists(dirname(__DIR__) . '/www/lib/pdf/fpdf_2.php')){
|
|
require_once dirname(__DIR__) . '/www/lib/pdf/fpdf_2.php';
|
|
}else{
|
|
require_once dirname(__DIR__) . '/www/lib/pdf/fpdf.php';
|
|
}
|
|
}
|
|
if(!class_exists('PDF_EPS')){
|
|
include_once(dirname(__DIR__) . '/www/lib/pdf/fpdf_final.php');
|
|
}
|
|
if(!class_exists('IMAP')){
|
|
include_once(dirname(__DIR__) . '/www/lib/imap.inc.php');
|
|
}
|
|
if(!class_exists('erpAPI')){
|
|
include_once(dirname(__DIR__) . '/www/lib/class.erpapi.php');
|
|
}
|
|
if(!class_exists('Remote')){
|
|
include_once(dirname(__DIR__) . '/www/lib/class.remote.php');
|
|
}
|
|
include_once(dirname(__DIR__) . '/www/lib/class.httpclient.php');
|
|
if(!class_exists('AES')){
|
|
$aes = '';
|
|
$phpversion = phpversion();
|
|
if($phpversion[0] == '7' && (int)$phpversion[2] > 0) $aes = '2';
|
|
if($aes == 2 && is_file(dirname(__DIR__) . '/www/lib/class.aes' . $aes . '.php')){
|
|
include_once(dirname(__DIR__) . '/www/lib/class.aes' . $aes . '.php');
|
|
}else{
|
|
include_once(dirname(__DIR__) . '/www/lib/class.aes.php');
|
|
}
|
|
}
|
|
$classes = array('briefpapier','lieferschein','auftrag','anfrage','gutschrift','bestellung','rechnung',
|
|
'mahnwesen');
|
|
foreach($classes as $class)
|
|
{
|
|
if(file_exists(dirname(__DIR__) . '/www/lib/dokumente/class.'.$class.'_custom.php')
|
|
&& !class_exists(ucfirst($class).($class==='briefpapier'?'':'PDF').'Custom')
|
|
)
|
|
{
|
|
include_once(dirname(__DIR__) . '/www/lib/dokumente/class.'.$class.'_custom.php');
|
|
}elseif(file_exists(dirname(__DIR__) . '/www/lib/dokumente/class.'.$class.'.php')
|
|
&& !class_exists(ucfirst($class).($class==='briefpapier'?'':'PDF'))
|
|
)
|
|
{
|
|
include_once(dirname(__DIR__) . '/www/lib/dokumente/class.'.$class.'.php');
|
|
}
|
|
}
|
|
|
|
/*
|
|
include_once(__DIR__."/../www/lib/dokumente/class.briefpapier.php");
|
|
include_once(__DIR__."/../www/lib/dokumente/class.lieferschein.php");
|
|
include_once(__DIR__."/../www/lib/dokumente/class.auftrag.php");
|
|
include_once(__DIR__."/../www/lib/dokumente/class.angebot.php");
|
|
if(file_exists(__DIR__."/../www/lib/dokumente/class.anfrage.php"))include_once(__DIR__."/../www/lib/dokumente/class.anfrage.php");
|
|
include_once(__DIR__."/../www/lib/dokumente/class.gutschrift.php");
|
|
include_once(__DIR__."/../www/lib/dokumente/class.bestellung.php");
|
|
include_once(__DIR__."/../www/lib/dokumente/class.rechnung.php");
|
|
include_once(__DIR__."/../www/lib/dokumente/class.mahnwesen.php");
|
|
include_once(__DIR__."/../phpwf/class.application_core.php");
|
|
include_once(__DIR__."/../www/lib/ShopimporterBase.php");
|
|
*/
|
|
if(!class_exists('WawiString')){
|
|
include_once(dirname(__DIR__) . '/phpwf/plugins/class.string.php');
|
|
}
|
|
if(!class_exists('app_t2'))
|
|
{
|
|
class app_t2 extends ApplicationCore {
|
|
var $DB;
|
|
var $erp;
|
|
var $User;
|
|
var $mail;
|
|
var $remote;
|
|
var $Secure;
|
|
|
|
public function GetLandLang($isocode)
|
|
{
|
|
$flipped = array_flip($this->GetLaender());
|
|
if(isset($flipped[$isocode])){
|
|
$land = $flipped[$isocode];
|
|
}
|
|
else
|
|
{
|
|
$land = 'unkown';
|
|
}
|
|
return $land;
|
|
}
|
|
|
|
public function GetLaender()
|
|
{
|
|
$laender = array(
|
|
'Afghanistan' => 'AF',
|
|
'Ägypten' => 'EG',
|
|
'Albanien' => 'AL',
|
|
'Algerien' => 'DZ',
|
|
'Andorra' => 'AD',
|
|
'Angola' => 'AO',
|
|
'Anguilla' => 'AI',
|
|
'Antarktis' => 'AQ',
|
|
'Antigua und Barbuda' => 'AG',
|
|
'Äquatorial Guinea' => 'GQ',
|
|
'Argentinien' => 'AR',
|
|
'Armenien' => 'AM',
|
|
'Aruba' => 'AW',
|
|
'Aserbaidschan' => 'AZ',
|
|
'Äthiopien' => 'ET',
|
|
'Australien' => 'AU',
|
|
'Bahamas' => 'BS',
|
|
'Bahrain' => 'BH',
|
|
'Bangladesh' => 'BD',
|
|
'Barbados' => 'BB',
|
|
'Belgien' => 'BE',
|
|
'Belize' => 'BZ',
|
|
'Benin' => 'BJ',
|
|
'Bermudas' => 'BM',
|
|
'Bhutan' => 'BT',
|
|
'Birma' => 'MM',
|
|
'Bolivien' => 'BO',
|
|
'Bosnien-Herzegowina' => 'BA',
|
|
'Botswana' => 'BW',
|
|
'Bouvet Inseln' => 'BV',
|
|
'Brasilien' => 'BR',
|
|
'Britisch-Indischer Ozean' => 'IO',
|
|
'Brunei' => 'BN',
|
|
'Bulgarien' => 'BG',
|
|
'Burkina Faso' => 'BF',
|
|
'Burundi' => 'BI',
|
|
'Chile' => 'CL',
|
|
'China' => 'CN',
|
|
'Christmas Island' => 'CX',
|
|
'Cook Inseln' => 'CK',
|
|
'Costa Rica' => 'CR',
|
|
'Dänemark' => 'DK',
|
|
'Deutschland' => 'DE',
|
|
'Djibuti' => 'DJ',
|
|
'Dominika' => 'DM',
|
|
'Dominikanische Republik' => 'DO',
|
|
'Ecuador' => 'EC',
|
|
'El Salvador' => 'SV',
|
|
'Elfenbeinküste' => 'CI',
|
|
'Eritrea' => 'ER',
|
|
'Estland' => 'EE',
|
|
'Falkland Inseln' => 'FK',
|
|
'Färöer Inseln' => 'FO',
|
|
'Fidschi' => 'FJ',
|
|
'Finnland' => 'FI',
|
|
'Frankreich' => 'FR',
|
|
'Französisch Guyana' => 'GF',
|
|
'Französisch Polynesien' => 'PF',
|
|
'Französisches Süd-Territorium' => 'TF',
|
|
'Gabun' => 'GA',
|
|
'Gambia' => 'GM',
|
|
'Georgien' => 'GE',
|
|
'Ghana' => 'GH',
|
|
'Gibraltar' => 'GI',
|
|
'Grenada' => 'GD',
|
|
'Griechenland' => 'GR',
|
|
'Grönland' => 'GL',
|
|
'Großbritannien' => 'UK',
|
|
'Großbritannien (UK)' => 'GB',
|
|
'Guadeloupe' => 'GP',
|
|
'Guam' => 'GU',
|
|
'Guatemala' => 'GT',
|
|
'Guinea' => 'GN',
|
|
'Guinea Bissau' => 'GW',
|
|
'Guyana' => 'GY',
|
|
'Haiti' => 'HT',
|
|
'Heard und McDonald Islands' => 'HM',
|
|
'Honduras' => 'HN',
|
|
'Hong Kong' => 'HK',
|
|
'Indien' => 'IN',
|
|
'Indonesien' => 'ID',
|
|
'Irak' => 'IQ',
|
|
'Iran' => 'IR',
|
|
'Irland' => 'IE',
|
|
'Island' => 'IS',
|
|
'Israel' => 'IL',
|
|
'Italien' => 'IT',
|
|
'Jamaika' => 'JM',
|
|
'Japan' => 'JP',
|
|
'Jemen' => 'YE',
|
|
'Jordanien' => 'JO',
|
|
'Jugoslawien' => 'YU',
|
|
'Kaiman Inseln' => 'KY',
|
|
'Kambodscha' => 'KH',
|
|
'Kamerun' => 'CM',
|
|
'Kanada' => 'CA',
|
|
'Kap Verde' => 'CV',
|
|
'Kasachstan' => 'KZ',
|
|
'Kenia' => 'KE',
|
|
'Kirgisistan' => 'KG',
|
|
'Kiribati' => 'KI',
|
|
'Kokosinseln' => 'CC',
|
|
'Kolumbien' => 'CO',
|
|
'Komoren' => 'KM',
|
|
'Kongo' => 'CG',
|
|
'Kongo, Demokratische Republik' => 'CD',
|
|
'Kosovo' => 'KO',
|
|
'Kroatien' => 'HR',
|
|
'Kuba' => 'CU',
|
|
'Kuwait' => 'KW',
|
|
'Laos' => 'LA',
|
|
'Lesotho' => 'LS',
|
|
'Lettland' => 'LV',
|
|
'Libanon' => 'LB',
|
|
'Liberia' => 'LR',
|
|
'Libyen' => 'LY',
|
|
'Liechtenstein' => 'LI',
|
|
'Litauen' => 'LT',
|
|
'Luxemburg' => 'LU',
|
|
'Macao' => 'MO',
|
|
'Madagaskar' => 'MG',
|
|
'Malawi' => 'MW',
|
|
'Malaysia' => 'MY',
|
|
'Malediven' => 'MV',
|
|
'Mali' => 'ML',
|
|
'Malta' => 'MT',
|
|
'Marianen' => 'MP',
|
|
'Marokko' => 'MA',
|
|
'Marshall Inseln' => 'MH',
|
|
'Martinique' => 'MQ',
|
|
'Mauretanien' => 'MR',
|
|
'Mauritius' => 'MU',
|
|
'Mayotte' => 'YT',
|
|
'Mazedonien' => 'MK',
|
|
'Mexiko' => 'MX',
|
|
'Mikronesien' => 'FM',
|
|
'Mocambique' => 'MZ',
|
|
'Moldavien' => 'MD',
|
|
'Monaco' => 'MC',
|
|
'Mongolei' => 'MN',
|
|
'Montenegro' => 'ME',
|
|
'Montserrat' => 'MS',
|
|
'Namibia' => 'NA',
|
|
'Nauru' => 'NR',
|
|
'Nepal' => 'NP',
|
|
'Neukaledonien' => 'NC',
|
|
'Neuseeland' => 'NZ',
|
|
'Nicaragua' => 'NI',
|
|
'Niederlande' => 'NL',
|
|
'Niederländische Antillen' => 'AN',
|
|
'Niger' => 'NE',
|
|
'Nigeria' => 'NG',
|
|
'Niue' => 'NU',
|
|
'Nord Korea' => 'KP',
|
|
'Norfolk Inseln' => 'NF',
|
|
'Norwegen' => 'NO',
|
|
'Oman' => 'OM',
|
|
'Österreich' => 'AT',
|
|
'Pakistan' => 'PK',
|
|
'Palästina' => 'PS',
|
|
'Palau' => 'PW',
|
|
'Panama' => 'PA',
|
|
'Papua Neuguinea' => 'PG',
|
|
'Paraguay' => 'PY',
|
|
'Peru' => 'PE',
|
|
'Philippinen' => 'PH',
|
|
'Pitcairn' => 'PN',
|
|
'Polen' => 'PL',
|
|
'Portugal' => 'PT',
|
|
'Puerto Rico' => 'PR',
|
|
'Qatar' => 'QA',
|
|
'Reunion' => 'RE',
|
|
'Ruanda' => 'RW',
|
|
'Rumänien' => 'RO',
|
|
'Rußland' => 'RU',
|
|
'Saint Lucia' => 'LC',
|
|
'Sambia' => 'ZM',
|
|
'Samoa' => 'AS',
|
|
'Samoa' => 'WS',
|
|
'San Marino' => 'SM',
|
|
'Sao Tome' => 'ST',
|
|
'Saudi Arabien' => 'SA',
|
|
'Schweden' => 'SE',
|
|
'Schweiz' => 'CH',
|
|
'Senegal' => 'SN',
|
|
'Serbien' => 'RS',
|
|
'Seychellen' => 'SC',
|
|
'Sierra Leone' => 'SL',
|
|
'Singapur' => 'SG',
|
|
'Slowakei -slowakische Republik-' => 'SK',
|
|
'Slowenien' => 'SI',
|
|
'Solomon Inseln' => 'SB',
|
|
'Somalia' => 'SO',
|
|
'South Georgia, South Sandwich Isl.' => 'GS',
|
|
'Spanien' => 'ES',
|
|
'Sri Lanka' => 'LK',
|
|
'St. Helena' => 'SH',
|
|
'St. Kitts Nevis Anguilla' => 'KN',
|
|
'St. Pierre und Miquelon' => 'PM',
|
|
'St. Vincent' => 'VC',
|
|
'Süd Korea' => 'KR',
|
|
'Südafrika' => 'ZA',
|
|
'Sudan' => 'SD',
|
|
'Surinam' => 'SR',
|
|
'Svalbard und Jan Mayen Islands' => 'SJ',
|
|
'Swasiland' => 'SZ',
|
|
'Syrien' => 'SY',
|
|
'Tadschikistan' => 'TJ',
|
|
'Taiwan' => 'TW',
|
|
'Tansania' => 'TZ',
|
|
'Thailand' => 'TH',
|
|
'Timor' => 'TP',
|
|
'Togo' => 'TG',
|
|
'Tokelau' => 'TK',
|
|
'Tonga' => 'TO',
|
|
'Trinidad Tobago' => 'TT',
|
|
'Tschad' => 'TD',
|
|
'Tschechische Republik' => 'CZ',
|
|
'Tunesien' => 'TN',
|
|
'Türkei' => 'TR',
|
|
'Turkmenistan' => 'TM',
|
|
'Turks und Kaikos Inseln' => 'TC',
|
|
'Tuvalu' => 'TV',
|
|
'Uganda' => 'UG',
|
|
'Ukraine' => 'UA',
|
|
'Ungarn' => 'HU',
|
|
'Uruguay' => 'UY',
|
|
'Usbekistan' => 'UZ',
|
|
'Vanuatu' => 'VU',
|
|
'Vatikan' => 'VA',
|
|
'Venezuela' => 'VE',
|
|
'Vereinigte Arabische Emirate' => 'AE',
|
|
'Vereinigte Staaten von Amerika' => 'US',
|
|
'Vietnam' => 'VN',
|
|
'Virgin Island (Brit.)' => 'VG',
|
|
'Virgin Island (USA)' => 'VI',
|
|
'Wallis et Futuna' => 'WF',
|
|
'Weißrußland' => 'BY',
|
|
'Westsahara' => 'EH',
|
|
'Zentralafrikanische Republik' => 'CF',
|
|
'Zimbabwe' => 'ZW',
|
|
'Zypern' => 'CY'
|
|
);
|
|
return $laender;
|
|
}
|
|
}
|
|
}
|
|
//ENDE
|
|
|
|
if(empty($app) || !class_exists('ApplicationCore') || !($app instanceof ApplicationCore)) {
|
|
$app = new app_t2();
|
|
}
|
|
if(empty($app->Conf)){
|
|
$conf = ConfigLoader::load();
|
|
$app->Conf = $conf;
|
|
}
|
|
if(empty($app->DB) || empty($app->DB->connection)) {
|
|
$app->DB = new DB($app->Conf->WFdbhost, $app->Conf->WFdbname, $app->Conf->WFdbuser, $app->Conf->WFdbpass, $app, $app->Conf->WFdbport);
|
|
}
|
|
if(empty($app->erp)) {
|
|
if(class_exists('erpAPICustom')) {
|
|
$erp = new erpAPICustom($app);
|
|
}
|
|
else {
|
|
$erp = new erpAPI($app);
|
|
}
|
|
$app->erp = $erp;
|
|
}
|
|
$app->String = new WawiString();
|
|
if(class_exists('RemoteCustom'))
|
|
{
|
|
$app->remote = new RemoteCustom($app);
|
|
}else{
|
|
$app->remote = new Remote($app);
|
|
}
|
|
$app->Secure = new Secure($app);
|
|
$app->User = new User($app);
|
|
if(!defined('FPDF_FONTPATH'))
|
|
{
|
|
define('FPDF_FONTPATH',dirname(__DIR__) . '/www/lib/pdf/font/');
|
|
}
|
|
|
|
|
|
//ENDE
|
|
|
|
$app->FormHandler = new FormHandler($app);
|
|
|
|
if(!$app->erp->ModulVorhanden('uebertragungen')) {
|
|
return;
|
|
}
|
|
|
|
$app->DB->Update(
|
|
"UPDATE prozessstarter
|
|
SET mutexcounter = mutexcounter + 1
|
|
WHERE mutex = 1 AND (parameter = 'api_uebertragungen') AND aktiv = 1"
|
|
);
|
|
if(!$app->DB->Select("SELECT id FROM prozessstarter WHERE mutex = 0 AND parameter = 'api_uebertragungen' AND aktiv = 1")) {
|
|
return;
|
|
}
|
|
|
|
$app->DB->Update(
|
|
"UPDATE prozessstarter SET letzteausfuerhung=NOW(), mutex = 1,mutexcounter=0 WHERE parameter = 'api_uebertragungen'"
|
|
);
|
|
if(!class_exists('Api')){
|
|
include_once dirname(__DIR__) . '/www/pages/api.php';
|
|
}
|
|
if(!class_exists('Uebertragungen')){
|
|
include_once dirname(__DIR__) . '/www/pages/uebertragungen.php';
|
|
}
|
|
|
|
$api = new Api($app, true);
|
|
$uebertragungen = new Uebertragungen($app, true);
|
|
$uebertragungen_accounts = $app->DB->SelectArr(
|
|
"SELECT * FROM uebertragungen_account WHERE aktiv = 1 AND (api > 0 OR typ = 'lokal')"
|
|
);
|
|
|
|
$belegtypen = $uebertragungen->getDocumentTypes();
|
|
$belegabkuerzungen = $uebertragungen->getShortCodes();
|
|
if(empty($uebertragungen_accounts)) {
|
|
$app->DB->Update(
|
|
"UPDATE prozessstarter
|
|
SET letzteausfuerhung=NOW(), mutex = 0,mutexcounter=0
|
|
WHERE parameter = 'api_uebertragungen'"
|
|
);
|
|
return;
|
|
}
|
|
|
|
|
|
//Requests generieren
|
|
$app->erp->ProzessstarterStatus(
|
|
'Requests generieren',
|
|
$app->DB->Select("SELECT id FROM prozessstarter WHERE parameter = 'api_uebertragungen' AND aktiv = 1 LIMIT 1")
|
|
);
|
|
$uebertragungen->cronjobGenerateRequests($uebertragungen_accounts);
|
|
|
|
|
|
$app->erp->ProzessstarterStatus('Artikel übertragen');
|
|
//Artikel übertragen
|
|
$app->DB->Update(
|
|
"UPDATE prozessstarter SET letzteausfuerhung=NOW(), mutex = 1,mutexcounter=0 WHERE parameter = 'api_uebertragungen'"
|
|
);
|
|
|
|
foreach($uebertragungen_accounts as $uebertragung_account) {
|
|
$uebertragungen->datei_id = null;
|
|
if(method_exists($app->erp, 'canRunCronjob') && !$app->erp->canRunCronjob(['api_uebertragungen'])) {
|
|
return;
|
|
}
|
|
$app->erp->ProzessstarterStatus('Artikel übertragen '.$uebertragung_account['bezeichnung']);
|
|
$countTransferAricle = $uebertragungen->transferAricle($uebertragung_account);
|
|
if($countTransferAricle > 0) {
|
|
$app->erp->LogFile($uebertragung_account['bezeichnung'].': '.$countTransferAricle.' Artikel uebertragen');
|
|
}
|
|
$app->DB->Update(
|
|
"UPDATE prozessstarter SET letzteausfuerhung=NOW(), mutex = 1,mutexcounter=0 WHERE parameter = 'api_uebertragungen'"
|
|
);
|
|
$uebertragungen->datei_id = null;
|
|
}
|
|
|
|
//SalesReports generieren
|
|
foreach($uebertragungen_accounts as $uebertragungen_account) {
|
|
$uebertragungen->datei_id = null;
|
|
if($uebertragungen->createSaleReport($uebertragungen_account)) {
|
|
$app->erp->LogFile($uebertragung_account['bezeichnung'].': SaleReport uebertragen');
|
|
}
|
|
$uebertragungen->datei_id = null;
|
|
}
|
|
if(method_exists($app->erp, 'canRunCronjob') && !$app->erp->canRunCronjob(['api_uebertragungen'])) {
|
|
return;
|
|
}
|
|
//SalesReports uebertragen
|
|
foreach($uebertragungen_accounts as $uebertragungen_account) {
|
|
$uebertragungen->datei_id = null;
|
|
if(!$uebertragungen_account['send_sales_report']) {
|
|
continue;
|
|
}
|
|
$salesReports = $uebertragungen->getSellingReports($uebertragungen_account['id']);
|
|
if(empty($salesReports)) {
|
|
continue;
|
|
}
|
|
$uebertragungen->sendSellingReport($uebertragungen_account, $salesReports);
|
|
$uebertragungen->datei_id = null;
|
|
}
|
|
if(method_exists($app->erp, 'canRunCronjob') && !$app->erp->canRunCronjob(['api_uebertragungen'])) {
|
|
return;
|
|
}
|
|
//Requests senden
|
|
$app->erp->ProzessstarterStatus('Requests senden');
|
|
foreach($uebertragungen_accounts as $uebertragung_account) {
|
|
$uebertragungen->datei_id = null;
|
|
$uebertragungen->cronjobSendDocuments($uebertragung_account, $api);
|
|
$uebertragungen->datei_id = null;
|
|
}
|
|
if(method_exists($app->erp, 'canRunCronjob') && !$app->erp->canRunCronjob(['api_uebertragungen'])) {
|
|
return;
|
|
}
|
|
$app->DB->Update(
|
|
"UPDATE prozessstarter SET letzteausfuerhung=NOW(), mutex = 1,mutexcounter=0 WHERE parameter = 'api_uebertragungen'"
|
|
);
|
|
//Daten Holen
|
|
$app->erp->ProzessstarterStatus('Daten Holen');
|
|
$anz = 0;
|
|
foreach($uebertragungen_accounts as $uebertragung_account) {
|
|
$uebertragungen->datei_id = null;
|
|
$uebertragungen->CronjobGetData($uebertragung_account, $api);
|
|
$uebertragungen->datei_id = null;
|
|
}
|
|
if(method_exists($app->erp, 'canRunCronjob') && !$app->erp->canRunCronjob(['api_uebertragungen'])) {
|
|
return;
|
|
}
|
|
$app->DB->Update(
|
|
"UPDATE prozessstarter
|
|
SET letzteausfuerhung= DATE_ADD(NOW(),INTERVAL 3 MINUTE), mutex = 1,mutexcounter=0
|
|
WHERE parameter = 'api_uebertragungen'"
|
|
);
|
|
$fnr3 = 1;
|
|
foreach($uebertragungen_accounts as $uebertragung_account) {
|
|
$uebertragungen->datei_id = null;
|
|
$lagerzahlen = $uebertragung_account['lagerzahlen'];
|
|
$tracking = $uebertragung_account['tracking'];
|
|
|
|
$uebertragungen->cronjobTracking($uebertragung_account, $api);
|
|
|
|
$uebertragungen->cronjobSendStorage($uebertragung_account, $api);
|
|
|
|
if(empty($uebertragungen->xml_pdfselorig[$uebertragung_account['xml_pdf']])) {
|
|
try {
|
|
$obj = $uebertragungen->LoadTransferModul($uebertragung_account['xml_pdf'], $uebertragung_account['id']);
|
|
if(!empty($obj) && method_exists($obj, 'generalRunning')){
|
|
$obj->generalRunning($uebertragungen);
|
|
}
|
|
}
|
|
catch(Exception $e) {
|
|
$app->erp->LogFile(
|
|
[
|
|
'ParseFileError'=>$e->getMessage(),
|
|
'Module'=>$uebertragung_account['xml_pdf']
|
|
]
|
|
);
|
|
}
|
|
}
|
|
|
|
$app->DB->Update(
|
|
"UPDATE prozessstarter SET letzteausfuerhung=NOW(), mutex = 1,mutexcounter=0 WHERE parameter = 'api_uebertragungen'"
|
|
);
|
|
$uebertragungen->datei_id = null;
|
|
}
|
|
if(method_exists($app->erp, 'canRunCronjob') && !$app->erp->canRunCronjob(['api_uebertragungen'])) {
|
|
return;
|
|
}
|
|
if(method_exists($uebertragungen,'forceAutoTracking')) {
|
|
foreach ($uebertragungen_accounts as $uebertragung_account) {
|
|
if($uebertragung_account['autoshopexport'] <= 0
|
|
|| empty($uebertragung_account['trackingeingang'])
|
|
|| empty($uebertragung_account['aktiv'])
|
|
|| !in_array($uebertragung_account['belegtyp'], ['lieferschein', 'auftrag'])
|
|
) {
|
|
continue;
|
|
}
|
|
$uebertragungen->forceAutoTracking($uebertragung_account);
|
|
$app->DB->Update(
|
|
"UPDATE prozessstarter
|
|
SET letzteausfuerhung=NOW(), mutex = 1,mutexcounter=0
|
|
WHERE parameter = 'api_uebertragungen'"
|
|
);
|
|
}
|
|
}
|
|
//Ende Artikel übertragen
|
|
|
|
if(isset($anz) && $anz > 1) {
|
|
$app->DB->Update("UPDATE prozessstarter SET letzteausfuerhung=DATE_ADD(NOW(), INTERVAL 5 MINUTE), mutex = 0,mutexcounter=0 WHERE parameter = 'api_uebertragungen'");
|
|
}
|
|
else{
|
|
$app->DB->Update("UPDATE prozessstarter SET letzteausfuerhung=NOW(), mutex = 0,mutexcounter=0 WHERE parameter = 'api_uebertragungen'");
|
|
}
|
|
|
|
//$app->erp->ProzessUnlock($fp);
|