diff --git a/ChangeLog b/ChangeLog index 516bc270321..d44e811c15c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,153 +4,155 @@ English Dolibarr ChangeLog ***** ChangeLog for 13.0.0 compared to 12.0.0 ***** + For users: +---------- NEW: Add module "Credit transfer SEPA" to manage payment of vendors using bank credit transfer SEPA files. NEW: Module Reception (for a more accurate management of your receptions) moved from experimental to stable. NEW: Several security issues after a private bug bounty campaign. NEW: #15065 Put the product label in bold in the PDF templates if configured -NEW: Accountancy - Add chart of sub accounts -NEW: Accountancy - Add options to disable binding on sales, purchases & expense reports independently of the modules -NEW: Accountancy balance - Add a menu entry to show subtotal by group -NEW: Accountancy - Move to real ledger, real journals, menu disposition -NEW: Accountancy - On transfers, select the periodicity by default -NEW: New currency rate editor. -NEW: Add 2 rules for emailcollector: Message send/not sent from Dolibarr -NEW: Add a counter of number of words for pages in website module -NEW: add alert before changing thirdparty in takepos -NEW: Add a page to list Stock at a given date in the past. -NEW: Add a start date to begin binding in accountancy -NEW: Add a statistics page to list popularity of products on invoices -NEW: Add calendar selection for agenda view -NEW: Support documents generation for ticket edition (pdf or odt) -NEW: Add column payment term into list of supplier invoices. -NEW: Add column quantity in product margin page -NEW: Add column vat rate in page to define accounting account on product/service -NEW: Add common list function for available app/module page +NEW: Accountancy - add chart of sub accounts +NEW: Accountancy - add options to disable binding on sales, purchases & expense reports independently of the modules +NEW: Accountancy balance - add a menu entry to show subtotal by group +NEW: Accountancy - move to real ledger, real journals, menu disposition +NEW: Accountancy - on transfers, select the periodicity by default +NEW: new currency rate editor +NEW: add 2 rules for emailcollector: Message send/not sent from Dolibarr +NEW: add a counter of number of words for pages in website module +NEW: add alert before changing thirdparty in TakePOS +NEW: add a page to list Stock at a given date in the past +NEW: add a start date to begin binding in accountancy +NEW: add a statistics page to list popularity of products on invoices +NEW: add calendar selection for agenda view +NEW: Support documents generation for ticket edition (PDF or ODT) +NEW: add column payment term into list of supplier invoices +NEW: add column quantity in product margin page +NEW: add column vat rate in page to define accounting account on product/service +NEW: add common list function for available app/module page NEW: add costprice in fields of products list -NEW: Added an import profile for CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE -NEW: Added incoterms dara into the substitution array -NEW: Add employee link in expense report binding page -NEW: Add export for various payment -NEW: add extra fields labels and values in mail on create ticket -NEW: Add extrafields support on ECM module -NEW: Add filter rules "is answer" and "is not answer" in email collector -NEW: Add focus when editing on product/stock/product.php Close #14548 +NEW: added an import profile for CUSTOMER ORDER, PO, PROPOSAL MODULE, SUPPLIER INVOICE +NEW: added incoterms data into the substitution array +NEW: add employee link in expense report binding page +NEW: add export for various payment +NEW: add Extrafields labels and values in mail on create ticket +NEW: add Extrafields support on ECM module +NEW: add filter rules "is answer" and "is not answer" in email collector +NEW: add focus when editing on product/stock/product.php Close #14548 NEW: add formConfirm hook on product page NEW: add free text on each terminal of cash desk -NEW: Add function dolButtonToOpenUrlInDialogPopup() to be able to open -NEW: Add global search for customer payments and vendor payments -NEW: Add global search for miscellaneous payments -NEW: Add helper function for table headers with numbers +NEW: add function dolButtonToOpenUrlInDialogPopup() to be able to open +NEW: add global search for customer payments and vendor payments +NEW: add global search for miscellaneous payments +NEW: add helper function for table headers with numbers NEW: add hooks on stats pages -NEW: Add link to edit property from search result of website pages -NEW: Add link to reset qty on supplier dispatch page +NEW: add link to edit property from search result of website pages +NEW: add link to reset qty on supplier dispatch page NEW: add MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const to remove header stored by email collector -NEW: Add Manufacturing Orders attached files into the automatic ECM view +NEW: add Manufacturing Orders attached files into the automatic ECM view NEW: add margin info in invoice list -NEW: Add mass action to set category on a list of website pages. -NEW: Add mass deletion for events -NEW: Add mass deletion for draft invoices -NEW: Add __MEMBER_TYPE__ substitution key -NEW: Add a message in error_log after detection of SQL or script injection -NEW: Add module Credit transfer SEPA to manage payment of supplier using -NEW: Add more filters on monthly statement list -NEW: Add option TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT -NEW: Add option to define a default warehouse at user level -NEW: Add option to include products without alert in replenish +NEW: add mass action to set category on a list of website pages +NEW: add mass deletion for events +NEW: add mass deletion for draft invoices +NEW: add __MEMBER_TYPE__ substitution key +NEW: add a message in error_log after detection of SQL or script injection +NEW: add module Credit transfer SEPA to manage payment of supplier using +NEW: add more filters on monthly statement list +NEW: add option TAKEPOS_CAN_FORCE_BANK_ACCOUNT_DURING_PAYMENT +NEW: add option to define a default warehouse at user level +NEW: add option to include products without alert in replenish NEW: add order by lastname and firstname by default in get sales representatives -NEW: Add param to not show links when output tags -NEW: Add PDF document templates for warehouses (list of stock) -NEW: Add property cssview when declaring fields of an object -NEW: Add prospect status managment for the contact with managment of custom icon -NEW: Add public note on products. This also partially fix the #14342 -NEW: Add quick dropdown menu in top right menu (MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN) +NEW: add param to not show links when output tags +NEW: add PDF document templates for warehouses (list of stock) +NEW: add property cssview when declaring fields of an object +NEW: add prospect status managment for the contact with managment of custom icon +NEW: add public note on products ; this also partially fix the #14342 +NEW: add quick dropdown menu in top right menu (MAIN_USE_TOP_MENU_QUICKADD_DROPDOWN) NEW: add region in export companies and contacts NEW: add rights on margin info on invoice list -NEW: Add search param for close date on order list +NEW: add search param for close date on order list NEW: add send context for ticket -NEW: Add show preview for mail attachement on form mail +NEW: add show preview for mail attachement on form mail NEW: add state origin for product NEW: add State/Province origin for products -NEW: Add the workflow interaction close intervention on closing ticket -NEW: Add third order printer to TakePOS +NEW: add the workflow interaction close intervention on closing ticket +NEW: add third order printer to TakePOS NEW: add tracking number in list and search_all items NEW: add two hooks printFieldListFrom and printFieldSearchParam -NEW: Add __TYPE__ substitution key -NEW: Add validation of MX domain for emails +NEW: add __TYPE__ substitution key +NEW: add validation of MX domain for emails NEW: add vcard for aderent and user NEW: add week number for month view in agenda NEW: Algeria data (tva and forme_juridique) -NEW: Allow click on all header numbers on commerce area -NEW: Allow to reopen interventions (green button) -NEW: Allow zero quality on supplier/vendor order line -NEW: Appearance tab in TakePOS with more visual parameters -NEW: Better currency rate editor -NEW: Calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') ) -NEW: Can add event to log into blockedlog module with a constant. -NEW: Can build vendor invoice from vendor orders -NEW: Can change a product in line of recurring invoice or contract -NEW: Can change size of logo on PDF documents -NEW: Can change VAT rate of all lines of a draft object in one step. -NEW: Can define date range of validity of a login during creation -NEW: Can disable, from edit page, the whole web site +NEW: allow click on all header numbers on commerce area +NEW: allow to reopen interventions (green button) +NEW: allow zero quality on supplier/vendor order line +NEW: appearance tab in TakePOS with more visual parameters +NEW: better currency rate editor +NEW: calculate the virtual stock in transverse mode ( not on getEntity('commande'), ... but on getEntity('stock') ) +NEW: can add event to log into blockedlog module with a constant +NEW: can build vendor invoice from vendor orders +NEW: can change a product in line of recurring invoice or contract +NEW: can change size of logo on PDF documents +NEW: can change VAT rate of all lines of a draft object in one step +NEW: can define date range of validity of a login during creation +NEW: can disable, from edit page, the whole web site NEW: can edit and set sales representatives directly on thirdparty card NEW: Can edit the list of sending email profiles. -NEW: Can enable/disable users in bulk actions -NEW: Can filter on accounting system ref in export of chart of account -NEW: Can filter on container type, language and tags in the list of pages -NEW: Can force the antivirus from conf file or autoprepend ini setup. -NEW: Can hide eatby, sellby dates with option PRODUCT_DISABLE_SELLBY and PRODUCT_DISABLE_EATBY -NEW: Can import proposals, sales orders, supplier invoices +NEW: can enable/disable users in bulk actions +NEW: can filter on accounting system ref in export of chart of account +NEW: can filter on container type, language and tags in the list of pages +NEW: can force the antivirus from conf file or autoprepend ini setup +NEW: can hide eatby, sellby dates with option PRODUCT_DISABLE_SELLBY and PRODUCT_DISABLE_EATBY +NEW: can import proposals, sales orders, supplier invoices NEW: can set a dedicated SMTP config for sending email from public ticket interface -NEW: Can set tags/categories to website pages. -NEW: Can set type of price without tax per default for new sale price creation -NEW: Can use desired stock of a given warehouse for replenishment -NEW: Can use THEME_DARKMODEENABLED=2 for a preview of theme in dark mode -NEW: change thirdparty with barcode scan in takepos -NEW: Common behavior for monthly leave list view +NEW: can set tags/categories to website pages +NEW: can set type of price without tax per default for new sale price creation +NEW: can use desired stock of a given warehouse for replenishment +NEW: can use THEME_DARKMODEENABLED=2 for a preview of theme in dark mode +NEW: change thirdparty with barcode scan in TakePOS +NEW: common behavior for monthly leave list view NEW: conf to allow show full arbo in warehouse getnomurl NEW: convert all subscription in datetime -NEW: create thirdparty customer from TAKEPOS -NEW: Date shipment from order accepts hours -NEW: Declinaison price level compatibility -NEW: Delayed payment in TakePOS -NEW: Development of module Recruitment -NEW: display date range if exist in takepos -NEW: display resiliate status in takepos for member +NEW: create thirdparty customer from TakePOS +NEW: date shipment from order accepts hours +NEW: declinaison price level compatibility +NEW: delayed payment in TakePOS +NEW: development of module Recruitment +NEW: display date range if exist in TakePOS +NEW: display resiliate status in TakePOS for member NEW: display stat for BOM on "object referent"/linked Object product tab NEW: edit and update a ticket NEW: edit or delete dispatched lines -NEW: Email configuration - Allow auto signed certificat when smtp ssl activated +NEW: Email configuration - allow auto signed certificat when smtp ssl activated NEW: enable free emails input with select2 NEW: endpoint getContacts and Clean results NEW: Events in agenda for contact NEW: Field to link website page to an other object -NEW: Fill ECM src object fields in dol_add_file_process +NEW: fill ECM src object fields in dol_add_file_process NEW: filter on progress column in task list NEW: filter product list by country and/or state/province NEW: format tickets sent by mail in public interface NEW: add juridical status for Algeria NEW: form to add customer/supplier into categories -NEW: Framework is ready for CSRF token protection on explicit GET URLs. +NEW: Framework is ready for CSRF token protection on explicit GET URLs NEW: get all child recursively -NEW: Get contacts list of a given order +NEW: get contacts list of a given order NEW: helper functions for export with phpspreadsheet NEW: hide closed contract lines -NEW: hide label in pdf for variants +NEW: hide label in PDF for variants NEW: Hook on propal card -NEW: If specific help page is available, we change color of icon -NEW: Include the tag editor of page as a popup into website editor -NEW: Introduce constant FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM -NEW: Introducing new modal boxes in TakePOS -NEW: Keep takepos terminal when login/logout -NEW: Link on balance to the ledger +NEW: if specific help page is available, we change color of icon +NEW: include the tag editor of page as a popup into website editor +NEW: introduce constant FACTUREFOURN_REUSE_NOTES_ON_CREATE_FROM +NEW: introducing new modal boxes in TakePOS +NEW: keep TakePOS terminal when login/logout +NEW: link on balance to the ledger NEW: MAIN_EMAILCOLLECTOR_MAIL_WITHOUT_HEADER const in email collector NEW: manage errors on update extra fields in ticket card NEW: mass-actions for the event list view NEW: Module Intracomm report -NEW: More filter for "View change logs" -NEW: multicurrency total in takepos +NEW: more filter for "View change logs" +NEW: multicurrency total in TakePOS NEW: multiselect type and date to date filter NEW: Nature of product is now a dictionay NEW: new line template: hidden conf to fill service dates from the last service line @@ -159,38 +161,38 @@ NEW: possibilty to group payments by mode and show their subtotal NEW: Print payment method and change in TakePOS NEW: Priority and transparency from external calendar events NEW: Products Import/Export 'default warehouse' and 'use batch number' fields -NEW: Purchase price table: Added filterable table columns +NEW: Purchase price table: added filterable table columns NEW: rate editor for multicurrency NEW: ref_ext field for Commande lines, order lines, Attributes and Combinations, Invoice lines, payments, order lines NEW: remove new lines in mail on add ticket message -NEW: restrict thirdparty to customer in takepos -NEW: Allow to edit "demand reason" field though API +NEW: restrict thirdparty to customer in TakePOS +NEW: allow to edit "demand reason" field though API NEW: Rule "email to" accept wildcard * NEW: Save filter of the project homepage -NEW: Select-able columns on customer invoice paymnet list -NEW: Select-able columns on miscellaneous payments + more data columns -NEW: Select-able columns on social taxes list -NEW: Select-able columns on supplier invoice payment list +NEW: select-able columns on customer invoice paymnet list +NEW: select-able columns on miscellaneous payments + more data columns +NEW: select-able columns on social taxes list +NEW: select-able columns on supplier invoice payment list NEW: send context and remove new lines on create ticket NEW: set entity when creating invoice on takepos -NEW: Show available stock in TakePOS -NEW: Show category filter on lists only when user have rights to read categories -NEW: Show header number and make it clickable in warehouse arean, payment area, shipment area -NEW: Show image of user in the combo select of users -NEW: Show label on batch card -NEW: Show line number on intervention card (via MAIN_VIEW_LINE_NUMBER) +NEW: show available stock in TakePOS +NEW: show category filter on lists only when user have rights to read categories +NEW: show header number and make it clickable in warehouse arean, payment area, shipment area +NEW: show image of user in the combo select of users +NEW: show label on batch card +NEW: show line number on intervention card (via MAIN_VIEW_LINE_NUMBER) NEW: show links for select and multi-select in category extra field -NEW: Show module and permission ids on user/group rights (only admin) -NEW: Show place from events on import calender -NEW: Show references in contract form on interventions -NEW: Show tags and status in search list of website pages -NEW: Show user on external calender events (when found) +NEW: show module and permission ids on user/group rights (only admin) +NEW: show place from events on import calender +NEW: show references in contract form on interventions +NEW: show tags and status in search list of website pages +NEW: show user on external calender events (when found) NEW: subject title with company name instead of application title in ticket message NEW: Support for Samba4 AD NEW: TakePOS connector compatibility with RECEIPT PRINTERS module NEW: TakePOS Gift Receipt NEW: TakePOS Multicurrency compatibility -NEW: The global header of a website can also have dynamic content +NEW: the global header of a website can also have dynamic content NEW: Third-Party Import new fields: mother company,outstanding debt limit,bank account,incoterms NEW: Thirdparty module : box on customer/supplier tab for invoice outsantding amount late NEW: ticket classification on create from email collector @@ -199,16 +201,18 @@ NEW: translate classification labels in ticket NEW: triggers create, modify, delete NEW: VAT for Algeria NEW: Use preselect third-party from list on new card -NEW: Vat report - Invert constant to show by default zero vat in reports +NEW: VAT report - Invert constant to show by default zero vat in reports NEW: website page fields selection NEW: Weighing Scale compatibility with TakePOS connector -NEW: When creating a user from a member linked to a thirdparty, you can choose to create if as external or internal user -NEW: Add clone functionality on miscellaneous payment +NEW: when creating a user from a member linked to a thirdparty, you can choose to create if as external or internal user +NEW: add clone functionality on miscellaneous payment + For developers: +--------------- NEW: Can use dynamic code into the 'enabled' property of DAO fields -NEW: API Can update a payment -NEW: api get member by thirdparty +NEW: API can update a payment +NEW: API get member by thirdparty NEW: API get thirdparty by barcode NEW: API get users by email / login NEW: fetch contact by email with REST API @@ -216,14 +220,15 @@ NEW: field ref_ext in llx_commandedet NEW: fields ref_ext for Attributes and Combinations NEW: get state by REST API NEW: get state dictionnary by REST API -NEW: Improve Product API for variant products -NEW: Oauth SCOPE for Admin SDK -NEW: Retrieve discount from invoice from API +NEW: improve Product API for variant products +NEW: OAuth SCOPE for Admin SDK +NEW: retrieve discount from invoice from API NEW: standardizes API thirdparties by email like other object -NEW: thirdparty REST API: endpoint to set price level -NEW: Use new category API for project list view +NEW: Thirdparty REST API: endpoint to set price level +NEW: use new category API for project list view NEW: Triggers Attributes and Attributes values -NEW: Add hooks on newpayment page to allow external payment modules +NEW: add hooks on newpayment page to allow external payment modules + WARNING: @@ -289,6 +294,7 @@ FIX: Visualization rights correction on last modified contacts box FIX: Wrong redirection FIX: Yogosha report 4425 (backport) + ***** ChangeLog for 12.0.2 compared to 12.0.1 ***** FIX: computation of the bottom margin of returns NaN because body is not loaded yet FIX: DebugBar hides content at page bottom diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index f9c14b91ac3..969bf3a8906 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -37,7 +37,8 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; $langs->loadLangs(array("companies", "members", "other")); -$id = GETPOST('id', 'int'); +$id = GETPOSTISSET('id') ? GETPOST('id', 'int') : GETPOST('rowid', 'int'); +$ref = GETPOST('ref', 'alphanohtml'); $action = GETPOST('action', 'aZ09'); $confirm = GETPOST('confirm', 'alpha'); @@ -60,7 +61,7 @@ if (!$sortfield) $sortfield = "name"; $form = new Form($db); $object = new Adherent($db); $membert = new AdherentType($db); -$result = $object->fetch($id); +$result = $object->fetch($id, $ref); if ($result < 0) { dol_print_error($db); exit; diff --git a/htdocs/bom/bom_document.php b/htdocs/bom/bom_document.php index 92423977be8..cf752878605 100644 --- a/htdocs/bom/bom_document.php +++ b/htdocs/bom/bom_document.php @@ -69,8 +69,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity?$object->entity:1] . "/bom/" . dol_sanitizeFileName($object->id); -if ($id > 0 || !empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity ? $object->entity : 1]."/bom/".dol_sanitizeFileName($object->ref); +if ($id > 0 || !empty($ref)) $upload_dir = $conf->bom->multidir_output[$object->entity ? $object->entity : 1]."/bom/".get_exdir(0, 0, 0, 1, $object); /* diff --git a/htdocs/bookmarks/card.php b/htdocs/bookmarks/card.php index b8d0949a1f0..5f7687a3d26 100644 --- a/htdocs/bookmarks/card.php +++ b/htdocs/bookmarks/card.php @@ -153,7 +153,7 @@ if ($action == 'create') print ''; - print ''; + print ''; dol_set_focus('#titlebookmark'); // Url @@ -167,12 +167,12 @@ if ($action == 'create') // Owner print ''; // Position print ''; print '
'.$langs->trans("BookmarkTitle").''.$langs->trans("SetHereATitleForLink").'
'.$langs->trans("BookmarkTitle").''.$langs->trans("SetHereATitleForLink").'
'.$langs->trans("Owner").''; - print img_picto('', 'user').' '.$form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : $user->id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); + print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : $user->id, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print ' 
'.$langs->trans("Position").''; - print 'position).'">'; + print 'position).'">'; print ' 
'; @@ -238,7 +238,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) } print ''; - if ($action == 'edit') print 'title).'">'; + if ($action == 'edit') print 'title).'">'; else print $object->title; print ''; @@ -251,7 +251,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) print ''; } print ''; - if ($action == 'edit') print 'url).'">'; + if ($action == 'edit') print 'url).'">'; else print 'target ? ' target="_blank"' : '').'>'.$object->url.''; print ''; @@ -259,7 +259,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) if ($action == 'edit') { $liste = array(1=>$langs->trans("OpenANewWindow"), 0=>$langs->trans("ReplaceWindow")); - print $form->selectarray('target', $liste, isset($_POST["target"]) ? $_POST["target"] : $object->target); + print $form->selectarray('target', $liste, GETPOSTISSET("target") ? GETPOST("target") : $object->target); } else { if ($object->target == 0) print $langs->trans("ReplaceWindow"); if ($object->target == 1) print $langs->trans("OpenANewWindow"); @@ -269,7 +269,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) print ''.$langs->trans("Owner").''; if ($action == 'edit' && $user->admin) { - print img_picto('', 'user').' '.$form->select_dolusers(isset($_POST['userid']) ? $_POST['userid'] : ($object->fk_user ? $object->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); + print img_picto('', 'user').' '.$form->select_dolusers(GETPOSTISSET('userid') ? GETPOST('userid', 'int') : ($object->fk_user ? $object->fk_user : ''), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); } else { if ($object->fk_user > 0) { @@ -284,7 +284,7 @@ if ($id > 0 && !preg_match('/^add/i', $action)) // Position print ''.$langs->trans("Position").''; - if ($action == 'edit') print 'position).'">'; + if ($action == 'edit') print 'position).'">'; else print $object->position; print ''; diff --git a/htdocs/bookmarks/list.php b/htdocs/bookmarks/list.php index 7f70d74f5d9..6ad2770aa25 100644 --- a/htdocs/bookmarks/list.php +++ b/htdocs/bookmarks/list.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2005-2020 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -197,14 +197,14 @@ while ($i < min($num, $limit)) // Title print ""; $linkintern = 1; - if ($linkintern) print "url."\">"; + if ($linkintern) print ''; print $title; if ($linkintern) print ""; print "\n"; // Url print ''; - if (!$linkintern) print 'target ? ' target="newlink"' : '').'>'; + if (!$linkintern) print 'target ? ' target="newlink" rel="noopener"' : '').'>'; print $link; if (!$linkintern) print ''; print "\n"; @@ -241,7 +241,7 @@ while ($i < min($num, $limit)) print ''; if ($user->rights->bookmark->creer) { - print 'rowid."&backtopage=".urlencode($_SERVER["PHP_SELF"]).'">'.img_edit().""; + print ''.img_edit().""; } if ($user->rights->bookmark->supprimer) { diff --git a/htdocs/cashdesk/include/environnement.php b/htdocs/cashdesk/include/environnement.php index 19736d4b46a..d97056470f1 100644 --- a/htdocs/cashdesk/include/environnement.php +++ b/htdocs/cashdesk/include/environnement.php @@ -32,7 +32,7 @@ $conf_db_base = $dolibarr_main_db_name; $conf_fksoc = (!empty($_SESSION["CASHDESK_ID_THIRDPARTY"])) ? $_SESSION["CASHDESK_ID_THIRDPARTY"] : ($conf->global->CASHDESK_ID_THIRDPARTY > 0 ? $conf->global->CASHDESK_ID_THIRDPARTY : 0); // Identifiant unique correspondant a l'entrepot a utiliser $conf_fkentrepot = (!empty($_SESSION["CASHDESK_ID_WAREHOUSE"])) ? $_SESSION["CASHDESK_ID_WAREHOUSE"] : ($conf->global->CASHDESK_ID_WAREHOUSE > 0 ? $conf->global->CASHDESK_ID_WAREHOUSE : 0); -if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $conf_fkentrepot = 0; // If option to disable stock decrease is on, we set warehouse id to 0. +if (!empty($conf->global->CASHDESK_NO_DECREASE_STOCK)) $conf_fkentrepot = 0; // If option to disable the stock decrease is on, we set warehouse id to 0. // Identifiant unique correspondant au compte caisse / liquide $conf_fkaccount_cash = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"])) ? $_SESSION["CASHDESK_ID_BANKACCOUNT_CASH"] : ($conf->global->CASHDESK_ID_BANKACCOUNT_CASH > 0 ? $conf->global->CASHDESK_ID_BANKACCOUNT_CASH : 0); @@ -46,6 +46,3 @@ $conf_fkaccount_cb = (!empty($_SESSION["CASHDESK_ID_BANKACCOUNT_CB"])) ? $_SESSI // View parameters $conf_taille_listes = (empty($conf->global->PRODUIT_LIMIT_SIZE) ? 1000 : $conf->global->PRODUIT_LIMIT_SIZE); // Number max of lines to show in lists $conf_nbr_car_listes = 60; // Nombre max de caracteres par ligne dans les listes - -// Add hidden option to force decrease of stock whatever is user setup -if (!empty($conf->global->CASHDESK_FORCE_STOCK_ON_BILL)) $conf->global->STOCK_CALCULATE_ON_BILL = 1; diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 8613828f632..3a80ae22306 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -171,13 +171,14 @@ if (empty($reshook)) GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int') ); - if (!empty($object->date_livraison) && !empty($date_delivery)) + $date_delivery_old = (empty($object->delivery_date) ? $object->date_livraison : $object->delivery_date); + if (!empty($date_delivery_old) && !empty($date_delivery)) { //Attempt to get the date without possible hour rounding errors $old_date_delivery = dol_mktime(12, 0, 0, - dol_print_date($object->date_livraison, '%m'), - dol_print_date($object->date_livraison, '%d'), - dol_print_date($object->date_livraison, '%Y') + dol_print_date($date_delivery_old, '%m'), + dol_print_date($date_delivery_old, '%d'), + dol_print_date($date_delivery_old, '%Y') ); //Calculate the difference and apply if necessary $difference = $date_delivery - $old_date_delivery; @@ -341,7 +342,9 @@ if (empty($reshook)) if ($object->fetch(GETPOST('copie_propal', 'int')) > 0) { $object->ref = GETPOST('ref'); $object->datep = $datep; - $object->date_livraison = $date_delivery; + $object->date = $datep; + $object->date_livraison = $date_delivery; // deprecated + $object->delivery_date = $date_delivery; $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); $object->fk_delivery_address = GETPOST('fk_address', 'int'); @@ -355,8 +358,9 @@ if (empty($reshook)) $object->socid = GETPOST('socid', 'int'); $object->contact_id = GETPOST('contactid', 'int'); $object->fk_project = GETPOST('projectid', 'int'); - $object->model_pdf = GETPOST('model'); + $object->model_pdf = GETPOST('model', 'alphanohtml'); $object->author = $user->id; // deprecated + $object->user_author_id = $user->id; $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); $object->statut = Propal::STATUS_DRAFT; @@ -372,7 +376,9 @@ if (empty($reshook)) $object->ref = GETPOST('ref'); $object->ref_client = GETPOST('ref_client'); $object->datep = $datep; + $object->date = $datep; $object->date_livraison = $date_delivery; + $object->delivery_date = $date_delivery; $object->availability_id = GETPOST('availability_id', 'int'); $object->demand_reason_id = GETPOST('demand_reason_id', 'int'); $object->fk_delivery_address = GETPOST('fk_address', 'int'); @@ -1823,8 +1829,8 @@ if ($action == 'create') // array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1), array('type' => 'other', 'name' => 'socid', 'label' => $langs->trans("SelectThirdParty"), 'value' => $form->select_company(GETPOST('socid', 'int'), 'socid', '(s.client=1 OR s.client=2 OR s.client=3)')) ); - if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->date_livraison)) { - $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->date_livraison); + if (!empty($conf->global->PROPAL_CLONE_DATE_DELIVERY) && !empty($object->delivery_date)) { + $formquestion[] = array('type' => 'date', 'name' => 'date_delivery', 'label' => $langs->trans("DeliveryDate"), 'value' => $object->delivery_date); } // Incomplete payment. We ask if reason = discount or other $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmClonePropal', $object->ref), 'confirm_clone', $formquestion, 'yes', 1); @@ -2048,9 +2054,9 @@ if ($action == 'create') // Delivery date $langs->load('deliveries'); print ''; - print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker'); + print $form->editfieldkey($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker'); print ''; - print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->date_livraison, $object, $usercancreate, 'datepicker'); + print $form->editfieldval($langs->trans('DeliveryDate'), 'date_livraison', $object->delivery_date, $object, $usercancreate, 'datepicker'); print ''; print ''; diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 27f57569c3a..4f2159a200e 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -991,6 +991,9 @@ class Propal extends CommonObject $this->multicurrency_tx = 1; } + // Set tmp vars + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; + dol_syslog(get_class($this)."::create"); // Check parameters @@ -1078,7 +1081,7 @@ class Propal extends CommonObject $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL'); $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); $sql .= ", '".$this->db->escape($this->ref_client)."'"; - $sql .= ", ".($this->date_livraison != '' ? "'".$this->db->idate($this->date_livraison)."'" : "NULL"); + $sql .= ", ".(empty($delivery_date) ? "NULL" : "'".$this->db->idate($delivery_date)."'"); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); $sql .= ", ".$this->availability_id; $sql .= ", ".$this->demand_reason_id; @@ -1441,7 +1444,7 @@ class Propal extends CommonObject $sql .= ", p.date_valid as datev"; $sql .= ", p.datep as dp"; $sql .= ", p.fin_validite as dfv"; - $sql .= ", p.date_livraison as date_livraison"; + $sql .= ", p.date_livraison as delivery_date"; $sql .= ", p.model_pdf, p.last_main_doc, p.ref_client, p.extraparams"; $sql .= ", p.note_private, p.note_public"; $sql .= ", p.fk_projet as fk_project, p.fk_statut"; @@ -1523,8 +1526,8 @@ class Propal extends CommonObject $this->date = $this->db->jdate($obj->dp); // Proposal date $this->datep = $this->db->jdate($obj->dp); // deprecated $this->fin_validite = $this->db->jdate($obj->dfv); - $this->date_livraison = $this->db->jdate($obj->date_livraison); - $this->delivery_date = $this->db->jdate($obj->date_livraison); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated + $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->availability_id = $obj->fk_availability; $this->availability_code = $obj->availability_code; @@ -2111,7 +2114,7 @@ class Propal extends CommonObject { $this->oldcopy = clone $this; $this->date_livraison = $delivery_date; - $this->date_delivery = $delivery_date; + $this->delivery_date = $delivery_date; } if (!$notrigger && empty($error)) @@ -3574,16 +3577,24 @@ class Propal extends CommonObject if (isset($this->statut)) { $label .= ' '.$this->getLibStatut(5); } - if (!empty($this->ref)) + if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; - if (!empty($this->ref_client)) + } + if (!empty($this->ref_client)) { $label .= '
'.$langs->trans('RefCustomer').': '.$this->ref_client; - if (!empty($this->total_ht)) + } + if (!empty($this->total_ht)) { $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_tva)) + } + if (!empty($this->total_tva)) { $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_ttc)) + } + if (!empty($this->total_ttc)) { $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->delivery_date)) { + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } if ($option == '') { $url = DOL_URL_ROOT.'/comm/propal/card.php?id='.$this->id.$get_params; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index fd4c895caec..cb629e2c1f9 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -120,6 +120,8 @@ if (!empty($conf->expedition->enabled) && !empty($conf->global->WAREHOUSE_ASK_WA $error = 0; +$date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); + /* * Actions @@ -274,7 +276,7 @@ if (empty($reshook)) $object->fk_account = GETPOST('fk_account', 'int'); $object->availability_id = GETPOST('availability_id'); $object->demand_reason_id = GETPOST('demand_reason_id'); - $object->date_livraison = $datelivraison; + $object->date_livraison = $datelivraison; // deprecated $object->delivery_date = $datelivraison; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->warehouse_id = GETPOST('warehouse_id', 'int'); @@ -539,10 +541,10 @@ if (empty($reshook)) } } elseif ($action == 'setdate_livraison' && $usercancreate) { // print "x ".$_POST['liv_month'].", ".$_POST['liv_day'].", ".$_POST['liv_year']; - $datedelivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); + $date_delivery = dol_mktime(GETPOST('liv_hour', 'int'), GETPOST('liv_min', 'int'), 0, GETPOST('liv_month', 'int'), GETPOST('liv_day', 'int'), GETPOST('liv_year', 'int')); $object->fetch($id); - $result = $object->setDeliveryDate($user, $datedelivery); + $result = $object->setDeliveryDate($user, $date_delivery); if ($result < 0) { setEventMessages($object->error, $object->errors, 'errors'); } @@ -1507,7 +1509,8 @@ if ($action == 'create' && $usercancreate) $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); $dateorder = empty($conf->global->MAIN_AUTOFILL_DATE_ORDER) ?-1 : ''; - $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); + $date_delivery = (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : ''); + if (empty($date_delivery)) $date_delivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); if (!empty($conf->multicurrency->enabled)) { @@ -1620,8 +1623,7 @@ if ($action == 'create' && $usercancreate) // Date delivery planned print ''.$langs->trans("DateDeliveryPlanned").''; print ''; - //print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed. - $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $object->date_delivery); print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "\n"; print ''; @@ -2138,12 +2140,12 @@ if ($action == 'create' && $usercancreate) print '
'; print ''; print ''; - print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print '
'; } else { - print $object->date_livraison ? dol_print_date($object->date_livraison, 'dayhour') : ' '; - if ($object->hasDelay() && !empty($object->date_livraison)) { + print $object->delivery_date ? dol_print_date($object->delivery_date, 'dayhour') : ' '; + if ($object->hasDelay() && !empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 5c341ac0ffb..cf3d8bbd82c 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -182,10 +182,13 @@ class Commande extends CommonOrder /** * @var int Date expected for delivery - * @deprecated + * @deprecated Use delivery_date instead. */ - public $date_livraison; // deprecated; Use delivery_date instead. + public $date_livraison; + /** + * @var int Date expected for delivery + */ public $delivery_date; // Date expected of shipment (date starting shipment, not the reception that occurs some days after) /** @@ -886,8 +889,9 @@ class Commande extends CommonOrder // Clean parameters $this->brouillon = 1; // set command as draft - // $date_commande is deprecated + // Set tmp vars $date = ($this->date_commande ? $this->date_commande : $this->date); + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; // Multicurrency (test on $this->multicurrency_tx because we should take the default rate only if not using origin rate) if (!empty($this->multicurrency_code) && empty($this->multicurrency_tx)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $date); @@ -960,7 +964,7 @@ class Commande extends CommonOrder $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); $sql .= ", ".($this->availability_id > 0 ? $this->availability_id : "null"); $sql .= ", ".($this->demand_reason_id > 0 ? $this->demand_reason_id : "null"); - $sql .= ", ".($this->date_livraison ? "'".$this->db->idate($this->date_livraison)."'" : "null"); + $sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null"); $sql .= ", ".($this->fk_delivery_address > 0 ? $this->fk_delivery_address : 'NULL'); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); $sql .= ", ".($this->warehouse_id > 0 ? $this->warehouse_id : 'NULL'); @@ -1359,7 +1363,7 @@ class Commande extends CommonOrder $this->fk_account = $object->fk_account; $this->availability_id = $object->availability_id; $this->demand_reason_id = $object->demand_reason_id; - $this->date_livraison = $object->date_livraison; + $this->date_livraison = $object->date_livraison; // deprecated $this->delivery_date = $object->date_livraison; $this->shipping_method_id = $object->shipping_method_id; $this->warehouse_id = $object->warehouse_id; @@ -1784,7 +1788,7 @@ class Commande extends CommonOrder $sql .= ', c.amount_ht, c.total_ht, c.total_ttc, c.tva as total_tva, c.localtax1 as total_localtax1, c.localtax2 as total_localtax2, c.fk_cond_reglement, c.fk_mode_reglement, c.fk_availability, c.fk_input_reason'; $sql .= ', c.fk_account'; $sql .= ', c.date_commande, c.date_valid, c.tms'; - $sql .= ', c.date_livraison'; + $sql .= ', c.date_livraison as delivery_date'; $sql .= ', c.fk_shipping_method'; $sql .= ', c.fk_warehouse'; $sql .= ', c.fk_projet as fk_project, c.remise_percent, c.remise, c.remise_absolue, c.source, c.facture as billed'; @@ -1870,8 +1874,8 @@ class Commande extends CommonOrder $this->availability = $obj->availability_label; $this->demand_reason_id = $obj->fk_input_reason; $this->demand_reason_code = $obj->demand_reason_code; - $this->date_livraison = $this->db->jdate($obj->date_livraison); - $this->delivery_date = $this->db->jdate($obj->date_livraison); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated + $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; $this->warehouse_id = ($obj->fk_warehouse > 0) ? $obj->fk_warehouse : null; $this->fk_delivery_address = $obj->fk_delivery_address; @@ -2013,7 +2017,7 @@ class Commande extends CommonOrder $sql .= ' l.total_ht, l.total_ttc, l.total_tva, l.total_localtax1, l.total_localtax2, l.date_start, l.date_end,'; $sql .= ' l.fk_unit,'; $sql .= ' l.fk_multicurrency, l.multicurrency_code, l.multicurrency_subprice, l.multicurrency_total_ht, l.multicurrency_total_tva, l.multicurrency_total_ttc,'; - $sql .= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tobatch as product_tobatch,'; + $sql .= ' p.ref as product_ref, p.description as product_desc, p.fk_product_type, p.label as product_label, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch,'; $sql .= ' p.weight, p.weight_units, p.volume, p.volume_units'; $sql .= ' FROM '.MAIN_DB_PREFIX.'commandedet as l'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON (p.rowid = l.fk_product)'; @@ -2076,6 +2080,8 @@ class Commande extends CommonOrder $line->libelle = $objp->product_label; $line->product_label = $objp->product_label; $line->product_desc = $objp->product_desc; + $line->product_tosell = $objp->product_tosell; + $line->product_tobuy = $objp->product_tobuy; $line->product_tobatch = $objp->product_tobatch; $line->fk_product_type = $objp->fk_product_type; // Produit ou service $line->fk_unit = $objp->fk_unit; @@ -3660,6 +3666,9 @@ class Commande extends CommonOrder if (!empty($this->total_ttc)) { $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); } + if (!empty($this->delivery_date)) { + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } } $linkclose = ''; diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 1c9cffcdacd..3e7a8d416cf 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -931,7 +931,7 @@ if ($resql) $generic_commande->statut = $obj->fk_statut; $generic_commande->billed = $obj->billed; $generic_commande->date = $db->jdate($obj->date_commande); - $generic_commande->date_livraison = $db->jdate($obj->date_delivery); + $generic_commande->date_livraison = $db->jdate($obj->date_delivery); // deprecated $generic_commande->delivery_date = $db->jdate($obj->date_delivery); $generic_commande->ref_client = $obj->ref_client; $generic_commande->total_ht = $obj->total_ht; diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 437516df50b..f8b978ca4c8 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -1093,7 +1093,7 @@ if ($resql) } print ''; - print ''; + print ''; print ' '; $formconfirm .= "\n"; } else { - $formconfirm .= "\n\n"; + $formconfirm .= "\n\n"; if (empty($disableformtag)) $formconfirm .= '
'."\n"; @@ -4415,7 +4437,7 @@ class Form $formconfirm .= ''; $formconfirm .= $this->selectyesno("confirm", $newselectedchoice); $formconfirm .= ''; - $formconfirm .= ''; + $formconfirm .= ''; $formconfirm .= ''."\n"; $formconfirm .= ''."\n"; @@ -4423,6 +4445,23 @@ class Form if (empty($disableformtag)) $formconfirm .= "
\n"; $formconfirm .= '
'; + if (empty($conf->use_javascript_ajax)) { + $formconfirm .= ''; + $formconfirm .= ''."\n"; + } + $formconfirm .= "\n"; } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 18d98ffd8a0..1adb078dc36 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3190,7 +3190,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $ '1downarrow', '1uparrow', '1leftarrow', '1rightarrow', '1uparrow_selected', '1downarrow_selected', '1leftarrow_selected', '1rightarrow_selected', 'accountancy', 'account', 'accountline', 'action', 'add', 'address', 'bank_account', 'barcode', 'bank', 'bill', 'bookmark', 'bom', 'building', 'cash-register', 'category', 'check', 'clock', 'close_title', 'company', 'contact', 'contract', 'cubes', - 'delete', 'dolly', 'dollyrevert', 'donation', 'edit', 'ellipsis-h', 'email', 'external-link-alt', 'external-link-square-alt', + 'delete', 'dolly', 'dollyrevert', 'donation', 'edit', 'ellipsis-h', 'email', 'eraser', 'external-link-alt', 'external-link-square-alt', 'filter', 'file-code', 'file-export', 'file-import', 'file-upload', 'folder', 'folder-open', 'globe', 'globe-americas', 'grip', 'grip_title', 'group', 'help', 'holiday', 'intervention', 'label', 'language', 'list', 'listlight', 'lot', @@ -5525,23 +5525,25 @@ function yn($yesno, $case = 1, $color = 0) /** * Return a path to have a the directory according to object where files are stored. - * New usage: $conf->module->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, $modulepart) - * or: $conf->module->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, $modulepart) if multidir_output not defined. + * New usage: $conf->module->multidir_output[$object->entity].'/'.get_exdir(0, 0, 0, 1, $object, '') + * or: $conf->module->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, '') if multidir_output not defined. * Example our with new usage: $object is invoice -> 'INYYMM-ABCD' * Example our with old usage: '015' with level 3->"0/1/5/", '015' with level 1->"5/", 'ABC-1' with level 3 ->"0/0/1/" * - * @param string $num Id of object (deprecated, $object will be used in future) - * @param int $level Level of subdirs to return (1, 2 or 3 levels). (deprecated, global option will be used in future) - * @param int $alpha 0=Keep number only to forge path, 1=Use alpha part afer the - (By default, use 0). (deprecated, global option will be used in future) - * @param int $withoutslash 0=With slash at end (except if '/', we return ''), 1=without slash at end - * @param Object $object Object - * @param string $modulepart Type of object ('invoice_supplier, 'donation', 'invoice', ...') - * @return string Dir to use ending. Example '' or '1/' or '1/2/' + * @param string|int $num Id of object (deprecated, $object will be used in future) + * @param int $level Level of subdirs to return (1, 2 or 3 levels). (deprecated, global option will be used in future) + * @param int $alpha 0=Keep number only to forge path, 1=Use alpha part afer the - (By default, use 0). (deprecated, global option will be used in future) + * @param int $withoutslash 0=With slash at end (except if '/', we return ''), 1=without slash at end + * @param Object $object Object to use to get ref to forge the path. + * @param string $modulepart Type of object ('invoice_supplier, 'donation', 'invoice', ...'). Use '' for autodetect from $object. + * @return string Dir to use ending. Example '' or '1/' or '1/2/' */ -function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart) +function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart = '') { global $conf; + if (empty($modulepart) && !empty($object->module)) $modulepart = $object->module; + $path = ''; $arrayforoldpath = array('cheque', 'user', 'category', 'holiday', 'supplier_invoice', 'invoice_supplier', 'mailing', 'supplier_payment'); @@ -5556,14 +5558,12 @@ function get_exdir($num, $level, $alpha, $withoutslash, $object, $modulepart) if ($level == 2) $path = substr($num, 1, 1).'/'.substr($num, 0, 1); if ($level == 3) $path = substr($num, 2, 1).'/'.substr($num, 1, 1).'/'.substr($num, 0, 1); } else { - // TODO - // We will enhance here a common way of forging path for document storage - // Here, object->id, object->ref and modulepart are required. + // We will enhance here a common way of forging path for document storage. + // In a future, we may distribut directories on several levels depending on setup and object. + // Here, $object->id, $object->ref and $modulepart are required. //var_dump($modulepart); - if (in_array($modulepart, array('thirdparty', 'contact', 'member', 'propal', 'proposal', 'commande', 'order', 'facture', 'invoice', - 'supplier_order', 'supplier_proposal', 'shipment', 'contract', 'expensereport', 'ficheinter'))) - { - $path = ($object->ref ? $object->ref : $object->id); + if (! in_array($modulepart, array('product'))) { // Test to remove + $path = dol_sanitizeFileName(empty($object->ref) ? $object->id : $object->ref); } } @@ -6260,12 +6260,12 @@ function getCommonSubstitutionArray($outputlangs, $onlykey = 0, $exclude = null, $substitutionarray['__REFCLIENT__'] = (isset($object->ref_client) ? $object->ref_client : (isset($object->ref_customer) ? $object->ref_customer : null)); $substitutionarray['__REFSUPPLIER__'] = (isset($object->ref_supplier) ? $object->ref_supplier : null); $substitutionarray['__SUPPLIER_ORDER_DATE_DELIVERY__'] = (isset($object->date_livraison) ? dol_print_date($object->date_livraison, 'day', 0, $outputlangs) : ''); - $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = $outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : ''); - - $birthday = dol_print_date($object->birth, 'day'); + $substitutionarray['__SUPPLIER_ORDER_DELAY_DELIVERY__'] = (isset($object->availability_code) ? ($outputlangs->transnoentities("AvailabilityType".$object->availability_code) != ('AvailabilityType'.$object->availability_code) ? $outputlangs->transnoentities("AvailabilityType".$object->availability_code) : $outputlangs->convToOutputCharset(isset($object->availability) ? $object->availability : '')) : ''); if (is_object($object) && ($object->element == 'adherent' || $object->element == 'member') && $object->id > 0) { + $birthday = (empty($object->birth) ? '': dol_print_date($object->birth, 'day')); + $substitutionarray['__MEMBER_ID__'] = (isset($object->id) ? $object->id : ''); if (method_exists($object, 'getCivilityLabel')) $substitutionarray['__MEMBER_CIVILITY__'] = $object->getCivilityLabel(); $substitutionarray['__MEMBER_FIRSTNAME__'] = (isset($object->firstname) ? $object->firstname : ''); @@ -6660,6 +6660,14 @@ function complete_substitutions_array(&$substitutionarray, $outputlangs, $object } } } + if (!empty($conf->global->ODT_ENABLE_ALL_TAGS_IN_SUBSTITUTIONS)) { + // to list all tags in odt template + $tags = ''; + foreach ($substitutionarray as $key => $value) { + $tags .= '{' . $key . '} => ' . $value ."\n"; + } + $substitutionarray = array_merge($substitutionarray, array('__ALL_TAGS__' => $tags)); + } } /** diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 09232fbd012..909e51dc6d7 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -90,16 +90,6 @@ function product_prepare_head($object) $h++; } - $head[$h][0] = DOL_URL_ROOT."/product/stats/card.php?id=".$object->id; - $head[$h][1] = $langs->trans('Statistics'); - $head[$h][2] = 'stats'; - $h++; - - $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?showmessage=1&id=".$object->id; - $head[$h][1] = $langs->trans('Referers'); - $head[$h][2] = 'referers'; - $h++; - if (!empty($conf->variants->enabled) && ($object->isProduct() || $object->isService())) { global $db; @@ -149,6 +139,16 @@ function product_prepare_head($object) } } + $head[$h][0] = DOL_URL_ROOT."/product/stats/facture.php?showmessage=1&id=".$object->id; + $head[$h][1] = $langs->trans('Referers'); + $head[$h][2] = 'referers'; + $h++; + + $head[$h][0] = DOL_URL_ROOT."/product/stats/card.php?id=".$object->id; + $head[$h][1] = $langs->trans('Statistics'); + $head[$h][2] = 'stats'; + $h++; + // Show more tabs from modules // Entries must be declared in modules descriptor with line // $this->tabs = array('entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'); to add new tab diff --git a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php index 9a618053ff2..114a3906392 100644 --- a/htdocs/core/modules/commande/doc/pdf_einstein.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_einstein.modules.php @@ -741,7 +741,7 @@ class pdf_einstein extends ModelePDFCommandes }*/ // Show planed date of delivery - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -750,7 +750,7 @@ class pdf_einstein extends ModelePDFCommandes $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 28c255e973b..1f266851a0c 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -958,7 +958,7 @@ class pdf_eratosthene extends ModelePDFCommandes }*/ // Show planed date of delivery - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -967,7 +967,7 @@ class pdf_eratosthene extends ModelePDFCommandes $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; diff --git a/htdocs/core/modules/delivery/mod_delivery_saphir.php b/htdocs/core/modules/delivery/mod_delivery_saphir.php index df1a15598b1..ca0de68a670 100644 --- a/htdocs/core/modules/delivery/mod_delivery_saphir.php +++ b/htdocs/core/modules/delivery/mod_delivery_saphir.php @@ -139,7 +139,7 @@ class mod_delivery_saphir extends ModeleNumRefDeliveryOrder return 0; } - $numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->date_livraison); + $numFinal = get_next_value($db, $mask, 'delivery', 'ref', '', $objsoc, $object->delivery_date); return $numFinal; } diff --git a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php index cfa8c75ec11..6d2f2772610 100644 --- a/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php +++ b/htdocs/core/modules/member/doc/doc_generic_member_odt.class.php @@ -322,11 +322,6 @@ class doc_generic_member_odt extends ModelePDFMember $tmparray = array_merge($array_member, $array_soc, $array_thirdparty, $array_other, $array_thirdparty_contact); complete_substitutions_array($tmparray, $outputlangs, $object); - $tags = ''; - foreach ($tmparray as $key => $value) { - $tags .= '{' . $key . '} => ' . $value ."\n"; - } - $tmparray = array_merge($tmparray, array('__ALL_TAGS__' => $tags)); // Call the ODTSubstitution hook $parameters = array( 'file'=>$file, @@ -352,12 +347,10 @@ class doc_generic_member_odt extends ModelePDFMember // Replace labels translated $tmparray = $outputlangs->get_translations_for_substitutions(); - foreach ($tmparray as $key=>$value) - { + foreach ($tmparray as $key=>$value) { try { $odfHandler->setVars($key, $value, true, 'UTF-8'); - } catch (OdfException $e) - { + } catch (OdfException $e) { dol_syslog($e->getMessage(), LOG_WARNING); } } diff --git a/htdocs/core/modules/propale/doc/pdf_azur.modules.php b/htdocs/core/modules/propale/doc/pdf_azur.modules.php index aff0e7c4457..3405b6a2774 100644 --- a/htdocs/core/modules/propale/doc/pdf_azur.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_azur.modules.php @@ -870,7 +870,7 @@ class pdf_azur extends ModelePDFPropales $posxval = 52; // Show shipping date - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -879,7 +879,7 @@ class pdf_azur extends ModelePDFPropales $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; diff --git a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php index 9be74e97fb9..8199f3ac11e 100644 --- a/htdocs/core/modules/propale/doc/pdf_cyan.modules.php +++ b/htdocs/core/modules/propale/doc/pdf_cyan.modules.php @@ -1006,7 +1006,7 @@ class pdf_cyan extends ModelePDFPropales $posxval = 52; // Show shipping date - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -1015,7 +1015,7 @@ class pdf_cyan extends ModelePDFPropales $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 0d7cfcdb90d..681b5316682 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1276,11 +1276,11 @@ class pdf_cornas extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 60); $usehourmin = 'day'; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour'; - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $posy += 4; $pdf->SetXY($posx - 90, $posy); - $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_livraison, $usehourmin, false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->delivery_date, $usehourmin, false, $outputlangs, true), '', 'R'); } if ($object->thirdparty->code_fournisseur) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php index a496bd8ba87..13111da6fa9 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_muscadet.modules.php @@ -1190,11 +1190,11 @@ class pdf_muscadet extends ModelePDFSuppliersOrders $pdf->SetTextColor(0, 0, 60); $usehourmin = 'day'; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour'; - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $posy += 4; $pdf->SetXY($posx - 90, $posy); - $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->date_livraison, $usehourmin, false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(190, 3, $outputlangs->transnoentities("DateDeliveryPlanned")." : ".dol_print_date($object->delivery_date, $usehourmin, false, $outputlangs, true), '', 'R'); } if ($object->thirdparty->code_fournisseur) diff --git a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php index f6dc1d789f0..8a3880dc93e 100644 --- a/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php +++ b/htdocs/core/modules/supplier_proposal/doc/pdf_aurore.modules.php @@ -724,7 +724,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posxval = 52; // Show shipping date - if (!empty($object->date_livraison)) + if (!empty($object->delivery_date)) { $outputlangs->load("sendings"); $pdf->SetFont('', 'B', $default_font_size - 2); @@ -733,7 +733,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - $dlp = dol_print_date($object->date_livraison, "daytext", false, $outputlangs, true); + $dlp = dol_print_date($object->delivery_date, "daytext", false, $outputlangs, true); $pdf->MultiCell(80, 4, $dlp, 0, 'L'); $posy = $pdf->GetY() + 1; @@ -745,7 +745,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $pdf->MultiCell(80, 4, $titre, 0, 'L'); $pdf->SetFont('', '', $default_font_size - 2); $pdf->SetXY($posxval, $posy); - //$dlp=dol_print_date($object->date_livraison,"daytext",false,$outputlangs,true); + //$dlp=dol_print_date($object->delivery_date,"daytext",false,$outputlangs,true); $pdf->MultiCell(80, 4, '', 0, 'L'); $posy = $pdf->GetY() + 1; @@ -1325,7 +1325,7 @@ class pdf_aurore extends ModelePDFSupplierProposal $posy+=4; $pdf->SetXY($posx,$posy); $pdf->SetTextColor(0,0,60); - $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->date_livraison, "day", false, $outputlangs, true), '', 'R'); + $pdf->MultiCell(100, 3, $outputlangs->transnoentities("SupplierProposalDate")." : " . dol_print_date($object->delivery_date, "day", false, $outputlangs, true), '', 'R'); */ if ($object->thirdparty->code_fournisseur) diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 05d0ffebc41..367faa630ba 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -153,7 +153,7 @@ $listofexamplesforlink = 'Societe:societe/class/societe.class.php
Contact:con trans("AttributeCode"); ?> (trans("AlphaNumOnlyLowerCharsAndNoSpace"); ?>) trans("Type"); ?> -selectarray('type', $type2label, GETPOST('type', 'alpha')); ?> +selectarray('type', $type2label, GETPOST('type', 'alpha'), 0, 0, 0, '', 0, 0, 0, '', '', 1); ?> trans("Size"); ?> diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 61971945183..5c1680d9ecb 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -205,7 +205,8 @@ $typewecanchangeinto = array( 'mail'=>array('varchar', 'phone', 'mail', 'url', 'select'), 'url'=>array('varchar', 'phone', 'mail', 'url', 'select'), 'phone'=>array('varchar', 'phone', 'mail', 'url', 'select'), - 'select'=>array('varchar', 'phone', 'mail', 'url', 'select') + 'select'=>array('varchar', 'phone', 'mail', 'url', 'select'), + 'date'=>array('date', 'datetime') ); /* Disabled because text is text on several lines, when varchar is text on 1 line, we should not be able to convert if ($size <= 255 && in_array($type, array('text', 'html'))) { @@ -224,6 +225,7 @@ if (in_array($type, array_keys($typewecanchangeinto))) else print ''; } print ''; + print ajax_combobox('type'); } else { print $type2label[$type]; print ''; diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index d177ce7637c..401e1079d35 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -693,7 +693,8 @@ if (!empty($usemargins) && $user->rights->margins->creer) $("#buying_price").val("").show(); /* Call post to load content of combo list fournprice_predef */ - $.post('/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val(), 'token': '' }, function(data) { + var token = ''; // For AJAX Call we use old 'token' and not 'newtoken' + $.post('/fourn/ajax/getSupplierPrices.php?bestpricefirst=1', { 'idprod': $(this).val(), 'token': token }, function(data) { if (data && data.length > 0) { var options = ''; var defaultkey = ''; var defaultprice = ''; var bestpricefound = 0; diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 6b3639d65eb..b7f0b8d5da1 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -434,7 +434,8 @@ jQuery(document).ready(function() }); /* Init field buying_price and fournprice */ - $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product ? $line->fk_product : 0; ?>, 'token': ''}, function(data) { + var token = ''; // For AJAX Call we use old 'token' and not 'newtoken' + $.post('/fourn/ajax/getSupplierPrices.php', {'idprod': fk_product ? $line->fk_product : 0; ?>, 'token': token }, function(data) { if (data && data.length > 0) { var options = ''; var trouve=false; diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 77e25704a6b..2cef2c39320 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -105,6 +105,8 @@ $hookmanager->initHooks(array('expeditioncard', 'globalcard')); $permissiondellink = $user->rights->expedition->delivery->creer; // Used by the include of actions_dellink.inc.php //var_dump($object->lines[0]->detail_batch); +$date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); + /* * Actions @@ -201,8 +203,6 @@ if (empty($reshook)) $object->size_units = GETPOST('size_units', 'int'); $object->weight_units = GETPOST('weight_units', 'int'); - $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); - // We will loop on each line of the original document to complete the shipping object with various info and quantity to deliver $classname = ucfirst($object->origin); $objectsrc = new $classname($db); @@ -936,8 +936,7 @@ if ($action == 'create') // Date delivery planned print ''.$langs->trans("DateDeliveryPlanned").''; print ''; - //print dol_print_date($object->date_livraison, "day"); // date_livraison come from order and will be stored into date_delivery planed. - $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "\n"; print ''; @@ -1048,7 +1047,7 @@ if ($action == 'create') $i++; } print '}); - jQuery("#autoreset").click(function() {'; + jQuery("#autoreset").click(function() { console.log("Reset values to 0"); '; $i = 0; while ($i < $numAsked) { @@ -1076,12 +1075,12 @@ if ($action == 'create') print ''.$langs->trans("QtyToShip"); if (empty($conf->productbatch->enabled)) { - print '
'.$langs->trans("Fill").''; + print '
'.$langs->trans("Fill").''; print ' / '; } else { print '
'; } - print ''.$langs->trans("Reset").''; + print ''.img_picto($langs->trans("Reset"), 'eraser').''; print ''; if (!empty($conf->stock->enabled)) { @@ -1115,7 +1114,7 @@ if ($action == 'create') if (!empty($line->date_start)) $type = 1; if (!empty($line->date_end)) $type = 1; - print ''."\n"; + print ''."\n"; print ''."\n"; // Product label @@ -1126,13 +1125,16 @@ if ($action == 'create') //var_dump($product->stock_warehouse[1]); print ''; - print ''; // ancre pour retourner sur la ligne + print ''; // ancre pour retourner sur la ligne // Show product and description $product_static->type = $line->fk_product_type; $product_static->id = $line->fk_product; $product_static->ref = $line->ref; + $product_static->status = $line->product_tosell; + $product_static->status_buy = $line->product_tobuy; $product_static->status_batch = $line->product_tobatch; + $text = $product_static->getNomUrl(1); $text .= ' - '.(!empty($line->label) ? $line->label : $line->product_label); $description = ($conf->global->PRODUIT_DESC_IN_FORM ? '' : dol_htmlentitiesbr($line->desc)); @@ -2049,7 +2051,7 @@ if ($action == 'create') $sql .= ", ed.rowid as shipmentline_id, ed.qty as qty_shipped, ed.fk_expedition as expedition_id, ed.fk_origin_line, ed.fk_entrepot"; $sql .= ", e.rowid as shipment_id, e.ref as shipment_ref, e.date_creation, e.date_valid, e.date_delivery, e.date_expedition"; //if ($conf->delivery_note->enabled) $sql .= ", l.rowid as livraison_id, l.ref as livraison_ref, l.date_delivery, ld.qty as qty_received"; - $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tobatch as product_tobatch'; + $sql .= ', p.label as product_label, p.ref, p.fk_product_type, p.rowid as prodid, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch'; $sql .= ', p.description as product_desc'; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed"; $sql .= ", ".MAIN_DB_PREFIX."expedition as e"; @@ -2076,7 +2078,10 @@ if ($action == 'create') if ($obj) { // $obj->rowid is rowid in $origin."det" table - $alreadysent[$obj->rowid][$obj->shipmentline_id] = array('shipment_ref'=>$obj->shipment_ref, 'shipment_id'=>$obj->shipment_id, 'warehouse'=>$obj->fk_entrepot, 'qty_shipped'=>$obj->qty_shipped, 'date_valid'=>$db->jdate($obj->date_valid), 'date_delivery'=>$db->jdate($obj->date_delivery)); + $alreadysent[$obj->rowid][$obj->shipmentline_id] = array( + 'shipment_ref'=>$obj->shipment_ref, 'shipment_id'=>$obj->shipment_id, 'warehouse'=>$obj->fk_entrepot, 'qty_shipped'=>$obj->qty_shipped, + 'product_tosell'=>$obj->product_tosell, 'product_tobuy'=>$obj->product_tobuy, 'product_tobatch'=>$obj->product_tobatch, + 'date_valid'=>$db->jdate($obj->date_valid), 'date_delivery'=>$db->jdate($obj->date_delivery)); } $i++; } @@ -2085,6 +2090,7 @@ if ($action == 'create') } print ''; + // Loop on each product to send/sent for ($i = 0; $i < $num_prod; $i++) { @@ -2120,6 +2126,8 @@ if ($action == 'create') $product_static->type = $lines[$i]->fk_product_type; $product_static->id = $lines[$i]->fk_product; $product_static->ref = $lines[$i]->ref; + $product_static->status = $lines[$i]->product_tosell; + $product_static->status_buy = $lines[$i]->product_tobuy; $product_static->status_batch = $lines[$i]->product_tobatch; $product_static->weight = $lines[$i]->weight; diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index abc59080912..6c2faa0624d 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -619,10 +619,8 @@ class Expedition extends CommonObject // Tracking url $this->getUrlTrackingStatus($obj->tracking_number); - /* - * Thirdparty - */ - $result = $this->fetch_thirdparty(); + // Thirdparty + $result = $this->fetch_thirdparty(); // TODO Remove this // Retrieve extrafields $this->fetch_optionals(); @@ -919,6 +917,7 @@ class Expedition extends CommonObject $line->entrepot_id = $entrepot_id; $line->origin_line_id = $id; + $line->fk_origin_line = $id; $line->qty = $qty; $orderline = new OrderLine($this->db); @@ -931,31 +930,37 @@ class Expedition extends CommonObject { $fk_product = $orderline->fk_product; - if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS)) - { + if (!($entrepot_id > 0) && empty($conf->global->STOCK_WAREHOUSE_NOT_REQUIRED_FOR_SHIPMENTS)) { $langs->load("errors"); $this->error = $langs->trans("ErrorWarehouseRequiredIntoShipmentLine"); return -1; } - if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) - { - // Check must be done for stock of product into warehouse if $entrepot_id defined + if ($conf->global->STOCK_MUST_BE_ENOUGH_FOR_SHIPMENT) { $product = new Product($this->db); - $result = $product->fetch($fk_product); + $product->fetch($fk_product); + // Check must be done for stock of product into warehouse if $entrepot_id defined if ($entrepot_id > 0) { $product->load_stock('warehouseopen'); $product_stock = $product->stock_warehouse[$entrepot_id]->real; - } else $product_stock = $product->stock_reel; + } else { + $product_stock = $product->stock_reel; + } $product_type = $product->type; - if ($product_type == 0 && $product_stock < $qty) - { - $langs->load("errors"); - $this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref); - $this->db->rollback(); - return -3; + if ($product_type == 0 || !empty($conf->global->STOCK_SUPPORTS_SERVICES)) { + $isavirtualproduct = ($product->hasFatherOrChild(1) > 0); + // The product is qualified for a check of quantity (must be enough in stock to be added into shipment). + if (!$isavirtualproduct || empty($conf->global->PRODUIT_SOUSPRODUITS) || ($isavirtualproduct && empty($conf->global->STOCK_EXCLUDE_VIRTUAL_PRODUCTS))) { // If STOCK_EXCLUDE_VIRTUAL_PRODUCTS is set, we do not manage stock for kits/virtual products. + if ($product_stock < $qty) { + $langs->load("errors"); + $this->error = $langs->trans('ErrorStockIsNotEnoughToAddProductOnShipment', $product->ref); + $this->errorhidden = 'ErrorStockIsNotEnoughToAddProductOnShipment'; + $this->db->rollback(); + return -3; + } + } } } } @@ -1576,7 +1581,7 @@ class Expedition extends CommonObject $sql .= ", cd.fk_multicurrency, cd.multicurrency_code, cd.multicurrency_subprice, cd.multicurrency_total_ht, cd.multicurrency_total_tva, cd.multicurrency_total_ttc, cd.rang"; $sql .= ", ed.rowid as line_id, ed.qty as qty_shipped, ed.fk_origin_line, ed.fk_entrepot"; $sql .= ", p.ref as product_ref, p.label as product_label, p.fk_product_type"; - $sql .= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tobatch as product_tobatch"; + $sql .= ", p.weight, p.weight_units, p.length, p.length_units, p.surface, p.surface_units, p.volume, p.volume_units, p.tosell as product_tosell, p.tobuy as product_tobuy, p.tobatch as product_tobatch"; $sql .= " FROM ".MAIN_DB_PREFIX."expeditiondet as ed, ".MAIN_DB_PREFIX."commandedet as cd"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = cd.fk_product"; $sql .= " WHERE ed.fk_expedition = ".$this->id; @@ -1638,6 +1643,8 @@ class Expedition extends CommonObject $line->product_ref = $obj->product_ref; $line->product_label = $obj->product_label; $line->libelle = $obj->product_label; // TODO deprecated + $line->product_tosell = $obj->product_tosell; + $line->product_tobuy = $obj->product_tobuy; $line->product_tobatch = $obj->product_tobatch; $line->label = $obj->custom_label; $line->description = $obj->description; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 09cec584c43..77a62bf8561 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -212,7 +212,7 @@ llxHeader('', $langs->trans('ListOfSendings'), $helpurl); $sql = 'SELECT'; if ($sall || $search_product_category > 0) $sql = 'SELECT DISTINCT'; -$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,"; +$sql .= " e.rowid, e.ref, e.ref_customer, e.date_expedition as date_expedition, e.weight, e.weight_units, e.date_delivery as delivery_date, l.date_delivery as date_reception, e.fk_statut, e.billed, e.tracking_number,"; $sql .= " s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, "; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; @@ -618,6 +618,7 @@ if ($resql) $object = new Expedition($db); $object->fetch($obj->rowid); + print ''; // Ref @@ -705,7 +706,7 @@ if ($resql) if (!empty($arrayfields['e.date_delivery']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->date_livraison), "dayhour"); + print dol_print_date($db->jdate($obj->delivery_date), "dayhour"); /*$now = time(); if ( ($now - $db->jdate($obj->date_expedition)) > $conf->warnings->lim && $obj->statutid == 1 ) { diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 62e6181abcf..39772360227 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -354,7 +354,7 @@ if ($id > 0 || !empty($ref)) print ''.$langs->trans('Date').''; print ''; print dol_print_date($object->date, 'day'); - if ($object->hasDelay() && empty($object->date_livraison)) { + if ($object->hasDelay() && empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } print ''; @@ -374,12 +374,12 @@ if ($id > 0 || !empty($ref)) print '
'; print ''; print ''; - print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', 1, 1, '', "setdate_livraison", 1, 0); print ''; print '
'; } else { - print dol_print_date($object->date_livraison, 'dayhour'); - if ($object->hasDelay() && !empty($object->date_livraison)) { + print dol_print_date($object->delivery_date, 'dayhour'); + if ($object->hasDelay() && !empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index 2bc539ea07e..6ac872d7555 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -9,7 +9,7 @@ * Copyright (C) 2013 Florian Henry * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018-2019 Frédéric France + * Copyright (C) 2018-2020 Frédéric France * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify @@ -121,7 +121,7 @@ class CommandeFournisseur extends CommonOrder public $date_livraison; /** - * Delivery date + * @var int Date expected for delivery */ public $delivery_date; @@ -132,16 +132,6 @@ class CommandeFournisseur extends CommonOrder public $total_ttc; public $source; - /** - * @deprecated - * @see $note_private, $note_public - */ - public $note; - - public $note_private; - public $note_public; - public $model_pdf; - /** * @var int ID */ @@ -375,7 +365,7 @@ class CommandeFournisseur extends CommonOrder $this->date_approve = $this->db->jdate($obj->date_approve); $this->date_approve2 = $this->db->jdate($obj->date_approve2); $this->date_commande = $this->db->jdate($obj->date_commande); // date we make the order to supplier - $this->date_livraison = $this->db->jdate($obj->delivery_date); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->remise_percent = $obj->remise_percent; $this->methode_commande_id = $obj->fk_input_method; @@ -778,16 +768,24 @@ class CommandeFournisseur extends CommonOrder if (isset($this->statut)) { $label .= ' '.$this->getLibStatut(5); } - if (!empty($this->ref)) + if (!empty($this->ref)) { $label .= '
'.$langs->trans('Ref').': '.$this->ref; - if (!empty($this->ref_supplier)) + } + if (!empty($this->ref_supplier)) { $label .= '
'.$langs->trans('RefSupplier').': '.$this->ref_supplier; - if (!empty($this->total_ht)) + } + if (!empty($this->total_ht)) { $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_tva)) + } + if (!empty($this->total_tva)) { $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - if (!empty($this->total_ttc)) + } + if (!empty($this->total_ttc)) { $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->delivery_date)) { + $label .= '
'.$langs->trans('DeliveryDate').': '.dol_print_date($this->delivery_date, 'dayhour'); + } } $picto = 'order'; @@ -1257,9 +1255,10 @@ class CommandeFournisseur extends CommonOrder $error = 0; $now = dol_now(); - // $date_commande is deprecated + // set tmp vars $date = ($this->date_commande ? $this->date_commande : $this->date); // in case of date is set if (empty($date)) $date = $now; + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; // Clean parameters if (empty($this->source)) $this->source = 0; @@ -1308,7 +1307,7 @@ class CommandeFournisseur extends CommonOrder $sql .= ", ".$this->socid; $sql .= ", ".($this->fk_project > 0 ? $this->fk_project : "null"); $sql .= ", '".$this->db->idate($date)."'"; - $sql .= ", ".($this->date_livraison ? "'".$this->db->idate($this->date_livraison)."'" : "null"); + $sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null"); $sql .= ", ".$user->id; $sql .= ", ".self::STATUS_DRAFT; $sql .= ", ".$this->db->escape($this->source); @@ -2925,7 +2924,7 @@ class CommandeFournisseur extends CommonOrder { $response->nbtodo++; - $commandestatic->date_livraison = $this->db->jdate($obj->delivery_date); + $commandestatic->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $commandestatic->delivery_date = $this->db->jdate($obj->delivery_date); $commandestatic->date_commande = $this->db->jdate($obj->date_commande); $commandestatic->statut = $obj->fk_statut; @@ -3079,10 +3078,10 @@ class CommandeFournisseur extends CommonOrder { global $conf; - if (empty($this->date_delivery) && !empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility + if (empty($this->delivery_date) && !empty($this->date_livraison)) $this->delivery_date = $this->date_livraison; // For backward compatibility $now = dol_now(); - $date_to_test = empty($this->date_delivery) ? $this->date_commande : $this->date_delivery; + $date_to_test = empty($this->delivery_date) ? $this->date_commande : $this->delivery_date; return ($this->statut > 0 && $this->statut < 5) && $date_to_test && $date_to_test < ($now - $conf->commande->fournisseur->warning_delay); } @@ -3096,10 +3095,13 @@ class CommandeFournisseur extends CommonOrder { global $conf, $langs; - if (empty($this->date_delivery) && !empty($this->date_livraison)) $this->date_delivery = $this->date_livraison; // For backward compatibility + if (empty($this->delivery_date) && !empty($this->date_livraison)) $this->delivery_date = $this->date_livraison; // For backward compatibility - if (empty($this->date_delivery)) $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); - else $text = $text = $langs->trans("DeliveryDate").' '.dol_print_date($this->date_delivery, 'day'); + if (empty($this->delivery_date)) { + $text = $langs->trans("OrderDate").' '.dol_print_date($this->date_commande, 'day'); + } else { + $text = $langs->trans("DeliveryDate").' '.dol_print_date($this->delivery_date, 'day'); + } $text .= ' '.($conf->commande->fournisseur->warning_delay > 0 ? '+' : '-').' '.round(abs($conf->commande->fournisseur->warning_delay) / 3600 / 24, 1).' '.$langs->trans("days").' < '.$langs->trans("Today"); return $text; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index ad4662a156c..b4f3570ff34 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -1145,7 +1145,7 @@ if (empty($reshook)) $object->fk_account = GETPOST('fk_account', 'int'); $object->note_private = GETPOST('note_private', 'restricthtml'); $object->note_public = GETPOST('note_public', 'restricthtml'); - $object->date_livraison = $datelivraison; + $object->date_livraison = $datelivraison; // deprecated $object->delivery_date = $datelivraison; $object->fk_incoterms = GETPOST('incoterm_id', 'int'); $object->location_incoterms = GETPOST('location_incoterms', 'alpha'); @@ -1200,7 +1200,8 @@ if (empty($reshook)) $result = $srcobject->fetch($object->origin_id); if ($result > 0) { - $object->setDeliveryDate($user, $srcobject->date_livraison); + $tmpdate = ($srcobject->delivery_date ? $srcobject->delivery_date : $srcobject->date_livraison); + $object->setDeliveryDate($user, $tmpdate); $object->set_id_projet($user, $srcobject->fk_project); $lines = $srcobject->lines; @@ -1552,7 +1553,7 @@ if ($action == 'create') $remise_absolue = (!empty($objectsrc->remise_absolue) ? $objectsrc->remise_absolue : (!empty($soc->remise_absolue) ? $soc->remise_absolue : 0)); $dateinvoice = empty($conf->global->MAIN_AUTOFILL_DATE) ?-1 : ''; - $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : ''); + $datedelivery = (!empty($objectsrc->date_livraison) ? $objectsrc->date_livraison : (!empty($objectsrc->delivery_date) ? $objectsrc->delivery_date : '')); if (!empty($conf->multicurrency->enabled)) { @@ -2161,14 +2162,14 @@ if ($action == 'create') print ''; $usehourmin = 0; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 1; - print $form->selectDate($object->date_livraison ? $object->date_livraison : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); + print $form->selectDate($object->delivery_date ? $object->delivery_date : -1, 'liv_', $usehourmin, $usehourmin, '', "setdate_livraison"); print ''; print ''; } else { $usehourmin = 'day'; if (!empty($conf->global->SUPPLIER_ORDER_USE_HOUR_FOR_DELIVERY_DATE)) $usehourmin = 'dayhour'; - print $object->date_livraison ? dol_print_date($object->date_livraison, $usehourmin) : ' '; - if ($object->hasDelay() && !empty($object->date_livraison)) { + print $object->delivery_date ? dol_print_date($object->delivery_date, $usehourmin) : ' '; + if ($object->hasDelay() && !empty($object->delivery_date)) { print ' '.img_picto($langs->trans("Late").' : '.$object->showDelay(), "warning"); } } diff --git a/htdocs/holiday/document.php b/htdocs/holiday/document.php index 192c7d24e33..f366bb50c85 100644 --- a/htdocs/holiday/document.php +++ b/htdocs/holiday/document.php @@ -64,7 +64,7 @@ if (!$sortfield) $sortfield = "position_name"; $object = new Holiday($db); $object->fetch($id, $ref); -$upload_dir = $conf->holiday->dir_output.'/'.get_exdir($object->id, 0, 0, 0, $object, 'holiday').dol_sanitizeFileName($object->ref); +$upload_dir = $conf->holiday->dir_output.'/'.get_exdir(0, 0, 0, 1, $object, ''); $modulepart = 'holiday'; diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php index 7b41e7030b1..a77606abb3f 100644 --- a/htdocs/install/upgrade2.php +++ b/htdocs/install/upgrade2.php @@ -2068,8 +2068,8 @@ function migrate_commande_livraison($db, $langs, $conf) $db->begin(); - $sql = "SELECT l.rowid, l.fk_commande"; - $sql .= ", c.ref_client, c.date_livraison"; + $sql = "SELECT l.rowid, l.fk_commande,"; + $sql .= " c.ref_client, c.date_livraison as delivery_date"; $sql .= " FROM ".MAIN_DB_PREFIX."livraison as l, ".MAIN_DB_PREFIX."commande as c"; $sql .= " WHERE c.rowid = l.fk_commande"; $resql = $db->query($sql); @@ -2090,7 +2090,7 @@ function migrate_commande_livraison($db, $langs, $conf) if ($resql2) { - $delivery_date = $db->jdate($obj->date_livraison); + $delivery_date = $db->jdate($obj->delivery_date); $sqlu = "UPDATE ".MAIN_DB_PREFIX."livraison SET"; $sqlu .= " ref_client='".$db->escape($obj->ref_client)."'"; @@ -3007,7 +3007,7 @@ function migrate_customerorder_shipping($db, $langs, $conf) if ($db->query($sqlAdd1) && $db->query($sqlAdd2)) { - $sqlSelect = "SELECT e.rowid as shipping_id, c.ref_client, c.date_livraison"; + $sqlSelect = "SELECT e.rowid as shipping_id, c.ref_client, c.date_livraison as delivery_date"; $sqlSelect .= " FROM ".MAIN_DB_PREFIX."expedition as e"; $sqlSelect .= ", ".MAIN_DB_PREFIX."element_element as el"; $sqlSelect .= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON c.rowid = el.fk_source AND el.sourcetype = 'commande'"; @@ -3028,7 +3028,7 @@ function migrate_customerorder_shipping($db, $langs, $conf) $sqlUpdate = "UPDATE ".MAIN_DB_PREFIX."expedition SET"; $sqlUpdate .= " ref_customer = '".$db->escape($obj->ref_client)."'"; - $sqlUpdate .= ", date_delivery = '".$db->escape($obj->date_livraison ? $obj->date_livraison : 'null')."'"; + $sqlUpdate .= ", date_delivery = '".$db->escape($obj->delivery_date ? $obj->delivery_date : 'null')."'"; $sqlUpdate .= " WHERE rowid = ".$obj->shipping_id; $result = $db->query($sqlUpdate); diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index ac3fb07e796..dd8e6fe6538 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1314,6 +1314,7 @@ PHPModuleLoaded=PHP component %s is loaded PreloadOPCode=Preloaded OPCode is used AddRefInList=Display Customer/Vendor ref. info list (select list or combobox) and most of hyperlink.
Third Parties will appear with a name format of "CC12345 - SC45678 - The Big Company corp." instead of "The Big Company corp". AddAdressInList=Display Customer/Vendor adress info list (select list or combobox)
Third Parties will appear with a name format of "The Big Company corp. - 21 jump street 123456 Big town - USA" instead of "The Big Company corp". +AddEmailPhoneTownInContactList=Display Contact email (or phones if not defined) and town info list (select list or combobox)
Contacts will appear with a name format of "Dupond Durand - dupond.durand@email.com - Paris" or "Dupond Durand - 06 07 59 65 66 - Paris" instead of "Dupond Durand". AskForPreferredShippingMethod=Ask for preferred shipping method for Third Parties. FieldEdition=Edition of field %s FillThisOnlyIfRequired=Example: +2 (fill only if timezone offset problems are experienced) diff --git a/htdocs/langs/en_US/compta.lang b/htdocs/langs/en_US/compta.lang index 715c3dfb8f5..18ee01eb3bb 100644 --- a/htdocs/langs/en_US/compta.lang +++ b/htdocs/langs/en_US/compta.lang @@ -111,7 +111,7 @@ Refund=Refund SocialContributionsPayments=Social/fiscal taxes payments ShowVatPayment=Show VAT payment TotalToPay=Total to pay -BalanceVisibilityDependsOnSortAndFilters=Balance is visible in this list only if table is sorted ascending on %s and filtered for 1 bank account +BalanceVisibilityDependsOnSortAndFilters=Balance is visible in this list only if table is sorted on %s and filtered on 1 bank account (with no other filters) CustomerAccountancyCode=Customer accounting code SupplierAccountancyCode=Vendor accounting code CustomerAccountancyCodeShort=Cust. account. code diff --git a/htdocs/langs/en_US/intracommreport.lang b/htdocs/langs/en_US/intracommreport.lang index 3060300b974..93c46f112bb 100644 --- a/htdocs/langs/en_US/intracommreport.lang +++ b/htdocs/langs/en_US/intracommreport.lang @@ -32,7 +32,7 @@ IntracommReportTitle=Preparation of an XML file in ProDouane format # List IntracommReportList=List of generated declarations IntracommReportNumber=Numero of declaration -IntracommReportPeriod=Period of nalysis +IntracommReportPeriod=Period of analysis IntracommReportTypeDeclaration=Type of declaration IntracommReportDownload=download XML file diff --git a/htdocs/langs/en_US/main.lang b/htdocs/langs/en_US/main.lang index 2068a37af2b..850d87ff883 100644 --- a/htdocs/langs/en_US/main.lang +++ b/htdocs/langs/en_US/main.lang @@ -197,6 +197,7 @@ ReOpen=Re-Open Upload=Upload ToLink=Link Select=Select +SelectAll=Select all Choose=Choose Resize=Resize ResizeOrCrop=Resize or Crop diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 97db059594f..00f08a0804e 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -167,8 +167,10 @@ BuyingPrices=Buying prices CustomerPrices=Customer prices SuppliersPrices=Vendor prices SuppliersPricesOfProductsOrServices=Vendor prices (of products or services) -CustomCode=Customs / Commodity / HS code +CustomCode=Customs|Commodity|HS code CountryOrigin=Origin country +RegionStateOrigin=Region origin +StateOrigin=State|Province origin Nature=Nature of product (material/finished) NatureOfProductShort=Nature of product NatureOfProductDesc=Raw material or finished product diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index d7842084c17..ffe9e6992b2 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1276,6 +1276,7 @@ PHPModuleLoaded=Le composant PHP %s est chargé PreloadOPCode=Le code OP préchargé est utilisé AddRefInList=Afficher les références client/fournisseur dans les listes (listes déroulantes ou à autocomplétion) et les libellés des liens clicables.
Les tiers apparaîtront alors sous la forme "CC12345 - SC45678 - La big company coorp", au lieu de "La big company coorp". AddAdressInList=Affiche les informations sur l’adresse du client/fournisseur (liste de sélection ou liste déroulante)
Les tiers apparaîtront avec le format de nom suivant: "The Big Company corp. - 21, rue du saut 123456 Big town - USA" au lieu de "The Big Company corp". +AddEmailPhoneTownInContactList=Affiche les informations sur l’email (ou les telephones si non définie) et la ville du contact (liste de sélection ou liste déroulante)
Les contacts apparaîtront avec le format de nom suivant: "Dupond Durand - dupond.durand@email.com - Paris" ou "Dupond Durand - 06 07 59 65 66 - Paris" au lieu de "Dupond Durand". AskForPreferredShippingMethod=Demander la méthode d'expédition préférée pour les Tiers FieldEdition=Édition du champ %s FillThisOnlyIfRequired=Exemple: +2 (ne remplir que si un décalage d'heure est constaté dans l'export) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index d57a9b154a3..b5eb35dd2d9 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -988,7 +988,7 @@ if (!defined('NOLOGIN')) $user->getrights(); } -dol_syslog("--- Access to ".$_SERVER["REQUEST_METHOD"].' '.$_SERVER["PHP_SELF"].' - action='.GETPOST('action', 'aZ09').', massaction='.GETPOST('massaction', 'aZ09')); +dol_syslog("--- Access to ".$_SERVER["REQUEST_METHOD"].' '.$_SERVER["PHP_SELF"].' - action='.GETPOST('action', 'aZ09').', massaction='.GETPOST('massaction', 'aZ09').' NOTOKENRENEWAL='.constant('NOTOKENRENEWAL')); //Another call for easy debugg //dol_syslog("Access to ".$_SERVER["PHP_SELF"].' GET='.join(',',array_keys($_GET)).'->'.join(',',$_GET).' POST:'.join(',',array_keys($_POST)).'->'.join(',',$_POST)); diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index b2158ac34ad..7399fa6fb09 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -98,8 +98,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:$conf->entity] . "/myobject/" . dol_sanitizeFileName($object->id); -if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity ? $object->entity : $conf->entity]."/myobject/".dol_sanitizeFileName($object->ref); +if ($id > 0 || !empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity ? $object->entity : $conf->entity]."/myobject/".get_exdir(0, 0, 0, 1, $object); // Security check - Protection if external user //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/mrp/mo_document.php b/htdocs/mrp/mo_document.php index 7ddf92c5cd1..01131b9ffa2 100644 --- a/htdocs/mrp/mo_document.php +++ b/htdocs/mrp/mo_document.php @@ -67,8 +67,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -//if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity?$object->entity:$conf->entity] . "/mo/" . dol_sanitizeFileName($object->id); -if ($id > 0 || !empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity ? $object->entity : $conf->entity]."/mo/".dol_sanitizeFileName($object->ref); +if ($id > 0 || !empty($ref)) $upload_dir = $conf->mrp->multidir_output[$object->entity ? $object->entity : $conf->entity]."/mo/".get_exdir(0, 0, 0, 1, $object); // Security check - Protection if external user //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 04933018410..33a30a00f47 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1175,10 +1175,10 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) // State if (empty($conf->global->PRODUCT_DISABLE_STATE)) { - if ($conf->browser->layout == 'phone') print ''; + if ($conf->browser->layout == 'phone') print ''; if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { - print ''.$form->editfieldkey('Region-StateOrigine', 'state_id', '', $object, 0).''; + print ''.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).''; } else { print ''.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).''; } @@ -1186,7 +1186,8 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) print $formcompany->select_state($object->state_id, $object->country_code); print ''; } - print ''; + + print ''; } // Other attributes @@ -1634,7 +1635,7 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) if ($conf->browser->layout == 'phone') print ''; if (!empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT) && ($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 1 || $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT == 2)) { - print ''.$form->editfieldkey('Region-StateOrigine', 'state_id', '', $object, 0).''; + print ''.$form->editfieldkey('RegionStateOrigin', 'state_id', '', $object, 0).''; } else { print ''.$form->editfieldkey('StateOrigin', 'state_id', '', $object, 0).''; } diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 59d34f728b1..292690020b9 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -3807,11 +3807,11 @@ class Product extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps /** - * Verifie si c'est un sous-produit + * Check if it is a sub-product into a kit * - * @param int $fk_parent Id du produit auquel le produit est lie - * @param int $fk_child Id du produit lie - * @return int < 0 si erreur, > 0 si ok + * @param int $fk_parent Id of parent kit product + * @param int $fk_child Id of child product + * @return int <0 if KO, >0 if OK */ public function is_sousproduit($fk_parent, $fk_child) { @@ -3827,6 +3827,7 @@ class Product extends CommonObject if ($num > 0) { $obj = $this->db->fetch_object($result); + $this->is_sousproduit_qty = $obj->qty; $this->is_sousproduit_incdec = $obj->incdec; @@ -4221,17 +4222,26 @@ class Product extends CommonObject } /** - * Return all parent products for current product (first level only) + * Count all parent and children products for current product (first level only) * - * @return int Nb of father + child + * @param int $mode 0=Both parent and child, -1=Parents only, 1=Children only + * @return int Nb of father + child + * @see getFather(), get_sousproduits_arbo() */ - public function hasFatherOrChild() + public function hasFatherOrChild($mode = 0) { $nb = 0; $sql = "SELECT COUNT(pa.rowid) as nb"; $sql .= " FROM ".MAIN_DB_PREFIX."product_association as pa"; - $sql .= " WHERE pa.fk_product_fils = ".$this->id." OR pa.fk_product_pere = ".$this->id; + if ($mode == 0) { + $sql .= " WHERE pa.fk_product_fils = ".$this->id." OR pa.fk_product_pere = ".$this->id; + } elseif ($mode == -1) { + $sql .= " WHERE pa.fk_product_fils = ".$this->id; // We are a child, so we found lines that link to parents (can have several parents) + } elseif ($mode == 1) { + $sql .= " WHERE pa.fk_product_pere = ".$this->id; // We are a parent, so we found lines that link to children (can have several children) + } + $resql = $this->db->query($sql); if ($resql) { $obj = $this->db->fetch_object($resql); @@ -4297,6 +4307,7 @@ class Product extends CommonObject * Return all parent products for current product (first level only) * * @return array Array of product + * @see hasFatherOrChild() */ public function getFather() { diff --git a/htdocs/product/stats/commande.php b/htdocs/product/stats/commande.php index 4bedbd3d2ba..f89305b4d95 100644 --- a/htdocs/product/stats/commande.php +++ b/htdocs/product/stats/commande.php @@ -170,6 +170,7 @@ if ($id > 0 || !empty($ref)) if (!empty($search_year)) $option .= '&search_year='.urlencode($search_year); print '
'."\n"; + print ''; if (!empty($sortfield)) print ''; if (!empty($sortorder)) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 62fc287fba3..169ffd327ad 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -111,6 +111,8 @@ $hookmanager->initHooks(array('receptioncard', 'globalcard')); $permissiondellink = $user->rights->reception->creer; // Used by the include of actions_dellink.inc.php //var_dump($object->lines[0]->detail_batch); +$date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); + /* * Actions @@ -226,8 +228,6 @@ if (empty($reshook)) $object->size_units = GETPOST('size_units', 'int'); $object->weight_units = GETPOST('weight_units', 'int'); - $date_delivery = dol_mktime(GETPOST('date_deliveryhour', 'int'), GETPOST('date_deliverymin', 'int'), 0, GETPOST('date_deliverymonth', 'int'), GETPOST('date_deliveryday', 'int'), GETPOST('date_deliveryyear', 'int')); - // On va boucler sur chaque ligne du document d'origine pour completer objet reception // avec info diverses + qte a livrer @@ -777,8 +777,7 @@ if ($action == 'create') // Date delivery planned print ''.$langs->trans("DateDeliveryPlanned").''; print ''; - //print dol_print_date($object->date_livraison,"day"); // date_livraison come from order and will be stored into date_delivery planed. - $date_delivery = ($date_delivery ? $date_delivery : $object->date_livraison); // $date_delivery comes from GETPOST + $date_delivery = ($date_delivery ? $date_delivery : $object->delivery_date); // $date_delivery comes from GETPOST print $form->selectDate($date_delivery ? $date_delivery : -1, 'date_delivery', 1, 1, 1); print "\n"; print ''; diff --git a/htdocs/reception/list.php b/htdocs/reception/list.php index b99ba707251..4df73cce925 100644 --- a/htdocs/reception/list.php +++ b/htdocs/reception/list.php @@ -409,7 +409,7 @@ $formfile = new FormFile($db); $helpurl = 'EN:Module_Receptions|FR:Module_Receptions|ES:Módulo_Receptiones'; llxHeader('', $langs->trans('ListOfReceptions'), $helpurl); -$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as date_livraison, l.date_delivery as date_reception, e.fk_statut, e.billed,"; +$sql = "SELECT e.rowid, e.ref, e.ref_supplier, e.date_reception as date_reception, e.date_delivery as delivery_date, l.date_delivery as date_reception2, e.fk_statut, e.billed,"; $sql .= ' s.rowid as socid, s.nom as name, s.town, s.zip, s.fk_pays, s.client, s.code_client, '; $sql .= " typent.code as typent_code,"; $sql .= " state.code_departement as state_code, state.nom as state_name,"; @@ -499,21 +499,21 @@ if ($resql) $arrayofselected = is_array($toselect) ? $toselect : array(); $param = ''; - if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.$contextpage; - if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.$limit; - if ($sall) $param .= "&sall=".$sall; - if ($search_ref_rcp) $param .= "&search_ref_rcp=".$search_ref_rcp; - if ($search_ref_liv) $param .= "&search_ref_liv=".$search_ref_liv; - if ($search_company) $param .= "&search_company=".$search_company; - if ($optioncss != '') $param .= '&optioncss='.$optioncss; - if ($search_billed != '' && $search_billed >= 0)$param .= "&search_billed=".$search_billed; - if ($search_town) $param .= "&search_town=".$search_town; - if ($search_zip) $param .= "&search_zip=".$search_zip; - if ($search_state) $param .= "&search_state=".$search_state; - if ($search_status) $param .= "&search_status=".$search_status; - if ($search_country) $param .= "&search_country=".$search_country; - if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".$search_type_thirdparty; - if ($search_ref_supplier) $param .= "&search_ref_supplier=".$search_ref_supplier; + if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param .= '&contextpage='.urlencode($contextpage); + if ($limit > 0 && $limit != $conf->liste_limit) $param .= '&limit='.urlencode($limit); + if ($sall) $param .= "&sall=".urlencode($sall); + if ($search_ref_rcp) $param .= "&search_ref_rcp=".urlencode($search_ref_rcp); + if ($search_ref_liv) $param .= "&search_ref_liv=".urlencode($search_ref_liv); + if ($search_company) $param .= "&search_company=".urlencode($search_company); + if ($optioncss != '') $param .= '&optioncss='.urlencode($optioncss); + if ($search_billed != '' && $search_billed >= 0) $param .= "&search_billed=".urlencode($search_billed); + if ($search_town) $param .= "&search_town=".urlencode($search_town); + if ($search_zip) $param .= "&search_zip=".urlencode($search_zip); + if ($search_state) $param .= "&search_state=".urlencode($search_state); + if ($search_status) $param .= "&search_status=".urlencode($search_status); + if ($search_country) $param .= "&search_country=".urlencode($search_country); + if ($search_type_thirdparty) $param .= "&search_type_thirdparty=".urlencode($search_type_thirdparty); + if ($search_ref_supplier) $param .= "&search_ref_supplier=".urlencode($search_ref_supplier); // Add $param from extra fields foreach ($search_array_options as $key => $val) { @@ -838,7 +838,7 @@ if ($resql) if (!empty($arrayfields['e.date_delivery']['checked'])) { print ''; - print dol_print_date($db->jdate($obj->date_livraison), "day"); + print dol_print_date($db->jdate($obj->delivery_date), "day"); /*$now = time(); if ( ($now - $db->jdate($obj->date_reception)) > $conf->warnings->lim && $obj->statutid == 1 ) { diff --git a/htdocs/recruitment/recruitmentcandidature_document.php b/htdocs/recruitment/recruitmentcandidature_document.php index cd8e24118fc..1c801f27fd4 100644 --- a/htdocs/recruitment/recruitmentcandidature_document.php +++ b/htdocs/recruitment/recruitmentcandidature_document.php @@ -77,7 +77,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -if ($id > 0 || !empty($ref)) $upload_dir = $conf->recruitment->multidir_output[$object->entity ? $object->entity : $conf->entity]."/recruitmentcandidature/".dol_sanitizeFileName($object->ref); +if ($id > 0 || !empty($ref)) $upload_dir = $conf->recruitment->multidir_output[$object->entity ? $object->entity : $conf->entity]."/recruitmentcandidature/".get_exdir(0, 0, 0, 1, $object); // Security check - Protection if external user //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/recruitment/recruitmentjobposition_document.php b/htdocs/recruitment/recruitmentjobposition_document.php index a9c06f57b95..3005b4cc1be 100644 --- a/htdocs/recruitment/recruitmentjobposition_document.php +++ b/htdocs/recruitment/recruitmentjobposition_document.php @@ -77,7 +77,7 @@ $extrafields->fetch_name_optionals_label($object->table_element); // Load object include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals -if ($id > 0 || !empty($ref)) $upload_dir = $conf->recruitment->multidir_output[$object->entity ? $object->entity : $conf->entity]."/recruitmentjobposition/".dol_sanitizeFileName($object->ref); +if ($id > 0 || !empty($ref)) $upload_dir = $conf->recruitment->multidir_output[$object->entity ? $object->entity : $conf->entity]."/recruitmentjobposition/".get_exdir(0, 0, 0, 1, $object); // Security check - Protection if external user //if ($user->socid > 0) accessforbidden(); diff --git a/htdocs/societe/admin/societe.php b/htdocs/societe/admin/societe.php index 4a9c40acd11..ac26eed537a 100644 --- a/htdocs/societe/admin/societe.php +++ b/htdocs/societe/admin/societe.php @@ -198,6 +198,18 @@ if ($action == "setaddadressinlist") { } } +//Activate Set email phone town in contact list +if ($action == "setaddemailphonetownincontactlist") { + $val = GETPOST('value', 'int'); + $res = dolibarr_set_const($db, "CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST", $val, 'yesno', 0, '', $conf->entity); + if (!$res > 0) $error++; + if (!$error) { + setEventMessages($langs->trans("SetupSaved"), null, 'mesgs'); + } else { + setEventMessages($langs->trans("Error"), null, 'errors'); + } +} + //Activate Ask For Preferred Shipping Method if ($action == "setaskforshippingmet") { $setaskforshippingmet = GETPOST('value', 'int'); @@ -383,7 +395,7 @@ foreach ($arrayofmodules as $file => $modCodeTiers) } else { $disabled = (!empty($conf->multicompany->enabled) && (is_object($mc) && !empty($mc->sharings['referent']) && $mc->sharings['referent'] != $conf->entity) ? true : false); print ''; - if (!$disabled) print ''; + if (!$disabled) print ''; print img_picto($langs->trans("Disabled"), 'switch_off'); if (!$disabled) print ''; print ''; @@ -559,7 +571,7 @@ foreach ($dirsociete as $dirroot) print "\n"; //if ($conf->global->COMPANY_ADDON_PDF != "$name") //{ - print 'scandir.'&label='.urlencode($module->name).'">'; + print 'scandir.'&label='.urlencode($module->name).'">'; print img_picto($langs->trans("Enabled"), 'switch_on'); print ''; //} @@ -571,12 +583,12 @@ foreach ($dirsociete as $dirroot) } else { if (versioncompare($module->phpmin, versionphparray()) > 0) { - print "\n"; + print ''."\n"; print img_picto(dol_escape_htmltag($langs->trans("ErrorModuleRequirePHPVersion", join('.', $module->phpmin))), 'switch_off'); print ""; } else { - print "\n"; - print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; + print ''."\n"; + print 'scandir.'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').''; print ""; } } @@ -599,7 +611,7 @@ foreach ($dirsociete as $dirroot) print ''; if ($module->type == 'pdf') { - $linkspec = ''.img_object($langs->trans("Preview"), 'bill').''; + $linkspec = ''.img_object($langs->trans("Preview"), 'bill').''; } else { $linkspec = img_object($langs->trans("PreviewNotAvailable"), 'generic'); } @@ -800,6 +812,20 @@ if (!empty($conf->global->COMPANY_SHOW_ADDRESS_SELECTLIST)) print ''; print ''; +print ''; +print '' . $langs->trans("AddEmailPhoneTownInContactList") . ''; +print ' '; +print ''; +if (!empty($conf->global->CONTACT_SHOW_EMAIL_PHONE_TOWN_SELECTLIST)) { + print ''; + print img_picto($langs->trans("Activated"), 'switch_on'); +} else { + print ''; + print img_picto($langs->trans("Disabled"), 'switch_off'); +} +print ''; +print ''; + if (!empty($conf->expedition->enabled)) { if (!empty($conf->global->MAIN_FEATURES_LEVEL)) { // Visible on experimental only because seems to not be implemented everywhere (only on proposal) print ''; diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 5a5e73a1927..eb918d8b3b4 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -257,7 +257,7 @@ if (empty($reshook)) { if ($object->fetch(GETPOST('copie_supplier_proposal')) > 0) { $object->ref = GETPOST('ref'); - $object->date_livraison = $date_delivery; + $object->date_livraison = $date_delivery; // deprecated $object->delivery_date = $date_delivery; $object->shipping_method_id = GETPOST('shipping_method_id', 'int'); $object->cond_reglement_id = GETPOST('cond_reglement_id'); @@ -1565,11 +1565,11 @@ if ($action == 'create') print ''; print ''; print ''; - print $form->selectDate($object->date_livraison, 'liv_', '', '', '', "editdate_livraison"); + print $form->selectDate($object->delivery_date, 'liv_', '', '', '', "editdate_livraison"); print ''; print '
'; } else { - print dol_print_date($object->date_livraison, 'daytext'); + print dol_print_date($object->delivery_date, 'daytext'); } print ''; print ''; diff --git a/htdocs/supplier_proposal/class/supplier_proposal.class.php b/htdocs/supplier_proposal/class/supplier_proposal.class.php index 59305cf7548..74bbf1afa7e 100644 --- a/htdocs/supplier_proposal/class/supplier_proposal.class.php +++ b/htdocs/supplier_proposal/class/supplier_proposal.class.php @@ -109,6 +109,12 @@ class SupplierProposal extends CommonObject */ public $date; + /** + * @var integer|string date_livraison + * @deprecated + */ + public $date_livraison; + /** * @var integer|string date_livraison */ @@ -855,8 +861,6 @@ class SupplierProposal extends CommonObject dol_syslog(get_class($this)."::create ".$this->error, LOG_ERR); return -3; } - - // Check parameters if (!empty($this->ref)) // We check that ref is not already used { $result = self::isExistingObject($this->element, 0, $this->ref); // Check ref is not yet used @@ -869,6 +873,9 @@ class SupplierProposal extends CommonObject } } + // Set tmp vars + $delivery_date = empty($this->delivery_date) ? $this->date_livraison : $this->delivery_date; + // Multicurrency if (!empty($this->multicurrency_code)) list($this->fk_multicurrency, $this->multicurrency_tx) = MultiCurrency::getIdAndTxFromCode($this->db, $this->multicurrency_code, $now); if (empty($this->fk_multicurrency)) @@ -923,7 +930,7 @@ class SupplierProposal extends CommonObject $sql .= ", ".($this->cond_reglement_id > 0 ? $this->cond_reglement_id : 'NULL'); $sql .= ", ".($this->mode_reglement_id > 0 ? $this->mode_reglement_id : 'NULL'); $sql .= ", ".($this->fk_account > 0 ? $this->fk_account : 'NULL'); - $sql .= ", ".($this->date_livraison != '' ? "'".$this->db->idate($this->date_livraison)."'" : "null"); + $sql .= ", ".($delivery_date ? "'".$this->db->idate($delivery_date)."'" : "null"); $sql .= ", ".($this->shipping_method_id > 0 ? $this->shipping_method_id : 'NULL'); $sql .= ", ".($this->fk_project ? $this->fk_project : "null"); $sql .= ", ".$conf->entity; @@ -1256,7 +1263,7 @@ class SupplierProposal extends CommonObject $this->datev = $this->db->jdate($obj->datev); // TODO deprecated $this->date_creation = $this->db->jdate($obj->datec); //Creation date $this->date_validation = $this->db->jdate($obj->datev); //Validation date - $this->date_livraison = $this->db->jdate($obj->delivery_date); + $this->date_livraison = $this->db->jdate($obj->delivery_date); // deprecated $this->delivery_date = $this->db->jdate($obj->delivery_date); $this->shipping_method_id = ($obj->fk_shipping_method > 0) ? $obj->fk_shipping_method : null; @@ -1538,6 +1545,7 @@ class SupplierProposal extends CommonObject if ($this->db->query($sql)) { $this->date_livraison = $delivery_date; + $this->delivery_date = $delivery_date; return 1; } else { $this->error = $this->db->error();