Commit old changes
This commit is contained in:
2
cron.php
2
cron.php
@@ -98,7 +98,6 @@ if($timestamp[0] < strtotime(date('H:i'))) {
|
|||||||
$s = new Scheduler();
|
$s = new Scheduler();
|
||||||
$s->flushDeadJobs();
|
$s->flushDeadJobs();
|
||||||
$s->checkPendingJobs();
|
$s->checkPendingJobs();
|
||||||
$GLOBALS['log']->info('Scheduler - tutaj dochodzę');
|
|
||||||
} else {
|
} else {
|
||||||
$GLOBALS['log']->fatal('Scheduler cannot write PID file. Please check permissions on '.$cachePath);
|
$GLOBALS['log']->fatal('Scheduler cannot write PID file. Please check permissions on '.$cachePath);
|
||||||
}
|
}
|
||||||
@@ -107,4 +106,3 @@ if($timestamp[0] < strtotime(date('H:i'))) {
|
|||||||
}
|
}
|
||||||
$exit_on_cleanup = true;
|
$exit_on_cleanup = true;
|
||||||
sugar_cleanup($exit_on_cleanup);
|
sugar_cleanup($exit_on_cleanup);
|
||||||
?>
|
|
||||||
@@ -42,8 +42,8 @@ $app_list_strings['moduleList']['EcmTexts']='Texts';
|
|||||||
|
|
||||||
$app_list_strings['moduleList']['EcmInvoiceOuts'] = 'Invoices';
|
$app_list_strings['moduleList']['EcmInvoiceOuts'] = 'Invoices';
|
||||||
$app_list_strings['ecminvoiceouts_parent_dom'] = array (
|
$app_list_strings['ecminvoiceouts_parent_dom'] = array (
|
||||||
'Accounts' => $app_list_strings['moduleList']['Accounts'],
|
//'Accounts' => $app_list_strings['moduleList']['Accounts'],
|
||||||
'Contacts' => $app_list_strings['moduleList']['Contacts'],
|
//'Contacts' => $app_list_strings['moduleList']['Contacts'],
|
||||||
);
|
);
|
||||||
$app_list_strings['ecminvoiceouts_status_dom'] = array (
|
$app_list_strings['ecminvoiceouts_status_dom'] = array (
|
||||||
'registered' => 'Registered',
|
'registered' => 'Registered',
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
|
|
||||||
$app_list_strings['moduleList']['EcmInvoiceOuts'] = 'Faktury';
|
$app_list_strings['moduleList']['EcmInvoiceOuts'] = 'Faktury';
|
||||||
$app_list_strings['ecminvoiceouts_parent_dom'] = array (
|
$app_list_strings['ecminvoiceouts_parent_dom'] = array (
|
||||||
'Accounts' => $app_list_strings['moduleList']['Accounts'],
|
//'Accounts' => $app_list_strings['moduleList']['Accounts'],
|
||||||
'Contacts' => $app_list_strings['moduleList']['Contacts'],
|
//'Contacts' => $app_list_strings['moduleList']['Contacts'],
|
||||||
);
|
);
|
||||||
$app_list_strings['ecminvoiceouts_type_dom'] = array (
|
$app_list_strings['ecminvoiceouts_type_dom'] = array (
|
||||||
'normal' => 'Normalna',
|
'normal' => 'Normalna',
|
||||||
@@ -48,7 +48,7 @@ $app_list_strings['ecmproducts_product_brand_dom'] = array(
|
|||||||
'brak' => 'Brak',
|
'brak' => 'Brak',
|
||||||
);
|
);
|
||||||
|
|
||||||
$app_list_strings['moduleList']['EcmDeliveryConditions'] = 'Warunki Przesy<73>ki';
|
$app_list_strings['moduleList']['EcmDeliveryConditions'] = 'Warunki Przesy<73>ki';
|
||||||
|
|
||||||
|
|
||||||
$app_list_strings['moduleList']['EcmDocumentTemplates']='Szablony Dokumentów';
|
$app_list_strings['moduleList']['EcmDocumentTemplates']='Szablony Dokumentów';
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ function checkEDISales()
|
|||||||
$s->document_no = $s->formatNumber($number);
|
$s->document_no = $s->formatNumber($number);
|
||||||
$s->edi_file = $order;
|
$s->edi_file = $order;
|
||||||
$s->type = 'sales_order';
|
$s->type = 'sales_order';
|
||||||
$s->status = 's30';
|
$s->status = 's60';
|
||||||
$s->ecmlanguage = 'pl_pl';
|
$s->ecmlanguage = 'pl_pl';
|
||||||
$a = new Account();
|
$a = new Account();
|
||||||
$a->retrieve($s->parent_id);
|
$a->retrieve($s->parent_id);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
// created: 2024-04-26 08:00:00
|
// created: 2024-09-12 06:58:07
|
||||||
$customDoms = array (
|
$customDoms = array (
|
||||||
'ecmproducts_attribute_dom' =>
|
'ecmproducts_attribute_dom' =>
|
||||||
array (
|
array (
|
||||||
@@ -41,10 +41,14 @@ $customDoms = array (
|
|||||||
'8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'Bottle D22_500ml',
|
'8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'Bottle D22_500ml',
|
||||||
'307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'B D23_500ml (nabłyszczacz)',
|
'307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'B D23_500ml (nabłyszczacz)',
|
||||||
'5df47246-d0cd-4151-9bdd-65eede53aba5' => 'B D24_500ml (systemy mleczne)',
|
'5df47246-d0cd-4151-9bdd-65eede53aba5' => 'B D24_500ml (systemy mleczne)',
|
||||||
|
'ab74cd2c-7720-5875-7ca5-66bb55a3e075' => 'Bottle D25_500ml (Ula)',
|
||||||
'd7c10cb9-7459-1174-6315-661cdae38a39' => 'D11_1000ml',
|
'd7c10cb9-7459-1174-6315-661cdae38a39' => 'D11_1000ml',
|
||||||
'58664d9d-0295-3539-4662-659f18dc4b80' => 'Bottle',
|
'58664d9d-0295-3539-4662-659f18dc4b80' => 'Bottle',
|
||||||
'92a7ee9b-d953-fd7e-5c88-65c9bf1e144d' => 'B D22_1000ml (szyjka)',
|
'92a7ee9b-d953-fd7e-5c88-65c9bf1e144d' => 'B D22_1000ml (szyjka)',
|
||||||
'87a2b609-9b67-de82-8f41-65eedd4613c9' => 'D23_1000ml (systemy mleczne)',
|
'87a2b609-9b67-de82-8f41-65eedd4613c9' => 'D23_1000ml (systemy mleczne)',
|
||||||
|
'75980ea5-d89e-3923-2662-66bb55202244' => 'D24_1000ml (Ula)',
|
||||||
|
'ba4f06a8-f6fb-4969-d4b9-6683e6b6b372' => 'D11_2000ml ',
|
||||||
|
'cb8f5e45-43e1-b62d-05d7-669646b4eb10' => 'Bottle D12_5000ml (kanister)',
|
||||||
'820341fa-0db5-9d74-7544-659f17560658' => 'Kit ',
|
'820341fa-0db5-9d74-7544-659f17560658' => 'Kit ',
|
||||||
'567da064-cd31-0416-2ad3-6581cc870e96' => 'Doypack 110x180mm',
|
'567da064-cd31-0416-2ad3-6581cc870e96' => 'Doypack 110x180mm',
|
||||||
'edf38614-90c3-50a7-56e8-65dda2d891c2' => 'Doypack 130x220mm',
|
'edf38614-90c3-50a7-56e8-65dda2d891c2' => 'Doypack 130x220mm',
|
||||||
@@ -57,18 +61,22 @@ $customDoms = array (
|
|||||||
'48369f61-18bd-53e6-070a-659f026773ac' => 'Box',
|
'48369f61-18bd-53e6-070a-659f026773ac' => 'Box',
|
||||||
'37dbeaa1-f183-3b3e-1b54-65aa78a662a2' => 'Jar 500 ml',
|
'37dbeaa1-f183-3b3e-1b54-65aa78a662a2' => 'Jar 500 ml',
|
||||||
'f13d7541-494d-75c7-2a35-65aa784b42a5' => 'Jar 1000 ml',
|
'f13d7541-494d-75c7-2a35-65aa784b42a5' => 'Jar 1000 ml',
|
||||||
|
'e703a7f9-d27d-b445-d946-66727a3940d9' => 'Jar 1500 ml',
|
||||||
'da8d7be4-58dc-4f75-f547-65c310cd97dd' => 'Jar 65 ml',
|
'da8d7be4-58dc-4f75-f547-65c310cd97dd' => 'Jar 65 ml',
|
||||||
'e1a16dbf-7216-d184-b9ed-65c310aff4d4' => 'Jar 150 ml',
|
'e1a16dbf-7216-d184-b9ed-65c310aff4d4' => 'Jar 150 ml',
|
||||||
'2a9454a6-b2a1-150f-c307-65c31102cb28' => 'Jar 250 ml',
|
'2a9454a6-b2a1-150f-c307-65c31102cb28' => 'Jar 250 ml',
|
||||||
'3acd80de-8dcc-ced9-c2fa-65eee6ae9949' => 'Foam 100 ml',
|
'3acd80de-8dcc-ced9-c2fa-65eee6ae9949' => 'Spray 100 ml',
|
||||||
'6014bd30-9be6-4348-5b3a-6603f015f392' => 'Bucket 2,75l',
|
'6014bd30-9be6-4348-5b3a-6603f015f392' => 'Bucket 2,75l',
|
||||||
'786f48d6-16e7-a0a4-4aec-6628a16a0f89' => 'Foam 100ml',
|
'786f48d6-16e7-a0a4-4aec-6628a16a0f89' => 'Foam 100ml',
|
||||||
'349b50d1-0a7b-b3bd-e72e-662b42ca98ae' => 'Foam 400ml',
|
'349b50d1-0a7b-b3bd-e72e-662b42ca98ae' => 'Foam 400ml',
|
||||||
|
'cb66a685-53e1-5f87-0a25-66967c7cb63b' => 'Doypack 210x285mm',
|
||||||
|
'75f4bd2a-51a8-0767-635e-66dde15af79e' => 'Foam 200ml',
|
||||||
),
|
),
|
||||||
'ecmproducts_brand_dom' =>
|
'ecmproducts_brand_dom' =>
|
||||||
array (
|
array (
|
||||||
'6c5722f6-33b3-41c3-a878-e2f7628e8360' => 'None',
|
'6c5722f6-33b3-41c3-a878-e2f7628e8360' => 'None',
|
||||||
'3dc7c0bb-3d26-427c-9ff0-6319ead2e988' => 'Soyeco',
|
'3dc7c0bb-3d26-427c-9ff0-6319ead2e988' => 'Soyeco',
|
||||||
|
'33fb10ad-55f6-54ac-73e5-66bb6130d36f' => 'Soyeco amz',
|
||||||
'5820a5e7-8fd4-48bd-ab28-bfd60c321c15' => 'Frischer',
|
'5820a5e7-8fd4-48bd-ab28-bfd60c321c15' => 'Frischer',
|
||||||
'2499563d-3671-c19a-c407-6628c97df75c' => 'Frischer amz',
|
'2499563d-3671-c19a-c407-6628c97df75c' => 'Frischer amz',
|
||||||
'c0a6f467-9021-47cc-9b31-9398d9c2e898' => 'e5',
|
'c0a6f467-9021-47cc-9b31-9398d9c2e898' => 'e5',
|
||||||
@@ -130,6 +138,17 @@ $customDoms = array (
|
|||||||
'1ba0e21f-9a07-b93c-5e2f-65e8c7bb833d' => 'Purivita',
|
'1ba0e21f-9a07-b93c-5e2f-65e8c7bb833d' => 'Purivita',
|
||||||
'5cc10610-e61e-846f-96a7-6613b79abce2' => 'Frischer Winner',
|
'5cc10610-e61e-846f-96a7-6613b79abce2' => 'Frischer Winner',
|
||||||
'8fb7cdf2-b9a9-ab07-d297-661670fb6120' => 'Aqualogis',
|
'8fb7cdf2-b9a9-ab07-d297-661670fb6120' => 'Aqualogis',
|
||||||
|
'd56c3876-c214-3829-f7b9-66618595d478' => 'Caffedelmondo',
|
||||||
|
'a7ca98eb-9a5d-660b-f483-666c350903c9' => 'Wilfa',
|
||||||
|
'2f641941-0ba1-b88b-2cb1-6684f93ef879' => 'Beko',
|
||||||
|
'89adb9a7-9d3e-1ec6-a4cf-668e2e46f158' => 'Aroca',
|
||||||
|
'26b07787-4207-7ab5-40fa-669527407b5a' => 'APM',
|
||||||
|
'47c4e190-198c-dcb6-612b-66978335a059' => 'Reus',
|
||||||
|
'a8a956e1-8288-2976-b71c-66bb3b8c3b8e' => 'Drekker',
|
||||||
|
'510f0cc2-1a76-3821-dbf2-66bb9e51bfc1' => 'NextProvider',
|
||||||
|
'd5f819ff-297b-c0d8-cfcd-66d0d0103806' => 'EcoExpert',
|
||||||
|
'4144e574-4870-fa26-25a0-66d85b094f7b' => 'Office Discount',
|
||||||
|
'e00b0e4a-ba66-796d-3bcb-66d89240c2cd' => 'Printus',
|
||||||
),
|
),
|
||||||
'ecmproducts_category_dom' =>
|
'ecmproducts_category_dom' =>
|
||||||
array (
|
array (
|
||||||
@@ -257,7 +276,7 @@ $customDoms = array (
|
|||||||
array (
|
array (
|
||||||
'sales_order' => 'Sales Order',
|
'sales_order' => 'Sales Order',
|
||||||
'gratis' => 'Samples',
|
'gratis' => 'Samples',
|
||||||
'b2c' => 'Stock states',
|
'b2c' => 'For stock',
|
||||||
'b2b' => 'Import',
|
'b2b' => 'Import',
|
||||||
'interval_order' => 'Zamówienie okresowe',
|
'interval_order' => 'Zamówienie okresowe',
|
||||||
),
|
),
|
||||||
@@ -274,9 +293,7 @@ $customDoms = array (
|
|||||||
's30' => 'Accepted',
|
's30' => 'Accepted',
|
||||||
's40' => 'Not Accepted',
|
's40' => 'Not Accepted',
|
||||||
's50' => 'Sent',
|
's50' => 'Sent',
|
||||||
's60' => 'Won',
|
's60' => 'From Stock',
|
||||||
's70' => 'Lost',
|
|
||||||
's80' => 'Delivery Note',
|
|
||||||
'93cc9f90-9a94-5502-50a9-66264b2fd03a' => 'Closed',
|
'93cc9f90-9a94-5502-50a9-66264b2fd03a' => 'Closed',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
// created: 2024-04-26 08:00:00
|
// created: 2024-09-12 06:58:07
|
||||||
$customDoms = array (
|
$customDoms = array (
|
||||||
'ecmproducts_attribute_dom' =>
|
'ecmproducts_attribute_dom' =>
|
||||||
array (
|
array (
|
||||||
@@ -41,10 +41,14 @@ $customDoms = array (
|
|||||||
'8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'Butelka D22_500ml (szyjka)',
|
'8f4fdd3c-44f9-103b-3f40-659f1c128319' => 'Butelka D22_500ml (szyjka)',
|
||||||
'307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'Butelka D23_500ml (nabłyszczacz)',
|
'307f61db-5fd9-3aa6-e701-65a04f4bba88' => 'Butelka D23_500ml (nabłyszczacz)',
|
||||||
'5df47246-d0cd-4151-9bdd-65eede53aba5' => 'Butelka D24_500ml (systemy mleczne)',
|
'5df47246-d0cd-4151-9bdd-65eede53aba5' => 'Butelka D24_500ml (systemy mleczne)',
|
||||||
|
'ab74cd2c-7720-5875-7ca5-66bb55a3e075' => 'Butelka D25_500ml (Ula)',
|
||||||
'd7c10cb9-7459-1174-6315-661cdae38a39' => 'Butelka D11_1000ml (RPET)',
|
'd7c10cb9-7459-1174-6315-661cdae38a39' => 'Butelka D11_1000ml (RPET)',
|
||||||
'58664d9d-0295-3539-4662-659f18dc4b80' => 'Butelka D21_1000ml (Odkamieniacz)',
|
'58664d9d-0295-3539-4662-659f18dc4b80' => 'Butelka D21_1000ml (Odkamieniacz)',
|
||||||
'92a7ee9b-d953-fd7e-5c88-65c9bf1e144d' => 'Butelka D22_1000ml (szyjka)',
|
'92a7ee9b-d953-fd7e-5c88-65c9bf1e144d' => 'Butelka D22_1000ml (szyjka)',
|
||||||
'87a2b609-9b67-de82-8f41-65eedd4613c9' => 'Butelka D23_1000ml (systemy mleczne)',
|
'87a2b609-9b67-de82-8f41-65eedd4613c9' => 'Butelka D23_1000ml (systemy mleczne)',
|
||||||
|
'75980ea5-d89e-3923-2662-66bb55202244' => 'Butelka D24_1000ml (Ula)',
|
||||||
|
'ba4f06a8-f6fb-4969-d4b9-6683e6b6b372' => 'Butelka D11_2000ml (płyn do prania)',
|
||||||
|
'cb8f5e45-43e1-b62d-05d7-669646b4eb10' => 'Butelka D12_5000ml (kanister)',
|
||||||
'820341fa-0db5-9d74-7544-659f17560658' => 'Zestaw D1_500ml+zapas',
|
'820341fa-0db5-9d74-7544-659f17560658' => 'Zestaw D1_500ml+zapas',
|
||||||
'567da064-cd31-0416-2ad3-6581cc870e96' => 'Doypack 110x180mm',
|
'567da064-cd31-0416-2ad3-6581cc870e96' => 'Doypack 110x180mm',
|
||||||
'edf38614-90c3-50a7-56e8-65dda2d891c2' => 'Doypack 130x220mm',
|
'edf38614-90c3-50a7-56e8-65dda2d891c2' => 'Doypack 130x220mm',
|
||||||
@@ -57,18 +61,22 @@ $customDoms = array (
|
|||||||
'48369f61-18bd-53e6-070a-659f026773ac' => 'Kartonik ',
|
'48369f61-18bd-53e6-070a-659f026773ac' => 'Kartonik ',
|
||||||
'37dbeaa1-f183-3b3e-1b54-65aa78a662a2' => 'Słoik 500 ml',
|
'37dbeaa1-f183-3b3e-1b54-65aa78a662a2' => 'Słoik 500 ml',
|
||||||
'f13d7541-494d-75c7-2a35-65aa784b42a5' => 'Słoik 1000 ml',
|
'f13d7541-494d-75c7-2a35-65aa784b42a5' => 'Słoik 1000 ml',
|
||||||
|
'e703a7f9-d27d-b445-d946-66727a3940d9' => 'Słoik 1500 ml',
|
||||||
'da8d7be4-58dc-4f75-f547-65c310cd97dd' => 'Słoik 65 ml',
|
'da8d7be4-58dc-4f75-f547-65c310cd97dd' => 'Słoik 65 ml',
|
||||||
'e1a16dbf-7216-d184-b9ed-65c310aff4d4' => 'Słoik 150 ml',
|
'e1a16dbf-7216-d184-b9ed-65c310aff4d4' => 'Słoik 150 ml',
|
||||||
'2a9454a6-b2a1-150f-c307-65c31102cb28' => 'Słoik 250 ml',
|
'2a9454a6-b2a1-150f-c307-65c31102cb28' => 'Słoik 250 ml',
|
||||||
'3acd80de-8dcc-ced9-c2fa-65eee6ae9949' => 'Pianka 100 ml',
|
'3acd80de-8dcc-ced9-c2fa-65eee6ae9949' => 'Spray 100 ml',
|
||||||
'6014bd30-9be6-4348-5b3a-6603f015f392' => 'Wiadro 2,75l',
|
'6014bd30-9be6-4348-5b3a-6603f015f392' => 'Wiadro 2,75l',
|
||||||
'786f48d6-16e7-a0a4-4aec-6628a16a0f89' => 'Pianka 100ml',
|
'786f48d6-16e7-a0a4-4aec-6628a16a0f89' => 'Pianka 100ml',
|
||||||
'349b50d1-0a7b-b3bd-e72e-662b42ca98ae' => 'Pianka 400ml',
|
'349b50d1-0a7b-b3bd-e72e-662b42ca98ae' => 'Pianka 400ml',
|
||||||
|
'cb66a685-53e1-5f87-0a25-66967c7cb63b' => 'Doypack 210x285mm',
|
||||||
|
'75f4bd2a-51a8-0767-635e-66dde15af79e' => 'Pianka 200ml',
|
||||||
),
|
),
|
||||||
'ecmproducts_brand_dom' =>
|
'ecmproducts_brand_dom' =>
|
||||||
array (
|
array (
|
||||||
'6c5722f6-33b3-41c3-a878-e2f7628e8360' => 'None',
|
'6c5722f6-33b3-41c3-a878-e2f7628e8360' => 'None',
|
||||||
'3dc7c0bb-3d26-427c-9ff0-6319ead2e988' => 'Soyeco',
|
'3dc7c0bb-3d26-427c-9ff0-6319ead2e988' => 'Soyeco',
|
||||||
|
'33fb10ad-55f6-54ac-73e5-66bb6130d36f' => 'Soyeco amz',
|
||||||
'5820a5e7-8fd4-48bd-ab28-bfd60c321c15' => 'Frischer',
|
'5820a5e7-8fd4-48bd-ab28-bfd60c321c15' => 'Frischer',
|
||||||
'2499563d-3671-c19a-c407-6628c97df75c' => 'Frischer amz',
|
'2499563d-3671-c19a-c407-6628c97df75c' => 'Frischer amz',
|
||||||
'c0a6f467-9021-47cc-9b31-9398d9c2e898' => 'e5',
|
'c0a6f467-9021-47cc-9b31-9398d9c2e898' => 'e5',
|
||||||
@@ -130,6 +138,17 @@ $customDoms = array (
|
|||||||
'1ba0e21f-9a07-b93c-5e2f-65e8c7bb833d' => 'Purivita',
|
'1ba0e21f-9a07-b93c-5e2f-65e8c7bb833d' => 'Purivita',
|
||||||
'5cc10610-e61e-846f-96a7-6613b79abce2' => 'Frischer Winner',
|
'5cc10610-e61e-846f-96a7-6613b79abce2' => 'Frischer Winner',
|
||||||
'8fb7cdf2-b9a9-ab07-d297-661670fb6120' => 'Aqualogis',
|
'8fb7cdf2-b9a9-ab07-d297-661670fb6120' => 'Aqualogis',
|
||||||
|
'd56c3876-c214-3829-f7b9-66618595d478' => 'Caffedelmondo',
|
||||||
|
'a7ca98eb-9a5d-660b-f483-666c350903c9' => 'Wilfa',
|
||||||
|
'2f641941-0ba1-b88b-2cb1-6684f93ef879' => 'Beko',
|
||||||
|
'89adb9a7-9d3e-1ec6-a4cf-668e2e46f158' => 'Aroca',
|
||||||
|
'26b07787-4207-7ab5-40fa-669527407b5a' => 'APM',
|
||||||
|
'47c4e190-198c-dcb6-612b-66978335a059' => 'Reus',
|
||||||
|
'a8a956e1-8288-2976-b71c-66bb3b8c3b8e' => 'Drekker',
|
||||||
|
'510f0cc2-1a76-3821-dbf2-66bb9e51bfc1' => 'NextProvider',
|
||||||
|
'd5f819ff-297b-c0d8-cfcd-66d0d0103806' => 'EcoExpert',
|
||||||
|
'4144e574-4870-fa26-25a0-66d85b094f7b' => 'Office Discount',
|
||||||
|
'e00b0e4a-ba66-796d-3bcb-66d89240c2cd' => 'Printus',
|
||||||
),
|
),
|
||||||
'ecmproducts_category_dom' =>
|
'ecmproducts_category_dom' =>
|
||||||
array (
|
array (
|
||||||
@@ -258,7 +277,7 @@ $customDoms = array (
|
|||||||
array (
|
array (
|
||||||
'sales_order' => 'Zamówienie sprzedaży',
|
'sales_order' => 'Zamówienie sprzedaży',
|
||||||
'gratis' => 'Próbki',
|
'gratis' => 'Próbki',
|
||||||
'b2c' => 'Stany magazynowe',
|
'b2c' => 'Produkcja na magazyn',
|
||||||
'b2b' => 'Import',
|
'b2b' => 'Import',
|
||||||
'interval_order' => 'Zamówienie okresowe',
|
'interval_order' => 'Zamówienie okresowe',
|
||||||
),
|
),
|
||||||
@@ -270,14 +289,12 @@ $customDoms = array (
|
|||||||
),
|
),
|
||||||
'ecmsales_status_dom' =>
|
'ecmsales_status_dom' =>
|
||||||
array (
|
array (
|
||||||
's10' => 'Zarejestrowany',
|
's10' => 'Planowany',
|
||||||
's20' => 'Oczekujący',
|
's20' => 'Oczekujący',
|
||||||
's30' => 'Zaakceptowany',
|
's30' => 'Zaakceptowany',
|
||||||
's40' => 'Niezaakceptowany',
|
's40' => 'Odrzucone',
|
||||||
's50' => 'Wysłany',
|
's50' => 'Wysłany',
|
||||||
's60' => 'Wygrany',
|
's60' => 'Realizacja ze stanów magazynowych',
|
||||||
's70' => 'Odrzucony',
|
|
||||||
's80' => 'Dokument Przewozowy',
|
|
||||||
'93cc9f90-9a94-5502-50a9-66264b2fd03a' => 'Zrealizowany ',
|
'93cc9f90-9a94-5502-50a9-66264b2fd03a' => 'Zrealizowany ',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
//die("Przerwa techniczna");
|
||||||
|
|
||||||
error_reporting(E_ERROR);
|
error_reporting(E_ERROR);
|
||||||
|
|
||||||
if(!defined('sugarEntry'))define('sugarEntry', true);
|
if(!defined('sugarEntry'))define('sugarEntry', true);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
//crontab job - save currencies
|
//crontab job - save currencies
|
||||||
set_time_limit(9999999999);
|
set_time_limit(9999999999);
|
||||||
require_once("./../../config.php");
|
require_once("./../../config.php");
|
||||||
@@ -23,6 +25,7 @@ fclose($connect);
|
|||||||
|
|
||||||
//download xml
|
//download xml
|
||||||
$connect = fopen("http://www.nbp.pl/kursy/xml/".trim($xml_file).".xml", "r") or die("Błąd przy łączeniu");
|
$connect = fopen("http://www.nbp.pl/kursy/xml/".trim($xml_file).".xml", "r") or die("Błąd przy łączeniu");
|
||||||
|
echo "http://www.nbp.pl/kursy/xml/".trim($xml_file).".xml";
|
||||||
$download = fopen("./currencies.xml", "w") or die("Błąd przy łączeniu");
|
$download = fopen("./currencies.xml", "w") or die("Błąd przy łączeniu");
|
||||||
while (!feof ($connect)) {
|
while (!feof ($connect)) {
|
||||||
$buffer = fgets($connect, 4096);//or die("Błąd przy odczyciee");
|
$buffer = fgets($connect, 4096);//or die("Błąd przy odczyciee");
|
||||||
@@ -45,6 +48,7 @@ while ($r=mysql_fetch_array($result)) {
|
|||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
$doc->load( 'currencies.xml' );
|
$doc->load( 'currencies.xml' );
|
||||||
$tmp = $doc->getElementsByTagName("data_publikacji");
|
$tmp = $doc->getElementsByTagName("data_publikacji");
|
||||||
|
var_dump($tmp);
|
||||||
$cur_date = $tmp->item(0)->nodeValue;
|
$cur_date = $tmp->item(0)->nodeValue;
|
||||||
$tmp = $doc->getElementsByTagName("numer_tabeli");
|
$tmp = $doc->getElementsByTagName("numer_tabeli");
|
||||||
$table_name = $tmp->item(0)->nodeValue;
|
$table_name = $tmp->item(0)->nodeValue;
|
||||||
@@ -58,7 +62,7 @@ foreach ($poz as $p) {
|
|||||||
$currencies[$kod]['kurs']=$kurs;
|
$currencies[$kod]['kurs']=$kurs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var_dump($currencies);
|
//var_dump($currencies);
|
||||||
//save values into db
|
//save values into db
|
||||||
foreach ($currencies as $key=>$value) {
|
foreach ($currencies as $key=>$value) {
|
||||||
mysql_query("INSERT INTO currency_nbp_archive VALUES ('".$cur_date."', '".$value['id']."', '".$key."', ".str_replace(",",".",$value['kurs']).",'".$table_name."')");
|
mysql_query("INSERT INTO currency_nbp_archive VALUES ('".$cur_date."', '".$value['id']."', '".$key."', ".str_replace(",",".",$value['kurs']).",'".$table_name."')");
|
||||||
@@ -69,5 +73,4 @@ foreach ($currencies as $key=>$value) {
|
|||||||
|
|
||||||
//delete xls
|
//delete xls
|
||||||
unlink("./currencies.xml");
|
unlink("./currencies.xml");
|
||||||
|
*/
|
||||||
?>
|
|
||||||
@@ -138,6 +138,29 @@ AND c.deleted='0' AND c.canceled='0';
|
|||||||
}
|
}
|
||||||
$edit->ss->assign ( "INVOICES_INFO", substr($inv,0,-6) );
|
$edit->ss->assign ( "INVOICES_INFO", substr($inv,0,-6) );
|
||||||
|
|
||||||
|
if ($focus->parent_id === '1b9643ca-5b1a-8f9b-b809-586b5619b068') {
|
||||||
|
require_once('REST/config.php');
|
||||||
|
|
||||||
|
$curl = curl_init();
|
||||||
|
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET' );
|
||||||
|
curl_setopt($curl, CURLOPT_VERBOSE, 1);
|
||||||
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||||
|
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||||
|
curl_setopt($curl, CURLOPT_URL, 'https://crm.twinpol.com/REST/index.php?action=getStocks&key='.$restConfig['twinpolKey']);
|
||||||
|
$twinpolStocks = json_decode(curl_exec($curl));
|
||||||
|
|
||||||
|
$btn ='<input title="Utwórz PZ w Twinpol" class="button" onclick="if($(\'#div_pz\').css(\'display\') == \'none\'){$(\'#div_pz\').show(\'slow\'); } else { $(\'#div_pz\').hide(\'slow\'); }" type="button" name="create_pz" id="create_pz" value="Utwórz PZ w Twinpol">';
|
||||||
|
$btn .= '<div id="div_pz" style="border: 1px solid #cccccc;background:#e6e6e6;padding:5px;position:absolute;display:none;">';
|
||||||
|
$btn .= 'Magazyn: <select name="pz_stock" id="pz_stock">';
|
||||||
|
foreach ($twinpolStocks as $s) {
|
||||||
|
$btn .= '<option value="'.$s->id.'">'.$s->name.'</option>';
|
||||||
|
}
|
||||||
|
$btn .= '</select><br /><br />';
|
||||||
|
$btn .= '<input name="pz_btn" id="pz_btn" title="Create" accessKey="" class="button" onclick="window.open(\'https://crm.twinpol.com/REST/index.php?action=createPzFromInvoice&stock_id=\'+$(\'#pz_stock\').val()+\'&record='.$_REQUEST['record'].'&key='.$restConfig['twinpolKey'].'\',\'blank\');" type="button" value="Utwórz"></div>';
|
||||||
|
|
||||||
|
$edit->ss->assign('CREATE_PZ', $btn);
|
||||||
|
}
|
||||||
$edit->bean = $focus;
|
$edit->bean = $focus;
|
||||||
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
|
$edit->tplFile = 'include/ECM/EcmViews/DetailView/Tabs/DetailView.tpl';
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ $viewdefs ['EcmInvoiceOuts'] ['DetailView'] = array (
|
|||||||
'customCode' => '<input name="edi" id="edi" class="button" onclick="window.open(\'index.php?module=EcmInvoiceOuts&record={$fields.id.value}&action=getEDI&to_pdf=1\');" type="button" value="EDI - wyślij fakturę">',
|
'customCode' => '<input name="edi" id="edi" class="button" onclick="window.open(\'index.php?module=EcmInvoiceOuts&record={$fields.id.value}&action=getEDI&to_pdf=1\');" type="button" value="EDI - wyślij fakturę">',
|
||||||
) ,
|
) ,
|
||||||
array (
|
array (
|
||||||
'customCode' => '{if $CAN_CREATE_PZ == true} <input name="twinpolPZ" id="twinpolPZ" class="button" onclick="window.open(\'https://crm.twinpol.com/REST/index.php?key=d68dac4c-f784-4e1b-8267-9ffcfa0eda4c&action=createPzFromInvoice&record={$fields.id.value}\');" type="button" value="Utwórz PZ w Twinpol"> {/if}'
|
'customCode' => '{$CREATE_PZ}'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
,
|
,
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ $(document).ready(function () {
|
|||||||
match: true
|
match: true
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
13: function ($cell, indx) {
|
12: function ($cell, indx) {
|
||||||
return $.tablesorter.filterFormatter.select2($cell, indx, {
|
return $.tablesorter.filterFormatter.select2($cell, indx, {
|
||||||
match: true
|
match: true
|
||||||
});
|
});
|
||||||
@@ -52,7 +52,7 @@ $(document).ready(function () {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
17: { sorter: 'production_date' },
|
16: { sorter: 'production_date'},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
$("#allTable").bind('filterEnd', function (event, config) {
|
$("#allTable").bind('filterEnd', function (event, config) {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ if (!isset($_GET['ajaxAction'])) {
|
|||||||
ON si.ecmproduct_id = p.id
|
ON si.ecmproduct_id = p.id
|
||||||
LEFT JOIN ecmstockstates AS ss
|
LEFT JOIN ecmstockstates AS ss
|
||||||
ON ss.product_id = si.ecmproduct_id AND ss.stock_id = 'c7afd71a-4c3a-bde4-138d-4acaee1644e4'
|
ON ss.product_id = si.ecmproduct_id AND ss.stock_id = 'c7afd71a-4c3a-bde4-138d-4acaee1644e4'
|
||||||
WHERE s.delivery_date > '$dateFrom' AND s.status IN ('s10', 's20', 's30')";
|
WHERE s.delivery_date > '$dateFrom'";
|
||||||
if (is_array($_GET['exclude']) && count($_GET['exclude']) > 0) {
|
if (is_array($_GET['exclude']) && count($_GET['exclude']) > 0) {
|
||||||
foreach ($_GET['exclude'] as $name) {
|
foreach ($_GET['exclude'] as $name) {
|
||||||
if (strlen($name) > 0) {
|
if (strlen($name) > 0) {
|
||||||
@@ -88,6 +88,7 @@ if (!isset($_GET['ajaxAction'])) {
|
|||||||
$row['orderNo'] = $r['document_no'];
|
$row['orderNo'] = $r['document_no'];
|
||||||
$row['orderId'] = $r['id'];
|
$row['orderId'] = $r['id'];
|
||||||
$row['orderStatus'] = $app_list_strings['ecmsales_status_dom'][$r['status']];
|
$row['orderStatus'] = $app_list_strings['ecmsales_status_dom'][$r['status']];
|
||||||
|
$row['orderType'] = $app_list_strings['ecmsales_type_dom'][$r['type']];
|
||||||
$row['orderParent'] = $r['parent_name'];
|
$row['orderParent'] = $r['parent_name'];
|
||||||
$row['orderParentId'] = $r['parent_id'];
|
$row['orderParentId'] = $r['parent_id'];
|
||||||
$row['orderRegisterDate'] = $r['register_date'];
|
$row['orderRegisterDate'] = $r['register_date'];
|
||||||
|
|||||||
@@ -75,7 +75,8 @@
|
|||||||
<select name="exclude[]" size="3" style="width: 150px" multiple="true">
|
<select name="exclude[]" size="3" style="width: 150px" multiple="true">
|
||||||
<option></option>
|
<option></option>
|
||||||
<option value="Media Markt" {if @in_array('Media Markt', $exclude)}selected="selected" {/if}>Media
|
<option value="Media Markt" {if @in_array('Media Markt', $exclude)}selected="selected" {/if}>Media
|
||||||
Markt</option>
|
Markt
|
||||||
|
</option>
|
||||||
<option value="TwinPol" {if @in_array('TwinPol', $exclude)}selected="selected" {/if}>TwinPol
|
<option value="TwinPol" {if @in_array('TwinPol', $exclude)}selected="selected" {/if}>TwinPol
|
||||||
</option>
|
</option>
|
||||||
<option value="Euro-net" {if @in_array('Euro-net', $exclude)}selected="selected" {/if}>Euro-net
|
<option value="Euro-net" {if @in_array('Euro-net', $exclude)}selected="selected" {/if}>Euro-net
|
||||||
@@ -105,7 +106,9 @@
|
|||||||
<li class="active" id="1_menu">
|
<li class="active" id="1_menu">
|
||||||
<script language="javascript">
|
<script language="javascript">
|
||||||
{literal}
|
{literal}
|
||||||
var set1 = function() { SetTab('1'); };
|
var set1 = function () {
|
||||||
|
SetTab('1');
|
||||||
|
};
|
||||||
SelectedTab = '1';
|
SelectedTab = '1';
|
||||||
{/literal}
|
{/literal}
|
||||||
</script>
|
</script>
|
||||||
@@ -114,7 +117,9 @@
|
|||||||
<li class="" id="2_menu">
|
<li class="" id="2_menu">
|
||||||
<script language="javascript">
|
<script language="javascript">
|
||||||
{literal}
|
{literal}
|
||||||
var set2 = function() { SetTab('2'); };
|
var set2 = function () {
|
||||||
|
SetTab('2');
|
||||||
|
};
|
||||||
{/literal}
|
{/literal}
|
||||||
</script>
|
</script>
|
||||||
<a class="" href="javascript:set2();">Komponenty</a>
|
<a class="" href="javascript:set2();">Komponenty</a>
|
||||||
@@ -122,7 +127,9 @@
|
|||||||
<li class="" id="3_menu">
|
<li class="" id="3_menu">
|
||||||
<script language="javascript">
|
<script language="javascript">
|
||||||
{literal}
|
{literal}
|
||||||
var set3 = function() { SetTab('3'); };
|
var set3 = function () {
|
||||||
|
SetTab('3');
|
||||||
|
};
|
||||||
{/literal}
|
{/literal}
|
||||||
</script>
|
</script>
|
||||||
<a class="" href="javascript:set3();">Surowce</a>
|
<a class="" href="javascript:set3();">Surowce</a>
|
||||||
@@ -148,11 +155,10 @@
|
|||||||
<th>Ilość</th>
|
<th>Ilość</th>
|
||||||
<th>Stan</th>
|
<th>Stan</th>
|
||||||
<th>ZS E5</th>
|
<th>ZS E5</th>
|
||||||
|
<th>Typ</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Zamawiający</th>
|
<th>Zamawiający</th>
|
||||||
<th>Odbiorca</th>
|
<th>Odbiorca</th>
|
||||||
<th>Rodzaj</th>
|
|
||||||
<th>Rozmiar</th>
|
|
||||||
<th>Forma</th>
|
<th>Forma</th>
|
||||||
<th>Marka</th>
|
<th>Marka</th>
|
||||||
<th>Data rejestracji</th>
|
<th>Data rejestracji</th>
|
||||||
@@ -179,7 +185,8 @@
|
|||||||
{$ROW.position}
|
{$ROW.position}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a title="{$ROW.productFullCode}" target="_blank" href="index.php?module=EcmProducts&action=DetailView&record={$ROW.productId}">
|
<a title="{$ROW.productFullCode}" target="_blank"
|
||||||
|
href="index.php?module=EcmProducts&action=DetailView&record={$ROW.productId}">
|
||||||
{$ROW.productCode}
|
{$ROW.productCode}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
@@ -197,6 +204,9 @@
|
|||||||
{$ROW.orderNo}
|
{$ROW.orderNo}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
{$ROW.orderType}
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{$ROW.orderStatus}
|
{$ROW.orderStatus}
|
||||||
</td>
|
</td>
|
||||||
@@ -208,12 +218,6 @@
|
|||||||
<td>
|
<td>
|
||||||
{$ROW.shippingTo}
|
{$ROW.shippingTo}
|
||||||
</td>
|
</td>
|
||||||
<td>
|
|
||||||
{$ROW.productKind}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{$ROW.productSize}
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
{$ROW.productShape}
|
{$ROW.productShape}
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@@ -438,8 +438,15 @@ class EcmSale extends SugarBean {
|
|||||||
'ecmproductcategory_id' => $p ['category_id'],
|
'ecmproductcategory_id' => $p ['category_id'],
|
||||||
'recipient_code' => $p ['recipient_code'],
|
'recipient_code' => $p ['recipient_code'],
|
||||||
'ean' => $p['product_ean'],
|
'ean' => $p['product_ean'],
|
||||||
'brand_label' => $p['product_brand_label']
|
'brand_label' => $p['product_brand_label'],
|
||||||
|
'description' => $p['product_description'],
|
||||||
);
|
);
|
||||||
|
if (isset($p['product_production_date']) && strlen($p['product_production_date']) > 5) {
|
||||||
|
$arr['production_date'] = $p['product_production_date'];
|
||||||
|
}
|
||||||
|
// else {
|
||||||
|
// $arr['production_date'] = null;
|
||||||
|
//}
|
||||||
$this->db->query ( $this->constructInsertQuery ( $arr ) );
|
$this->db->query ( $this->constructInsertQuery ( $arr ) );
|
||||||
|
|
||||||
$this->db->query("INSERT INTO log VALUES ('".mysql_escape_string($this->constructInsertQuery ( $arr ))."')");
|
$this->db->query("INSERT INTO log VALUES ('".mysql_escape_string($this->constructInsertQuery ( $arr ))."')");
|
||||||
@@ -472,6 +479,8 @@ class EcmSale extends SugarBean {
|
|||||||
$return_array ['product_supplier_code'] = $position ['recipient_code'];
|
$return_array ['product_supplier_code'] = $position ['recipient_code'];
|
||||||
$return_array ['product_ean'] = $position ['ean'];
|
$return_array ['product_ean'] = $position ['ean'];
|
||||||
$return_array ['product_brand_label'] = $position ['brand_label'];
|
$return_array ['product_brand_label'] = $position ['brand_label'];
|
||||||
|
$return_array ['product_description'] = $position ['description'];
|
||||||
|
$return_array ['product_production_date'] = $position ['production_date'];
|
||||||
$ecmStockOperations = new EcmStockOperation();
|
$ecmStockOperations = new EcmStockOperation();
|
||||||
|
|
||||||
$return_array ['stock_state']=($ecmStockOperations->getRealStock($position ['ecmproduct_id']));
|
$return_array ['stock_state']=($ecmStockOperations->getRealStock($position ['ecmproduct_id']));
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ function importSale($file)
|
|||||||
$sale->assigned_user_id = $buyer['assigned_user_id'];
|
$sale->assigned_user_id = $buyer['assigned_user_id'];
|
||||||
$sale->edi_file = $file;
|
$sale->edi_file = $file;
|
||||||
$sale->type = 'sales_order';
|
$sale->type = 'sales_order';
|
||||||
$sale->status = 's30';
|
$sale->status = 's60';
|
||||||
$sale->ecmlanguage = 'pl_pl';
|
$sale->ecmlanguage = 'pl_pl';
|
||||||
|
|
||||||
$sale->position_list = loadProducts($xml->{'Order-Lines'}->Line, $isCarrefour);
|
$sale->position_list = loadProducts($xml->{'Order-Lines'}->Line, $isCarrefour);
|
||||||
|
|||||||
@@ -18,8 +18,10 @@ columns[1] = {
|
|||||||
};
|
};
|
||||||
columns[1]['content'][0] = {'name' : 'code', 'type': 'hidden', 'readonly' : true};
|
columns[1]['content'][0] = {'name' : 'code', 'type': 'hidden', 'readonly' : true};
|
||||||
columns[1]['content'][1] = {'name' : 'id', 'type': 'hidden'};
|
columns[1]['content'][1] = {'name' : 'id', 'type': 'hidden'};
|
||||||
columns[1]['content'][1] = {'name' : 'brand_label', 'type': 'hidden',};
|
columns[1]['content'][2] = {'name' : 'brand_label', 'type': 'hidden',};
|
||||||
columns[1]['content'][2] = {'name' : 'link', 'type': 'text', 'readonly' : true};
|
columns[1]['content'][3] = {'name' : 'link', 'type': 'text', 'readonly' : true};
|
||||||
|
columns[1]['content'][4] = {'name' : 'description', 'type': 'hidden',};
|
||||||
|
columns[1]['content'][5] = {'name' : 'production_date', 'type': 'hidden',};
|
||||||
//end: code
|
//end: code
|
||||||
//begin: name
|
//begin: name
|
||||||
columns[2] = {
|
columns[2] = {
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ if (isset($_GET['ids'])) {
|
|||||||
order by date_entered");
|
order by date_entered");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
brecho($codes);
|
||||||
|
//die();
|
||||||
|
|
||||||
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
while($r=$GLOBALS['db']->fetchByAssoc($w)){
|
||||||
if(!in_array($r['stock_id'],$sarr))$sarr[]=$r['stock_id'];
|
if(!in_array($r['stock_id'],$sarr))$sarr[]=$r['stock_id'];
|
||||||
|
|||||||
@@ -59,491 +59,43 @@ if (! defined ( 'sugarEntry' ) || ! sugarEntry)
|
|||||||
* dropdown menu.
|
* dropdown menu.
|
||||||
*/
|
*/
|
||||||
$job_strings = array (
|
$job_strings = array (
|
||||||
0 => 'refreshJobs',
|
0 => 'getNbpCurrencies',
|
||||||
1 => 'pollMonitoredInboxes',
|
);
|
||||||
2 => 'runMassEmailCampaign',
|
|
||||||
5 => 'pollMonitoredInboxesForBouncedCampaignEmails',
|
|
||||||
3 => 'pruneDatabase',
|
|
||||||
4 => 'trimTracker',
|
|
||||||
6 => 'checkEDISales',
|
|
||||||
7 => 'mailingsE5'
|
|
||||||
)
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
function getNbpCurrencies() {
|
||||||
* Job 0 refreshes all job schedulers at midnight
|
try {
|
||||||
* DEPRECATED
|
$db = $GLOBALS['db'];
|
||||||
*/
|
$currencies = $db->query("SELECT id, iso4217 FROM currencies WHERE deleted=0");
|
||||||
function refreshJobs() {
|
while ($c = $db->fetchByAssoc($currencies)) {
|
||||||
return true;
|
$nbpData = makeCUrlRequest("https://api.nbp.pl/api/exchangerates/rates/a/" . $c['iso4217'] . "?format=json");
|
||||||
}
|
if ($nbpData != null && is_array($nbpData->rates) && count($nbpData->rates) > 0) {
|
||||||
|
$db->query("UPDATE currencies SET conversion_rate=" . $nbpData->rates[0]->mid . ", date_modified = NOW() WHERE id = '" . $c['id'] . "'");
|
||||||
function mailingsE5(){
|
$db->query("INSERT INTO currency_nbp_archive VALUES('" . $nbpData->rates[0]->effectiveDate . "', '" . $c['id'] . "', '" . $c['iso4217'] . "', " . $nbpData->rates[0]->mid . ", '" . $nbpData->rates[0]->no . "')");
|
||||||
|
|
||||||
require_once ('modules/Schedulers/MailingCron.php');
|
|
||||||
$mailingCron = new MailingCron ();
|
|
||||||
$mailingCron->getMalingToSend ();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Job 1
|
|
||||||
*/
|
|
||||||
function pollMonitoredInboxes() {
|
|
||||||
$GLOBALS ['log']->info ( '----->Scheduler fired job of type pollMonitoredInboxes()' );
|
|
||||||
global $dictionary;
|
|
||||||
global $app_strings;
|
|
||||||
|
|
||||||
require_once ('modules/Emails/EmailUI.php');
|
|
||||||
|
|
||||||
$ie = new InboundEmail ();
|
|
||||||
$emailUI = new EmailUI ();
|
|
||||||
$r = $ie->db->query ( 'SELECT id, name FROM inbound_email WHERE is_personal = 0 AND deleted=0 AND status=\'Active\' AND mailbox_type != \'bounce\'' );
|
|
||||||
$GLOBALS ['log']->debug ( 'Just got Result from get all Inbounds of Inbound Emails' );
|
|
||||||
|
|
||||||
while ( $a = $ie->db->fetchByAssoc ( $r ) ) {
|
|
||||||
$GLOBALS ['log']->debug ( 'In while loop of Inbound Emails' );
|
|
||||||
$ieX = new InboundEmail ();
|
|
||||||
$ieX->retrieve ( $a ['id'] );
|
|
||||||
$mailboxes = $ieX->mailboxarray;
|
|
||||||
foreach ( $mailboxes as $mbox ) {
|
|
||||||
$ieX->mailbox = $mbox;
|
|
||||||
$newMsgs = array ();
|
|
||||||
$msgNoToUIDL = array ();
|
|
||||||
$connectToMailServer = false;
|
|
||||||
if ($ieX->isPop3Protocol ()) {
|
|
||||||
$msgNoToUIDL = $ieX->getPop3NewMessagesToDownloadForCron ();
|
|
||||||
// get all the keys which are msgnos;
|
|
||||||
$newMsgs = array_keys ( $msgNoToUIDL );
|
|
||||||
}
|
|
||||||
if ($ieX->connectMailserver () == 'true') {
|
|
||||||
$connectToMailServer = true;
|
|
||||||
} // if
|
|
||||||
|
|
||||||
$GLOBALS ['log']->debug ( 'Trying to connect to mailserver for [ ' . $a ['name'] . ' ]' );
|
|
||||||
if ($connectToMailServer) {
|
|
||||||
$GLOBALS ['log']->debug ( 'Connected to mailserver' );
|
|
||||||
if (! $ieX->isPop3Protocol ()) {
|
|
||||||
$newMsgs = $ieX->getNewMessageIds ();
|
|
||||||
}
|
|
||||||
if (is_array ( $newMsgs )) {
|
|
||||||
$current = 1;
|
|
||||||
$total = count ( $newMsgs );
|
|
||||||
require_once ("include/SugarFolders/SugarFolders.php");
|
|
||||||
$sugarFolder = new SugarFolder ();
|
|
||||||
$groupFolderId = $ieX->groupfolder_id;
|
|
||||||
$isGroupFolderExists = false;
|
|
||||||
$users = array ();
|
|
||||||
if ($groupFolderId != null && $groupFolderId != "") {
|
|
||||||
$sugarFolder->retrieve ( $groupFolderId );
|
|
||||||
$isGroupFolderExists = true;
|
|
||||||
} // if
|
|
||||||
$messagesToDelete = array ();
|
|
||||||
if ($ieX->isMailBoxTypeCreateCase ()) {
|
|
||||||
$users [] = $sugarFolder->assign_to_id;
|
|
||||||
$distributionMethod = $ieX->get_stored_options ( "distrib_method", "" );
|
|
||||||
if ($distributionMethod != 'roundRobin') {
|
|
||||||
$counts = $emailUI->getAssignedEmailsCountForUsers ( $users );
|
|
||||||
} else {
|
} else {
|
||||||
$lastRobin = $emailUI->getLastRobin ( $ieX );
|
|
||||||
}
|
|
||||||
$GLOBALS ['log']->debug ( 'distribution method id [ ' . $distributionMethod . ' ]' );
|
|
||||||
}
|
|
||||||
foreach ( $newMsgs as $k => $msgNo ) {
|
|
||||||
$uid = $msgNo;
|
|
||||||
if ($ieX->isPop3Protocol ()) {
|
|
||||||
$uid = $msgNoToUIDL [$msgNo];
|
|
||||||
} else {
|
|
||||||
$uid = imap_uid ( $ieX->conn, $msgNo );
|
|
||||||
} // else
|
|
||||||
if ($isGroupFolderExists) {
|
|
||||||
if ($ieX->importOneEmail ( $msgNo, $uid )) {
|
|
||||||
// add to folder
|
|
||||||
$sugarFolder->addBean ( $ieX->email );
|
|
||||||
if ($ieX->isPop3Protocol ()) {
|
|
||||||
$messagesToDelete [] = $msgNo;
|
|
||||||
} else {
|
|
||||||
$messagesToDelete [] = $uid;
|
|
||||||
}
|
|
||||||
if ($ieX->isMailBoxTypeCreateCase ()) {
|
|
||||||
$userId = "";
|
|
||||||
if ($distributionMethod == 'roundRobin') {
|
|
||||||
if (sizeof ( $users ) == 1) {
|
|
||||||
$userId = $users [0];
|
|
||||||
$lastRobin = $users [0];
|
|
||||||
} else {
|
|
||||||
$userIdsKeys = array_flip ( $users ); // now keys are values
|
|
||||||
$thisRobinKey = $userIdsKeys [$lastRobin] + 1;
|
|
||||||
if (! empty ( $users [$thisRobinKey] )) {
|
|
||||||
$userId = $users [$thisRobinKey];
|
|
||||||
$lastRobin = $users [$thisRobinKey];
|
|
||||||
} else {
|
|
||||||
$userId = $users [0];
|
|
||||||
$lastRobin = $users [0];
|
|
||||||
}
|
|
||||||
} // else
|
|
||||||
} else {
|
|
||||||
if (sizeof ( $users ) == 1) {
|
|
||||||
foreach ( $users as $k => $value ) {
|
|
||||||
$userId = $value;
|
|
||||||
} // foreach
|
|
||||||
} else {
|
|
||||||
asort ( $counts ); // lowest to highest
|
|
||||||
$countsKeys = array_flip ( $counts ); // keys now the 'count of items'
|
|
||||||
$leastBusy = array_shift ( $countsKeys ); // user id of lowest item count
|
|
||||||
$userId = $leastBusy;
|
|
||||||
$counts [$leastBusy] = $counts [$leastBusy] + 1;
|
|
||||||
}
|
|
||||||
} // else
|
|
||||||
$GLOBALS ['log']->debug ( 'userId [ ' . $userId . ' ]' );
|
|
||||||
$ieX->handleCreateCase ( $ieX->email, $userId );
|
|
||||||
} // if
|
|
||||||
} // if
|
|
||||||
} else {
|
|
||||||
if ($ieX->isAutoImport ()) {
|
|
||||||
$ieX->importOneEmail ( $msgNo, $uid );
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* If the group folder doesn't exist then download only those messages
|
|
||||||
* which has caseid in message
|
|
||||||
*/
|
|
||||||
$ieX->getMessagesInEmailCache ( $msgNo, $uid );
|
|
||||||
$email = new Email ();
|
|
||||||
$header = imap_headerinfo ( $ieX->conn, $msgNo );
|
|
||||||
$email->name = $ieX->handleMimeHeaderDecode ( $header->subject );
|
|
||||||
$email->from_addr = $ieX->convertImapToSugarEmailAddress ( $header->from );
|
|
||||||
$email->reply_to_email = $ieX->convertImapToSugarEmailAddress ( $header->reply_to );
|
|
||||||
if (! empty ( $email->reply_to_email )) {
|
|
||||||
$contactAddr = $email->reply_to_email;
|
|
||||||
} else {
|
|
||||||
$contactAddr = $email->from_addr;
|
|
||||||
}
|
|
||||||
$mailBoxType = $ieX->mailbox_type;
|
|
||||||
$ieX->handleAutoresponse ( $email, $contactAddr );
|
|
||||||
} // else
|
|
||||||
} // else
|
|
||||||
$GLOBALS ['log']->debug ( '***** On message [ ' . $current . ' of ' . $total . ' ] *****' );
|
|
||||||
$current ++;
|
|
||||||
} // foreach
|
|
||||||
// update Inbound Account with last robin
|
|
||||||
if ($ieX->isMailBoxTypeCreateCase () && $distributionMethod == 'roundRobin') {
|
|
||||||
$emailUI->setLastRobin ( $ieX, $lastRobin );
|
|
||||||
} // if
|
|
||||||
} // if
|
|
||||||
if ($isGroupFolderExists) {
|
|
||||||
$leaveMessagesOnMailServer = $ieX->get_stored_options ( "leaveMessagesOnMailServer", 0 );
|
|
||||||
if (! $leaveMessagesOnMailServer) {
|
|
||||||
if ($ieX->isPop3Protocol ()) {
|
|
||||||
$ieX->deleteMessageOnMailServerForPop3 ( implode ( ",", $messagesToDelete ) );
|
|
||||||
} else {
|
|
||||||
$ieX->deleteMessageOnMailServer ( implode ( $app_strings ['LBL_EMAIL_DELIMITER'], $messagesToDelete ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$GLOBALS ['log']->fatal ( "SCHEDULERS: could not get an IMAP connection resource for ID [ {$a['id']} ]. Skipping mailbox [ {$a['name']} ]." );
|
|
||||||
// cn: bug 9171 - continue while
|
|
||||||
} // else
|
|
||||||
} // foreach
|
|
||||||
imap_expunge ( $ieX->conn );
|
|
||||||
imap_close ( $ieX->conn, CL_EXPUNGE );
|
|
||||||
} // while
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Job 2
|
|
||||||
*/
|
|
||||||
function runMassEmailCampaign() {
|
|
||||||
if (! class_exists ( 'LoggerManager' )) {
|
|
||||||
}
|
|
||||||
$GLOBALS ['log'] = LoggerManager::getLogger ( 'emailmandelivery' );
|
|
||||||
$GLOBALS ['log']->debug ( 'Called:runMassEmailCampaign' );
|
|
||||||
|
|
||||||
if (! class_exists ( 'DBManagerFactory' )) {
|
|
||||||
require ('include/database/DBManagerFactory.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
global $beanList;
|
|
||||||
global $beanFiles;
|
|
||||||
require ("config.php");
|
|
||||||
require ('include/modules.php');
|
|
||||||
if (! class_exists ( 'AclController' )) {
|
|
||||||
require ('modules/ACL/ACLController.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
require ('modules/EmailMan/EmailManDelivery.php');
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Job 3
|
|
||||||
*/
|
|
||||||
function pruneDatabase() {
|
|
||||||
$GLOBALS ['log']->info ( '----->Scheduler fired job of type pruneDatabase()' );
|
|
||||||
$backupDir = $GLOBALS ['sugar_config'] ['cache_dir'] . 'backups';
|
|
||||||
$backupFile = 'backup-pruneDatabase-GMT0_' . gmdate ( 'Y_m_d-H_i_s', strtotime ( 'now' ) ) . '.php';
|
|
||||||
|
|
||||||
$db = DBManagerFactory::getInstance ();
|
|
||||||
$tables = $db->getTablesArray ();
|
|
||||||
|
|
||||||
// _ppd($tables);
|
|
||||||
if (! empty ( $tables )) {
|
|
||||||
foreach ( $tables as $kTable => $table ) {
|
|
||||||
// find tables with deleted=1
|
|
||||||
$qDel = 'SELECT * FROM ' . $table . ' WHERE deleted = 1';
|
|
||||||
$rDel = $db->query ( $qDel ); // OR continue; // continue if no 'deleted' column
|
|
||||||
|
|
||||||
// make a backup INSERT query if we are deleting.
|
|
||||||
while ( $aDel = $db->fetchByAssoc ( $rDel ) ) {
|
|
||||||
// build column names
|
|
||||||
$rCols = $db->query ( 'SHOW COLUMNS FROM ' . $table );
|
|
||||||
$colName = array ();
|
|
||||||
|
|
||||||
while ( $aCols = $db->fetchByAssoc ( $rCols ) ) {
|
|
||||||
$colName [] = $aCols ['Field'];
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = 'INSERT INTO ' . $table . ' (';
|
|
||||||
$values = '';
|
|
||||||
foreach ( $colName as $kC => $column ) {
|
|
||||||
$query .= $column . ', ';
|
|
||||||
$values .= '"' . $aDel [$column] . '", ';
|
|
||||||
}
|
|
||||||
|
|
||||||
$query = substr ( $query, 0, (strlen ( $query ) - 2) );
|
|
||||||
$values = substr ( $values, 0, (strlen ( $values ) - 2) );
|
|
||||||
$query .= ') VALUES (' . str_replace ( "'", "'", $values ) . ');';
|
|
||||||
|
|
||||||
$queryString [] = $query;
|
|
||||||
|
|
||||||
if (empty ( $colName )) {
|
|
||||||
$GLOBALS ['log']->fatal ( 'pruneDatabase() could not get the columns for table (' . $table . ')' );
|
|
||||||
}
|
|
||||||
} // end aDel while()
|
|
||||||
// now do the actual delete
|
|
||||||
$db->query ( 'DELETE FROM ' . $table . ' WHERE deleted = 1' );
|
|
||||||
} // foreach() tables
|
|
||||||
|
|
||||||
// now output file with SQL
|
|
||||||
if (! function_exists ( 'mkdir_recursive' )) {
|
|
||||||
}
|
|
||||||
if (! function_exists ( 'write_array_to_file' )) {
|
|
||||||
}
|
|
||||||
if (! file_exists ( $backupDir ) || ! file_exists ( $backupDir . '/' . $backupFile )) {
|
|
||||||
// create directory if not existent
|
|
||||||
mkdir_recursive ( $backupDir, false );
|
|
||||||
}
|
|
||||||
// write cache file
|
|
||||||
|
|
||||||
write_array_to_file ( 'pruneDatabase', $queryString, $backupDir . '/' . $backupFile );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Job 4
|
|
||||||
// */
|
|
||||||
|
|
||||||
// function securityAudit() {
|
|
||||||
// // do something
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
function trimTracker() {
|
|
||||||
global $sugar_config;
|
|
||||||
$GLOBALS ['log']->info ( '----->Scheduler fired job of type trimTracker()' );
|
|
||||||
$db = DBManagerFactory::getInstance ();
|
|
||||||
|
|
||||||
$admin = new Administration ();
|
|
||||||
$admin->retrieveSettings ( 'tracker' );
|
|
||||||
require ('modules/Trackers/config.php');
|
|
||||||
$trackerConfig = $tracker_config;
|
|
||||||
|
|
||||||
require_once ('include/utils/db_utils.php');
|
|
||||||
$prune_interval = ! empty ( $admin->settings ['tracker_prune_interval'] ) ? $admin->settings ['tracker_prune_interval'] : 30;
|
|
||||||
foreach ( $trackerConfig as $tableName => $tableConfig ) {
|
|
||||||
|
|
||||||
// Skip if table does not exist
|
|
||||||
if (! $db->tableExists ( $tableName )) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
$db->query("DELETE FROM currency_nbp_archive WHERE date < (NOW() - INTERVAL 100 DAY)");
|
||||||
$timeStamp = db_convert ( "'" . gmdate ( $GLOBALS ['timedate']->get_db_date_time_format (), time () + (86400 * - $prune_interval) ) . "'", "datetime" );
|
|
||||||
if ($tableName == 'tracker_sessions') {
|
|
||||||
$query = "DELETE FROM $tableName WHERE date_end < $timeStamp";
|
|
||||||
} else {
|
|
||||||
$query = "DELETE FROM $tableName WHERE date_modified < $timeStamp";
|
|
||||||
}
|
|
||||||
|
|
||||||
$GLOBALS ['log']->info ( "----->Scheduler is about to trim the $tableName table by running the query $query" );
|
|
||||||
$db->query ( $query );
|
|
||||||
} // foreach
|
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch (Exception $e) {
|
||||||
|
return false;
|
||||||
/*
|
|
||||||
* Job 5
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
function pollMonitoredInboxesForBouncedCampaignEmails() {
|
|
||||||
$GLOBALS ['log']->info ( '----->Scheduler job of type pollMonitoredInboxesForBouncedCampaignEmails()' );
|
|
||||||
global $dictionary;
|
|
||||||
|
|
||||||
$ie = new InboundEmail ();
|
|
||||||
$r = $ie->db->query ( 'SELECT id FROM inbound_email WHERE deleted=0 AND status=\'Active\' AND mailbox_type=\'bounce\'' );
|
|
||||||
|
|
||||||
while ( $a = $ie->db->fetchByAssoc ( $r ) ) {
|
|
||||||
$ieX = new InboundEmail ();
|
|
||||||
$ieX->retrieve ( $a ['id'] );
|
|
||||||
$ieX->connectMailserver ();
|
|
||||||
|
|
||||||
$newMsgs = array ();
|
|
||||||
if ($ieX->isPop3Protocol ()) {
|
|
||||||
$newMsgs = $ieX->getPop3NewMessagesToDownload ();
|
|
||||||
} else {
|
|
||||||
$newMsgs = $ieX->getNewMessageIds ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// $newMsgs = $ieX->getNewMessageIds();
|
|
||||||
if (is_array ( $newMsgs )) {
|
|
||||||
foreach ( $newMsgs as $k => $msgNo ) {
|
|
||||||
$uid = $msgNo;
|
|
||||||
if ($ieX->isPop3Protocol ()) {
|
|
||||||
$uid = $ieX->getUIDLForMessage ( $msgNo );
|
|
||||||
} else {
|
|
||||||
$uid = imap_uid ( $ieX->conn, $msgNo );
|
|
||||||
} // else
|
|
||||||
|
|
||||||
$ieX->importOneEmail ( $msgNo, $uid, false, false );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
imap_expunge ( $ieX->conn );
|
|
||||||
imap_close ( $ieX->conn );
|
// helpers
|
||||||
|
function brecho($msg) {
|
||||||
|
echo PHP_EOL;
|
||||||
|
var_dump($msg);
|
||||||
|
echo PHP_EOL.PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
function makeCUrlRequest($url) {
|
||||||
|
$curl = curl_init();
|
||||||
|
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET' );
|
||||||
|
curl_setopt($curl, CURLOPT_VERBOSE, 0);
|
||||||
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||||
|
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||||
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
|
return json_decode(curl_exec($curl));
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkEDISales() {
|
|
||||||
require_once ('modules/EcmSales/EcmSale.php');
|
|
||||||
require_once ('modules/EcmSales/readXML.php');
|
|
||||||
|
|
||||||
require_once 'include/phpMailer2/class.phpmailer.php';
|
|
||||||
require_once 'include/phpMailer2/class.smtp.php';
|
|
||||||
|
|
||||||
$path = '/var/edi/e5/orders';
|
|
||||||
$folders = array (
|
|
||||||
'archive',
|
|
||||||
'temp',
|
|
||||||
'confirm'
|
|
||||||
); // do not read this folders
|
|
||||||
|
|
||||||
$orders = array ();
|
|
||||||
if (is_dir ( $path )) {
|
|
||||||
if ($dh = opendir ( $path )) {
|
|
||||||
while ( ($file = readdir ( $dh )) !== false ) {
|
|
||||||
if (! is_dir ( $file ) && ! in_array ( $file, $folders )) {
|
|
||||||
$orders [] = $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// add orders
|
|
||||||
$mail_msg = array ();
|
|
||||||
foreach ( $orders as $order ) {
|
|
||||||
$s = new EcmSale ();
|
|
||||||
$reader = new readXML ();
|
|
||||||
$reader->loadXMLFile ( $order );
|
|
||||||
$reader->loader ( $s );
|
|
||||||
$s->position_list = $reader->getPositionList ( true );
|
|
||||||
$missedProducts = $reader->checkProducts($s->position_list);
|
|
||||||
$number = $s->generateNumber ();
|
|
||||||
$s->number = $number;
|
|
||||||
$s->document_no = $s->formatNumber ( $number );
|
|
||||||
$s->edi_file = $order;
|
|
||||||
$s->type = 'sales_order';
|
|
||||||
$s->status = 's30';
|
|
||||||
$s->ecmlanguage = 'pl_pl';
|
|
||||||
$a = new Account ();
|
|
||||||
$a->retrieve ( $s->parent_id );
|
|
||||||
$s->assigned_user_id = $a->assigned_user_id;
|
|
||||||
$s->assigned_user_name = $a->assigned_user_name;
|
|
||||||
// calculate totals
|
|
||||||
$sum_netto = 0;
|
|
||||||
$sum_brutto = 0;
|
|
||||||
foreach ( $s->position_list as $p ) {
|
|
||||||
$sum_netto += $p ['total_netto'];
|
|
||||||
$sum_brutto += $p ['total_brutto'];
|
|
||||||
}
|
|
||||||
$s->total_netto = $sum_netto;
|
|
||||||
|
|
||||||
if($s->parent_id==134 || $s->parent_id=='134'){
|
|
||||||
$s->shop_number = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
$s->total_brutto = $sum_brutto;
|
|
||||||
$s->save ();
|
|
||||||
|
|
||||||
$s->sendSoap($s->id);
|
|
||||||
|
|
||||||
|
|
||||||
if (!is_array($mail_msg [$a->assigned_user_id]))
|
|
||||||
$mail_msg [$a->assigned_user_id] = array ();
|
|
||||||
if (!$s->parent_name || $s->parent_name=="")
|
|
||||||
$s->parent_name = 'Błąd! Brak kontrahenta!';
|
|
||||||
$msg =
|
|
||||||
'<b>Plik: '.$order.'</b><br>'.$s->document_no.', '.$s->parent_document_no.', '. $s->parent_name.'<br>';
|
|
||||||
if (count($missedProducts) == 0) {
|
|
||||||
$msg.='Status produktów: <b>OK</b>';
|
|
||||||
} else {
|
|
||||||
$msg.='<b>Zamówienie niekompletne: '.implode(', ', $missedProducts);
|
|
||||||
}
|
|
||||||
$msg.='<br><br><br>';
|
|
||||||
$mail_msg [$a->assigned_user_id][] = $msg;
|
|
||||||
unset($a);
|
|
||||||
// move files
|
|
||||||
rename ( $path . '/' . $order, $path . '/archive/' . $order );
|
|
||||||
}
|
|
||||||
//send messages
|
|
||||||
// require_once 'modules/Schedulers/phpMailer.php';
|
|
||||||
foreach ( $mail_msg as $user=>$msg ) {
|
|
||||||
$u = new User();
|
|
||||||
$u->retrieve($user);
|
|
||||||
|
|
||||||
$message = $date = date('Y-m-d H:i:s').' dodano zamówienie(a):<br>';
|
|
||||||
foreach ($msg as $m) {
|
|
||||||
$message .= $m.'<br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$mail = new PHPMailer2 ();
|
|
||||||
$mail->isSMTP();
|
|
||||||
$mail->setFrom('system@e5.pl', 'Usługa importu EDI');
|
|
||||||
$mail->Host = 'smtp.gmail.com';
|
|
||||||
$mail->SMTPAuth = true;
|
|
||||||
$mail->Username = 'system@e5.pl';
|
|
||||||
$mail->Password = 'eT4U>hyJe';
|
|
||||||
$mail->SMTPSecure = 'tls';
|
|
||||||
$mail->Port = 587;
|
|
||||||
$mail->CharSet = 'UTF-8';
|
|
||||||
$mail->addAddress('mz@bim-it.pl', 'Michał Zieliński');
|
|
||||||
$mail->addAddress('rl@e5.pl', 'Ryszard Lisiecki');
|
|
||||||
$mail->addAddress('mf@e5.pl', 'Małgorzata Franiewska');
|
|
||||||
$mail->isHTML(true);
|
|
||||||
$mail->Subject = "Import zamówienia EDI - E5" ;
|
|
||||||
$mail->Body = $message;
|
|
||||||
$mail->send();
|
|
||||||
|
|
||||||
unset ( $mS ); // cleaning
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file_exists ( 'custom/modules/Schedulers/_AddJobsHere.php' )) {
|
|
||||||
require ('custom/modules/Schedulers/_AddJobsHere.php');
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
|||||||
* "Powered by SugarCRM".
|
* "Powered by SugarCRM".
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
|
|
||||||
* Description: TODO: To be written.
|
* Description: TODO: To be written.
|
||||||
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
* Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
|
||||||
* All Rights Reserved.
|
* All Rights Reserved.
|
||||||
@@ -69,23 +68,18 @@ if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
|||||||
echo $mod_strings['LBL_PROVIDE_USERNAME_AND_EMAIL'];
|
echo $mod_strings['LBL_PROVIDE_USERNAME_AND_EMAIL'];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
echo $mod_strings['LBL_PROVIDE_USERNAME_AND_EMAIL'];
|
echo $mod_strings['LBL_PROVIDE_USERNAME_AND_EMAIL'];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
if (isset($_POST['userId']) && $_POST['userId'] != '') {
|
if (isset($_POST['userId']) && $_POST['userId'] != '') {
|
||||||
$usr->retrieve($_POST['userId']);
|
$usr->retrieve($_POST['userId']);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
if (isset($_POST['sugar_user_name']) && isset($_POST['sugar_user_name'])) {
|
if (isset($_POST['sugar_user_name']) && isset($_POST['sugar_user_name'])) {
|
||||||
$usr_id = $usr->retrieve_user_id($_POST['sugar_user_name']);
|
$usr_id = $usr->retrieve_user_id($_POST['sugar_user_name']);
|
||||||
$usr->retrieve($usr_id);
|
$usr->retrieve($usr_id);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
echo $mod_strings['ERR_USER_INFO_NOT_FOUND'];
|
echo $mod_strings['ERR_USER_INFO_NOT_FOUND'];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -155,7 +149,8 @@ if (isset($_POST['link']) && $_POST['link'] == '1'){
|
|||||||
if ($emailTemp->retrieve($emailTemp_id) == '') {
|
if ($emailTemp->retrieve($emailTemp_id) == '') {
|
||||||
echo $mod_strings['LBL_EMAIL_TEMPLATE_MISSING'];
|
echo $mod_strings['LBL_EMAIL_TEMPLATE_MISSING'];
|
||||||
$new_pwd = '4';
|
$new_pwd = '4';
|
||||||
return;}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//replace instance variables in email templates
|
//replace instance variables in email templates
|
||||||
$htmlBody = $emailTemp->body_html;
|
$htmlBody = $emailTemp->body_html;
|
||||||
@@ -163,8 +158,7 @@ if (isset($_POST['link']) && $_POST['link'] == '1'){
|
|||||||
if (isset($_POST['link']) && $_POST['link'] == '1') {
|
if (isset($_POST['link']) && $_POST['link'] == '1') {
|
||||||
$htmlBody = str_replace('$contact_user_link_guid', $url, $htmlBody);
|
$htmlBody = str_replace('$contact_user_link_guid', $url, $htmlBody);
|
||||||
$body = str_replace('$contact_user_link_guid', $url, $body);
|
$body = str_replace('$contact_user_link_guid', $url, $body);
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
$htmlBody = str_replace('$contact_user_user_hash', $password, $htmlBody);
|
$htmlBody = str_replace('$contact_user_user_hash', $password, $htmlBody);
|
||||||
$body = str_replace('$contact_user_user_hash', $password, $body);
|
$body = str_replace('$contact_user_user_hash', $password, $body);
|
||||||
}
|
}
|
||||||
@@ -190,10 +184,11 @@ if (isset($_POST['link']) && $_POST['link'] == '1'){
|
|||||||
$mail->From = $defaults['email'];
|
$mail->From = $defaults['email'];
|
||||||
$mail->FromName = $defaults['name'];
|
$mail->FromName = $defaults['name'];
|
||||||
$mail->isSMTP(); // Set mailer to use SMTP
|
$mail->isSMTP(); // Set mailer to use SMTP
|
||||||
$mail->Host = 'poczta.saas-systems.pl'; // Specify main and backup SMTP servers
|
$mail->Host = 'smtp.gmail.com';
|
||||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
$mail->SMTPAuth = true;
|
||||||
$mail->Username = 'biuro@saas-systems.pl'; // SMTP username
|
$mail->Username = 'system@e5.pl';
|
||||||
$mail->Password = '3g431r31!'; // SMTP password
|
$mail->Password = 'wqiz ekxn lysj zheu';
|
||||||
|
|
||||||
$mail->CharSet = 'UTF-8';
|
$mail->CharSet = 'UTF-8';
|
||||||
$mail->charSet = "UTF-8";
|
$mail->charSet = "UTF-8";
|
||||||
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
|
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
|
||||||
@@ -203,19 +198,20 @@ if (isset($_POST['link']) && $_POST['link'] == '1'){
|
|||||||
$mail->IsHTML(true);
|
$mail->IsHTML(true);
|
||||||
$mail->Body = from_html($emailTemp->body_html);
|
$mail->Body = from_html($emailTemp->body_html);
|
||||||
$mail->AltBody = from_html($emailTemp->body);
|
$mail->AltBody = from_html($emailTemp->body);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$mail->Body_html = from_html($emailTemp->body_html);
|
$mail->Body_html = from_html($emailTemp->body_html);
|
||||||
$mail->Body = from_html($emailTemp->body);
|
$mail->Body = from_html($emailTemp->body);
|
||||||
}
|
}
|
||||||
if ($mail->Body == '' && $current_user->is_admin) {
|
if ($mail->Body == '' && $current_user->is_admin) {
|
||||||
echo $app_strings['LBL_EMAIL_TEMPLATE_EDIT_PLAIN_TEXT'];
|
echo $app_strings['LBL_EMAIL_TEMPLATE_EDIT_PLAIN_TEXT'];
|
||||||
$new_pwd = '4';
|
$new_pwd = '4';
|
||||||
return;}
|
return;
|
||||||
|
}
|
||||||
if ($mail->Mailer == 'smtp' && $mail->Host == '' && $current_user->is_admin) {
|
if ($mail->Mailer == 'smtp' && $mail->Host == '' && $current_user->is_admin) {
|
||||||
echo $mod_strings['ERR_SERVER_SMTP_EMPTY'];
|
echo $mod_strings['ERR_SERVER_SMTP_EMPTY'];
|
||||||
$new_pwd = '4';
|
$new_pwd = '4';
|
||||||
return;}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// $mail->prepForOutbound();
|
// $mail->prepForOutbound();
|
||||||
@@ -279,8 +275,7 @@ if (isset($_POST['link']) && $_POST['link'] == '1'){
|
|||||||
$email_errors .= "\n-" . $mod_strings['ERR_RECIPIENT_EMAIL'];
|
$email_errors .= "\n-" . $mod_strings['ERR_RECIPIENT_EMAIL'];
|
||||||
$email_errors .= "\n-" . $mod_strings['ERR_SERVER_STATUS'];
|
$email_errors .= "\n-" . $mod_strings['ERR_SERVER_STATUS'];
|
||||||
echo $email_errors;
|
echo $email_errors;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
echo $mod_strings['LBL_EMAIL_NOT_SENT'];
|
echo $mod_strings['LBL_EMAIL_NOT_SENT'];
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user