Commit old changes
This commit is contained in:
@@ -39,13 +39,13 @@
|
|||||||
echo '<a target="new" href="https://crm.e5.pl/index.php?module=EcmSales&action=DetailView&record='.$exists['id'].'">'.$exists['document_no'].'</a>';
|
echo '<a target="new" href="https://crm.e5.pl/index.php?module=EcmSales&action=DetailView&record='.$exists['id'].'">'.$exists['document_no'].'</a>';
|
||||||
die();
|
die();
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = makeCUrlRequest("https://crm.twinpol.com/REST/index.php?key=d68dac4c-f784-4e1b-8267-9ffcfa0eda4c&action=getSale&record=".$record);
|
$res = makeCUrlRequest("https://crm.twinpol.com/REST/index.php?key=d68dac4c-f784-4e1b-8267-9ffcfa0eda4c&action=getSale&record=".$record);
|
||||||
$sale = json_decode($res);
|
$sale = json_decode($res);
|
||||||
$sale->position_list = json_decode($sale->position_list);
|
$sale->position_list = json_decode($sale->position_list);
|
||||||
echo "Numer dokumentu TwinPol: <b>".$sale->document_no."</b><br>";
|
echo "Numer dokumentu TwinPol: <b>".$sale->document_no."</b><br>";
|
||||||
|
|
||||||
$gotAllProducts = true; // hope :)
|
$gotAllProducts = true; // hope :)
|
||||||
$newPositionList = array();
|
$newPositionList = array();
|
||||||
$total_netto = 0; $total_brutto = 0; $total_discount = 0; $vats = array();
|
$total_netto = 0; $total_brutto = 0; $total_discount = 0; $vats = array();
|
||||||
foreach ( $sale->position_list as $product ) {
|
foreach ( $sale->position_list as $product ) {
|
||||||
@@ -84,7 +84,7 @@
|
|||||||
}
|
}
|
||||||
$prod['quantity'] = $product->quantity;
|
$prod['quantity'] = $product->quantity;
|
||||||
$prod['discount'] = $product->discount;
|
$prod['discount'] = $product->discount;
|
||||||
$prod['price_start'] = $price_start;
|
$prod['price_start'] = $price_start;
|
||||||
$prod['price_netto'] = round($price_start - ($price_start * ($product->discount / 100)),2);
|
$prod['price_netto'] = round($price_start - ($price_start * ($product->discount / 100)),2);
|
||||||
$prod['ecmvat_id'] = $fvPrice['ecmvat_id'];
|
$prod['ecmvat_id'] = $fvPrice['ecmvat_id'];
|
||||||
$prod['ecmvat_value'] = $fvPrice['ecmvat_value'];
|
$prod['ecmvat_value'] = $fvPrice['ecmvat_value'];
|
||||||
@@ -105,7 +105,7 @@
|
|||||||
|
|
||||||
$prod['date_entered'] = date('Y-m-d H:i:s');
|
$prod['date_entered'] = date('Y-m-d H:i:s');
|
||||||
$prod['date_modified'] = date('Y-m-d H:i:s');
|
$prod['date_modified'] = date('Y-m-d H:i:s');
|
||||||
$prod['modified_user_id'] = null;
|
$prod['modified_user_id'] = null;
|
||||||
$prod['assigned_user_id'] = null;
|
$prod['assigned_user_id'] = null;
|
||||||
$prod['created_by'] = null;
|
$prod['created_by'] = null;
|
||||||
$prod['deleted'] = '0';
|
$prod['deleted'] = '0';
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
$new->shipping_nip = $sale->parent_nip;
|
$new->shipping_nip = $sale->parent_nip;
|
||||||
$new->edi_zs_id = $sale->id;
|
$new->edi_zs_id = $sale->id;
|
||||||
$new->edi_zs_document_no = $sale->document_no;
|
$new->edi_zs_document_no = $sale->document_no;
|
||||||
$new->pdf_text =
|
$new->pdf_text =
|
||||||
"Dostawa
|
"Dostawa
|
||||||
".$sale->shipping_address_name."
|
".$sale->shipping_address_name."
|
||||||
".$sale->shipping_address_street."
|
".$sale->shipping_address_street."
|
||||||
|
|||||||
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);
|
||||||
?>
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
//WARNING: The contents of this file are auto-generated
|
//WARNING: The contents of this file are auto-generated
|
||||||
|
|
||||||
|
|
||||||
$app_list_strings['moduleList']['EcmProductsDocumentsRelations']='ProductsDocumentsRelations';
|
$app_list_strings['moduleList']['EcmProductsDocumentsRelations']='ProductsDocumentsRelations';
|
||||||
|
|
||||||
|
|
||||||
$app_list_strings['moduleList']['EcmQuotes'] = 'Quotes';
|
$app_list_strings['moduleList']['EcmQuotes'] = 'Quotes';
|
||||||
@@ -30,34 +30,34 @@ $app_list_strings['ecmquotes_order_origin_dom'] = array (
|
|||||||
'fair' => 'From Fair'
|
'fair' => 'From Fair'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$app_list_strings['moduleList']['EcmDeliveryConditions'] = 'Delivery Conditions';
|
|
||||||
|
|
||||||
|
$app_list_strings['moduleList']['EcmDeliveryConditions'] = 'Delivery Conditions';
|
||||||
$app_list_strings['moduleList']['EcmPaymentConditions'] = 'Payment Conditions';
|
|
||||||
|
|
||||||
|
$app_list_strings['moduleList']['EcmPaymentConditions'] = 'Payment Conditions';
|
||||||
|
|
||||||
|
|
||||||
$app_list_strings['moduleList']['EcmTexts']='Texts';
|
$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',
|
||||||
'not_accepted' => 'Not Accepted',
|
'not_accepted' => 'Not Accepted',
|
||||||
'accepted' => 'Accepted',
|
'accepted' => 'Accepted',
|
||||||
'mailed' => 'Sent',
|
'mailed' => 'Sent',
|
||||||
'printed' => 'Printed',
|
'printed' => 'Printed',
|
||||||
'paid' => 'Paid',
|
'paid' => 'Paid',
|
||||||
'admonition' => 'Admonition',
|
'admonition' => 'Admonition',
|
||||||
);
|
);
|
||||||
$app_list_strings['ecminvoiceouts_type_dom'] = array (
|
$app_list_strings['ecminvoiceouts_type_dom'] = array (
|
||||||
'normal' => 'Normal',
|
'normal' => 'Normal',
|
||||||
'correct' => 'Correct',
|
'correct' => 'Correct',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -74,13 +74,13 @@ $app_list_strings['ecmproducts_product_size_dom'] = array(
|
|||||||
$app_list_strings['ecmproducts_product_brand_dom'] = array(
|
$app_list_strings['ecmproducts_product_brand_dom'] = array(
|
||||||
'brak' => 'Brak',
|
'brak' => 'Brak',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
$mod_strings['LBL_ECMDOCUMENTTEMPLATES_TITLE'] = 'Document Templates';
|
$mod_strings['LBL_ECMDOCUMENTTEMPLATES_TITLE'] = 'Document Templates';
|
||||||
$mod_strings['LBL_ECMDOCUMENTTEMPLATES_DESC'] = 'Here You can set informations contained with pdf file for Invoices, Offers...';
|
$mod_strings['LBL_ECMDOCUMENTTEMPLATES_DESC'] = 'Here You can set informations contained with pdf file for Invoices, Offers...';
|
||||||
$mod_strings['LBL_SETTINGS_OF_ECMDOCUMENTTEMPLATES'] = 'Document Templates';
|
$mod_strings['LBL_SETTINGS_OF_ECMDOCUMENTTEMPLATES'] = 'Document Templates';
|
||||||
$mod_strings['LBL_ECMDOCUMENTTEMPLATES'] = 'Settings for pdf file';
|
$mod_strings['LBL_ECMDOCUMENTTEMPLATES'] = 'Settings for pdf file';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$app_list_strings['moduleList']['EcmGroupSales']='Group Sales';
|
$app_list_strings['moduleList']['EcmGroupSales']='Group Sales';
|
||||||
|
|||||||
@@ -1,35 +1,35 @@
|
|||||||
<?php
|
<?php
|
||||||
//WARNING: The contents of this file are auto-generated
|
//WARNING: The contents of this file are auto-generated
|
||||||
|
|
||||||
|
|
||||||
$app_list_strings['moduleList']['EcmInvoiceOuts'] = 'Faktury';
|
|
||||||
$app_list_strings['ecminvoiceouts_parent_dom'] = array (
|
|
||||||
'Accounts' => $app_list_strings['moduleList']['Accounts'],
|
|
||||||
'Contacts' => $app_list_strings['moduleList']['Contacts'],
|
|
||||||
);
|
|
||||||
$app_list_strings['ecminvoiceouts_type_dom'] = array (
|
|
||||||
'normal' => 'Normalna',
|
|
||||||
'correct' => 'Korekta',
|
|
||||||
);
|
|
||||||
$app_list_strings['ecminvoiceouts_status_dom'] = array (
|
|
||||||
'registered' => 'Zarejestrowana',
|
|
||||||
'not_accepted' => 'Niezaakceptowana',
|
|
||||||
'accepted' => 'Zaakceptowana',
|
|
||||||
'mailed' => 'Wysłana',
|
|
||||||
'printed' => 'Wydrukowana',
|
|
||||||
'paid' => 'Zapłacona',
|
|
||||||
'admonition' => 'Upomnienie',
|
|
||||||
);
|
|
||||||
$app_list_strings['ecminvoiceouts_type_dom'] = array (
|
|
||||||
'normal' => 'Normalna',
|
|
||||||
'correct' => 'Korekta',
|
|
||||||
);
|
|
||||||
|
|
||||||
|
$app_list_strings['moduleList']['EcmInvoiceOuts'] = 'Faktury';
|
||||||
$app_list_strings['moduleList']['EcmProductsDocumentsRelations']='Relacja z Produktami';
|
$app_list_strings['ecminvoiceouts_parent_dom'] = array (
|
||||||
|
//'Accounts' => $app_list_strings['moduleList']['Accounts'],
|
||||||
|
//'Contacts' => $app_list_strings['moduleList']['Contacts'],
|
||||||
|
);
|
||||||
|
$app_list_strings['ecminvoiceouts_type_dom'] = array (
|
||||||
|
'normal' => 'Normalna',
|
||||||
|
'correct' => 'Korekta',
|
||||||
|
);
|
||||||
|
$app_list_strings['ecminvoiceouts_status_dom'] = array (
|
||||||
|
'registered' => 'Zarejestrowana',
|
||||||
|
'not_accepted' => 'Niezaakceptowana',
|
||||||
|
'accepted' => 'Zaakceptowana',
|
||||||
|
'mailed' => 'Wysłana',
|
||||||
|
'printed' => 'Wydrukowana',
|
||||||
|
'paid' => 'Zapłacona',
|
||||||
|
'admonition' => 'Upomnienie',
|
||||||
|
);
|
||||||
|
$app_list_strings['ecminvoiceouts_type_dom'] = array (
|
||||||
|
'normal' => 'Normalna',
|
||||||
|
'correct' => 'Korekta',
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
$app_list_strings['moduleList']['EcmPaymentConditions'] = 'Warunki Płatności';
|
$app_list_strings['moduleList']['EcmProductsDocumentsRelations']='Relacja z Produktami';
|
||||||
|
|
||||||
|
|
||||||
|
$app_list_strings['moduleList']['EcmPaymentConditions'] = 'Warunki Płatności';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -47,8 +47,8 @@ $app_list_strings['ecmproducts_product_size_dom'] = array(
|
|||||||
$app_list_strings['ecmproducts_product_brand_dom'] = array(
|
$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'];
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
<script type="text/javascript" src="modules/EcmReports/javascript/jquery.js"></script>
|
<script type="text/javascript" src="modules/EcmReports/javascript/jquery.js"></script>
|
||||||
<link rel="stylesheet" href="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/css/theme.blue.min.css">
|
<link rel="stylesheet" href="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/css/theme.blue.min.css">
|
||||||
<script type="text/javascript"
|
<script type="text/javascript"
|
||||||
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.js"></script>
|
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.js"></script>
|
||||||
<script type="text/javascript"
|
<script type="text/javascript"
|
||||||
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.widgets.js">
|
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/jquery.tablesorter.widgets.js">
|
||||||
</script>
|
</script>
|
||||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.6/select2.min.css" rel="stylesheet">
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.6/select2.min.css" rel="stylesheet">
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.6/select2.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/select2/3.4.6/select2.min.js"></script>
|
||||||
<script type="text/javascript"
|
<script type="text/javascript"
|
||||||
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/widgets/widget-filter-formatter-select2.min.js">
|
src="modules/EcmReports/BimIT-Reports/lib/tablesorter-2.31.3/dist/js/widgets/widget-filter-formatter-select2.min.js">
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="modules/EcmReports/javascript/jquery.blockUI.js"></script>
|
<script type="text/javascript" src="modules/EcmReports/javascript/jquery.blockUI.js"></script>
|
||||||
<script type="text/javascript" src="modules/EcmReports/BimIT-Reports/productsBySales/productsBySales.js"></script>
|
<script type="text/javascript" src="modules/EcmReports/BimIT-Reports/productsBySales/productsBySales.js"></script>
|
||||||
@@ -16,58 +16,58 @@
|
|||||||
<!-- HEADER -->
|
<!-- HEADER -->
|
||||||
<table id="tableMenu" cellspacing="0" cellpadding="0">
|
<table id="tableMenu" cellspacing="0" cellpadding="0">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<img src="themes/Sugar5/images/CaseReports.gif" style="margin-top: 3px; margin-right: 3px;" width="16"
|
<img src="themes/Sugar5/images/CaseReports.gif" style="margin-top: 3px; margin-right: 3px;" width="16"
|
||||||
height="16">
|
height="16">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<h2>Produkcja</h2>
|
<h2>Produkcja</h2>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<!-- SEARCH -->
|
<!-- SEARCH -->
|
||||||
<form action="index.php" method="get" name="searchProductBySales">
|
<form action="index.php" method="get" name="searchProductBySales">
|
||||||
<input type="hidden" name="module" value="EcmReports" />
|
<input type="hidden" name="module" value="EcmReports"/>
|
||||||
<input type="hidden" name="action" value="index" />
|
<input type="hidden" name="action" value="index"/>
|
||||||
<input type="hidden" name="reportName" value="productsBySales" />
|
<input type="hidden" name="reportName" value="productsBySales"/>
|
||||||
<input type="hidden" name="hideReadyProducts" id="hideReadyProducts" value="{$hideReadyProducts}" />
|
<input type="hidden" name="hideReadyProducts" id="hideReadyProducts" value="{$hideReadyProducts}"/>
|
||||||
<table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0"
|
<table style="border-top: 0px none; margin-bottom: 4px;width:100%" class="tabForm" border="0" cellpadding="0"
|
||||||
cellspacing="0">
|
cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<td class="dataLabel" width="5%" nowrap="nowrap">
|
<td class="dataLabel" width="5%" nowrap="nowrap">
|
||||||
Data wysyłki: od
|
Data wysyłki: od
|
||||||
|
|
||||||
<input id="date_from" name="date_from" type="text" maxlength="10" size="11" tabindex="" title=""
|
<input id="date_from" name="date_from" type="text" maxlength="10" size="11" tabindex="" title=""
|
||||||
value="{$dateFrom}" autocomplete="off">
|
value="{$dateFrom}" autocomplete="off">
|
||||||
<img id="date_from_trigger" src="themes/default/images/jscalendar.gif">
|
<img id="date_from_trigger" src="themes/default/images/jscalendar.gif">
|
||||||
<script language="JavaScript" type="text/javascript">
|
<script language="JavaScript" type="text/javascript">
|
||||||
Calendar.setup ({ldelim}
|
Calendar.setup({ldelim}
|
||||||
inputField: "date_from",
|
inputField: "date_from",
|
||||||
daFormat: "%d.%m.%Y",
|
daFormat: "%d.%m.%Y",
|
||||||
button: "date_from_trigger",
|
button: "date_from_trigger",
|
||||||
singleClick: true,
|
singleClick: true,
|
||||||
dateStr: "",
|
dateStr: "",
|
||||||
step: 1
|
step: 1
|
||||||
{rdelim}
|
{rdelim}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|
||||||
<input autocomplete="off" name="date_to" id="date_to" value="{$dateTo}" title="" tabindex="" size="11"
|
<input autocomplete="off" name="date_to" id="date_to" value="{$dateTo}" title="" tabindex="" size="11"
|
||||||
maxlength="10" type="text">
|
maxlength="10" type="text">
|
||||||
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_to_trigger">
|
<img src="themes/default/images/jscalendar.gif" alt="Enter Date" id="date_to_trigger">
|
||||||
<script language="JavaScript" type="text/javascript">
|
<script language="JavaScript" type="text/javascript">
|
||||||
Calendar.setup ({ldelim}
|
Calendar.setup({ldelim}
|
||||||
inputField: "date_to",
|
inputField: "date_to",
|
||||||
daFormat: "%d.%m.%Y",
|
daFormat: "%d.%m.%Y",
|
||||||
button: "date_to_trigger",
|
button: "date_to_trigger",
|
||||||
singleClick: true,
|
singleClick: true,
|
||||||
dateStr: "",
|
dateStr: "",
|
||||||
step: 1
|
step: 1
|
||||||
{rdelim}
|
{rdelim}
|
||||||
);
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -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,8 +106,10 @@
|
|||||||
<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 () {
|
||||||
SelectedTab = '1';
|
SetTab('1');
|
||||||
|
};
|
||||||
|
SelectedTab = '1';
|
||||||
{/literal}
|
{/literal}
|
||||||
</script>
|
</script>
|
||||||
<a class="current" href="javascript:set1();">Produkty</a>
|
<a class="current" href="javascript:set1();">Produkty</a>
|
||||||
@@ -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>
|
||||||
@@ -132,161 +139,158 @@
|
|||||||
<!-- TABS -->
|
<!-- TABS -->
|
||||||
<div id="1">
|
<div id="1">
|
||||||
<br>
|
<br>
|
||||||
<input class="button" name="submit" value="Utwórz zamówienie wewnętrzne" type="button" id="createInsideOrder" />
|
<input class="button" name="submit" value="Utwórz zamówienie wewnętrzne" type="button" id="createInsideOrder"/>
|
||||||
<br>
|
<br>
|
||||||
<form action="index.php?module=EcmInsideOrders&action=EditView&fromProductsBySalesReport=true" method="post"
|
<form action="index.php?module=EcmInsideOrders&action=EditView&fromProductsBySalesReport=true" method="post"
|
||||||
target="_blank" id="createInsideOrderForm">
|
target="_blank" id="createInsideOrderForm">
|
||||||
<input id="insideOrderProducts" name="insideOrderProducts" type="hidden" value="" />
|
<input id="insideOrderProducts" name="insideOrderProducts" type="hidden" value=""/>
|
||||||
</form>
|
</form>
|
||||||
<table id="allTable">
|
<table id="allTable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="filter-false"><input type="checkbox" id="selectAll" /></th>
|
<th class="filter-false"><input type="checkbox" id="selectAll"/></th>
|
||||||
<th>Pozycja</th>
|
<th>Pozycja</th>
|
||||||
<th>Indeks</th>
|
<th>Indeks</th>
|
||||||
<th>Nazwa</th>
|
<th>Nazwa</th>
|
||||||
<th>Ilość</th>
|
<th>Ilość</th>
|
||||||
<th>Stan</th>
|
<th>Stan</th>
|
||||||
<th>ZS E5</th>
|
<th>ZS E5</th>
|
||||||
<th>Status</th>
|
<th>Typ</th>
|
||||||
<th>Zamawiający</th>
|
<th>Status</th>
|
||||||
<th>Odbiorca</th>
|
<th>Zamawiający</th>
|
||||||
<th>Rodzaj</th>
|
<th>Odbiorca</th>
|
||||||
<th>Rozmiar</th>
|
<th>Forma</th>
|
||||||
<th>Forma</th>
|
<th>Marka</th>
|
||||||
<th>Marka</th>
|
<th>Data rejestracji</th>
|
||||||
<th>Data rejestracji</th>
|
<th>Data wysyłki</th>
|
||||||
<th>Data wysyłki</th>
|
<th>Data dostawy</th>
|
||||||
<th>Data dostawy</th>
|
<th>Data produkcji</th>
|
||||||
<th>Data produkcji</th>
|
<th>Uwagi</th>
|
||||||
<th>Uwagi</th>
|
</tr>
|
||||||
</tr>
|
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody aria-live="polite" aria-relevant="all">
|
<tbody aria-live="polite" aria-relevant="all">
|
||||||
{foreach from=$allData item=ROW name=loop}
|
{foreach from=$allData item=ROW name=loop}
|
||||||
|
|
||||||
{if $smarty.foreach.loop.index % 2 == 1}
|
{if $smarty.foreach.loop.index % 2 == 1}
|
||||||
<tr>
|
<tr>
|
||||||
{else}
|
{else}
|
||||||
<tr style="background-color: #e6e6e6;" role="row">
|
<tr style="background-color: #e6e6e6;" role="row">
|
||||||
{/if}
|
{/if}
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" value="{$ROW.orderItemId}" class="allCheck" />
|
<input type="checkbox" value="{$ROW.orderItemId}" class="allCheck"/>
|
||||||
<input type="hidden" id="productId-{$ROW.orderItemId}" value="{$ROW.productId}" />
|
<input type="hidden" id="productId-{$ROW.orderItemId}" value="{$ROW.productId}"/>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{$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"
|
||||||
{$ROW.productCode}
|
href="index.php?module=EcmProducts&action=DetailView&record={$ROW.productId}">
|
||||||
</a>
|
{$ROW.productCode}
|
||||||
</td>
|
</a>
|
||||||
<td title="{$ROW.productFullName}">
|
</td>
|
||||||
{$ROW.productName}
|
<td title="{$ROW.productFullName}">
|
||||||
</td>
|
{$ROW.productName}
|
||||||
<td id="productQty-{$ROW.orderItemId}">
|
</td>
|
||||||
{$ROW.productQty}
|
<td id="productQty-{$ROW.orderItemId}">
|
||||||
</td>
|
{$ROW.productQty}
|
||||||
<td>
|
</td>
|
||||||
{$ROW.productStockState}
|
<td>
|
||||||
</td>
|
{$ROW.productStockState}
|
||||||
<td>
|
</td>
|
||||||
<a target="_blank" href="index.php?module=EcmSales&action=DetailView&record={$ROW.orderId}">
|
<td>
|
||||||
{$ROW.orderNo}
|
<a target="_blank" href="index.php?module=EcmSales&action=DetailView&record={$ROW.orderId}">
|
||||||
</a>
|
{$ROW.orderNo}
|
||||||
</td>
|
</a>
|
||||||
<td>
|
</td>
|
||||||
{$ROW.orderStatus}
|
<td>
|
||||||
</td>
|
{$ROW.orderType}
|
||||||
<td>
|
</td>
|
||||||
<a target="_blank" href="index.php?module=Accounts&action=DetailView&record={$ROW.orderParentId}">
|
<td>
|
||||||
{$ROW.orderParent}
|
{$ROW.orderStatus}
|
||||||
</a>
|
</td>
|
||||||
</td>
|
<td>
|
||||||
<td>
|
<a target="_blank" href="index.php?module=Accounts&action=DetailView&record={$ROW.orderParentId}">
|
||||||
{$ROW.shippingTo}
|
{$ROW.orderParent}
|
||||||
</td>
|
</a>
|
||||||
<td>
|
</td>
|
||||||
{$ROW.productKind}
|
<td>
|
||||||
</td>
|
{$ROW.shippingTo}
|
||||||
<td>
|
</td>
|
||||||
{$ROW.productSize}
|
<td>
|
||||||
</td>
|
{$ROW.productShape}
|
||||||
<td>
|
</td>
|
||||||
{$ROW.productShape}
|
<td>
|
||||||
</td>
|
{$ROW.productBrand}
|
||||||
<td>
|
</td>
|
||||||
{$ROW.productBrand}
|
<td>
|
||||||
</td>
|
{$ROW.orderRegisterDate}
|
||||||
<td>
|
</td>
|
||||||
{$ROW.orderRegisterDate}
|
<td>
|
||||||
</td>
|
{$ROW.orderSendDate}
|
||||||
<td>
|
</td>
|
||||||
{$ROW.orderSendDate}
|
<td>
|
||||||
</td>
|
{$ROW.orderDeliveryDate}
|
||||||
<td>
|
</td>
|
||||||
{$ROW.orderDeliveryDate}
|
<td>
|
||||||
</td>
|
<input id="production-date-{$ROW.orderItemId}" name="production-date-{$ROW.orderItemId}" type="text"
|
||||||
<td>
|
maxlength="10" size="11" tabindex="" title="" value="{$ROW.productionDate}" autocomplete="off"
|
||||||
<input id="production-date-{$ROW.orderItemId}" name="production-date-{$ROW.orderItemId}" type="text"
|
id="production-date-{$ROW.orderItemId}" onchange="saveProductionDate('{$ROW.orderItemId}')">
|
||||||
maxlength="10" size="11" tabindex="" title="" value="{$ROW.productionDate}" autocomplete="off"
|
<img id="production-date-trigger-{$ROW.orderItemId}" src="themes/default/images/jscalendar.gif"
|
||||||
id="production-date-{$ROW.orderItemId}" onchange="saveProductionDate('{$ROW.orderItemId}')">
|
style="width: 13px;">
|
||||||
<img id="production-date-trigger-{$ROW.orderItemId}" src="themes/default/images/jscalendar.gif"
|
<script language="JavaScript" type="text/javascript">
|
||||||
style="width: 13px;">
|
Calendar.setup({ldelim}
|
||||||
<script language="JavaScript" type="text/javascript">
|
inputField: "production-date-{$ROW.orderItemId}",
|
||||||
Calendar.setup ({ldelim}
|
daFormat: "%Y-%m-%d",
|
||||||
inputField: "production-date-{$ROW.orderItemId}",
|
button: "production-date-trigger-{$ROW.orderItemId}",
|
||||||
daFormat: "%Y-%m-%d",
|
singleClick: true,
|
||||||
button: "production-date-trigger-{$ROW.orderItemId}",
|
dateStr: "",
|
||||||
singleClick: true,
|
step: 1
|
||||||
dateStr: "",
|
{rdelim}
|
||||||
step: 1
|
);
|
||||||
{rdelim}
|
</script>
|
||||||
);
|
</td>
|
||||||
</script>
|
<td title="{$ROW.fullDescription}">
|
||||||
</td>
|
<div id="edit-{$ROW.orderItemId}" class="ui-icon ui-icon-pencil"
|
||||||
<td title="{$ROW.fullDescription}">
|
onclick="editComment('{$ROW.orderItemId}')" style="display: inline-block;"></div>
|
||||||
<div id="edit-{$ROW.orderItemId}" class="ui-icon ui-icon-pencil"
|
<div id="save-{$ROW.orderItemId}" class="ui-icon ui-icon-check"
|
||||||
onclick="editComment('{$ROW.orderItemId}')" style="display: inline-block;"></div>
|
onclick="saveComment('{$ROW.orderItemId}')" style="display: none;"></div>
|
||||||
<div id="save-{$ROW.orderItemId}" class="ui-icon ui-icon-check"
|
<div id="description-{$ROW.orderItemId}" style="display: inline; width: 300px;">{$ROW.description}
|
||||||
onclick="saveComment('{$ROW.orderItemId}')" style="display: none;"></div>
|
</div>
|
||||||
<div id="description-{$ROW.orderItemId}" style="display: inline; width: 300px;">{$ROW.description}
|
<input id="descriptionInput-{$ROW.orderItemId}" type="text" value="{$ROW.fullDescription}"
|
||||||
</div>
|
style="width: 300px; display: none;"/>
|
||||||
<input id="descriptionInput-{$ROW.orderItemId}" type="text" value="{$ROW.fullDescription}"
|
</td>
|
||||||
style="width: 300px; display: none;" />
|
</tr>
|
||||||
</td>
|
{/foreach}
|
||||||
</tr>
|
|
||||||
{/foreach}
|
|
||||||
</tbody>
|
</tbody>
|
||||||
<tfoot>
|
<tfoot>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan=4></td>
|
<td colspan=4></td>
|
||||||
<td id="allTableSum">0</td>
|
<td id="allTableSum">0</td>
|
||||||
<td colspan="13"></td>
|
<td colspan="13"></td>
|
||||||
</tr>
|
</tr>
|
||||||
</tfoot>
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id="2" style="display: none">
|
<div id="2" style="display: none">
|
||||||
<br>
|
<br>
|
||||||
<input class="button" name="submit" value="Zamówienie - komponenty" type="button" id="orderComponents" />
|
<input class="button" name="submit" value="Zamówienie - komponenty" type="button" id="orderComponents"/>
|
||||||
<br>
|
<br>
|
||||||
<form action="index.php?module=EcmPurchaseOrders&action=EditView&fromProductsBySalesReport=true" method="post"
|
<form action="index.php?module=EcmPurchaseOrders&action=EditView&fromProductsBySalesReport=true" method="post"
|
||||||
target="_blank" id="orderComponentsForm">
|
target="_blank" id="orderComponentsForm">
|
||||||
<input id="componentsToOrder" name="componentsToOrder" type="hidden" value="" />
|
<input id="componentsToOrder" name="componentsToOrder" type="hidden" value=""/>
|
||||||
</form>
|
</form>
|
||||||
<div id="componentsTableContainer">
|
<div id="componentsTableContainer">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="3" style="display: none">
|
<div id="3" style="display: none">
|
||||||
<br>
|
<br>
|
||||||
<input class="button" name="submit" value="Zamówienie - surowce" type="button" id="orderRawMaterials" />
|
<input class="button" name="submit" value="Zamówienie - surowce" type="button" id="orderRawMaterials"/>
|
||||||
<br>
|
<br>
|
||||||
<form action="index.php?module=EcmPurchaseOrders&action=EditView&fromProductsBySalesReport=true" method="post"
|
<form action="index.php?module=EcmPurchaseOrders&action=EditView&fromProductsBySalesReport=true" method="post"
|
||||||
target="_blank" id="orderRawMaterialsForm">
|
target="_blank" id="orderRawMaterialsForm">
|
||||||
<input id="rawMaterialsToOrder" name="rawMaterialsToOrder" type="hidden" value="" />
|
<input id="rawMaterialsToOrder" name="rawMaterialsToOrder" type="hidden" value=""/>
|
||||||
</form>
|
</form>
|
||||||
<div id="rawMaterialsTableContainer">
|
<div id="rawMaterialsTableContainer">
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -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 {
|
|
||||||
$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 {
|
} else {
|
||||||
$GLOBALS ['log']->fatal ( "SCHEDULERS: could not get an IMAP connection resource for ID [ {$a['id']} ]. Skipping mailbox [ {$a['name']} ]." );
|
return false;
|
||||||
// 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' )) {
|
$db->query("DELETE FROM currency_nbp_archive WHERE date < (NOW() - INTERVAL 100 DAY)");
|
||||||
}
|
|
||||||
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 true;
|
||||||
|
} catch (Exception $e) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// helpers
|
||||||
// * Job 4
|
function brecho($msg) {
|
||||||
// */
|
echo PHP_EOL;
|
||||||
|
var_dump($msg);
|
||||||
// function securityAudit() {
|
echo PHP_EOL.PHP_EOL;
|
||||||
// // 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
$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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
function makeCUrlRequest($url) {
|
||||||
* Job 5
|
$curl = curl_init();
|
||||||
*
|
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET' );
|
||||||
*/
|
curl_setopt($curl, CURLOPT_VERBOSE, 0);
|
||||||
function pollMonitoredInboxesForBouncedCampaignEmails() {
|
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||||
$GLOBALS ['log']->info ( '----->Scheduler job of type pollMonitoredInboxesForBouncedCampaignEmails()' );
|
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0);
|
||||||
global $dictionary;
|
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0);
|
||||||
|
curl_setopt($curl, CURLOPT_URL, $url);
|
||||||
$ie = new InboundEmail ();
|
return json_decode(curl_exec($curl));
|
||||||
$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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
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');
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
|
||||||
@@ -1,34 +1,34 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
|
||||||
/*********************************************************************************
|
/*********************************************************************************
|
||||||
* SugarCRM is a customer relationship management program developed by
|
* SugarCRM is a customer relationship management program developed by
|
||||||
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it under
|
* This program is free software; you can redistribute it and/or modify it under
|
||||||
* the terms of the GNU Affero General Public License version 3 as published by the
|
* the terms of the GNU Affero General Public License version 3 as published by the
|
||||||
* Free Software Foundation with the addition of the following permission added
|
* Free Software Foundation with the addition of the following permission added
|
||||||
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
|
||||||
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
|
||||||
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
||||||
* details.
|
* details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License along with
|
* You should have received a copy of the GNU Affero General Public License along with
|
||||||
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
* this program; if not, see http://www.gnu.org/licenses or write to the Free
|
||||||
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||||
* 02110-1301 USA.
|
* 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
|
||||||
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
|
||||||
*
|
*
|
||||||
* The interactive user interfaces in modified source and object code versions
|
* The interactive user interfaces in modified source and object code versions
|
||||||
* of this program must display Appropriate Legal Notices, as required under
|
* of this program must display Appropriate Legal Notices, as required under
|
||||||
* Section 5 of the GNU Affero General Public License version 3.
|
* Section 5 of the GNU Affero General Public License version 3.
|
||||||
*
|
*
|
||||||
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
|
||||||
* these Appropriate Legal Notices must retain the display of the "Powered by
|
* these Appropriate Legal Notices must retain the display of the "Powered by
|
||||||
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
* SugarCRM" logo. If the display of the logo is not reasonably feasible for
|
||||||
@@ -36,253 +36,248 @@ 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.
|
||||||
* Contributor(s): ______________________________________..
|
* Contributor(s): ______________________________________..
|
||||||
********************************************************************************/
|
********************************************************************************/
|
||||||
|
|
||||||
require_once('include/entryPoint.php');
|
require_once('include/entryPoint.php');
|
||||||
|
|
||||||
require_once('modules/Users/language/en_us.lang.php');
|
require_once('modules/Users/language/en_us.lang.php');
|
||||||
global $app_strings;
|
global $app_strings;
|
||||||
global $new_pwd;
|
global $new_pwd;
|
||||||
|
|
||||||
$mod_strings=return_module_language('','Users');
|
$mod_strings = return_module_language('', 'Users');
|
||||||
$res=$GLOBALS['sugar_config']['passwordsetting'];
|
$res = $GLOBALS['sugar_config']['passwordsetting'];
|
||||||
$regexmail = "/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+\$/";
|
$regexmail = "/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+\$/";
|
||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
/////// Retrieve user
|
/////// Retrieve user
|
||||||
|
|
||||||
$usr= new user();
|
$usr = new user();
|
||||||
if(isset( $_POST['username']) && isset($_POST['user_email'] )){
|
if (isset($_POST['username']) && isset($_POST['user_email'])) {
|
||||||
if ($_POST['username'] != '' && $_POST['user_email'] != ''){
|
if ($_POST['username'] != '' && $_POST['user_email'] != '') {
|
||||||
$usr_id=$usr->retrieve_user_id($_POST['username']);
|
$usr_id = $usr->retrieve_user_id($_POST['username']);
|
||||||
$usr->retrieve($usr_id);
|
$usr->retrieve($usr_id);
|
||||||
if ($usr->email1 != $_POST['user_email']){
|
if ($usr->email1 != $_POST['user_email']) {
|
||||||
echo $mod_strings['ERR_PASSWORD_USERNAME_MISSMATCH'];
|
echo $mod_strings['ERR_PASSWORD_USERNAME_MISSMATCH'];
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
if ($usr->portal_only || $usr->is_group){
|
|
||||||
echo $mod_strings['LBL_PROVIDE_USERNAME_AND_EMAIL'];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
echo $mod_strings['LBL_PROVIDE_USERNAME_AND_EMAIL'];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (isset($_POST['userId']) && $_POST['userId'] != ''){
|
|
||||||
$usr->retrieve($_POST['userId']);
|
|
||||||
}
|
}
|
||||||
else{
|
if ($usr->portal_only || $usr->is_group) {
|
||||||
if(isset( $_POST['sugar_user_name']) && isset($_POST['sugar_user_name'] )){
|
echo $mod_strings['LBL_PROVIDE_USERNAME_AND_EMAIL'];
|
||||||
$usr_id=$usr->retrieve_user_id($_POST['sugar_user_name']);
|
return;
|
||||||
$usr->retrieve($usr_id);
|
}
|
||||||
}
|
} else {
|
||||||
else{
|
echo $mod_strings['LBL_PROVIDE_USERNAME_AND_EMAIL'];
|
||||||
echo $mod_strings['ERR_USER_INFO_NOT_FOUND'];
|
return;
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if (isset($_POST['userId']) && $_POST['userId'] != '') {
|
||||||
|
$usr->retrieve($_POST['userId']);
|
||||||
|
} else {
|
||||||
|
if (isset($_POST['sugar_user_name']) && isset($_POST['sugar_user_name'])) {
|
||||||
|
$usr_id = $usr->retrieve_user_id($_POST['sugar_user_name']);
|
||||||
|
$usr->retrieve($usr_id);
|
||||||
|
} else {
|
||||||
|
echo $mod_strings['ERR_USER_INFO_NOT_FOUND'];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///////
|
///////
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
/////// Check email address
|
/////// Check email address
|
||||||
|
|
||||||
if (!preg_match($regexmail, $usr->emailAddress->getPrimaryAddress($usr))){
|
if (!preg_match($regexmail, $usr->emailAddress->getPrimaryAddress($usr))) {
|
||||||
echo 'Błąd poczty';
|
echo 'Błąd poczty';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////
|
///////
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
// if i need to generate a password (not a link)
|
|
||||||
if (!isset($_POST['link'])){
|
|
||||||
$charBKT='';
|
|
||||||
//chars to select from
|
|
||||||
$LOWERCASE = "abcdefghijklmnpqrstuvwxyz";
|
|
||||||
$NUMBER = "0123456789";
|
|
||||||
$UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
||||||
$SPECIAL = '~!@#$%^&*()_+=-{}|';
|
|
||||||
$condition = 0;
|
|
||||||
$charBKT.=$UPPERCASE.$LOWERCASE.$NUMBER;
|
|
||||||
$password="";
|
|
||||||
|
|
||||||
$lenght='6';
|
// if i need to generate a password (not a link)
|
||||||
// Create random characters for the ones that doesnt have requirements
|
if (!isset($_POST['link'])) {
|
||||||
for ($i=0;$i<$lenght-$condition;$i++) // loop and create password
|
$charBKT = '';
|
||||||
$password = $password . substr ($charBKT, rand() % strlen($charBKT), 1);
|
//chars to select from
|
||||||
|
$LOWERCASE = "abcdefghijklmnpqrstuvwxyz";
|
||||||
}
|
$NUMBER = "0123456789";
|
||||||
|
$UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||||
|
$SPECIAL = '~!@#$%^&*()_+=-{}|';
|
||||||
|
$condition = 0;
|
||||||
|
$charBKT .= $UPPERCASE . $LOWERCASE . $NUMBER;
|
||||||
|
$password = "";
|
||||||
|
|
||||||
|
$lenght = '6';
|
||||||
|
// Create random characters for the ones that doesnt have requirements
|
||||||
|
for ($i = 0; $i < $lenght - $condition; $i++) // loop and create password
|
||||||
|
$password = $password . substr($charBKT, rand() % strlen($charBKT), 1);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
/////// Create URL
|
/////// Create URL
|
||||||
|
|
||||||
// if i need to generate a link
|
// if i need to generate a link
|
||||||
if (isset($_POST['link']) && $_POST['link'] == '1'){
|
if (isset($_POST['link']) && $_POST['link'] == '1') {
|
||||||
global $timedate;
|
global $timedate;
|
||||||
$guid=create_guid();
|
$guid = create_guid();
|
||||||
$url=$GLOBALS['sugar_config']['site_url']."/index.php?entryPoint=Changenewpassword&guid=$guid";
|
$url = $GLOBALS['sugar_config']['site_url'] . "/index.php?entryPoint=Changenewpassword&guid=$guid";
|
||||||
$time_now=gmdate($GLOBALS['timedate']->get_db_date_time_format());
|
$time_now = gmdate($GLOBALS['timedate']->get_db_date_time_format());
|
||||||
//$q2="UPDATE `users_password_link` SET `deleted` = '1' WHERE `username` = '".$_POST['username']."'";
|
//$q2="UPDATE `users_password_link` SET `deleted` = '1' WHERE `username` = '".$_POST['username']."'";
|
||||||
//$usr->db->query($q2);
|
//$usr->db->query($q2);
|
||||||
$q = "INSERT INTO users_password_link (id, username, date_generated) VALUES('".$guid."','".$_POST['username']."',' ".$time_now."' ) ";
|
$q = "INSERT INTO users_password_link (id, username, date_generated) VALUES('" . $guid . "','" . $_POST['username'] . "',' " . $time_now . "' ) ";
|
||||||
$usr->db->query($q);
|
$usr->db->query($q);
|
||||||
}
|
}
|
||||||
///////
|
///////
|
||||||
///////////////////////////////////////////////////
|
///////////////////////////////////////////////////
|
||||||
|
|
||||||
/////// Email creation
|
/////// Email creation
|
||||||
global $sugar_config, $current_user;
|
global $sugar_config, $current_user;
|
||||||
if (isset($_POST['link']) && $_POST['link'] == '1')
|
if (isset($_POST['link']) && $_POST['link'] == '1')
|
||||||
$emailTemp_id = $res['lostpasswordtmpl'];
|
$emailTemp_id = $res['lostpasswordtmpl'];
|
||||||
else
|
else
|
||||||
$emailTemp_id = $res['generatepasswordtmpl'];
|
$emailTemp_id = $res['generatepasswordtmpl'];
|
||||||
|
|
||||||
$emailTemp = new EmailTemplate();
|
|
||||||
$emailTemp->disable_row_level_security = true;
|
|
||||||
if ($emailTemp->retrieve($emailTemp_id) == ''){
|
|
||||||
echo $mod_strings['LBL_EMAIL_TEMPLATE_MISSING'];
|
|
||||||
$new_pwd='4';
|
|
||||||
return;}
|
|
||||||
|
|
||||||
//replace instance variables in email templates
|
|
||||||
$htmlBody = $emailTemp->body_html;
|
|
||||||
$body = $emailTemp->body;
|
|
||||||
if (isset($_POST['link']) && $_POST['link'] == '1'){
|
|
||||||
$htmlBody = str_replace('$contact_user_link_guid', $url, $htmlBody);
|
|
||||||
$body = str_replace('$contact_user_link_guid', $url, $body);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$htmlBody = str_replace('$contact_user_user_hash', $password, $htmlBody);
|
|
||||||
$body = str_replace('$contact_user_user_hash', $password, $body);
|
|
||||||
}
|
|
||||||
$htmlBody = str_replace('$contact_user_user_name', $usr->user_name, $htmlBody);
|
|
||||||
$htmlBody = str_replace('$contact_user_pwd_last_changed', gmdate($GLOBALS['timedate']->get_db_date_time_format()), $htmlBody);
|
|
||||||
$body = str_replace('$contact_user_user_name', $usr->user_name, $body);
|
|
||||||
$body = str_replace('$contact_user_pwd_last_changed', gmdate($GLOBALS['timedate']->get_db_date_time_format()), $body);
|
|
||||||
$emailTemp->body_html = $htmlBody;
|
|
||||||
$emailTemp->body = $body;
|
|
||||||
require_once('include/SugarPHPMailer.php');
|
|
||||||
|
|
||||||
$itemail=$usr->emailAddress->getPrimaryAddress($usr);
|
|
||||||
//retrieve IT Admin Email
|
|
||||||
//_ppd( $emailTemp->body_html);
|
|
||||||
//retrieve email defaults
|
|
||||||
$emailObj = new Email();
|
|
||||||
$defaults = $emailObj->getSystemDefaultEmail();
|
|
||||||
require_once 'include/phpMailer2/class.phpmailer.php';
|
|
||||||
require_once 'include/phpMailer2/class.smtp.php';
|
|
||||||
$mail = new PHPMailer2 ();
|
|
||||||
|
|
||||||
//$mail->IsHTML(true);
|
$emailTemp = new EmailTemplate();
|
||||||
$mail->From = $defaults['email'];
|
$emailTemp->disable_row_level_security = true;
|
||||||
$mail->FromName = $defaults['name'];
|
if ($emailTemp->retrieve($emailTemp_id) == '') {
|
||||||
$mail->isSMTP (); // Set mailer to use SMTP
|
echo $mod_strings['LBL_EMAIL_TEMPLATE_MISSING'];
|
||||||
$mail->Host = 'poczta.saas-systems.pl'; // Specify main and backup SMTP servers
|
$new_pwd = '4';
|
||||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
|
||||||
$mail->Username = 'biuro@saas-systems.pl'; // SMTP username
|
|
||||||
$mail->Password = '3g431r31!'; // SMTP password
|
|
||||||
$mail->CharSet = 'UTF-8';
|
|
||||||
$mail ->charSet = "UTF-8";
|
|
||||||
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
|
|
||||||
$mail->Port = 587;
|
|
||||||
$mail->Subject=from_html($emailTemp->subject);
|
|
||||||
if($emailTemp->text_only != 1){
|
|
||||||
$mail->IsHTML(true);
|
|
||||||
$mail->Body=from_html($emailTemp->body_html);
|
|
||||||
$mail->AltBody=from_html($emailTemp->body);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$mail->Body_html=from_html($emailTemp->body_html);
|
|
||||||
$mail->Body=from_html($emailTemp->body);
|
|
||||||
}
|
|
||||||
if($mail->Body == '' && $current_user->is_admin){
|
|
||||||
echo $app_strings['LBL_EMAIL_TEMPLATE_EDIT_PLAIN_TEXT'];
|
|
||||||
$new_pwd='4';
|
|
||||||
return;}
|
|
||||||
if($mail->Mailer == 'smtp' && $mail->Host ==''&& $current_user->is_admin){
|
|
||||||
echo $mod_strings['ERR_SERVER_SMTP_EMPTY'];
|
|
||||||
$new_pwd='4';
|
|
||||||
return;}
|
|
||||||
|
|
||||||
|
|
||||||
// $mail->prepForOutbound();
|
|
||||||
$hasRecipients = false;
|
|
||||||
|
|
||||||
if (!empty($itemail)){
|
|
||||||
if($hasRecipients){
|
|
||||||
$mail->AddBCC($itemail);
|
|
||||||
}else{
|
|
||||||
$mail->AddAddress($itemail);
|
|
||||||
}
|
|
||||||
$hasRecipients = true;
|
|
||||||
}
|
|
||||||
$success = false;
|
|
||||||
if($hasRecipients){
|
|
||||||
$success = @$mail->Send();
|
|
||||||
}
|
|
||||||
|
|
||||||
$now=gmdate("Y-m-d H:i:s");
|
|
||||||
$user_hash = strtolower(md5($password));
|
|
||||||
|
|
||||||
|
|
||||||
//now create email
|
|
||||||
if($success){
|
|
||||||
|
|
||||||
$emailObj->team_id = 1;
|
|
||||||
$emailObj->to_addrs= '';
|
|
||||||
$emailObj->type= 'archived';
|
|
||||||
$emailObj->deleted = '0';
|
|
||||||
$emailObj->name = $mail->Subject ;
|
|
||||||
$emailObj->description = $mail->Body;
|
|
||||||
$emailObj->description_html =null;
|
|
||||||
$emailObj->from_addr = $mail->From;
|
|
||||||
$emailObj->parent_type = 'User';
|
|
||||||
$emailObj->date_sent =gmdate($GLOBALS['timedate']->get_db_date_time_format());
|
|
||||||
$emailObj->modified_user_id = '1';
|
|
||||||
$emailObj->created_by = '1';
|
|
||||||
$emailObj->status='sent';
|
|
||||||
$retId = $emailObj->save();
|
|
||||||
echo '1';
|
|
||||||
if (!isset($_POST['link'])){
|
|
||||||
$user_hash = strtolower(md5($password));
|
|
||||||
$usr->setPreference('loginexpiration','0');
|
|
||||||
$usr->setPreference('lockout','');
|
|
||||||
$usr->setPreference('loginfailed','0');
|
|
||||||
$usr->savePreferencesToDB();
|
|
||||||
//set new password
|
|
||||||
$now=gmdate("Y-m-d H:i:s");
|
|
||||||
$query = "UPDATE $usr->table_name SET user_hash='$user_hash', system_generated_password='1', pwd_last_changed='$now' where id='$usr->id'";
|
|
||||||
$usr->db->query($query, true, "Error setting new password for $usr->user_name: ");
|
|
||||||
//echo $password;
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
$new_pwd='4';
|
|
||||||
if ($current_user->is_admin){
|
|
||||||
$email_errors=$mod_strings['ERR_EMAIL_NOT_SENT_ADMIN'];
|
|
||||||
if ($mail->Mailer == 'smtp')
|
|
||||||
$email_errors.="\n-".$mod_strings['ERR_SMTP_URL_SMTP_PORT'];
|
|
||||||
if ($mail->SMTPAuth)
|
|
||||||
$email_errors.="\n-".$mod_strings['ERR_SMTP_USERNAME_SMTP_PASSWORD'];
|
|
||||||
$email_errors.="\n-".$mod_strings['ERR_RECIPIENT_EMAIL'];
|
|
||||||
$email_errors.="\n-".$mod_strings['ERR_SERVER_STATUS'];
|
|
||||||
echo $email_errors;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
echo $mod_strings['LBL_EMAIL_NOT_SENT'];
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
//replace instance variables in email templates
|
||||||
|
$htmlBody = $emailTemp->body_html;
|
||||||
|
$body = $emailTemp->body;
|
||||||
|
if (isset($_POST['link']) && $_POST['link'] == '1') {
|
||||||
|
$htmlBody = str_replace('$contact_user_link_guid', $url, $htmlBody);
|
||||||
|
$body = str_replace('$contact_user_link_guid', $url, $body);
|
||||||
|
} else {
|
||||||
|
$htmlBody = str_replace('$contact_user_user_hash', $password, $htmlBody);
|
||||||
|
$body = str_replace('$contact_user_user_hash', $password, $body);
|
||||||
|
}
|
||||||
|
$htmlBody = str_replace('$contact_user_user_name', $usr->user_name, $htmlBody);
|
||||||
|
$htmlBody = str_replace('$contact_user_pwd_last_changed', gmdate($GLOBALS['timedate']->get_db_date_time_format()), $htmlBody);
|
||||||
|
$body = str_replace('$contact_user_user_name', $usr->user_name, $body);
|
||||||
|
$body = str_replace('$contact_user_pwd_last_changed', gmdate($GLOBALS['timedate']->get_db_date_time_format()), $body);
|
||||||
|
$emailTemp->body_html = $htmlBody;
|
||||||
|
$emailTemp->body = $body;
|
||||||
|
require_once('include/SugarPHPMailer.php');
|
||||||
|
|
||||||
|
$itemail = $usr->emailAddress->getPrimaryAddress($usr);
|
||||||
|
//retrieve IT Admin Email
|
||||||
|
//_ppd( $emailTemp->body_html);
|
||||||
|
//retrieve email defaults
|
||||||
|
$emailObj = new Email();
|
||||||
|
$defaults = $emailObj->getSystemDefaultEmail();
|
||||||
|
require_once 'include/phpMailer2/class.phpmailer.php';
|
||||||
|
require_once 'include/phpMailer2/class.smtp.php';
|
||||||
|
$mail = new PHPMailer2 ();
|
||||||
|
|
||||||
|
//$mail->IsHTML(true);
|
||||||
|
$mail->From = $defaults['email'];
|
||||||
|
$mail->FromName = $defaults['name'];
|
||||||
|
$mail->isSMTP(); // Set mailer to use SMTP
|
||||||
|
$mail->Host = 'smtp.gmail.com';
|
||||||
|
$mail->SMTPAuth = true;
|
||||||
|
$mail->Username = 'system@e5.pl';
|
||||||
|
$mail->Password = 'wqiz ekxn lysj zheu';
|
||||||
|
|
||||||
|
$mail->CharSet = 'UTF-8';
|
||||||
|
$mail->charSet = "UTF-8";
|
||||||
|
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
|
||||||
|
$mail->Port = 587;
|
||||||
|
$mail->Subject = from_html($emailTemp->subject);
|
||||||
|
if ($emailTemp->text_only != 1) {
|
||||||
|
$mail->IsHTML(true);
|
||||||
|
$mail->Body = from_html($emailTemp->body_html);
|
||||||
|
$mail->AltBody = from_html($emailTemp->body);
|
||||||
|
} else {
|
||||||
|
$mail->Body_html = from_html($emailTemp->body_html);
|
||||||
|
$mail->Body = from_html($emailTemp->body);
|
||||||
|
}
|
||||||
|
if ($mail->Body == '' && $current_user->is_admin) {
|
||||||
|
echo $app_strings['LBL_EMAIL_TEMPLATE_EDIT_PLAIN_TEXT'];
|
||||||
|
$new_pwd = '4';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($mail->Mailer == 'smtp' && $mail->Host == '' && $current_user->is_admin) {
|
||||||
|
echo $mod_strings['ERR_SERVER_SMTP_EMPTY'];
|
||||||
|
$new_pwd = '4';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// $mail->prepForOutbound();
|
||||||
|
$hasRecipients = false;
|
||||||
|
|
||||||
|
if (!empty($itemail)) {
|
||||||
|
if ($hasRecipients) {
|
||||||
|
$mail->AddBCC($itemail);
|
||||||
|
} else {
|
||||||
|
$mail->AddAddress($itemail);
|
||||||
|
}
|
||||||
|
$hasRecipients = true;
|
||||||
|
}
|
||||||
|
$success = false;
|
||||||
|
if ($hasRecipients) {
|
||||||
|
$success = @$mail->Send();
|
||||||
|
}
|
||||||
|
|
||||||
|
$now = gmdate("Y-m-d H:i:s");
|
||||||
|
$user_hash = strtolower(md5($password));
|
||||||
|
|
||||||
|
|
||||||
|
//now create email
|
||||||
|
if ($success) {
|
||||||
|
|
||||||
|
$emailObj->team_id = 1;
|
||||||
|
$emailObj->to_addrs = '';
|
||||||
|
$emailObj->type = 'archived';
|
||||||
|
$emailObj->deleted = '0';
|
||||||
|
$emailObj->name = $mail->Subject;
|
||||||
|
$emailObj->description = $mail->Body;
|
||||||
|
$emailObj->description_html = null;
|
||||||
|
$emailObj->from_addr = $mail->From;
|
||||||
|
$emailObj->parent_type = 'User';
|
||||||
|
$emailObj->date_sent = gmdate($GLOBALS['timedate']->get_db_date_time_format());
|
||||||
|
$emailObj->modified_user_id = '1';
|
||||||
|
$emailObj->created_by = '1';
|
||||||
|
$emailObj->status = 'sent';
|
||||||
|
$retId = $emailObj->save();
|
||||||
|
echo '1';
|
||||||
|
if (!isset($_POST['link'])) {
|
||||||
|
$user_hash = strtolower(md5($password));
|
||||||
|
$usr->setPreference('loginexpiration', '0');
|
||||||
|
$usr->setPreference('lockout', '');
|
||||||
|
$usr->setPreference('loginfailed', '0');
|
||||||
|
$usr->savePreferencesToDB();
|
||||||
|
//set new password
|
||||||
|
$now = gmdate("Y-m-d H:i:s");
|
||||||
|
$query = "UPDATE $usr->table_name SET user_hash='$user_hash', system_generated_password='1', pwd_last_changed='$now' where id='$usr->id'";
|
||||||
|
$usr->db->query($query, true, "Error setting new password for $usr->user_name: ");
|
||||||
|
//echo $password;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$new_pwd = '4';
|
||||||
|
if ($current_user->is_admin) {
|
||||||
|
$email_errors = $mod_strings['ERR_EMAIL_NOT_SENT_ADMIN'];
|
||||||
|
if ($mail->Mailer == 'smtp')
|
||||||
|
$email_errors .= "\n-" . $mod_strings['ERR_SMTP_URL_SMTP_PORT'];
|
||||||
|
if ($mail->SMTPAuth)
|
||||||
|
$email_errors .= "\n-" . $mod_strings['ERR_SMTP_USERNAME_SMTP_PASSWORD'];
|
||||||
|
$email_errors .= "\n-" . $mod_strings['ERR_RECIPIENT_EMAIL'];
|
||||||
|
$email_errors .= "\n-" . $mod_strings['ERR_SERVER_STATUS'];
|
||||||
|
echo $email_errors;
|
||||||
|
} else
|
||||||
|
echo $mod_strings['LBL_EMAIL_NOT_SENT'];
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
|
||||||
|
?>
|
||||||
Reference in New Issue
Block a user