diff --git a/ChangeLog b/ChangeLog index 9b91afd128f..70144f80733 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,20 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 11.0.0 compared to 10.0.0 ***** +For Users: + + +For Developers: + + +WARNING: + +Following changes may create regressions for some external modules, but were necessary to make Dolibarr better: +* Properties ->libelle_incoterms were renamed into ->label_incoterms + + + ***** ChangeLog for 10.0.0 compared to 9.0.0 ***** For Users: NEW: Module "Ticket" is available as a stable module. @@ -58,7 +72,7 @@ NEW: Can generate invoices from the timespent entered on a project NEW: Can update product supplier price ref NEW: Can upload files from the edit page of expense report NEW: Color for hover and for checked line is on by default -NEW: Column of parent company is available in list of third parties +NEW: Column of p...arent company is available in list of third parties NEW: conditionnal add member button by statut NEW: constant KEEP_DISCOUNT_LINES_FROM_ORIGIN NEW: Contact related items tab @@ -182,6 +196,55 @@ Following changes may create regressions for some external modules, but were nec called $dolibarr_main_instance_unique_id is now generated at each installation. It will be used by some future features. +***** ChangeLog for 9.0.4 compared to 9.0.3 ***** +FIX: #5249 +FIX: #11025 +FIX: #11032 +FIX: #11097 +FIX: #11169 +FIX: #11202 +FIX: #11244 +FIX: #11296 +FIX: #11316 +FIX: #11335 +FIX: Add missing end date of subscription in export +FIX: A user may read holiday and expense report without permissions +FIX: better syntax +FIX: condition +FIX: confirmation of mass email sending + option MAILING_NO_USING_PHPMAIL +FIX: crabe pdf: bad detailed VAT for situation invoices, in situations S2 and above +FIX: default value for duration of validity can be set from generic +FIX: do not include tpl from disabled modules +FIX: Error management when MAILING_NO_USING_PHPMAIL is set +FIX: Even with permission, can't validate leave once validator defined. +FIX: extrafield list search: SQL error when field is multiselect +FIX: if last char of customercode is accent making the truncate of first +FIX: Import of chart of account +FIX: in edit mode, dictionary inputs do not escape the string inside the 'value' attribute, causing errors if there are any double quotes +FIX: invalid link on user.fk_user +FIX: invoice class: bad SQL request if product type not set +FIX: javascript error when ckeditor module not enabled +FIX: mail presend: can overwrite a file previously uploaded (Issue #11056) +FIX: mass send mail +FIX: missing compatibility with multicompany transverse mode +FIX: missing llx_const encrypt +FIX: modulebuilder: hardcoded llx_ +FIX: Not showing Contract and Project columns on ficheinter list +FIX: only profid1 to 4 were editable for pdf option to show. Not 5 and 6. +FIX: productaccount buylist with pages +FIX: remove isolated transaction commit +FIX: security (a user can read leave or holiday of other without perm. +FIX: situation invoices: bad detailed VAT in situations following the first one +FIX: situation invoices: block progress percentage change for discount lines +FIX: syntax error +FIX: the id was not loaded in fetch of accounting system +FIX: try to use WHERE EXISTS instead of DISTINCT +FIX: use dol_sanitizeFileName() function to remove double spaces in filenames, as well as done on document.php when we want to download pdf +FIX: Use of cron with multicompany +FIX: var name +FIX: we need to fetch fourn invoice with ref in current entity +FIX: Wrong stock movement on supplier credit notes +FIX: Import of record in ledger ***** ChangeLog for 9.0.3 compared to 9.0.2 ***** FIX: #11013 diff --git a/build/debian/copyright b/build/debian/copyright index 72e531d7007..a5832aa7754 100644 --- a/build/debian/copyright +++ b/build/debian/copyright @@ -52,7 +52,7 @@ License: GPL-3+ details. . You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 3 can be found in the file @@ -98,7 +98,7 @@ License: GPL-2+ GNU General Public License for more details. . You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . . On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2 file. @@ -192,7 +192,7 @@ License: GPL-2+ details. . You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file @@ -212,7 +212,7 @@ License: LGPL-2.1+ Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . + along with this program. If not, see . . On Debian systems, the full text of the GNU Lesser General Public License version 2.1 can be found in the file @@ -236,7 +236,7 @@ License: GPL-2+ or MIT details. . You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file @@ -291,7 +291,7 @@ License: GPL-2+ details. . You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file @@ -311,7 +311,7 @@ License: LGPL-2.1+ Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . + along with this program. If not, see . . On Debian systems, the full text of the GNU Lesser General Public License version 2.1 can be found in the file @@ -358,7 +358,7 @@ License: LGPL-2.1+ Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License - along with this program. If not, see . + along with this program. If not, see . . On Debian systems, the full text of the GNU Lesser General Public License version 2.1 can be found in the file @@ -378,7 +378,7 @@ License: LGPL-3.0+ See the GNU Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License - along with TCPDF. If not, see . + along with TCPDF. If not, see . . On Debian systems, the complete text of the GNU Lesser General Public License version 3 can be found in "/usr/share/common-licenses/LGPL-3". diff --git a/build/generate_filelist_xml.php b/build/generate_filelist_xml.php index 88b194f362b..d5af14f9171 100755 --- a/build/generate_filelist_xml.php +++ b/build/generate_filelist_xml.php @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ /** @@ -106,6 +106,7 @@ if (empty($includecustom)) { } print "Release : ".$release."\n"; +print "Working on files into : ".DOL_DOCUMENT_ROOT."\n"; print "Include custom in signature : ".$includecustom."\n"; print "Include constants in signature : "; foreach ($includeconstants as $countrycode => $tmp) { diff --git a/dev/examples/code/create_invoice.php b/dev/examples/code/create_invoice.php index 792341f5c79..dbbe9d84c1c 100755 --- a/dev/examples/code/create_invoice.php +++ b/dev/examples/code/create_invoice.php @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ /** diff --git a/dev/examples/code/create_order.php b/dev/examples/code/create_order.php index fa3fa573223..30265d5462e 100755 --- a/dev/examples/code/create_order.php +++ b/dev/examples/code/create_order.php @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ /** diff --git a/dev/examples/code/create_product.php b/dev/examples/code/create_product.php index 7ca09246980..234658388df 100755 --- a/dev/examples/code/create_product.php +++ b/dev/examples/code/create_product.php @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ /** diff --git a/dev/examples/code/create_user.php b/dev/examples/code/create_user.php index 2fed1a51972..96d369085d2 100755 --- a/dev/examples/code/create_user.php +++ b/dev/examples/code/create_user.php @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ /** diff --git a/dev/examples/code/get_contracts.php b/dev/examples/code/get_contracts.php index eafc0dfeed5..aec246e9480 100755 --- a/dev/examples/code/get_contracts.php +++ b/dev/examples/code/get_contracts.php @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ /** diff --git a/dev/initdata/generate-invoice.php b/dev/initdata/generate-invoice.php index 0f04a4d236f..bfdda2896a1 100755 --- a/dev/initdata/generate-invoice.php +++ b/dev/initdata/generate-invoice.php @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * ATTENTION DE PAS EXECUTER CE SCRIPT SUR UNE INSTALLATION DE PRODUCTION */ diff --git a/dev/initdata/generate-order.php b/dev/initdata/generate-order.php index f07905f1edd..b66d3a3abc9 100755 --- a/dev/initdata/generate-order.php +++ b/dev/initdata/generate-order.php @@ -14,7 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * ATTENTION DE PAS EXECUTER CE SCRIPT SUR UNE INSTALLATION DE PRODUCTION */ diff --git a/dev/initdata/generate-product.php b/dev/initdata/generate-product.php index 9e1b15331d4..e9703fbfd6e 100755 --- a/dev/initdata/generate-product.php +++ b/dev/initdata/generate-product.php @@ -14,7 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * ATTENTION DE PAS EXECUTER CE SCRIPT SUR UNE INSTALLATION DE PRODUCTION */ diff --git a/dev/initdata/generate-proposal.php b/dev/initdata/generate-proposal.php index 4bd9c2c654b..30c9471a281 100755 --- a/dev/initdata/generate-proposal.php +++ b/dev/initdata/generate-proposal.php @@ -14,7 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * ATTENTION DE PAS EXECUTER CE SCRIPT SUR UNE INSTALLATION DE PRODUCTION */ diff --git a/dev/initdata/generate-thirdparty.php b/dev/initdata/generate-thirdparty.php index cc2e85e544a..54e17c7f8d7 100755 --- a/dev/initdata/generate-thirdparty.php +++ b/dev/initdata/generate-thirdparty.php @@ -14,7 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * ATTENTION DE PAS EXECUTER CE SCRIPT SUR UNE INSTALLATION DE PRODUCTION */ diff --git a/dev/initdata/import-products.php b/dev/initdata/import-products.php index fa9cfd6592b..e55f13c7c82 100755 --- a/dev/initdata/import-products.php +++ b/dev/initdata/import-products.php @@ -14,7 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE */ diff --git a/dev/initdata/import-thirdparties.php b/dev/initdata/import-thirdparties.php index 8826ca18544..558745e8d06 100755 --- a/dev/initdata/import-thirdparties.php +++ b/dev/initdata/import-thirdparties.php @@ -14,7 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE */ diff --git a/dev/initdata/import-users.php b/dev/initdata/import-users.php index 34130890f4b..64af2f9eb64 100755 --- a/dev/initdata/import-users.php +++ b/dev/initdata/import-users.php @@ -14,7 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * WARNING, THIS WILL LOAD MASS DATA ON YOUR INSTANCE */ diff --git a/dev/initdata/purge-data.php b/dev/initdata/purge-data.php index 42d6d28eadf..62f41ce825f 100755 --- a/dev/initdata/purge-data.php +++ b/dev/initdata/purge-data.php @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * THIS SCRIPT DELETE ALL MAIN TABLE CONTENT * WARNING, DO NOT USE ON A PRODUCTION INSTANCE diff --git a/dev/initdemo/sftpget_and_loaddump.php b/dev/initdemo/sftpget_and_loaddump.php index e261895b617..e5ade3aa2f6 100755 --- a/dev/initdemo/sftpget_and_loaddump.php +++ b/dev/initdemo/sftpget_and_loaddump.php @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * or see http://www.gnu.org/ * * Get a distant dump file and load it into a mysql database diff --git a/dev/initdemo/updatedemo.php b/dev/initdemo/updatedemo.php index 53ae2251f35..dcaa44c43a6 100755 --- a/dev/initdemo/updatedemo.php +++ b/dev/initdemo/updatedemo.php @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * or see http://www.gnu.org/ * * Get a distant dump file and load it into a mysql database diff --git a/dev/resources/licence/Links on GPL.txt b/dev/resources/licence/Links on GPL.txt index 1bb3053da2a..bb9c1597f68 100644 --- a/dev/resources/licence/Links on GPL.txt +++ b/dev/resources/licence/Links on GPL.txt @@ -1,8 +1,8 @@ * Page with licence compatibility -http://www.gnu.org/licenses/quick-guide-gplv3.fr.html +https://www.gnu.org/licenses/quick-guide-gplv3.fr.html * FAQ on GPL licence -http://www.fsf.org/licensing/licenses/gpl-faq.html +https://www.fsf.org/licensing/licenses/gpl-faq.html * Questions/Answers on Fork for using Dolibarr as a SaaS -http://stackoverflow.com/questions/539291/rebranding-a-gpld-app-as-saas +https://stackoverflow.com/questions/539291/rebranding-a-gpld-app-as-saas diff --git a/dev/translation/autotranslator.class.php b/dev/translation/autotranslator.class.php index 789bd8173c4..f9657482c86 100644 --- a/dev/translation/autotranslator.class.php +++ b/dev/translation/autotranslator.class.php @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ /** diff --git a/dev/translation/autotranslator.php b/dev/translation/autotranslator.php index eb0f53ead65..5e8cc13c3c8 100755 --- a/dev/translation/autotranslator.php +++ b/dev/translation/autotranslator.php @@ -13,7 +13,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ /** diff --git a/dev/translation/sanity_check_en_langfiles.php b/dev/translation/sanity_check_en_langfiles.php index 4db931f7dae..7f095a744db 100755 --- a/dev/translation/sanity_check_en_langfiles.php +++ b/dev/translation/sanity_check_en_langfiles.php @@ -15,7 +15,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . */ $sapi_type = php_sapi_name(); diff --git a/dev/translation/strip_language_file.php b/dev/translation/strip_language_file.php index d439397a512..ce28ca5de63 100755 --- a/dev/translation/strip_language_file.php +++ b/dev/translation/strip_language_file.php @@ -14,7 +14,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * ----- * diff --git a/htdocs/accountancy/admin/accountmodel.php b/htdocs/accountancy/admin/accountmodel.php index 102d268e218..527cb13fcfd 100644 --- a/htdocs/accountancy/admin/accountmodel.php +++ b/htdocs/accountancy/admin/accountmodel.php @@ -4,7 +4,7 @@ * Copyright (C) 2004 Benoit Mortier * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2010-2016 Juanjo Menent - * Copyright (C) 2011-2018 Philippe Grand + * Copyright (C) 2011-2019 Philippe Grand * Copyright (C) 2011 Remy Younes * Copyright (C) 2012-2015 Marcos García * Copyright (C) 2012 Christophe Battarel diff --git a/htdocs/accountancy/admin/fiscalyear_info.php b/htdocs/accountancy/admin/fiscalyear_info.php index dfec49949a3..8a5213f5ab8 100644 --- a/htdocs/accountancy/admin/fiscalyear_info.php +++ b/htdocs/accountancy/admin/fiscalyear_info.php @@ -12,7 +12,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, seehttp://www.gnu.org/licenses/>. + * along with this program. If not, see . */ /** diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index 4fc30bb0c30..0c92bcb8950 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -104,7 +104,7 @@ $formaccounting = new FormAccounting($db); $formother = new FormOther($db); $form = new Form($db); -if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && ! GETPOST('noreset', 'int')) +if (! in_array($action, array('export_file', 'delmouv', 'delmouvconfirm')) && ! isset($_POST['begin']) && ! isset($_GET['begin']) && ! isset($_POST['formfilteraction']) && GETPOST('page', 'int') == '' && ! GETPOST('noreset', 'int') && $user->rights->accounting->mouvements->export) { if (empty($search_date_start) && empty($search_date_end) && ! GETPOSTISSET('restore_lastsearch_values')) { @@ -300,7 +300,7 @@ if (! empty($search_lettering_code)) { } -if ($action == 'delbookkeeping') { +if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) { $import_key = GETPOST('importkey', 'alpha'); @@ -315,7 +315,7 @@ if ($action == 'delbookkeeping') { exit; } } -if ($action == 'delbookkeepingyearconfirm') { +if ($action == 'delbookkeepingyearconfirm' && $user->rights->accounting->mouvements->supprimer_tous) { $delyear = GETPOST('delyear', 'int'); if ($delyear==-1) { @@ -346,7 +346,7 @@ if ($action == 'delbookkeepingyearconfirm') { setEventMessages("NoRecordDeleted", null, 'warnings'); } } -if ($action == 'delmouvconfirm') { +if ($action == 'delmouvconfirm' && $user->rights->accounting->mouvements->supprimer) { $mvt_num = GETPOST('mvt_num', 'int'); @@ -366,7 +366,8 @@ if ($action == 'delmouvconfirm') { } // Export into a file with format defined into setup (FEC, CSV, ...) -if ($action == 'export_file') { +if ($action == 'export_file' && $user->rights->accounting->mouvements->export) { + $result = $object->fetchAll($sortorder, $sortfield, 0, 0, $filter, 'AND', $conf->global->ACCOUNTING_REEXPORT); if ($result < 0) @@ -514,11 +515,11 @@ if (! empty($conf->global->ACCOUNTING_REEXPORT)) { } $newcardbutton.= ''.$langs->trans("IncludeDocsAlreadyExported").''; -$newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:'')); +$newcardbutton.= dolGetButtonTitle($buttonLabel, $langs->trans("ExportFilteredList").' ('.$listofformat[$conf->global->ACCOUNTING_EXPORT_MODELCSV].')', 'fa fa-file-export paddingleft', $_SERVER["PHP_SELF"].'?action=export_file'.($param?'&'.$param:''), $user->rights->accounting->mouvements->export); $newcardbutton.= dolGetButtonTitle($langs->trans('GroupByAccountAccounting'), '', 'fa fa-stream paddingleft', DOL_URL_ROOT.'/accountancy/bookkeeping/listbyaccount.php?'.$param); -$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create'); +$newcardbutton.= dolGetButtonTitle($langs->trans('NewAccountingMvt'), '', 'fa fa-plus-circle paddingleft', './card.php?action=create', '', $user->rights->accounting->mouvements->creer); print_barre_liste($title_page, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $result, $nbtotalofrecords, 'title_accountancy', 0, $newcardbutton, '', $limit); @@ -818,12 +819,17 @@ if ($num > 0) // Action column print ''; - if(empty($line->date_export)) { - print '' . img_edit() . ' '; - print '' . img_delete() . ''; + if (empty($line->date_export)) { + if ($user->rights->accounting->mouvements->creer) { + print '' . img_edit() . ''; + } + if ($user->rights->accounting->mouvements->supprimer) { + print ' ' . img_delete() . ''; + } } - print ''; - if (! $i) $totalarray['nbfield']++; + print ''; + + if (! $i) $totalarray['nbfield']++; print "\n"; @@ -855,10 +861,11 @@ print ""; print ''; // TODO Replace this with mass delete action -print '
' . "\n"; -print '' . $langs->trans("DeleteMvt") . ''; -print '
'; - +if ($user->rights->accounting->mouvements->supprimer_tous) { + print '
' . "\n"; + print '' . $langs->trans("DeleteMvt") . ''; + print '
'; +} print ''; diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index cfe49764c74..cb8c35f0416 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -8,8 +8,8 @@ * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017-2018 Frédéric France - * Copyright (C) 2018 Ferran Marcet - * Copyright (C) 2018 Eric Seigne + * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Eric Seigne * * 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 diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 3aed4bc11d5..c6dda99dcb2 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -502,7 +502,7 @@ if (empty($reshook)) // Check parameters if (empty($morphy) || $morphy == "-1") { $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Nature")), null, 'errors'); + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MemberNature")), null, 'errors'); } // Tests if the login already exists if (empty($conf->global->ADHERENT_LOGIN_NOT_REQUIRED)) @@ -941,7 +941,7 @@ else // Morphy $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Moral"); - print ''.$langs->trans("Nature")."\n"; + print ''.$langs->trans("MemberNature")."\n"; print $form->selectarray("morphy", $morphys, GETPOST('morphy', 'alpha')?GETPOST('morphy', 'alpha'):$object->morphy, 1); print "\n"; @@ -1059,11 +1059,17 @@ else // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - - print ''; + //Hooks here + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) + { + print $object->showOptionals($extrafields, 'edit'); + } + + print ''; print "\n"; - - dol_fiche_end(); + dol_fiche_end(); print '
'; print ''; @@ -1182,7 +1188,7 @@ else // Morphy $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Morale"); - print ''.$langs->trans("Nature").''; + print ''.$langs->trans("MemberNature").''; print $form->selectarray("morphy", $morphys, (GETPOSTISSET("morphy")?GETPOST("morphy", 'alpha'):$object->morphy)); print ""; @@ -1357,9 +1363,15 @@ else // Other attributes include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php'; - + //Hooks here + $reshook=$hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + if (empty($reshook)) + { + print $object->showOptionals($extrafields, 'edit'); + } + print ''; - dol_fiche_end(); print '
'; @@ -1613,7 +1625,7 @@ else print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("Nature").''.$object->getmorphylib().''; + print ''.$langs->trans("MemberNature").''.$object->getmorphylib().''; print ''; // Gender diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 06a5aa3e598..1e940df2e26 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -2124,28 +2124,28 @@ class Adherent extends CommonObject $link.=$linkclose.'>'; $linkend=''; - //if ($withpictoimg == -1) $result.='
'; $result.=$link; + if ($withpictoimg) $result.='
'; if ($withpictoimg) { $paddafterimage=''; if (abs($withpictoimg) == 1) $paddafterimage='style="margin-right: 3px;"'; // Only picto - if ($withpictoimg > 0) $picto='
'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).'
'; + if ($withpictoimg > 0) $picto=''.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"'), 0, 0, $notooltip?0:1).''; // Picto must be a photo - else $picto='
'.Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).'
'; + else $picto=''.Form::showphoto('memberphoto', $this, 0, 0, 0, 'userphoto'.($withpictoimg==-3?'small':''), 'mini', 0, 1).''; $result.=$picto; } if ($withpictoimg > -2 && $withpictoimg != 2) { - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='
'; + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.=''; if ($mode == 'login') $result.=dol_trunc($this->login, $maxlen); elseif ($mode == 'ref') $result.=$this->id; else $result.=$this->getFullName($langs, '', ($mode == 'firstname' ? 2 : -1), $maxlen); - if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.='
'; + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $result.=''; } + if ($withpictoimg) $result.='
'; $result.=$linkend; - //if ($withpictoimg == -1) $result.='
'; return $result; } diff --git a/htdocs/adherents/class/api_members.class.php b/htdocs/adherents/class/api_members.class.php index e5b93c4bfd1..7ad51fdcfda 100644 --- a/htdocs/adherents/class/api_members.class.php +++ b/htdocs/adherents/class/api_members.class.php @@ -304,7 +304,7 @@ class Members extends DolibarrApi // Remove the subscriptions because they are handled as a subresource. unset($object->subscriptions); unset($object->fk_incoterms); - unset($object->libelle_incoterms); + unset($object->label_incoterms); unset($object->location_incoterms); unset($object->fk_delivery_address); unset($object->shipping_method_id); diff --git a/htdocs/adherents/class/api_memberstypes.class.php b/htdocs/adherents/class/api_memberstypes.class.php index abfaf84993d..80b7d738ad7 100644 --- a/htdocs/adherents/class/api_memberstypes.class.php +++ b/htdocs/adherents/class/api_memberstypes.class.php @@ -307,7 +307,7 @@ class MembersTypes extends DolibarrApi unset($object->note_public); unset($object->note_private); unset($object->fk_incoterms); - unset($object->libelle_incoterms); + unset($object->label_incoterms); unset($object->location_incoterms); unset($object->name); unset($object->lastname); diff --git a/htdocs/adherents/document.php b/htdocs/adherents/document.php index 2de98e1b96a..72a1bd0d569 100644 --- a/htdocs/adherents/document.php +++ b/htdocs/adherents/document.php @@ -127,7 +127,7 @@ if ($id > 0) print ''.$langs->trans("Type").''.$membert->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("Nature").''.$object->getmorphylib().''; + print ''.$langs->trans("MemberNature").''.$object->getmorphylib().''; /*print ''; print $form->showphoto('memberphoto',$object); print '';*/ diff --git a/htdocs/adherents/note.php b/htdocs/adherents/note.php index b3e18f543be..ce2918cb86a 100644 --- a/htdocs/adherents/note.php +++ b/htdocs/adherents/note.php @@ -92,7 +92,7 @@ if ($id) print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("Nature").''.$object->getmorphylib().''; + print ''.$langs->trans("MemberNature").''.$object->getmorphylib().''; /*print ''; print $form->showphoto('memberphoto',$member); print '';*/ diff --git a/htdocs/adherents/subscription.php b/htdocs/adherents/subscription.php index b28a8b31f2c..ab8206c66b8 100644 --- a/htdocs/adherents/subscription.php +++ b/htdocs/adherents/subscription.php @@ -490,7 +490,7 @@ if ($rowid > 0) print ''.$langs->trans("Type").''.$adht->getNomUrl(1)."\n"; // Morphy - print ''.$langs->trans("Nature").''.$object->getmorphylib().''; + print ''.$langs->trans("MemberNature").''.$object->getmorphylib().''; print ''; // Company @@ -667,7 +667,7 @@ if ($rowid > 0) */ if ($action != 'addsubscription' && $action != 'create_thirdparty') { - $sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe,"; + $sql = "SELECT d.rowid, d.firstname, d.lastname, d.societe, d.fk_adherent_type as type,"; $sql.= " c.rowid as crowid, c.subscription,"; $sql.= " c.datec, c.fk_type as cfk_type,"; $sql.= " c.dateadh as dateh,"; @@ -705,26 +705,30 @@ if ($rowid > 0) print "\n"; $accountstatic=new Account($db); + $adh = new Adherent($db); $adht = new AdherentType($db); while ($i < $num) { $objp = $db->fetch_object($result); + $adh->id = $objp->rowid; + $adh->typeid = $objp->type; + $subscriptionstatic->ref=$objp->crowid; $subscriptionstatic->id=$objp->crowid; - if ($objp->cfk_type > 0) + $typeid = ($objp->cfk_type > 0 ? $objp->cfk_type : $adh->typeid); + if ($typeid > 0) { - $adht->fetch($objp->cfk_type); + $adht->fetch($typeid); } print ''; print ''.$subscriptionstatic->getNomUrl(1).''; print ''.dol_print_date($db->jdate($objp->datec), 'dayhour')."\n"; print ''; - if ($objp->cfk_type > 0) - { + if ($typeid > 0) { print $adht->getNomUrl(1); } print ''; diff --git a/htdocs/adherents/subscription/card.php b/htdocs/adherents/subscription/card.php index 31cf3020765..a8478f35e88 100644 --- a/htdocs/adherents/subscription/card.php +++ b/htdocs/adherents/subscription/card.php @@ -313,8 +313,9 @@ if ($rowid && $action != 'edit') print ''; print ''.$langs->trans("Type").''; print ''; - if (! empty($object->fk_type) ) { - $adht->fetch($object->fk_type); + if ($object->fk_type > 0 || $adh->typeid > 0) { + $typeid = ($object->fk_type > 0 ? $object->fk_type : $adh->typeid); + $adht->fetch($typeid); print $adht->getNomUrl(1); } else { print $langs->trans("NoType"); @@ -345,7 +346,7 @@ if ($rowid && $action != 'edit') // Amount print ''.$langs->trans("Amount").''.price($object->amount).''; - // Amount + // Label print ''.$langs->trans("Label").''.$object->note.''; // Bank line diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index a55aadfe9cb..16d92b20c5e 100644 --- a/htdocs/adherents/subscription/list.php +++ b/htdocs/adherents/subscription/list.php @@ -142,7 +142,7 @@ $accountstatic=new Account($db); $now=dol_now(); // List of subscriptions -$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo,"; +$sql = "SELECT d.rowid, d.login, d.firstname, d.lastname, d.societe, d.photo, d.statut,"; $sql.= " c.rowid as crowid, c.fk_type, c.subscription,"; $sql.= " c.dateadh, c.datef, c.datec as date_creation, c.tms as date_update,"; $sql.= " c.fk_bank as bank, c.note,"; @@ -225,7 +225,7 @@ $param=''; if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.urlencode($contextpage); if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.urlencode($limit); if ($statut != '') $param.="&statut=".urlencode($statut); -if ($search_type) $param.="&search_type=".urlencode($search_type); +if ($search_type) $param.="&search_type=".urlencode($search_type); if ($date_select) $param.="&date_select=".urlencode($date_select); if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname); if ($search_login) $param.="&search_login=".urlencode($search_login); @@ -298,33 +298,33 @@ if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) if (! empty($arrayfields['d.ref']['checked'])) { print ''; - print ''; + print ''; } // Type if (! empty($arrayfields['d.fk_type']['checked'])) { print ''; - print ''; + print ''; print''; } if (! empty($arrayfields['d.lastname']['checked'])) { print ''; - print ''; + print ''; } if (! empty($arrayfields['d.firstname']['checked'])) { print ''; - print ''; + print ''; } if (! empty($arrayfields['d.login']['checked'])) { print ''; - print ''; + print ''; } if (! empty($arrayfields['t.libelle']['checked'])) @@ -409,23 +409,23 @@ if (! empty($arrayfields['d.login']['checked'])) } if (! empty($arrayfields['t.libelle']['checked'])) { - print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "c.note", $param, "", 'align="left"', $sortfield, $sortorder); + print_liste_field_titre("Label", $_SERVER["PHP_SELF"], "c.note", $param, "", '', $sortfield, $sortorder); } if (! empty($arrayfields['d.bank']['checked'])) { - print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "b.fk_account", $pram, "", "", $sortfield, $sortorder); + print_liste_field_titre("Account", $_SERVER["PHP_SELF"], "b.fk_account", $param, "", "", $sortfield, $sortorder); } if (! empty($arrayfields['c.dateadh']['checked'])) { - print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "c.dateadh", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("DateStart", $_SERVER["PHP_SELF"], "c.dateadh", $param, "", '', $sortfield, $sortorder, 'center nowraponall '); } if (! empty($arrayfields['c.datef']['checked'])) { - print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "c.datef", $param, "", 'align="center"', $sortfield, $sortorder); + print_liste_field_titre("DateEnd", $_SERVER["PHP_SELF"], "c.datef", $param, "", '', $sortfield, $sortorder, 'center nowraponall '); } if (! empty($arrayfields['d.amount']['checked'])) { - print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "c.subscription", $param, "", 'class="right"', $sortfield, $sortorder); + print_liste_field_titre("Amount", $_SERVER["PHP_SELF"], "c.subscription", $param, "", '', $sortfield, $sortorder, 'right '); } // Extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php'; @@ -457,9 +457,11 @@ while ($i < min($num, $limit)) $adherent->statut=$obj->statut; $adherent->login=$obj->login; $adherent->photo=$obj->photo; + $adherent->typeid=$obj->type; + $typeid = ($obj->fk_type > 0 ? $obj->fk_type : $adherent->typeid); $adht = new AdherentType($db); - $adht->fetch($obj->fk_type); + $adht->fetch($typeid); print ''; @@ -473,7 +475,10 @@ while ($i < min($num, $limit)) if (! empty($arrayfields['d.fk_type']['checked'])) { print ''; - if ( ! empty($obj->fk_type) ) print $adht->getNomUrl(1); + if ($typeid > 0) + { + print $adht->getNomUrl(1); + } print ''; if (! $i) $totalarray['nbfield']++; } diff --git a/htdocs/adherents/type.php b/htdocs/adherents/type.php index 650a466140c..19790159c22 100644 --- a/htdocs/adherents/type.php +++ b/htdocs/adherents/type.php @@ -258,7 +258,7 @@ if (! $rowid && $action != 'create' && $action != 'edit') print ''; print ''.$langs->trans("Ref").''; print ''.$langs->trans("Label").''; - print ''.$langs->trans("Nature").''; + print ''.$langs->trans("MemberNature").''; print ''.$langs->trans("SubscriptionRequired").''; print ''.$langs->trans("VoteAllowed").''; print ''.$langs->trans("Status").''; @@ -338,12 +338,12 @@ if ($action == 'create') print ''.$langs->trans("Status").''; print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), 1); print ''; - + // Morphy - $morphys[""] = $langs->trans("Physical & Morale"); + $morphys[""] = $langs->trans("MorPhy"); $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Morale"); - print ''.$langs->trans("Nature").''; + print ''.$langs->trans("MemberNature").''; print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy); print ""; @@ -427,9 +427,9 @@ if ($rowid > 0) print img_picto($langs->trans('TypeStatusInactive'), 'statut5').' '.$langs->trans("ActivityCeased"); } print ''; - + // Morphy - print ''.$langs->trans("Nature").''.$object->getmorphylib($object->morphy).''; + print ''.$langs->trans("MemberNature").''.$object->getmorphylib($object->morphy).''; print ''; print ''.$langs->trans("SubscriptionRequired").''; @@ -630,7 +630,7 @@ if ($rowid > 0) print ''; print_liste_field_titre("NameSlashCompany", $_SERVER["PHP_SELF"], "d.lastname", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Login", $_SERVER["PHP_SELF"], "d.login", $param, "", "", $sortfield, $sortorder); - print_liste_field_titre("Nature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder); + print_liste_field_titre("MemberNature", $_SERVER["PHP_SELF"], "d.morphy", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("EMail", $_SERVER["PHP_SELF"], "d.email", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("Status", $_SERVER["PHP_SELF"], "d.statut,d.datefin", $param, "", "", $sortfield, $sortorder); print_liste_field_titre("EndSubscription", $_SERVER["PHP_SELF"], "d.datefin", $param, "", 'align="center"', $sortfield, $sortorder); @@ -771,12 +771,12 @@ if ($rowid > 0) print ''.$langs->trans("Status").''; print $form->selectarray('statut', array('0'=>$langs->trans('ActivityCeased'),'1'=>$langs->trans('InActivity')), $object->statut); print ''; - + // Morphy - $morphys[""] = $langs->trans("Physical & Morale"); + $morphys[""] = $langs->trans("MorPhy"); $morphys["phy"] = $langs->trans("Physical"); $morphys["mor"] = $langs->trans("Morale"); - print ''.$langs->trans("Nature").''; + print ''.$langs->trans("MemberNature").''; print $form->selectarray("morphy", $morphys, isset($_POST["morphy"])?$_POST["morphy"]:$object->morphy); print ""; diff --git a/htdocs/admin/barcode.php b/htdocs/admin/barcode.php index 993af489989..f844b135a4a 100644 --- a/htdocs/admin/barcode.php +++ b/htdocs/admin/barcode.php @@ -365,7 +365,7 @@ print '
'; // Select barcode numbering module -if ($conf->produit->enabled) +if ($conf->product->enabled) { print load_fiche_titre($langs->trans("BarCodeNumberManager")." (".$langs->trans("Product").")", '', ''); diff --git a/htdocs/api/class/api.class.php b/htdocs/api/class/api.class.php index de5a1e75d0a..458de02a2db 100644 --- a/htdocs/api/class/api.class.php +++ b/htdocs/api/class/api.class.php @@ -106,8 +106,6 @@ class DolibarrApi // Remove linkedObjects. We should already have linkedObjectIds that avoid huge responses unset($object->linkedObjects); - unset($object->lignes); // we don't want lignes, we want only ->lines - unset($object->fields); unset($object->oldline); @@ -188,7 +186,7 @@ class DolibarrApi unset($object->lines[$i]->note_public); unset($object->lines[$i]->note_private); unset($object->lines[$i]->fk_incoterms); - unset($object->lines[$i]->libelle_incoterms); + unset($object->lines[$i]->label_incoterms); unset($object->lines[$i]->location_incoterms); unset($object->lines[$i]->name); unset($object->lines[$i]->lastname); diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 8b556d7c02b..35ea7d79f5a 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -449,6 +449,7 @@ class Setup extends DolibarrApi /** * Get the list of currencies. * + * @param int $multicurrency Multicurrency rates (0: no multicurrency, 1: last rate, 2: all rates) {@min 0} {@max 2} * @param string $sortfield Sort field * @param string $sortorder Sort order * @param int $limit Number of items per page @@ -461,13 +462,22 @@ class Setup extends DolibarrApi * * @throws RestException */ - public function getListOfCurrencies($sortfield = "code_iso", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') + public function getListOfCurrencies($multicurrency = 0, $sortfield = "code_iso", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { $list = array(); - //TODO link with multicurrency module $sql = "SELECT t.code_iso, t.label, t.unicode"; + if (!empty($multicurrency)) $sql.= " , cr.date_sync, cr.rate "; $sql.= " FROM ".MAIN_DB_PREFIX."c_currencies as t"; + if (!empty($multicurrency)) { + $sql.= " JOIN ".MAIN_DB_PREFIX."multicurrency as m ON m.code=t.code_iso"; + $sql.= " JOIN ".MAIN_DB_PREFIX."multicurrency_rate as cr ON (m.rowid = cr.fk_multicurrency)"; + } $sql.= " WHERE t.active = ".$active; + if (!empty($multicurrency)) { + $sql.= " AND m.entity IN (".getEntity('multicurrency').")"; + if (!empty($multicurrency) && $multicurrency != 2) $sql.= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX."multicurrency_rate AS cr2 WHERE cr2.fk_multicurrency = m.rowid)"; + } + // Add sql filters if ($sqlfilters) { diff --git a/htdocs/blockedlog/class/blockedlog.class.php b/htdocs/blockedlog/class/blockedlog.class.php index d7302a2c795..c313a0b7666 100644 --- a/htdocs/blockedlog/class/blockedlog.class.php +++ b/htdocs/blockedlog/class/blockedlog.class.php @@ -398,7 +398,7 @@ class BlockedLog 'name','lastname','firstname','region','region_id','region_code','state','state_id','state_code','country','country_id','country_code', 'total_ht','total_tva','total_ttc','total_localtax1','total_localtax2', 'barcode_type','barcode_type_code','barcode_type_label','barcode_type_coder','mode_reglement_id','cond_reglement_id','mode_reglement','cond_reglement','shipping_method_id', - 'fk_incoterms','libelle_incoterms','location_incoterms','lines') + 'fk_incoterms','label_incoterms','location_incoterms','lines') ); } diff --git a/htdocs/categories/class/api_categories.class.php b/htdocs/categories/class/api_categories.class.php index c389e1b63d1..eecb2f44048 100644 --- a/htdocs/categories/class/api_categories.class.php +++ b/htdocs/categories/class/api_categories.class.php @@ -290,7 +290,7 @@ class Categories extends DolibarrApi unset($object->total_tva); unset($object->lines); unset($object->fk_incoterms); - unset($object->libelle_incoterms); + unset($object->label_incoterms); unset($object->location_incoterms); unset($object->civility_id); unset($object->name); diff --git a/htdocs/comm/action/class/api_agendaevents.class.php b/htdocs/comm/action/class/api_agendaevents.class.php index ec899d72ae1..833f97b3b6b 100644 --- a/htdocs/comm/action/class/api_agendaevents.class.php +++ b/htdocs/comm/action/class/api_agendaevents.class.php @@ -356,7 +356,7 @@ class AgendaEvents extends DolibarrApi unset($object->total_localtax2); unset($object->total_ttc); unset($object->fk_incoterms); - unset($object->libelle_incoterms); + unset($object->label_incoterms); unset($object->location_incoterms); unset($object->name); unset($object->lastname); diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 7331d7a86e9..8b52aedcaad 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -1688,7 +1688,7 @@ if ($action == 'create') if (!empty($conf->incoterm->enabled)) { print ''; - print ''; + print ''; print ''; print $form->select_incoterms((!empty($soc->fk_incoterms) ? $soc->fk_incoterms : ''), (!empty($soc->location_incoterms)?$soc->location_incoterms:'')); print ''; @@ -2305,7 +2305,7 @@ $formquestion = array_merge($formquestion, array( print ''; if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } else { diff --git a/htdocs/comm/propal/class/propal.class.php b/htdocs/comm/propal/class/propal.class.php index 0b9863f287b..36162e8b9aa 100644 --- a/htdocs/comm/propal/class/propal.class.php +++ b/htdocs/comm/propal/class/propal.class.php @@ -1383,7 +1383,7 @@ class Propal extends CommonObject $sql.= ", p.fk_incoterms, p.location_incoterms"; $sql.= ", p.fk_multicurrency, p.multicurrency_code, p.multicurrency_tx, p.multicurrency_total_ht, p.multicurrency_total_tva, p.multicurrency_total_ttc"; $sql.= ", p.tms as date_modification"; - $sql.= ", i.libelle as libelle_incoterms"; + $sql.= ", i.libelle as label_incoterms"; $sql.= ", c.label as statut_label"; $sql.= ", ca.code as availability_code, ca.label as availability"; $sql.= ", dr.code as demand_reason_code, dr.label as demand_reason"; @@ -1471,7 +1471,7 @@ class Propal extends CommonObject //Incoterms $this->fk_incoterms = $obj->fk_incoterms; $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->label_incoterms = $obj->label_incoterms; // Multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index 8ceadce89e5..7362f30e5a8 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -1737,7 +1737,7 @@ if ($action == 'create' && $user->rights->commande->creer) if (!empty($conf->incoterm->enabled)) { print ''; - print ''; + print ''; print ''; $incoterm_id = GETPOST('incoterm_id'); $incoterm_location = GETPOST('location_incoterms'); @@ -2361,7 +2361,7 @@ if ($action == 'create' && $user->rights->commande->creer) print ''; if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } else { diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index fd7832f868f..4eb3b3236e0 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1676,7 +1676,7 @@ class Commande extends CommonOrder $sql.= ', c.fk_incoterms, c.location_incoterms'; $sql.= ", c.fk_multicurrency, c.multicurrency_code, c.multicurrency_tx, c.multicurrency_total_ht, c.multicurrency_total_tva, c.multicurrency_total_ttc"; $sql.= ", c.module_source, c.pos_source"; - $sql.= ", i.libelle as libelle_incoterms"; + $sql.= ", i.libelle as label_incoterms"; $sql.= ', p.code as mode_reglement_code, p.libelle as mode_reglement_libelle'; $sql.= ', cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc'; $sql.= ', ca.code as availability_code, ca.label as availability_label'; @@ -1758,7 +1758,7 @@ class Commande extends CommonOrder //Incoterms $this->fk_incoterms = $obj->fk_incoterms; $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->label_incoterms = $obj->label_incoterms; // Multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 44be21898f8..68ed6fc3f57 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -3171,7 +3171,7 @@ if ($action == 'create') if (!empty($conf->incoterm->enabled)) { print ''; - print ''; + print ''; print ''; $incoterm_id = GETPOST('incoterm_id'); $incoterm_location = GETPOST('location_incoterms'); @@ -4007,7 +4007,7 @@ elseif ($id > 0 || ! empty($ref)) print ''; if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } else { diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index e5041217cb3..f249443ac66 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -1335,7 +1335,7 @@ class Facture extends CommonInvoice $sql.= ', c.code as cond_reglement_code, c.libelle as cond_reglement_libelle, c.libelle_facture as cond_reglement_libelle_doc'; $sql.= ', f.fk_incoterms, f.location_incoterms'; $sql.= ', f.module_source, f.pos_source'; - $sql.= ", i.libelle as libelle_incoterms"; + $sql.= ", i.libelle as label_incoterms"; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_payment_term as c ON f.fk_cond_reglement = c.rowid'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_paiement as p ON f.fk_mode_reglement = p.id'; @@ -1410,7 +1410,7 @@ class Facture extends CommonInvoice //Incoterms $this->fk_incoterms = $obj->fk_incoterms; $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->label_incoterms = $obj->label_incoterms; $this->module_source = $obj->module_source; $this->pos_source = $obj->pos_source; @@ -4141,7 +4141,7 @@ class Facture extends CommonInvoice /** * Create a document onto disk according to template module. * - * @param string $modele Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf') for example. + * @param string $modele Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf','alpha') for example. * @param Translate $outputlangs objet lang a utiliser pour traduction * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description diff --git a/htdocs/contrat/class/contrat.class.php b/htdocs/contrat/class/contrat.class.php index 6396b5e5f88..91a373743c4 100644 --- a/htdocs/contrat/class/contrat.class.php +++ b/htdocs/contrat/class/contrat.class.php @@ -1920,7 +1920,7 @@ class Contrat extends CommonObject */ public function getNomUrl($withpicto = 0, $maxlength = 0, $notooltip = 0, $save_lastsearch_value = -1) { - global $conf, $langs, $user; + global $conf, $langs, $user, $hookmanager; $result=''; @@ -1973,6 +1973,16 @@ class Contrat extends CommonObject if ($withpicto != 2) $result.= ($this->ref?$this->ref:$this->id); $result .= $linkend; + global $action; + $hookmanager->initHooks(array('contractdao')); + $parameters=array('id'=>$this->id, 'getnomurl'=>$result); + $reshook=$hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks + if ($reshook > 0) { + $result = $hookmanager->resPrint; + } else { + $result .= $hookmanager->resPrint; + } + return $result; } diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 28c4702a5c2..01cc12dd34a 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -592,7 +592,7 @@ if (! empty($arrayfields['c.tms']['checked'])){ print_liste_field_titre($arrayfields['c.tms']['label'], $_SERVER["PHP_SELF"], "c.tms", "", $param, '', $sortfield, $sortorder, 'center nowrap '); } if (! empty($arrayfields['lower_planned_end_date']['checked'])) { - print_liste_field_titre($arrayfields['lower_planned_end_date']['label'], $_SERVER["PHP_SELF"], "lower_planned_end_date", "", $param, '', $sortfield, $sortorder, 'center nowrap '); + print_liste_field_titre($arrayfields['lower_planned_end_date']['label'], $_SERVER["PHP_SELF"], "lower_planned_end_date", "", $param, '', $sortfield, $sortorder, 'center '); } if (! empty($arrayfields['status']['checked'])) { print_liste_field_titre($staticcontratligne->LibStatut(0, 3), '', '', '', '', 'width="16"'); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 9017ece676e..f474b1b05f8 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1,8 +1,8 @@ - * Copyright (C) 2018 Nicolas ZABOURI - * Copyright (C) 2018 Juanjo Menent - * Copyright (C) 2019 Ferran Marcet +/* Copyright (C) 2015-2017 Laurent Destailleur + * Copyright (C) 2018 Nicolas ZABOURI + * Copyright (C) 2018 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet * Copyright (C) 2019 Frédéric France * * This program is free software; you can redistribute it and/or modify @@ -39,8 +39,8 @@ // Protection if (empty($objectclass) || empty($uploaddir)) { - dol_print_error(null, 'include of actions_massactions.inc.php is done but var $massaction or $objectclass or $uploaddir was not defined'); - exit; + dol_print_error(null, 'include of actions_massactions.inc.php is done but var $massaction or $objectclass or $uploaddir was not defined'); + exit; } @@ -48,227 +48,228 @@ if (empty($objectclass) || empty($uploaddir)) $maxformassaction=(empty($conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS)?1000:$conf->global->MAIN_LIMIT_FOR_MASS_ACTIONS); if (! empty($massaction) && is_array($toselect) && count($toselect) < 1) { - $error++; - setEventMessages($langs->trans("NoRecordSelected"), null, "warnings"); + $error++; + setEventMessages($langs->trans("NoRecordSelected"), null, "warnings"); } if (! $error && is_array($toselect) && count($toselect) > $maxformassaction) { - setEventMessages($langs->trans('TooManyRecordForMassAction', $maxformassaction), null, 'errors'); - $error++; + setEventMessages($langs->trans('TooManyRecordForMassAction', $maxformassaction), null, 'errors'); + $error++; } if (! $error && $massaction == 'confirm_presend' && ! GETPOST('sendmail')) // If we do not choose button send (for example when we change template or limit), we must not send email, but keep on send email form { - $massaction='presend'; + $massaction='presend'; } if (! $error && $massaction == 'confirm_presend') { - $resaction = ''; - $nbsent = 0; - $nbignored = 0; - $langs->load("mails"); - include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + $resaction = ''; + $nbsent = 0; + $nbignored = 0; + $langs->load("mails"); + include_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $listofobjectid=array(); - $listofobjectthirdparties=array(); - $listofobjectref=array(); + $listofobjectid=array(); + $listofobjectthirdparties=array(); + $listofobjectref=array(); + $attachedfilesThirdpartyObj=array(); + $oneemailperrecipient=(GETPOST('oneemailperrecipient')=='on'?1:0); - if (! $error) - { - $thirdparty=new Societe($db); + if (! $error) + { + $thirdparty=new Societe($db); - $objecttmp=new $objectclass($db); - if ($objecttmp->element == 'expensereport') $thirdparty=new User($db); - if ($objecttmp->element == 'holiday') $thirdparty=new User($db); + $objecttmp=new $objectclass($db); + if ($objecttmp->element == 'expensereport') $thirdparty=new User($db); + if ($objecttmp->element == 'holiday') $thirdparty=new User($db); - foreach($toselect as $toselectid) - { - $objecttmp=new $objectclass($db); // we must create new instance because instance is saved into $listofobjectref array for future use - $result=$objecttmp->fetch($toselectid); - if ($result > 0) - { - $listofobjectid[$toselectid]=$toselectid; + foreach($toselect as $toselectid) + { + $objecttmp=new $objectclass($db); // we must create new instance because instance is saved into $listofobjectref array for future use + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $listofobjectid[$toselectid]=$toselectid; - $thirdpartyid=($objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid); - if ($objecttmp->element == 'societe') $thirdpartyid=$objecttmp->id; - if ($objecttmp->element == 'expensereport') $thirdpartyid=$objecttmp->fk_user_author; - if ($objecttmp->element == 'holiday') $thirdpartyid=$objecttmp->fk_user; - if (empty($thirdpartyid)) $thirdpartyid=0; + $thirdpartyid=($objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid); + if ($objecttmp->element == 'societe') $thirdpartyid=$objecttmp->id; + if ($objecttmp->element == 'expensereport') $thirdpartyid=$objecttmp->fk_user_author; + if ($objecttmp->element == 'holiday') $thirdpartyid=$objecttmp->fk_user; + if (empty($thirdpartyid)) $thirdpartyid=0; - $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; - $listofobjectref[$thirdpartyid][$toselectid]=$objecttmp; - } - } - } + $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; + $listofobjectref[$thirdpartyid][$toselectid]=$objecttmp; + } + } + } - // Check mandatory parameters - if (GETPOST('fromtype', 'alpha') === 'user' && empty($user->email)) - { - $error++; - setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings'); - $massaction='presend'; - } + // Check mandatory parameters + if (GETPOST('fromtype', 'alpha') === 'user' && empty($user->email)) + { + $error++; + setEventMessages($langs->trans("NoSenderEmailDefined"), null, 'warnings'); + $massaction='presend'; + } - $receiver=$_POST['receiver']; - if (! is_array($receiver)) - { - if (empty($receiver) || $receiver == '-1') $receiver=array(); - else $receiver=array($receiver); - } - if (! trim($_POST['sendto']) && count($receiver) == 0 && count($listofobjectthirdparties) == 1) // if only one recipient, receiver is mandatory - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Recipient")), null, 'warnings'); - $massaction='presend'; - } + $receiver=$_POST['receiver']; + if (! is_array($receiver)) + { + if (empty($receiver) || $receiver == '-1') $receiver=array(); + else $receiver=array($receiver); + } + if (! trim($_POST['sendto']) && count($receiver) == 0 && count($listofobjectthirdparties) == 1) // if only one recipient, receiver is mandatory + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("Recipient")), null, 'warnings'); + $massaction='presend'; + } - if (! GETPOST('subject', 'none')) - { - $error++; - setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTopic")), null, 'warnings'); - $massaction='presend'; - } + if (! GETPOST('subject', 'none')) + { + $error++; + setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv("MailTopic")), null, 'warnings'); + $massaction='presend'; + } - // Loop on each recipient/thirdparty - if (! $error) - { - foreach ($listofobjectthirdparties as $thirdpartyid) - { - $result = $thirdparty->fetch($thirdpartyid); - if ($result < 0) - { - dol_print_error($db); - exit; - } + // Loop on each recipient/thirdparty + if (! $error) + { + foreach ($listofobjectthirdparties as $thirdpartyid) + { + $result = $thirdparty->fetch($thirdpartyid); + if ($result < 0) + { + dol_print_error($db); + exit; + } - $sendto=''; - $sendtocc=''; - $sendtobcc=''; - $sendtoid = array(); + $sendto=''; + $sendtocc=''; + $sendtobcc=''; + $sendtoid = array(); - // Define $sendto - $tmparray=array(); - if (trim($_POST['sendto'])) - { - // Recipients are provided into free text - $tmparray[] = trim($_POST['sendto']); - } - if (count($receiver)>0) - { - foreach($receiver as $key=>$val) - { - // Recipient was provided from combo list - if ($val == 'thirdparty') // Id of third party or user - { - $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; - } - elseif ($val && method_exists($thirdparty, 'contact_get_property')) // Id of contact - { - $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); - $sendtoid[] = $val; - } - } - } - $sendto=implode(',', $tmparray); + // Define $sendto + $tmparray=array(); + if (trim($_POST['sendto'])) + { + // Recipients are provided into free text + $tmparray[] = trim($_POST['sendto']); + } + if (count($receiver)>0) + { + foreach($receiver as $key=>$val) + { + // Recipient was provided from combo list + if ($val == 'thirdparty') // Id of third party or user + { + $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; + } + elseif ($val && method_exists($thirdparty, 'contact_get_property')) // Id of contact + { + $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); + $sendtoid[] = $val; + } + } + } + $sendto=implode(',', $tmparray); - // Define $sendtocc - $receivercc=$_POST['receivercc']; - if (! is_array($receivercc)) - { - if ($receivercc == '-1') $receivercc=array(); - else $receivercc=array($receivercc); - } - $tmparray=array(); - if (trim($_POST['sendtocc'])) - { - $tmparray[] = trim($_POST['sendtocc']); - } - if (count($receivercc) > 0) - { - foreach($receivercc as $key=>$val) - { - // Recipient was provided from combo list - if ($val == 'thirdparty') // Id of third party - { - $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; - } - elseif ($val) // Id du contact - { - $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); - //$sendtoid[] = $val; TODO Add also id of contact in CC ? - } - } - } - $sendtocc=implode(',', $tmparray); + // Define $sendtocc + $receivercc=$_POST['receivercc']; + if (! is_array($receivercc)) + { + if ($receivercc == '-1') $receivercc=array(); + else $receivercc=array($receivercc); + } + $tmparray=array(); + if (trim($_POST['sendtocc'])) + { + $tmparray[] = trim($_POST['sendtocc']); + } + if (count($receivercc) > 0) + { + foreach($receivercc as $key=>$val) + { + // Recipient was provided from combo list + if ($val == 'thirdparty') // Id of third party + { + $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; + } + elseif ($val) // Id du contact + { + $tmparray[] = $thirdparty->contact_get_property((int) $val, 'email'); + //$sendtoid[] = $val; TODO Add also id of contact in CC ? + } + } + } + $sendtocc=implode(',', $tmparray); - //var_dump($listofobjectref);exit; - $attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array()); - $listofqualifiedobj=array(); - $listofqualifiedref=array(); - $thirdpartywithoutemail=array(); + //var_dump($listofobjectref);exit; + $listofqualifiedobj=array(); + $listofqualifiedref=array(); + $thirdpartywithoutemail=array(); - foreach($listofobjectref[$thirdpartyid] as $objectid => $objectobj) - { - //var_dump($thirdpartyid.' - '.$objectid.' - '.$objectobj->statut); - if ($objectclass == 'Propal' && $objectobj->statut == Propal::STATUS_DRAFT) - { - $langs->load("errors"); - $nbignored++; - $resaction.='
'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction', $objectobj->ref).'

'; - continue; // Payment done or started or canceled - } - if ($objectclass == 'Commande' && $objectojb->statut == Commande::STATUS_DRAFT) - { - $langs->load("errors"); - $nbignored++; - $resaction.='
'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction', $objectobj->ref).'

'; - continue; - } - if ($objectclass == 'Facture' && $objectobj->statut == Facture::STATUS_DRAFT) - { - $langs->load("errors"); - $nbignored++; - $resaction.='
'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction', $objectobj->ref).'

'; - continue; // Payment done or started or canceled - } + foreach($listofobjectref[$thirdpartyid] as $objectid => $objectobj) + { + //var_dump($thirdpartyid.' - '.$objectid.' - '.$objectobj->statut); + if ($objectclass == 'Propal' && $objectobj->statut == Propal::STATUS_DRAFT) + { + $langs->load("errors"); + $nbignored++; + $resaction.='
'.$langs->trans('ErrorOnlyProposalNotDraftCanBeSentInMassAction', $objectobj->ref).'

'; + continue; // Payment done or started or canceled + } + if ($objectclass == 'Commande' && $objectobj->statut == Commande::STATUS_DRAFT) + { + $langs->load("errors"); + $nbignored++; + $resaction.='
'.$langs->trans('ErrorOnlyOrderNotDraftCanBeSentInMassAction', $objectobj->ref).'

'; + continue; + } + if ($objectclass == 'Facture' && $objectobj->statut == Facture::STATUS_DRAFT) + { + $langs->load("errors"); + $nbignored++; + $resaction.='
'.$langs->trans('ErrorOnlyInvoiceValidatedCanBeSentInMassAction', $objectobj->ref).'

'; + continue; // Payment done or started or canceled + } - // Test recipient - if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send) - { - if ($objectobj->element == 'expensereport') - { - $fuser = new User($db); - $fuser->fetch($objectobj->fk_user_author); - $sendto = $fuser->email; - } - elseif ($objectobj->element == 'holiday') - { - $fuser = new User($db); - $fuser->fetch($objectobj->fk_user); - $sendto = $fuser->email; - } - else - { - $objectobj->fetch_thirdparty(); - $sendto = $objectobj->thirdparty->email; - } - } + // Test recipient + if (empty($sendto)) // For the case, no recipient were set (multi thirdparties send) + { + if ($objectobj->element == 'expensereport') + { + $fuser = new User($db); + $fuser->fetch($objectobj->fk_user_author); + $sendto = $fuser->email; + } + elseif ($objectobj->element == 'holiday') + { + $fuser = new User($db); + $fuser->fetch($objectobj->fk_user); + $sendto = $fuser->email; + } + else + { + $objectobj->fetch_thirdparty(); + $sendto = $objectobj->thirdparty->email; + } + } - if (empty($sendto)) - { - //print "No recipient for thirdparty ".$objectobj->thirdparty->name; - $nbignored++; - if (empty($thirdpartywithoutemail[$objectobj->thirdparty->id])) - { - $resaction.='
'.$langs->trans('NoRecipientEmail', $objectobj->thirdparty->name).'

'; - } - dol_syslog('No recipient for thirdparty: '.$objectobj->thirdparty->name, LOG_WARNING); - $thirdpartywithoutemail[$objectobj->thirdparty->id]=1; - continue; - } + if (empty($sendto)) + { + //print "No recipient for thirdparty ".$objectobj->thirdparty->name; + $nbignored++; + if (empty($thirdpartywithoutemail[$objectobj->thirdparty->id])) + { + $resaction.='
'.$langs->trans('NoRecipientEmail', $objectobj->thirdparty->name).'

'; + } + dol_syslog('No recipient for thirdparty: '.$objectobj->thirdparty->name, LOG_WARNING); + $thirdpartywithoutemail[$objectobj->thirdparty->id]=1; + continue; + } - if ($_POST['addmaindocfile']) - { + if ($_POST['addmaindocfile']) + { // TODO Use future field $objectobj->fullpathdoc to know where is stored default file // TODO If not defined, use $objectobj->modelpdf (or defaut invoice config) to know what is template to use to regenerate doc. $filename = dol_sanitizeFileName($objectobj->ref).'.pdf'; @@ -281,841 +282,864 @@ if (! $error && $massaction == 'confirm_presend') // For supplier invoices, we use the file provided by supplier, not the one we generate if ($objectobj->element == 'invoice_supplier') { - $fileparams = dol_most_recent_file($uploaddir.'/'.get_exdir($objectobj->id, 2, 0, 0, $objectobj, $objectobj->element).$objectobj->ref, preg_quote($objectobj->ref, '/').'([^\-])+'); + $fileparams = dol_most_recent_file($uploaddir . '/' . get_exdir($objectobj->id, 2, 0, 0, $objectobj, $objectobj->element).$objectobj->ref, preg_quote($objectobj->ref, '/').'([^\-])+'); $file = $fileparams['fullname']; } - $mime = dol_mimetype($file); + $mime = dol_mimetype($file); - if (dol_is_file($file)) - { - // Create form object - $attachedfiles=array( - 'paths'=>array_merge($attachedfiles['paths'], array($file)), - 'names'=>array_merge($attachedfiles['names'], array($filename)), - 'mimes'=>array_merge($attachedfiles['mimes'], array($mime)) - ); - } - else - { - $nbignored++; - $langs->load("errors"); - $resaction.='
'.$langs->trans('ErrorCantReadFile', $file).'

'; - dol_syslog('Failed to read file: '.$file, LOG_WARNING); - continue; - } - } + if (dol_is_file($file)) + { + // Create form object + $attachedfilesThirdpartyObj[$thirdpartyid][$objectid]=array( + 'paths'=>array($file), + 'names'=>array($filename), + 'mimes'=>array($mime) + ); + } + else + { + $nbignored++; + $langs->load("errors"); + $resaction.='
'.$langs->trans('ErrorCantReadFile', $file).'

'; + dol_syslog('Failed to read file: '.$file, LOG_WARNING); + continue; + } + } - // Object of thirdparty qualified, we add it - $listofqualifiedobj[$objectid]=$objectobj; - $listofqualifiedref[$objectid]=$objectobj->ref; + // Object of thirdparty qualified, we add it + $listofqualifiedobj[$objectid]=$objectobj; + $listofqualifiedref[$objectid]=$objectobj->ref; - //var_dump($listofqualifiedref); - } - // Send email if there is at least one qualified object for current thirdparty - if (count($listofqualifiedobj) > 0) - { - $langs->load("commercial"); + //var_dump($listofqualifiedref); + } - $fromtype = GETPOST('fromtype'); - if ($fromtype === 'user') { - $from = $user->getFullName($langs) .' <'.$user->email.'>'; - } - elseif ($fromtype === 'company') { - $from = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; - } - elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { - $tmp=explode(',', $user->email_aliases); - $from = trim($tmp[($reg[1] - 1)]); - } - elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { - $tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); - $from = trim($tmp[($reg[1] - 1)]); - } - elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { - $sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE rowid = '.(int) $reg[1]; - $resql = $db->query($sql); - $obj = $db->fetch_object($resql); - if ($obj) - { - $from = $obj->label.' <'.$obj->email.'>'; - } - } - else { - $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; - } + // Send email if there is at least one qualified object for current thirdparty + if (count($listofqualifiedobj) > 0) + { + $langs->load("commercial"); - $replyto = $from; - $subject = GETPOST('subject', 'none'); - $message = GETPOST('message', 'none'); + $fromtype = GETPOST('fromtype'); + if ($fromtype === 'user') { + $from = $user->getFullName($langs) .' <'.$user->email.'>'; + } + elseif ($fromtype === 'company') { + $from = $conf->global->MAIN_INFO_SOCIETE_NOM .' <'.$conf->global->MAIN_INFO_SOCIETE_MAIL.'>'; + } + elseif (preg_match('/user_aliases_(\d+)/', $fromtype, $reg)) { + $tmp=explode(',', $user->email_aliases); + $from = trim($tmp[($reg[1] - 1)]); + } + elseif (preg_match('/global_aliases_(\d+)/', $fromtype, $reg)) { + $tmp=explode(',', $conf->global->MAIN_INFO_SOCIETE_MAIL_ALIASES); + $from = trim($tmp[($reg[1] - 1)]); + } + elseif (preg_match('/senderprofile_(\d+)_(\d+)/', $fromtype, $reg)) { + $sql='SELECT rowid, label, email FROM '.MAIN_DB_PREFIX.'c_email_senderprofile WHERE rowid = '.(int) $reg[1]; + $resql = $db->query($sql); + $obj = $db->fetch_object($resql); + if ($obj) + { + $from = $obj->label.' <'.$obj->email.'>'; + } + } + else { + $from = $_POST['fromname'] . ' <' . $_POST['frommail'] .'>'; + } - $sendtobcc = GETPOST('sendtoccc'); - if ($objectclass == 'Propal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)); - if ($objectclass == 'Commande') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)); - if ($objectclass == 'Facture') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)); - if ($objectclass == 'Supplier_Proposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO)); - if ($objectclass == 'CommandeFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)); - if ($objectclass == 'FactureFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)); - if ($objectclass == 'Project') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO)); + $replyto = $from; + $subject = GETPOST('subject', 'none'); + $message = GETPOST('message', 'none'); - // $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet) - // $looparray will be an array with number of email to send for the current thirdparty (so 1 or n if n object for same thirdparty) - $oneemailperrecipient=(GETPOST('oneemailperrecipient', 'alpha')=='on'?1:0); - $looparray=array(); - if (! $oneemailperrecipient) - { - $looparray = $listofqualifiedobj; - foreach ($looparray as $key => $objecttmp) - { - $looparray[$key]->thirdparty = $thirdparty; // Force thirdparty on object - } - } - else - { - $objectforloop=new $objectclass($db); - $objectforloop->thirdparty = $thirdparty; // Force thirdparty on object (even if object was not loaded) - $looparray[0]=$objectforloop; - } - //var_dump($looparray);exit; + $sendtobcc = GETPOST('sendtoccc'); + if ($objectclass == 'Propal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO)); + if ($objectclass == 'Commande') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO)); + if ($objectclass == 'Facture') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO)); + if ($objectclass == 'Supplier_Proposal') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO)); + if ($objectclass == 'CommandeFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO)); + if ($objectclass == 'FactureFournisseur') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO)); + if ($objectclass == 'Project') $sendtobcc .= (empty($conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO) ? '' : (($sendtobcc?", ":"").$conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO)); + + // $listofqualifiedobj is array with key = object id and value is instance of qualified objects, for the current thirdparty (but thirdparty property is not loaded yet) + // $looparray will be an array with number of email to send for the current thirdparty (so 1 or n if n object for same thirdparty) + $looparray=array(); + if (! $oneemailperrecipient) + { + $looparray = $listofqualifiedobj; + foreach ($looparray as $key => $objecttmp) + { + $looparray[$key]->thirdparty = $thirdparty; // Force thirdparty on object + } + } + else + { + $objectforloop=new $objectclass($db); + $objectforloop->thirdparty = $thirdparty; // Force thirdparty on object (even if object was not loaded) + $looparray[0]=$objectforloop; + } + //var_dump($looparray);exit; dol_syslog("We have set an array of ".count($looparray)." emails to send. oneemailperrecipient=".$oneemailperrecipient); //var_dump($oneemailperrecipient); var_dump($listofqualifiedobj); var_dump($listofqualifiedref); foreach ($looparray as $objectid => $objecttmp) // $objecttmp is a real object or an empty object if we choose to send one email per thirdparty instead of one per object - { - // Make substitution in email content - $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $objecttmp); - $substitutionarray['__ID__'] = ($oneemailperrecipient ? join(', ', array_keys($listofqualifiedobj)) : $objecttmp->id); - $substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ', $listofqualifiedref) : $objecttmp->ref); - $substitutionarray['__EMAIL__'] = $thirdparty->email; - $substitutionarray['__CHECK_READ__'] = ''; + { + // Make substitution in email content + $substitutionarray=getCommonSubstitutionArray($langs, 0, null, $objecttmp); + $substitutionarray['__ID__'] = ($oneemailperrecipient ? join(', ', array_keys($listofqualifiedobj)) : $objecttmp->id); + $substitutionarray['__REF__'] = ($oneemailperrecipient ? join(', ', $listofqualifiedref) : $objecttmp->ref); + $substitutionarray['__EMAIL__'] = $thirdparty->email; + $substitutionarray['__CHECK_READ__'] = ''; - $parameters=array('mode'=>'formemail'); + $parameters=array('mode'=>'formemail'); - if ( ! empty($listofobjectthirdparties) ) { - $parameters['listofobjectthirdparties'] = $listofobjectthirdparties; - } - if ( ! empty($listofobjectref) ) { - $parameters['listofobjectref'] = $listofobjectref; - } + if (! empty($listofobjectthirdparties)) { + $parameters['listofobjectthirdparties'] = $listofobjectthirdparties; + } + if (! empty($listofobjectref)) { + $parameters['listofobjectref'] = $listofobjectref; + } - complete_substitutions_array($substitutionarray, $langs, $objecttmp, $parameters); + complete_substitutions_array($substitutionarray, $langs, $objecttmp, $parameters); $subjectreplaced=make_substitutions($subject, $substitutionarray); $messagereplaced=make_substitutions($message, $substitutionarray); - $filepath = $attachedfiles['paths']; - $filename = $attachedfiles['names']; - $mimetype = $attachedfiles['mimes']; + $attachedfiles=array('paths'=>array(), 'names'=>array(), 'mimes'=>array()); + if ($oneemailperrecipient) + { + // if "one email per recipient" is check we must collate $attachedfiles by thirdparty + if (is_array($attachedfilesThirdpartyObj[$thirdparty->id]) && count($attachedfilesThirdpartyObj[$thirdparty->id])) + { + foreach ($attachedfilesThirdpartyObj[$thirdparty->id] as $keyObjId => $objAttachedFiles){ + // Create form object + $attachedfiles=array( + 'paths'=>array_merge($attachedfiles['paths'], $objAttachedFiles['paths']), + 'names'=>array_merge($attachedfiles['names'], $objAttachedFiles['names']), + 'mimes'=>array_merge($attachedfiles['mimes'], $objAttachedFiles['mimes']) + ); + } + } + } + elseif (!empty($attachedfilesThirdpartyObj[$thirdparty->id][$objectid])){ + // Create form object + // if "one email per recipient" isn't check we must separate $attachedfiles by object + $attachedfiles=$attachedfilesThirdpartyObj[$thirdparty->id][$objectid]; + } - // Define the trackid when emails sent from the mass action - if ($oneemailperrecipient) - { - $trackid='thi'.$thirdparty->id; - if ($objecttmp->element == 'expensereport') $trackid='use'.$thirdparty->id; - if ($objecttmp->element == 'holiday') $trackid='use'.$thirdparty->id; - } - else - { - $trackid=strtolower(get_class($objecttmp)); - if (get_class($objecttmp)=='Contrat') $trackid='con'; - if (get_class($objecttmp)=='Propal') $trackid='pro'; - if (get_class($objecttmp)=='Commande') $trackid='ord'; - if (get_class($objecttmp)=='Facture') $trackid='inv'; - if (get_class($objecttmp)=='Supplier_Proposal') $trackid='spr'; - if (get_class($objecttmp)=='CommandeFournisseur') $trackid='sor'; - if (get_class($objecttmp)=='FactureFournisseur') $trackid='sin'; + $filepath = $attachedfiles['paths']; + $filename = $attachedfiles['names']; + $mimetype = $attachedfiles['mimes']; - $trackid.=$objecttmp->id; - } - //var_dump($filepath); - //var_dump($trackid);exit; - //var_dump($subjectreplaced); + // Define the trackid when emails sent from the mass action + if ($oneemailperrecipient) + { + $trackid='thi'.$thirdparty->id; + if ($objecttmp->element == 'expensereport') $trackid='use'.$thirdparty->id; + if ($objecttmp->element == 'holiday') $trackid='use'.$thirdparty->id; + } + else + { + $trackid=strtolower(get_class($objecttmp)); + if (get_class($objecttmp)=='Contrat') $trackid='con'; + if (get_class($objecttmp)=='Propal') $trackid='pro'; + if (get_class($objecttmp)=='Commande') $trackid='ord'; + if (get_class($objecttmp)=='Facture') $trackid='inv'; + if (get_class($objecttmp)=='Supplier_Proposal') $trackid='spr'; + if (get_class($objecttmp)=='CommandeFournisseur') $trackid='sor'; + if (get_class($objecttmp)=='FactureFournisseur') $trackid='sin'; - // Send mail (substitutionarray must be done just before this) + $trackid.=$objecttmp->id; + } + //var_dump($filepath); + //var_dump($trackid);exit; + //var_dump($subjectreplaced); + + // Send mail (substitutionarray must be done just before this) require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php'; $mailfile = new CMailFile($subjectreplaced, $sendto, $from, $messagereplaced, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1, '', '', $trackid); - if ($mailfile->error) - { - $resaction.='
'.$mailfile->error.'
'; - } - else - { - $result=$mailfile->sendfile(); - if ($result) - { - $resaction.=$langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)).'
'; // Must not contain " + if ($mailfile->error) + { + $resaction.='
'.$mailfile->error.'
'; + } + else + { + $result=$mailfile->sendfile(); + if ($result) + { + $resaction.=$langs->trans('MailSuccessfulySent', $mailfile->getValidAddress($from, 2), $mailfile->getValidAddress($sendto, 2)).'
'; // Must not contain " - $error=0; + $error=0; - // Insert logs into agenda + // Insert logs into agenda foreach($listofqualifiedobj as $objid2 => $objectobj2) - { + { if ((! $oneemailperrecipient) && $objid2 != $objectid) continue; // We discard this pass to avoid duplicate with other pass in looparray at higher level dol_syslog("Try to insert email event into agenda for objid=".$objid2." => objectobj=".get_class($objectobj2)); - /*if ($objectclass == 'Propale') $actiontypecode='AC_PROP'; - if ($objectclass == 'Commande') $actiontypecode='AC_COM'; - if ($objectclass == 'Facture') $actiontypecode='AC_FAC'; - if ($objectclass == 'Supplier_Proposal') $actiontypecode='AC_SUP_PRO'; - if ($objectclass == 'CommandeFournisseur') $actiontypecode='AC_SUP_ORD'; - if ($objectclass == 'FactureFournisseur') $actiontypecode='AC_SUP_INV';*/ + /*if ($objectclass == 'Propale') $actiontypecode='AC_PROP'; + if ($objectclass == 'Commande') $actiontypecode='AC_COM'; + if ($objectclass == 'Facture') $actiontypecode='AC_FAC'; + if ($objectclass == 'Supplier_Proposal') $actiontypecode='AC_SUP_PRO'; + if ($objectclass == 'CommandeFournisseur') $actiontypecode='AC_SUP_ORD'; + if ($objectclass == 'FactureFournisseur') $actiontypecode='AC_SUP_INV';*/ - $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; - if ($message) - { - if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); + $actionmsg=$langs->transnoentities('MailSentBy').' '.$from.' '.$langs->transnoentities('To').' '.$sendto; + if ($message) + { + if ($sendtocc) $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('Bcc') . ": " . $sendtocc); $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('MailTopic') . ": " . $subjectreplaced); - $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); + $actionmsg = dol_concatdesc($actionmsg, $langs->transnoentities('TextUsedInTheMessageBody') . ":"); $actionmsg = dol_concatdesc($actionmsg, $messagereplaced); - } - $actionmsg2=''; + } + $actionmsg2=''; - // Initialisation donnees + // Initialisation donnees $objectobj2->sendtoid = 0; $objectobj2->actionmsg = $actionmsg; // Long text $objectobj2->actionmsg2 = $actionmsg2; // Short text $objectobj2->fk_element = $objid2; $objectobj2->elementtype = $objectobj2->element; - $triggername = strtoupper(get_class($objectobj2)) .'_SENTBYMAIL'; - if ($triggername == 'SOCIETE_SENTBYMAIL') $triggername = 'COMPANY_SENTBYMAIL'; - if ($triggername == 'CONTRAT_SENTBYMAIL') $triggername = 'CONTRACT_SENTBYMAIL'; - if ($triggername == 'COMMANDE_SENTBYMAIL') $triggername = 'ORDER_SENTBYMAIL'; - if ($triggername == 'FACTURE_SENTBYMAIL') $triggername = 'BILL_SENTBYMAIL'; - if ($triggername == 'EXPEDITION_SENTBYMAIL') $triggername = 'SHIPPING_SENTBYMAIL'; - if ($triggername == 'COMMANDEFOURNISSEUR_SENTBYMAIL') $triggername = 'ORDER_SUPPLIER_SENTBYMAIL'; - if ($triggername == 'FACTUREFOURNISSEUR_SENTBYMAIL') $triggername = 'BILL_SUPPLIER_SENTBYMAIL'; - if ($triggername == 'SUPPLIERPROPOSAL_SENTBYMAIL') $triggername = 'PROPOSAL_SUPPLIER_SENTBYMAIL'; + $triggername = strtoupper(get_class($objectobj2)) .'_SENTBYMAIL'; + if ($triggername == 'SOCIETE_SENTBYMAIL') $triggername = 'COMPANY_SENTBYMAIL'; + if ($triggername == 'CONTRAT_SENTBYMAIL') $triggername = 'CONTRACT_SENTBYMAIL'; + if ($triggername == 'COMMANDE_SENTBYMAIL') $triggername = 'ORDER_SENTBYMAIL'; + if ($triggername == 'FACTURE_SENTBYMAIL') $triggername = 'BILL_SENTBYMAIL'; + if ($triggername == 'EXPEDITION_SENTBYMAIL') $triggername = 'SHIPPING_SENTBYMAIL'; + if ($triggername == 'COMMANDEFOURNISSEUR_SENTBYMAIL') $triggername = 'ORDER_SUPPLIER_SENTBYMAIL'; + if ($triggername == 'FACTUREFOURNISSEUR_SENTBYMAIL') $triggername = 'BILL_SUPPLIER_SENTBYMAIL'; + if ($triggername == 'SUPPLIERPROPOSAL_SENTBYMAIL') $triggername = 'PROPOSAL_SUPPLIER_SENTBYMAIL'; - if (! empty($triggername)) - { - // Appel des triggers + if (! empty($triggername)) + { + // Appel des triggers include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"; - $interface=new Interfaces($db); + $interface=new Interfaces($db); $result=$interface->run_triggers($triggername, $objectobj2, $user, $langs, $conf); - if ($result < 0) { $error++; $errors=$interface->errors; } - // Fin appel triggers + if ($result < 0) { $error++; $errors=$interface->errors; } + // Fin appel triggers - if ($error) - { - setEventMessages($db->lasterror(), $errors, 'errors'); - dol_syslog("Error in trigger ".$triggername.' '.$db->lasterror(), LOG_ERR); - } - } - } + if ($error) + { + setEventMessages($db->lasterror(), $errors, 'errors'); + dol_syslog("Error in trigger ".$triggername.' '.$db->lasterror(), LOG_ERR); + } + } - $nbsent++; // Nb of email sent (may be lower than number of record selected if we group thirdparties) - } - else - { - $langs->load("other"); - if ($mailfile->error) - { - $resaction.=$langs->trans('ErrorFailedToSendMail', $from, $sendto); - $resaction.='
'.$mailfile->error.'
'; - } - else - { - $resaction.='
No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS
'; - } - } - } - } - } - } + $nbsent++; // Nb of object sent + } + } + else + { + $langs->load("other"); + if ($mailfile->error) + { + $resaction.=$langs->trans('ErrorFailedToSendMail', $from, $sendto); + $resaction.='
'.$mailfile->error.'
'; + } + else + { + $resaction.='
No mail sent. Feature is disabled by option MAIN_DISABLE_ALL_MAILS
'; + } + } + } + } + } + } - $resaction.=($resaction?'
':$resaction); - $resaction.=''.$langs->trans("ResultOfMailSending").':
'."\n"; - $resaction.=$langs->trans("NbSelected").': '.count($toselect)."\n
"; - $resaction.=$langs->trans("NbIgnored").': '.($nbignored?$nbignored:0)."\n
"; - $resaction.=$langs->trans("NbSent").': '.($nbsent?$nbsent:0)."\n
"; + $resaction.=($resaction?'
':$resaction); + $resaction.=''.$langs->trans("ResultOfMailSending").':
'."\n"; + $resaction.=$langs->trans("NbSelected").': '.count($toselect)."\n
"; + $resaction.=$langs->trans("NbIgnored").': '.($nbignored?$nbignored:0)."\n
"; + $resaction.=$langs->trans("NbSent").': '.($nbsent?$nbsent:0)."\n
"; - if ($nbsent) - { - $action=''; // Do not show form post if there was at least one successfull sent - //setEventMessages($langs->trans("EMailSentToNRecipients", $nbsent.'/'.count($toselect)), null, 'mesgs'); - setEventMessages($langs->trans("EMailSentForNElements", $nbsent.'/'.count($toselect)), null, 'mesgs'); - setEventMessages($resaction, null, 'mesgs'); - } - else - { - //setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file - setEventMessages($resaction, null, 'warnings'); - } + if ($nbsent) + { + $action=''; // Do not show form post if there was at least one successfull sent + //setEventMessages($langs->trans("EMailSentToNRecipients", $nbsent.'/'.count($toselect)), null, 'mesgs'); + setEventMessages($langs->trans("EMailSentForNElements", $nbsent.'/'.count($toselect)), null, 'mesgs'); + setEventMessages($resaction, null, 'mesgs'); + } + else + { + //setEventMessages($langs->trans("EMailSentToNRecipients", 0), null, 'warnings'); // May be object has no generated PDF file + setEventMessages($resaction, null, 'warnings'); + } - $action='list'; - $massaction=''; - } + $action='list'; + $massaction=''; + } } if ($massaction == 'confirm_createbills') // Create bills from orders { - $orders = GETPOST('toselect', 'array'); - $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); - $validate_invoices = GETPOST('validate_invoices', 'int'); + $orders = GETPOST('toselect', 'array'); + $createbills_onebythird = GETPOST('createbills_onebythird', 'int'); + $validate_invoices = GETPOST('validate_invoices', 'int'); - $TFact = array(); - $TFactThird = array(); + $TFact = array(); + $TFactThird = array(); - $nb_bills_created = 0; + $nb_bills_created = 0; - $db->begin(); + $db->begin(); - foreach($orders as $id_order) - { - $cmd = new Commande($db); - if ($cmd->fetch($id_order) <= 0) continue; + foreach($orders as $id_order) + { + $cmd = new Commande($db); + if ($cmd->fetch($id_order) <= 0) continue; - $objecttmp = new Facture($db); - if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. - else { - // Load extrafields of order - $cmd->fetch_optionals(); + $objecttmp = new Facture($db); + if (!empty($createbills_onebythird) && !empty($TFactThird[$cmd->socid])) $objecttmp = $TFactThird[$cmd->socid]; // If option "one bill per third" is set, we use already created order. + else { + // Load extrafields of order + $cmd->fetch_optionals(); - $objecttmp->socid = $cmd->socid; - $objecttmp->type = Facture::TYPE_STANDARD; - $objecttmp->cond_reglement_id = $cmd->cond_reglement_id; - $objecttmp->mode_reglement_id = $cmd->mode_reglement_id; - $objecttmp->fk_project = $cmd->fk_project; + $objecttmp->socid = $cmd->socid; + $objecttmp->type = Facture::TYPE_STANDARD; + $objecttmp->cond_reglement_id = $cmd->cond_reglement_id; + $objecttmp->mode_reglement_id = $cmd->mode_reglement_id; + $objecttmp->fk_project = $cmd->fk_project; $objecttmp->multicurrency_code = $cmd->multicurrency_code; if (empty($createbills_onebythird)) $objecttmp->ref_client = $cmd->ref_client; $datefacture = dol_mktime(12, 0, 0, GETPOST('remonth', 'int'), GETPOST('reday', 'int'), GETPOST('reyear', 'int')); if (empty($datefacture)) - { - $datefacture = dol_now(); - } + { + $datefacture = dol_now(); + } - $objecttmp->date = $datefacture; - $objecttmp->origin = 'commande'; - $objecttmp->origin_id = $id_order; + $objecttmp->date = $datefacture; + $objecttmp->origin = 'commande'; + $objecttmp->origin_id = $id_order; - $objecttmp->array_options = $cmd->array_options; // Copy extrafields + $objecttmp->array_options = $cmd->array_options; // Copy extrafields - $res = $objecttmp->create($user); + $res = $objecttmp->create($user); - if($res > 0) $nb_bills_created++; - } + if($res > 0) $nb_bills_created++; + } - if ($objecttmp->id > 0) - { - $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; - $sql.= "fk_source"; - $sql.= ", sourcetype"; - $sql.= ", fk_target"; - $sql.= ", targettype"; - $sql.= ") VALUES ("; - $sql.= $id_order; - $sql.= ", '".$objecttmp->origin."'"; - $sql.= ", ".$objecttmp->id; - $sql.= ", '".$objecttmp->element."'"; - $sql.= ")"; + if ($objecttmp->id > 0) + { + $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; + $sql.= "fk_source"; + $sql.= ", sourcetype"; + $sql.= ", fk_target"; + $sql.= ", targettype"; + $sql.= ") VALUES ("; + $sql.= $id_order; + $sql.= ", '".$objecttmp->origin."'"; + $sql.= ", ".$objecttmp->id; + $sql.= ", '".$objecttmp->element."'"; + $sql.= ")"; - if (! $db->query($sql)) - { - $error++; - } + if (! $db->query($sql)) + { + $error++; + } - if (! $error) - { - $lines = $cmd->lines; - if (empty($lines) && method_exists($cmd, 'fetch_lines')) - { - $cmd->fetch_lines(); - $lines = $cmd->lines; - } + if (! $error) + { + $lines = $cmd->lines; + if (empty($lines) && method_exists($cmd, 'fetch_lines')) + { + $cmd->fetch_lines(); + $lines = $cmd->lines; + } - $fk_parent_line=0; - $num=count($lines); + $fk_parent_line=0; + $num=count($lines); - for ($i=0;$i<$num;$i++) - { - $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); - // If we build one invoice for several order, we must put the invoice of order on the line - if (! empty($createbills_onebythird)) - { - $desc=dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day', $langs)); - } + for ($i=0;$i<$num;$i++) + { + $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); + // If we build one invoice for several order, we must put the invoice of order on the line + if (! empty($createbills_onebythird)) + { + $desc=dol_concatdesc($desc, $langs->trans("Order").' '.$cmd->ref.' - '.dol_print_date($cmd->date, 'day', $langs)); + } - if ($lines[$i]->subprice < 0) - { - // Negative line, we create a discount line - $discount = new DiscountAbsolute($db); - $discount->fk_soc=$objecttmp->socid; - $discount->amount_ht=abs($lines[$i]->total_ht); - $discount->amount_tva=abs($lines[$i]->total_tva); - $discount->amount_ttc=abs($lines[$i]->total_ttc); - $discount->tva_tx=$lines[$i]->tva_tx; - $discount->fk_user=$user->id; - $discount->description=$desc; - $discountid=$discount->create($user); - if ($discountid > 0) - { - $result=$objecttmp->insert_discount($discountid); - //$result=$discount->link_to_invoice($lineid,$id); - } - else - { - setEventMessages($discount->error, $discount->errors, 'errors'); - $error++; - break; - } - } - else - { - // Positive line - $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); - // Date start - $date_start=false; - if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue; - if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; - if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; - //Date end - $date_end=false; - if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue; - if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; - if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; - // Reset fk_parent_line for no child products and special product - if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) - { - $fk_parent_line = 0; - } + if ($lines[$i]->subprice < 0) + { + // Negative line, we create a discount line + $discount = new DiscountAbsolute($db); + $discount->fk_soc=$objecttmp->socid; + $discount->amount_ht=abs($lines[$i]->total_ht); + $discount->amount_tva=abs($lines[$i]->total_tva); + $discount->amount_ttc=abs($lines[$i]->total_ttc); + $discount->tva_tx=$lines[$i]->tva_tx; + $discount->fk_user=$user->id; + $discount->description=$desc; + $discountid=$discount->create($user); + if ($discountid > 0) + { + $result=$objecttmp->insert_discount($discountid); + //$result=$discount->link_to_invoice($lineid,$id); + } + else + { + setEventMessages($discount->error, $discount->errors, 'errors'); + $error++; + break; + } + } + else + { + // Positive line + $product_type=($lines[$i]->product_type?$lines[$i]->product_type:0); + // Date start + $date_start=false; + if ($lines[$i]->date_debut_prevue) $date_start=$lines[$i]->date_debut_prevue; + if ($lines[$i]->date_debut_reel) $date_start=$lines[$i]->date_debut_reel; + if ($lines[$i]->date_start) $date_start=$lines[$i]->date_start; + //Date end + $date_end=false; + if ($lines[$i]->date_fin_prevue) $date_end=$lines[$i]->date_fin_prevue; + if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; + if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; + // Reset fk_parent_line for no child products and special product + if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) + { + $fk_parent_line = 0; + } - // Extrafields - if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { - $lines[$i]->fetch_optionals($lines[$i]->rowid); - $array_options = $lines[$i]->array_options; - } + // Extrafields + if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED) && method_exists($lines[$i], 'fetch_optionals')) { + $lines[$i]->fetch_optionals($lines[$i]->rowid); + $array_options = $lines[$i]->array_options; + } - $result = $objecttmp->addline( - $desc, - $lines[$i]->subprice, - $lines[$i]->qty, - $lines[$i]->tva_tx, - $lines[$i]->localtax1_tx, - $lines[$i]->localtax2_tx, - $lines[$i]->fk_product, - $lines[$i]->remise_percent, - $date_start, - $date_end, - 0, - $lines[$i]->info_bits, - $lines[$i]->fk_remise_except, - 'HT', - 0, - $product_type, - $ii, - $lines[$i]->special_code, - $objecttmp->origin, - $lines[$i]->rowid, - $fk_parent_line, - $lines[$i]->fk_fournprice, - $lines[$i]->pa_ht, - $lines[$i]->label, - $array_options - ); - if ($result > 0) - { - $lineid=$result; - } - else - { - $lineid=0; - $error++; - break; - } - // Defined the new fk_parent_line - if ($result > 0 && $lines[$i]->product_type == 9) - { - $fk_parent_line = $result; - } - } - } - } - } + $result = $objecttmp->addline( + $desc, + $lines[$i]->subprice, + $lines[$i]->qty, + $lines[$i]->tva_tx, + $lines[$i]->localtax1_tx, + $lines[$i]->localtax2_tx, + $lines[$i]->fk_product, + $lines[$i]->remise_percent, + $date_start, + $date_end, + 0, + $lines[$i]->info_bits, + $lines[$i]->fk_remise_except, + 'HT', + 0, + $product_type, + $ii, + $lines[$i]->special_code, + $objecttmp->origin, + $lines[$i]->rowid, + $fk_parent_line, + $lines[$i]->fk_fournprice, + $lines[$i]->pa_ht, + $lines[$i]->label, + $array_options + ); + if ($result > 0) + { + $lineid=$result; + } + else + { + $lineid=0; + $error++; + break; + } + // Defined the new fk_parent_line + if ($result > 0 && $lines[$i]->product_type == 9) + { + $fk_parent_line = $result; + } + } + } + } + } - //$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module. + //$cmd->classifyBilled($user); // Disabled. This behavior must be set or not using the workflow module. - if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $objecttmp; - else $TFact[$objecttmp->id] = $objecttmp; - } + if(!empty($createbills_onebythird) && empty($TFactThird[$cmd->socid])) $TFactThird[$cmd->socid] = $objecttmp; + else $TFact[$objecttmp->id] = $objecttmp; + } - // Build doc with all invoices - $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird; - $toselect = array(); + // Build doc with all invoices + $TAllFact = empty($createbills_onebythird) ? $TFact : $TFactThird; + $toselect = array(); - if (! $error && $validate_invoices) - { - $massaction = $action = 'builddoc'; + if (! $error && $validate_invoices) + { + $massaction = $action = 'builddoc'; - foreach($TAllFact as &$objecttmp) - { - $result = $objecttmp->validate($user); - if ($result <= 0) - { - $error++; - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - break; - } + foreach($TAllFact as &$objecttmp) + { + $result = $objecttmp->validate($user); + if ($result <= 0) + { + $error++; + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + break; + } - $id = $objecttmp->id; // For builddoc action - $object = $objecttmp; + $id = $objecttmp->id; // For builddoc action + $object = $objecttmp; - // Builddoc - $donotredirect = 1; - $upload_dir = $conf->facture->dir_output; - $permissioncreate=$user->rights->facture->creer; + // Builddoc + $donotredirect = 1; + $upload_dir = $conf->facture->dir_output; + $permissioncreate=$user->rights->facture->creer; - // Call action to build doc - $savobject = $object; - $object = $objecttmp; - include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; - $object = $savobject; - } + // Call action to build doc + $savobject = $object; + $object = $objecttmp; + include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; + $object = $savobject; + } - $massaction = $action = 'confirm_createbills'; - } + $massaction = $action = 'confirm_createbills'; + } - if (! $error) - { - $db->commit(); + if (! $error) + { + $db->commit(); setEventMessages($langs->trans('BillCreated', $nb_bills_created), null, 'mesgs'); - // Make a redirect to avoid to bill twice if we make a refresh or back - $param=''; - 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 ($socid > 0) $param.='&socid='.urlencode($socid); - if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut); - if ($search_orderday) $param.='&search_orderday='.urlencode($search_orderday); - if ($search_ordermonth) $param.='&search_ordermonth='.urlencode($search_ordermonth); - if ($search_orderyear) $param.='&search_orderyear='.urlencode($search_orderyear); - if ($search_deliveryday) $param.='&search_deliveryday='.urlencode($search_deliveryday); - if ($search_deliverymonth) $param.='&search_deliverymonth='.urlencode($search_deliverymonth); - if ($search_deliveryyear) $param.='&search_deliveryyear='.urlencode($search_deliveryyear); - if ($search_ref) $param.='&search_ref='.urlencode($search_ref); - if ($search_company) $param.='&search_company='.urlencode($search_company); - if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer); - if ($search_user > 0) $param.='&search_user='.urlencode($search_user); - if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); - if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht); - if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat); - if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc); - if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); - if ($show_files) $param.='&show_files=' .urlencode($show_files); - if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); - if ($billed != '') $param.='&billed='.urlencode($billed); + // Make a redirect to avoid to bill twice if we make a refresh or back + $param=''; + 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 ($socid > 0) $param.='&socid='.urlencode($socid); + if ($viewstatut != '') $param.='&viewstatut='.urlencode($viewstatut); + if ($search_orderday) $param.='&search_orderday='.urlencode($search_orderday); + if ($search_ordermonth) $param.='&search_ordermonth='.urlencode($search_ordermonth); + if ($search_orderyear) $param.='&search_orderyear='.urlencode($search_orderyear); + if ($search_deliveryday) $param.='&search_deliveryday='.urlencode($search_deliveryday); + if ($search_deliverymonth) $param.='&search_deliverymonth='.urlencode($search_deliverymonth); + if ($search_deliveryyear) $param.='&search_deliveryyear='.urlencode($search_deliveryyear); + if ($search_ref) $param.='&search_ref='.urlencode($search_ref); + if ($search_company) $param.='&search_company='.urlencode($search_company); + if ($search_ref_customer) $param.='&search_ref_customer='.urlencode($search_ref_customer); + if ($search_user > 0) $param.='&search_user='.urlencode($search_user); + if ($search_sale > 0) $param.='&search_sale='.urlencode($search_sale); + if ($search_total_ht != '') $param.='&search_total_ht='.urlencode($search_total_ht); + if ($search_total_vat != '') $param.='&search_total_vat='.urlencode($search_total_vat); + if ($search_total_ttc != '') $param.='&search_total_ttc='.urlencode($search_total_ttc); + if ($search_project_ref >= 0) $param.="&search_project_ref=".urlencode($search_project_ref); + if ($show_files) $param.='&show_files=' .urlencode($show_files); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + if ($billed != '') $param.='&billed='.urlencode($billed); - header("Location: ".$_SERVER['PHP_SELF'].'?'.$param); - exit; - } - else - { - $db->rollback(); - $action='create'; - $_GET["origin"]=$_POST["origin"]; - $_GET["originid"]=$_POST["originid"]; - setEventMessages("Error", null, 'errors'); - $error++; - } + header("Location: ".$_SERVER['PHP_SELF'].'?'.$param); + exit; + } + else + { + $db->rollback(); + $action='create'; + $_GET["origin"]=$_POST["origin"]; + $_GET["originid"]=$_POST["originid"]; + setEventMessages("Error", null, 'errors'); + $error++; + } } if (!$error && $massaction == 'cancelorders') { - $db->begin(); - $nbok = 0; + $db->begin(); + + $nbok = 0; - $orders = GETPOST('toselect', 'array'); - foreach ($orders as $id_order) - { + $orders = GETPOST('toselect', 'array'); + foreach ($orders as $id_order) + { - $cmd = new Commande($db); - if ($cmd->fetch($id_order) <= 0) - continue; + $cmd = new Commande($db); + if ($cmd->fetch($id_order) <= 0) + continue; - if ($cmd->statut != Commande::STATUS_VALIDATED) - { - $langs->load('errors'); - setEventMessages($langs->trans("ErrorObjectMustHaveStatusValidToBeCanceled", $cmd->ref), null, 'errors'); - $error++; - break; - } - else - $result = $cmd->cancel(); + if ($cmd->statut != Commande::STATUS_VALIDATED) + { + $langs->load('errors'); + setEventMessages($langs->trans("ErrorObjectMustHaveStatusValidToBeCanceled", $cmd->ref), null, 'errors'); + $error++; + break; + } + else + $result = $cmd->cancel(); - if ($result < 0) - { - setEventMessages($cmd->error, $cmd->errors, 'errors'); - $error++; - break; - } - else - $nbok++; - } - if (!$error) - { - if ($nbok > 1) - setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - else - setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - $db->commit(); - } - else - { - $db->rollback(); - } + if ($result < 0) + { + setEventMessages($cmd->error, $cmd->errors, 'errors'); + $error++; + break; + } + else + $nbok++; + } + if (!$error) + { + if ($nbok > 1) + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + else + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); + } + else + { + $db->rollback(); + } } if (! $error && $massaction == "builddoc" && $permtoread && ! GETPOST('button_search')) { - if (empty($diroutputmassaction)) - { - dol_print_error(null, 'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined'); - exit; - } + if (empty($diroutputmassaction)) + { + dol_print_error(null, 'include of actions_massactions.inc.php is done but var $diroutputmassaction was not defined'); + exit; + } - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; - require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; - $objecttmp=new $objectclass($db); - $listofobjectid=array(); - $listofobjectthirdparties=array(); - $listofobjectref=array(); - foreach($toselect as $toselectid) - { - $objecttmp=new $objectclass($db); // must create new instance because instance is saved into $listofobjectref array for future use - $result=$objecttmp->fetch($toselectid); - if ($result > 0) - { - $listofobjectid[$toselectid]=$toselectid; - $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; - $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; - $listofobjectref[$toselectid]=$objecttmp->ref; - } - } + $objecttmp=new $objectclass($db); + $listofobjectid=array(); + $listofobjectthirdparties=array(); + $listofobjectref=array(); + foreach($toselect as $toselectid) + { + $objecttmp=new $objectclass($db); // must create new instance because instance is saved into $listofobjectref array for future use + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + $listofobjectid[$toselectid]=$toselectid; + $thirdpartyid=$objecttmp->fk_soc?$objecttmp->fk_soc:$objecttmp->socid; + $listofobjectthirdparties[$thirdpartyid]=$thirdpartyid; + $listofobjectref[$toselectid]=$objecttmp->ref; + } + } - $arrayofinclusion=array(); - foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$'; - foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files - $listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, true); + $arrayofinclusion=array(); + foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'\.pdf$'; + foreach($listofobjectref as $tmppdf) $arrayofinclusion[]='^'.preg_quote(dol_sanitizeFileName($tmppdf), '/').'_[a-zA-Z0-9-_]+\.pdf$'; // To include PDF generated from ODX files + $listoffiles = dol_dir_list($uploaddir, 'all', 1, implode('|', $arrayofinclusion), '\.meta$|\.png', 'date', SORT_DESC, 0, true); - // build list of files with full path - $files = array(); - foreach($listofobjectref as $basename) - { - $basename = dol_sanitizeFileName($basename); - foreach($listoffiles as $filefound) - { - if (strstr($filefound["name"], $basename)) - { - $files[] = $uploaddir.'/'.$basename.'/'.$filefound["name"]; - break; - } - } - } + // build list of files with full path + $files = array(); + foreach($listofobjectref as $basename) + { + $basename = dol_sanitizeFileName($basename); + foreach($listoffiles as $filefound) + { + if (strstr($filefound["name"], $basename)) + { + $files[] = $uploaddir.'/'.$basename.'/'.$filefound["name"]; + break; + } + } + } - // Define output language (Here it is not used because we do only merging existing PDF) - $outputlangs = $langs; - $newlang=''; - if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang=GETPOST('lang_id', 'aZ09'); - if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$objecttmp->thirdparty->default_lang; - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } + // Define output language (Here it is not used because we do only merging existing PDF) + $outputlangs = $langs; + $newlang=''; + if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id', 'aZ09')) $newlang=GETPOST('lang_id', 'aZ09'); + if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$objecttmp->thirdparty->default_lang; + if (! empty($newlang)) { + $outputlangs = new Translate("", $conf); + $outputlangs->setDefaultLang($newlang); + } - if (!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT)) - { - // Create output dir if not exists - dol_mkdir($diroutputmassaction); + if (!empty($conf->global->USE_PDFTK_FOR_PDF_CONCAT)) + { + // Create output dir if not exists + dol_mkdir($diroutputmassaction); - // Defined name of merged file - $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); - $filename=preg_replace('/\s/', '_', $filename); + // Defined name of merged file + $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); + $filename=preg_replace('/\s/', '_', $filename); - // Save merged file - if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) - { - if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); - else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); - } - if ($year) $filename.='_'.$year; - if ($month) $filename.='_'.$month; + // Save merged file + if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) + { + if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); + else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); + } + if ($year) $filename.='_'.$year; + if ($month) $filename.='_'.$month; - if (count($files)>0) - { - $now=dol_now(); - $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now, 'dayhourlog').'.pdf'; + if (count($files)>0) + { + $now=dol_now(); + $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now, 'dayhourlog').'.pdf'; - $input_files = ''; - foreach($files as $f) { - $input_files.=' '.escapeshellarg($f); - } + $input_files = ''; + foreach($files as $f) { + $input_files.=' '.escapeshellarg($f); + } - $cmd = 'pdftk '.escapeshellarg($input_files).' cat output '.escapeshellarg($file); - exec($cmd); + $cmd = 'pdftk '.escapeshellarg($input_files).' cat output '.escapeshellarg($file); + exec($cmd); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($file, octdec($conf->global->MAIN_UMASK)); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); - $langs->load("exports"); - setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); - } - } - else { - // Create empty PDF - $formatarray=pdf_getFormat(); - $page_largeur = $formatarray['width']; - $page_hauteur = $formatarray['height']; - $format = array($page_largeur,$page_hauteur); + $langs->load("exports"); + setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); + } + } + else { + // Create empty PDF + $formatarray=pdf_getFormat(); + $page_largeur = $formatarray['width']; + $page_hauteur = $formatarray['height']; + $format = array($page_largeur, $page_hauteur); - $pdf=pdf_getInstance($format); + $pdf=pdf_getInstance($format); - if (class_exists('TCPDF')) - { - $pdf->setPrintHeader(false); - $pdf->setPrintFooter(false); - } - $pdf->SetFont(pdf_getPDFFont($outputlangs)); + if (class_exists('TCPDF')) + { + $pdf->setPrintHeader(false); + $pdf->setPrintFooter(false); + } + $pdf->SetFont(pdf_getPDFFont($outputlangs)); - if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); + if (! empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) $pdf->SetCompression(false); - // Add all others - foreach($files as $file) - { - // Charge un document PDF depuis un fichier. - $pagecount = $pdf->setSourceFile($file); - for ($i = 1; $i <= $pagecount; $i++) - { - $tplidx = $pdf->importPage($i); - $s = $pdf->getTemplatesize($tplidx); - $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); - $pdf->useTemplate($tplidx); - } - } + // Add all others + foreach($files as $file) + { + // Charge un document PDF depuis un fichier. + $pagecount = $pdf->setSourceFile($file); + for ($i = 1; $i <= $pagecount; $i++) + { + $tplidx = $pdf->importPage($i); + $s = $pdf->getTemplatesize($tplidx); + $pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L'); + $pdf->useTemplate($tplidx); + } + } - // Create output dir if not exists - dol_mkdir($diroutputmassaction); + // Create output dir if not exists + dol_mkdir($diroutputmassaction); - // Defined name of merged file - $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); - $filename=preg_replace('/\s/', '_', $filename); + // Defined name of merged file + $filename=strtolower(dol_sanitizeFileName($langs->transnoentities($objectlabel))); + $filename=preg_replace('/\s/', '_', $filename); - // Save merged file - if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) - { - if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); - else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); - } - if ($year) $filename.='_'.$year; - if ($month) $filename.='_'.$month; - if ($pagecount) - { - $now=dol_now(); - $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now, 'dayhourlog').'.pdf'; - $pdf->Output($file, 'F'); - if (! empty($conf->global->MAIN_UMASK)) - @chmod($file, octdec($conf->global->MAIN_UMASK)); + // Save merged file + if (in_array($objecttmp->element, array('facture', 'facture_fournisseur')) && $search_status == Facture::STATUS_VALIDATED) + { + if ($option=='late') $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))).'_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Late"))); + else $filename.='_'.strtolower(dol_sanitizeFileName($langs->transnoentities("Unpaid"))); + } + if ($year) $filename.='_'.$year; + if ($month) $filename.='_'.$month; + if ($pagecount) + { + $now=dol_now(); + $file=$diroutputmassaction.'/'.$filename.'_'.dol_print_date($now, 'dayhourlog').'.pdf'; + $pdf->Output($file, 'F'); + if (! empty($conf->global->MAIN_UMASK)) + @chmod($file, octdec($conf->global->MAIN_UMASK)); - $langs->load("exports"); - setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); - } - else - { - setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); - } - } + $langs->load("exports"); + setEventMessages($langs->trans('FileSuccessfullyBuilt', $filename.'_'.dol_print_date($now, 'dayhourlog')), null, 'mesgs'); + } + else + { + setEventMessages($langs->trans('NoPDFAvailableForDocGenAmongChecked'), null, 'errors'); + } + } } // Remove a file from massaction area if ($action == 'remove_file') { - require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; + require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; - $langs->load("other"); - $upload_dir = $diroutputmassaction; - $file = $upload_dir . '/' . GETPOST('file'); - $ret=dol_delete_file($file); - if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); - else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); - $action=''; + $langs->load("other"); + $upload_dir = $diroutputmassaction; + $file = $upload_dir . '/' . GETPOST('file'); + $ret=dol_delete_file($file); + if ($ret) setEventMessages($langs->trans("FileWasRemoved", GETPOST('file')), null, 'mesgs'); + else setEventMessages($langs->trans("ErrorFailToDeleteFile", GETPOST('file')), null, 'errors'); + $action=''; } // Validate records if (! $error && $massaction == 'validate' && $permtocreate) { - $objecttmp=new $objectclass($db); + $objecttmp=new $objectclass($db); - if ($objecttmp->element == 'invoice' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) - { - $langs->load("errors"); - setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); - $error++; - } - if ($objecttmp->element == 'invoice_supplier' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) - { - $langs->load("errors"); - setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); - $error++; - } - if (! $error) - { - $db->begin(); + if ($objecttmp->element == 'invoice' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_BILL)) + { + $langs->load("errors"); + setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); + $error++; + } + if ($objecttmp->element == 'invoice_supplier' && ! empty($conf->stock->enabled) && ! empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_BILL)) + { + $langs->load("errors"); + setEventMessages($langs->trans('ErrorMassValidationNotAllowedWhenStockIncreaseOnAction'), null, 'errors'); + $error++; + } + if (! $error) + { + $db->begin(); - $nbok = 0; - foreach($toselect as $toselectid) - { - $result=$objecttmp->fetch($toselectid); - if ($result > 0) - { - //if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1); - //else - $result = $objecttmp->validate($user); - if ($result == 0) - { - $langs->load("errors"); - setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftToBeValidated", $objecttmp->ref), null, 'errors'); - $error++; - break; - } - elseif ($result < 0) - { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } - else $nbok++; - } - else - { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } - } + $nbok = 0; + foreach($toselect as $toselectid) + { + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + //if (in_array($objecttmp->element, array('societe','member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1); + //else + $result = $objecttmp->validate($user); + if ($result == 0) + { + $langs->load("errors"); + setEventMessages($langs->trans("ErrorObjectMustHaveStatusDraftToBeValidated", $objecttmp->ref), null, 'errors'); + $error++; + break; + } + elseif ($result < 0) + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + else $nbok++; + } + else + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } - if (! $error) - { - if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - $db->commit(); - } - else - { - $db->rollback(); - } - //var_dump($listofobjectthirdparties);exit; - } + if (! $error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); + } + else + { + $db->rollback(); + } + //var_dump($listofobjectthirdparties);exit; + } } // Closed records if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permtoclose) { @@ -1144,9 +1168,9 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permtoclo if (!$error) { if ($nbok > 1) setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - else - setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); - $db->commit(); + else + setEventMessages($langs->trans("RecordsModified", $nbok), null, 'mesgs'); + $db->commit(); } else { $db->rollback(); @@ -1155,66 +1179,66 @@ if (!$error && $massaction == 'closed' && $objectclass == "Propal" && $permtoclo // Delete record from mass action (massaction = 'delete' for direct delete, action/confirm='delete'/'yes' with a confirmation step before) if (! $error && ($massaction == 'delete' || ($action == 'delete' && $confirm == 'yes')) && $permtodelete) { - $db->begin(); + $db->begin(); - $objecttmp=new $objectclass($db); - $nbok = 0; - foreach($toselect as $toselectid) - { - $result=$objecttmp->fetch($toselectid); - if ($result > 0) - { - // Refuse deletion for some objects/status - if ($objectclass == 'Facture' && empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $objecttmp->status != Facture::STATUS_DRAFT) - { - $langs->load("errors"); - $nbignored++; - $resaction.='
'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction', $objecttmp->ref).'

'; - continue; - } + $objecttmp=new $objectclass($db); + $nbok = 0; + foreach($toselect as $toselectid) + { + $result=$objecttmp->fetch($toselectid); + if ($result > 0) + { + // Refuse deletion for some objects/status + if ($objectclass == 'Facture' && empty($conf->global->INVOICE_CAN_ALWAYS_BE_REMOVED) && $objecttmp->status != Facture::STATUS_DRAFT) + { + $langs->load("errors"); + $nbignored++; + $resaction.='
'.$langs->trans('ErrorOnlyDraftStatusCanBeDeletedInMassAction', $objecttmp->ref).'

'; + continue; + } - if ($objectclass == "Task" && $objecttmp->hasChildren() > 0) - { - $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".$objecttmp->id; - $res = $db->query($sql); + if ($objectclass == "Task" && $objecttmp->hasChildren() > 0) + { + $sql = "UPDATE ".MAIN_DB_PREFIX."projet_task SET fk_task_parent = 0 WHERE fk_task_parent = ".$objecttmp->id; + $res = $db->query($sql); - if (!$res) - { - setEventMessage('ErrorRecordParentingNotModified', 'errors'); - $error++; - } - } + if (!$res) + { + setEventMessage('ErrorRecordParentingNotModified', 'errors'); + $error++; + } + } - if (in_array($objecttmp->element, array('societe', 'member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1); - else $result = $objecttmp->delete($user); + if (in_array($objecttmp->element, array('societe', 'member'))) $result = $objecttmp->delete($objecttmp->id, $user, 1); + else $result = $objecttmp->delete($user); - if ($result <= 0) - { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } - else $nbok++; - } - else - { - setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); - $error++; - break; - } - } + if ($result <= 0) + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + else $nbok++; + } + else + { + setEventMessages($objecttmp->error, $objecttmp->errors, 'errors'); + $error++; + break; + } + } - if (! $error) - { - if ($nbok > 1) setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs'); - else setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs'); - $db->commit(); - } - else - { - $db->rollback(); - } - //var_dump($listofobjectthirdparties);exit; + if (! $error) + { + if ($nbok > 1) setEventMessages($langs->trans("RecordsDeleted", $nbok), null, 'mesgs'); + else setEventMessages($langs->trans("RecordDeleted", $nbok), null, 'mesgs'); + $db->commit(); + } + else + { + $db->rollback(); + } + //var_dump($listofobjectthirdparties);exit; } // Generate document foreach object according to model linked to object diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 9c5812069b7..5016d10780d 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -391,7 +391,7 @@ abstract class CommonObject * @var string * @see SetIncoterms() */ - public $libelle_incoterms; + public $label_incoterms; /** * @var string @@ -3762,7 +3762,7 @@ abstract class CommonObject { // phpcs:enable $out = ''; - $this->libelle_incoterms = ''; + $this->label_incoterms = ''; if (!empty($this->fk_incoterms)) { $sql = 'SELECT code FROM '.MAIN_DB_PREFIX.'c_incoterms WHERE rowid = '.(int) $this->fk_incoterms; @@ -3835,7 +3835,7 @@ abstract class CommonObject if ($res) { $obj = $this->db->fetch_object($res); - $this->libelle_incoterms = $obj->libelle; + $this->label_incoterms = $obj->libelle; } return 1; } @@ -4450,7 +4450,7 @@ abstract class CommonObject * Common function for all objects extending CommonObject for generating documents * * @param string $modelspath Relative folder where generators are placed - * @param string $modele Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf') for example. + * @param string $modele Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf','alpha') for example. * @param Translate $outputlangs Output language to use * @param int $hidedetails 1 to hide details. 0 by default * @param int $hidedesc 1 to hide product description. 0 by default @@ -4465,6 +4465,8 @@ abstract class CommonObject $srctemplatepath=''; + dol_syslog("commonGenerateDocument modele=".$modele." outputlangs->defaultlang=".(is_object($outputlangs)?$outputlangs->defaultlang:'null')); + // Increase limit for PDF build $err=error_reporting(); error_reporting(0); @@ -4505,7 +4507,7 @@ abstract class CommonObject // If generator was found if ($filefound) { - global $db; // Required to solve a conception default in commonstickergenerator.class.php making an include of code using $db + global $db; // Required to solve a conception default making an include of code using $db instead of $this->db just after. require_once $file; @@ -6379,6 +6381,7 @@ abstract class CommonObject $out .= ' '; $out .= "\n"; + $extrafields_collapse_num = ''; $e = 0; foreach($extrafields->attributes[$this->table_element]['label'] as $key=>$label) { @@ -6438,6 +6441,20 @@ abstract class CommonObject if ($extrafields->attributes[$this->table_element]['type'][$key] == 'separate') { + $extrafields_collapse_num = ''; + $extrafield_param = $extrafields->attributes[$this->table_element]['param'][$key]; + if (!empty($extrafield_param) && is_array($extrafield_param)) { + $extrafield_param_list = array_keys($extrafield_param['options']); + + if (count($extrafield_param_list)>0) { + $extrafield_collapse_display_value = intval($extrafield_param_list[0]); + + if ($extrafield_collapse_display_value==1 || $extrafield_collapse_display_value==2) { + $extrafields_collapse_num = $extrafields->attributes[$this->table_element]['pos'][$key]; + } + } + } + $out .= $extrafields->showSeparator($key, $this); } else @@ -6457,7 +6474,7 @@ abstract class CommonObject $html_id = !empty($this->id) ? 'extrarow-'.$this->element.'_'.$key.'_'.$this->id : ''; - $out .= ''; + $out .= ''; if (! empty($conf->global->MAIN_EXTRAFIELDS_USE_TWO_COLUMS) && ($e % 2) == 0) { @@ -6519,7 +6536,7 @@ abstract class CommonObject jQuery(document).ready(function() { function showOptions(child_list, parent_list) { - var val = $("select[name=\"options_"+parent_list+"\"]").val(); + var val = $("select[name=\""+parent_list+"\"]").val(); var parentVal = parent_list + ":" + val; if(val > 0) { $("select[name=\""+child_list+"\"] option[parent]").hide(); diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 62c7f0f9e24..9dbf7ccd125 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -672,6 +672,7 @@ class Conf if (isset($this->commande)) $this->order=$this->commande; if (isset($this->contrat)) $this->contract=$this->contrat; if (isset($this->categorie)) $this->category=$this->categorie; + if (isset($this->project)) $this->project=$this->projet; // Object $mc if (! defined('NOREQUIREMC') && ! empty($this->multicompany->enabled)) diff --git a/htdocs/core/class/discount.class.php b/htdocs/core/class/discount.class.php index 8e66b29a3f8..678cfe446a0 100644 --- a/htdocs/core/class/discount.class.php +++ b/htdocs/core/class/discount.class.php @@ -227,6 +227,15 @@ class DiscountAbsolute return -1; } + $userid = $user->id; + if (! ($userid > 0)) // For example when record is saved into an anonymous context with a not loaded object $user. + { + include_once DOL_DOCUMENT_ROOT.'/compta/facture/class/facture.class.php'; + $tmpinvoice = new Facture($this->db); + $tmpinvoice->fetch($this->fk_facture_source); + $userid = $tmpinvoice->fk_user_author; // We use the author of invoice + } + // Insert request $sql = "INSERT INTO ".MAIN_DB_PREFIX."societe_remise_except"; $sql.= " (entity, datec, fk_soc, discount_type, fk_user, description,"; @@ -234,7 +243,7 @@ class DiscountAbsolute $sql.= " multicurrency_amount_ht, multicurrency_amount_tva, multicurrency_amount_ttc,"; $sql.= " fk_facture_source, fk_invoice_supplier_source"; $sql.= ")"; - $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($this->datec!=''?$this->datec:dol_now())."', ".$this->fk_soc.", ".(empty($this->discount_type)?0:intval($this->discount_type)).", ".$user->id.", '".$this->db->escape($this->description)."',"; + $sql.= " VALUES (".$conf->entity.", '".$this->db->idate($this->datec!=''?$this->datec:dol_now())."', ".$this->fk_soc.", ".(empty($this->discount_type)?0:intval($this->discount_type)).", ".$userid.", '".$this->db->escape($this->description)."',"; $sql.= " ".$this->amount_ht.", ".$this->amount_tva.", ".$this->amount_ttc.", ".$this->tva_tx.","; $sql.= " ".$this->multicurrency_amount_ht.", ".$this->multicurrency_amount_tva.", ".$this->multicurrency_amount_ttc.", "; $sql.= " ".($this->fk_facture_source ? "'".$this->db->escape($this->fk_facture_source)."'":"null").","; diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index eeb653aec8a..fae30c05e73 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1956,9 +1956,43 @@ class ExtraFields { global $langs; - $out = ''; + $out = ''; $out.= $langs->trans($this->attributes[$object->table_element]['label'][$key]); $out.= ''; + + $extrafield_param = $this->attributes[$object->table_element]['param'][$key]; + if (!empty($extrafield_param) && is_array($extrafield_param)) { + $extrafield_param_list = array_keys($extrafield_param['options']); + + if (count($extrafield_param_list) > 0) { + $extrafield_collapse_display_value = intval($extrafield_param_list[0]); + if ($extrafield_collapse_display_value == 1 || $extrafield_collapse_display_value == 2) { + $collapse_display = ($extrafield_collapse_display_value == 2 ? false : true); + $extrafields_collapse_num = $this->attributes[$object->table_element]['pos'][$key]; + + $out .= ''; + } + } + } + return $out; } diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 1e4ff4b353f..b0cdcd23a96 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -936,7 +936,6 @@ class FormMail extends Form $defaultmessage=preg_replace("/^(
)+/", "", $defaultmessage); $defaultmessage=preg_replace("/^\n+/", "", $defaultmessage); } - $out.= ''; $out.= ''; $out.=$form->textwithpicto($langs->trans('MailText'), $helpforsubstitution, 1, 'help', '', 0, 2, 'substittooltipfrombody'); @@ -1155,6 +1154,12 @@ class FormMail extends Form return -1; } + $languagetosearch = (is_object($outputlangs) ? $outputlangs->defaultlang : ''); + // Define $languagetosearchmain to fall back on main language (for example to get 'es_ES' for 'es_MX') + $tmparray = explode('_', $languagetosearch); + $languagetosearchmain = $tmparray[0].'_'.strtoupper($tmparray[0]); + if ($languagetosearchmain == $languagetosearch) $languagetosearchmain = ''; + $sql = "SELECT rowid, label, topic, joinfiles, content, content_lines, lang"; $sql.= " FROM ".MAIN_DB_PREFIX.'c_email_templates'; $sql.= " WHERE (type_template='".$db->escape($type_template)."' OR type_template='all')"; @@ -1162,10 +1167,10 @@ class FormMail extends Form $sql.= " AND (private = 0 OR fk_user = ".$user->id.")"; // Get all public or private owned if ($active >= 0) $sql.=" AND active = ".$active; if ($label) $sql.=" AND label ='".$db->escape($label)."'"; - if (! ($id > 0) && is_object($outputlangs)) $sql.= " AND (lang = '".$db->escape($outputlangs->defaultlang)."' OR lang IS NULL OR lang = '')"; + if (! ($id > 0) && $languagetosearch) $sql.= " AND (lang = '".$db->escape($languagetosearch)."'".($languagetosearchmain ? " OR lang = '".$db->escape($languagetosearchmain)."'" : "")." OR lang IS NULL OR lang = '')"; if ($id > 0) $sql.= " AND rowid=".$id; if ($id == -1) $sql.= " AND position=0"; - if (is_object($outputlangs)) $sql.= $db->order("position,lang,label", "ASC,DESC,ASC"); // We want line with lang set first, then with lang null or '' + if ($languagetosearch) $sql.= $db->order("position,lang,label", "ASC,DESC,ASC"); // We want line with lang set first, then with lang null or '' else $sql.= $db->order("position,lang,label", "ASC,ASC,ASC"); // If no language provided, we give priority to lang not defined $sql.= $db->plimit(1); //print $sql; diff --git a/htdocs/core/class/utils.class.php b/htdocs/core/class/utils.class.php index 9e0063ac414..f86d6570e5c 100644 --- a/htdocs/core/class/utils.class.php +++ b/htdocs/core/class/utils.class.php @@ -50,33 +50,36 @@ class Utils * Purge files into directory of data files. * CAN BE A CRON TASK * - * @param string $choice Choice of purge mode ('tempfiles', '' or 'tempfilesold' to purge temp older than 24h, 'allfiles', 'logfile') - * @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK) + * @param string $choice Choice of purge mode ('tempfiles', '' or 'tempfilesold' to purge temp older than $nbsecondsold seconds, 'allfiles', 'logfile') + * @param int $nbsecondsold Nb of seconds old to accept deletion of a directory if $choice is 'tempfilesold' + * @return int 0 if OK, < 0 if KO (this function is used also by cron so only 0 is OK) */ - public function purgeFiles($choice = 'tempfilesold') + public function purgeFiles($choice = 'tempfilesold', $nbsecondsold = 86400) { global $conf, $langs, $dolibarr_main_data_root; $langs->load("admin"); - dol_syslog("Utils::purgeFiles choice=".$choice, LOG_DEBUG); require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; $filesarray=array(); if (empty($choice)) $choice='tempfilesold'; + dol_syslog("Utils::purgeFiles choice=".$choice, LOG_DEBUG); + if ($choice=='tempfiles' || $choice=='tempfilesold') { // Delete temporary files if ($dolibarr_main_data_root) { - $filesarray=dol_dir_list($dolibarr_main_data_root, "directories", 1, '^temp$', '', 'name', SORT_ASC, 2, 0, '', 1); // Do not follow symlinks - if ($choice == 'tempfilesold') + $filesarray=dol_dir_list($dolibarr_main_data_root, "directories", 1, '^temp$', '', 'name', SORT_ASC, 2, 0, '', 1); // Do not follow symlinks + + if ($choice == 'tempfilesold') { $now = dol_now(); foreach($filesarray as $key => $val) { - if ($val['date'] > ($now - (24 * 3600))) unset($filesarray[$key]); // Discard files not older than 24h + if ($val['date'] > ($now - ($nbsecondsold))) unset($filesarray[$key]); // Discard temp dir not older than $nbsecondsold } } } @@ -119,13 +122,14 @@ class Utils $counterror=0; if (count($filesarray)) { - foreach($filesarray as $key => $value) + foreach($filesarray as $key => $value) { //print "x ".$filesarray[$key]['fullname']."-".$filesarray[$key]['type']."
\n"; - if ($filesarray[$key]['type'] == 'dir') + if ($filesarray[$key]['type'] == 'dir') { $startcount=0; $tmpcountdeleted=0; + $result=dol_delete_dir_recursive($filesarray[$key]['fullname'], $startcount, 1, 0, $tmpcountdeleted); $count+=$result; $countdeleted+=$tmpcountdeleted; @@ -165,6 +169,13 @@ class Utils } else $this->output=$langs->trans("PurgeNothingToDelete").($choice == 'tempfilesold' ? ' (older than 24h)':''); + // Recreate temp dir that are not automatically recreated by core code for performance purpose, we need them + if (! empty($conf->api->enabled)) + { + dol_mkdir($conf->api->dir_temp); + } + dol_mkdir($conf->user->dir_temp); + //return $count; return 0; // This function can be called by cron so must return 0 if OK } diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 56ca215e118..db3b8763941 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -36,25 +36,31 @@ /** * Return array with format properties of default PDF format * - * @param Translate $outputlangs Output lang to use to autodetect output format if setup not done + * @param Translate $outputlangs Output lang to use to autodetect output format if we need 'auto' detection + * @param string $mode 'setup' = Use setup, 'auto' = Force autodetection whatever is setup * @return array Array('width'=>w,'height'=>h,'unit'=>u); */ -function pdf_getFormat(Translate $outputlangs = null) +function pdf_getFormat(Translate $outputlangs = null, $mode = 'setup') { - global $conf,$db; + global $conf, $db, $langs; + + dol_syslog("pdf_getFormat Get paper format with mode=".$mode." MAIN_PDF_FORMAT=".(empty($conf->global->MAIN_PDF_FORMAT)?'null':$conf->global->MAIN_PDF_FORMAT)." outputlangs->defaultlang=".(is_object($outputlangs) ? $outputlangs->defaultlang : 'null')." and langs->defaultlang=".(is_object($langs) ? $langs->defaultlang : 'null')); // Default value if setup was not done and/or entry into c_paper_format not defined $width=210; $height=297; $unit='mm'; - if (empty($conf->global->MAIN_PDF_FORMAT)) + if ($mode == 'auto' || empty($conf->global->MAIN_PDF_FORMAT) || $conf->global->MAIN_PDF_FORMAT == 'auto') { include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; $pdfformat=dol_getDefaultFormat($outputlangs); } - else $pdfformat=$conf->global->MAIN_PDF_FORMAT; + else + { + $pdfformat=$conf->global->MAIN_PDF_FORMAT; + } $sql="SELECT code, label, width, height, unit FROM ".MAIN_DB_PREFIX."c_paper_format"; - $sql.=" WHERE code = '".$pdfformat."'"; + $sql.=" WHERE code = '".$db->escape($pdfformat)."'"; $resql=$db->query($sql); if ($resql) { diff --git a/htdocs/core/lib/product.lib.php b/htdocs/core/lib/product.lib.php index 4d79d0d4db3..68a6d9082f2 100644 --- a/htdocs/core/lib/product.lib.php +++ b/htdocs/core/lib/product.lib.php @@ -127,7 +127,7 @@ function product_prepare_head($object) $h++; } } - + // Tab to link resources if (!empty($conf->resource->enabled)) { @@ -173,7 +173,7 @@ function product_prepare_head($object) if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.dol_sanitizeFileName($object->ref); $nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { - if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->produit->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; + if (! empty($conf->product->enabled) && ($object->type==Product::TYPE_PRODUCT)) $upload_dir = $conf->product->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; if (! empty($conf->service->enabled) && ($object->type==Product::TYPE_SERVICE)) $upload_dir = $conf->service->multidir_output[$object->entity].'/'.get_exdir($object->id, 2, 0, 0, $object, 'product').$object->id.'/photos'; $nbFiles += count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$')); } diff --git a/htdocs/core/lib/project.lib.php b/htdocs/core/lib/project.lib.php index efcfeca61dd..77ac518c384 100644 --- a/htdocs/core/lib/project.lib.php +++ b/htdocs/core/lib/project.lib.php @@ -371,12 +371,13 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $numlines=count($lines); // We declare counter as global because we want to edit them into recursive call - global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned,$total_projectlinesa_tobill,$total_projectlinesa_billed; + global $total_projectlinesa_spent,$total_projectlinesa_planned,$total_projectlinesa_spent_if_planned,$total_projectlinesa_declared_if_planned,$total_projectlinesa_tobill,$total_projectlinesa_billed; if ($level == 0) { $total_projectlinesa_spent=0; $total_projectlinesa_planned=0; $total_projectlinesa_spent_if_planned=0; + $total_projectlinesa_declared_if_planned=0; $total_projectlinesa_tobill=0; $total_projectlinesa_billed=0; } @@ -624,6 +625,7 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t $total_projectlinesa_spent += $lines[$i]->duration; $total_projectlinesa_planned += $lines[$i]->planned_workload; if ($lines[$i]->planned_workload) $total_projectlinesa_spent_if_planned += $lines[$i]->duration; + if ($lines[$i]->planned_workload) $total_projectlinesa_declared_if_planned += $lines[$i]->planned_workload * $lines[$i]->progress / 100; } } else @@ -652,7 +654,9 @@ function projectLinesa(&$inc, $parent, &$lines, &$level, $var, $showproject, &$t print ''; if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_spent / $total_projectlinesa_planned, 2).' %'; print ''; - print ''; + print ''; + if ($total_projectlinesa_planned) print round(100 * $total_projectlinesa_declared_if_planned / $total_projectlinesa_planned, 2).' %'; + print ''; if ($showbilltime) { print ''; diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index 9a695788b47..4a8135800ae 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -1297,7 +1297,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it // For the moment, we manage this with hard coded exception //print "Remove box ".$file.'
'; if ($file == 'box_graph_product_distribution.php') { - if (! empty($conf->produit->enabled) || ! empty($conf->service->enabled)) { + if (! empty($conf->product->enabled) || ! empty($conf->service->enabled)) { dol_syslog("We discard disabling of module ".$file." because another module still active require it."); continue; } diff --git a/htdocs/core/modules/bom/mod_bom_advanced.php b/htdocs/core/modules/bom/mod_bom_advanced.php index ba5c437f0a0..aa8eef7aa59 100644 --- a/htdocs/core/modules/bom/mod_bom_advanced.php +++ b/htdocs/core/modules/bom/mod_bom_advanced.php @@ -23,7 +23,7 @@ /** * \file htdocs/core/modules/bom/mod_bom_advanced.php * \ingroup bom - * \brief Fichier contenant la classe du modele de numerotation de reference de bom advanced + * \brief File containing class for numbering model of bom advanced */ require_once DOL_DOCUMENT_ROOT .'/core/modules/bom/modules_bom.php'; @@ -52,7 +52,7 @@ class mod_bom_advanced extends ModeleNumRefboms /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php index 7ff3bc6f6cc..545222c8b03 100644 --- a/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php +++ b/htdocs/core/modules/cheque/mod_chequereceipt_thyme.php @@ -46,7 +46,7 @@ class mod_chequereceipt_thyme extends ModeleNumRefChequeReceipts /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php index 1abc6c95e20..53cdd50b644 100644 --- a/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php +++ b/htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php @@ -27,7 +27,7 @@ /** * \file htdocs/core/modules/commande/doc/pdf_eratosthene.modules.php * \ingroup commande - * \brief Fichier de la classe permettant de generer les commandes au modele Eratosthène + * \brief File of the class allowing to generate the orders to the Eratosthene model */ require_once DOL_DOCUMENT_ROOT.'/core/modules/commande/modules_commande.php'; @@ -38,7 +38,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/pdf.lib.php'; /** - * Classe to generate PDF orders with template Eratosthene + * Class to generate PDF orders with template Eratosthene */ class pdf_eratosthene extends ModelePDFCommandes { diff --git a/htdocs/core/modules/commande/mod_commande_saphir.php b/htdocs/core/modules/commande/mod_commande_saphir.php index 8c96c237a0f..892a279cbe8 100644 --- a/htdocs/core/modules/commande/mod_commande_saphir.php +++ b/htdocs/core/modules/commande/mod_commande_saphir.php @@ -52,7 +52,7 @@ class mod_commande_saphir extends ModeleNumRefCommandes /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/expensereport/mod_expensereport_sand.php b/htdocs/core/modules/expensereport/mod_expensereport_sand.php index c0a5aa0a031..5217e2dc1c3 100644 --- a/htdocs/core/modules/expensereport/mod_expensereport_sand.php +++ b/htdocs/core/modules/expensereport/mod_expensereport_sand.php @@ -55,7 +55,7 @@ class mod_expensereport_sand extends ModeleNumRefExpenseReport /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/facture/mod_facture_mars.php b/htdocs/core/modules/facture/mod_facture_mars.php index 752a80669c5..4c9d249d6c8 100644 --- a/htdocs/core/modules/facture/mod_facture_mars.php +++ b/htdocs/core/modules/facture/mod_facture_mars.php @@ -62,7 +62,7 @@ class mod_facture_mars extends ModeleNumRefFactures } /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/facture/mod_facture_mercure.php b/htdocs/core/modules/facture/mod_facture_mercure.php index 8c921d982bf..992a90b9731 100644 --- a/htdocs/core/modules/facture/mod_facture_mercure.php +++ b/htdocs/core/modules/facture/mod_facture_mercure.php @@ -46,7 +46,7 @@ class mod_facture_mercure extends ModeleNumRefFactures /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/facture/mod_facture_terre.php b/htdocs/core/modules/facture/mod_facture_terre.php index a4cc1762766..db9a3e2e046 100644 --- a/htdocs/core/modules/facture/mod_facture_terre.php +++ b/htdocs/core/modules/facture/mod_facture_terre.php @@ -72,7 +72,7 @@ class mod_facture_terre extends ModeleNumRefFactures } /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/fichinter/mod_arctic.php b/htdocs/core/modules/fichinter/mod_arctic.php index 1902ffc70af..1d33cb7fc83 100644 --- a/htdocs/core/modules/fichinter/mod_arctic.php +++ b/htdocs/core/modules/fichinter/mod_arctic.php @@ -57,7 +57,7 @@ class mod_arctic extends ModeleNumRefFicheinter /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/import/import_csv.modules.php b/htdocs/core/modules/import/import_csv.modules.php index f75e5035670..1311264f7fb 100644 --- a/htdocs/core/modules/import/import_csv.modules.php +++ b/htdocs/core/modules/import/import_csv.modules.php @@ -669,18 +669,30 @@ class ImportCsv extends ModeleImports if (! preg_match('/^'.preg_quote($alias).'\./', $key)) continue; // Not a field of current table if ($val == 'user->id') { - $listfields[] = preg_replace('/^'.preg_quote($alias).'\./', '', $key); + $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); $listvalues[] = $user->id; } elseif (preg_match('/^lastrowid-/', $val)) { $tmp=explode('-', $val); $lastinsertid=(isset($last_insert_id_array[$tmp[1]]))?$last_insert_id_array[$tmp[1]]:0; - $keyfield = preg_replace('/^'.preg_quote($alias).'\./', '', $key); + $keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); $listfields[] = $keyfield; $listvalues[] = $lastinsertid; //print $key."-".$val."-".$listfields."-".$listvalues."
";exit; } + elseif (preg_match('/^const-/', $val)) + { + $tmp=explode('-', $val, 2); + $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); + $listvalues[] = "'".$tmp[1]."'"; + } + else + { + $this->errors[$error]['lib']='Bad value of profile setup '.$val.' for array_import_fieldshidden'; + $this->errors[$error]['type']='Import profile setup'; + $error++; + } } } //print 'listfields='.$listfields.'
listvalues='.$listvalues.'
'; diff --git a/htdocs/core/modules/import/import_xlsx.modules.php b/htdocs/core/modules/import/import_xlsx.modules.php index ae0290401cc..00db9096bca 100644 --- a/htdocs/core/modules/import/import_xlsx.modules.php +++ b/htdocs/core/modules/import/import_xlsx.modules.php @@ -688,21 +688,33 @@ class ImportXlsx extends ModeleImports // Loop on each hidden fields to add them into listfields/listvalues foreach($objimport->array_import_fieldshidden[0] as $key => $val) { - if (! preg_match('/^'.preg_quote($alias).'\./', $key)) continue; // Not a field of current table + if (! preg_match('/^'.preg_quote($alias, '/').'\./', $key)) continue; // Not a field of current table if ($val == 'user->id') { - $listfields[] = preg_replace('/^'.preg_quote($alias).'\./', '', $key); + $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); $listvalues[] = $user->id; } elseif (preg_match('/^lastrowid-/', $val)) { $tmp=explode('-', $val); $lastinsertid=(isset($last_insert_id_array[$tmp[1]]))?$last_insert_id_array[$tmp[1]]:0; - $keyfield = preg_replace('/^'.preg_quote($alias).'\./', '', $key); + $keyfield = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); $listfields[] = $keyfield; $listvalues[] = $lastinsertid; //print $key."-".$val."-".$listfields."-".$listvalues."
";exit; } + elseif (preg_match('/^const-/', $val)) + { + $tmp=explode('-', $val, 2); + $listfields[] = preg_replace('/^'.preg_quote($alias, '/').'\./', '', $key); + $listvalues[] = "'".$tmp[1]."'"; + } + else + { + $this->errors[$error]['lib']='Bad value of profile setup '.$val.' for array_import_fieldshidden'; + $this->errors[$error]['type']='Import profile setup'; + $error++; + } } } //print 'listfields='.$listfields.'
listvalues='.$listvalues.'
'; diff --git a/htdocs/core/modules/livraison/mod_livraison_jade.php b/htdocs/core/modules/livraison/mod_livraison_jade.php index 531ff26a354..5cae280f245 100644 --- a/htdocs/core/modules/livraison/mod_livraison_jade.php +++ b/htdocs/core/modules/livraison/mod_livraison_jade.php @@ -61,7 +61,7 @@ class mod_livraison_jade extends ModeleNumRefDeliveryOrder /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/livraison/mod_livraison_saphir.php b/htdocs/core/modules/livraison/mod_livraison_saphir.php index f05900600c2..23af66b1913 100644 --- a/htdocs/core/modules/livraison/mod_livraison_saphir.php +++ b/htdocs/core/modules/livraison/mod_livraison_saphir.php @@ -56,7 +56,7 @@ class mod_livraison_saphir extends ModeleNumRefDeliveryOrder /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/modAccounting.class.php b/htdocs/core/modules/modAccounting.class.php index 65638a1cab2..12f95053dc0 100644 --- a/htdocs/core/modules/modAccounting.class.php +++ b/htdocs/core/modules/modAccounting.class.php @@ -170,15 +170,23 @@ class modAccounting extends DolibarrModules $this->rights = array(); // Permission array used by this module $r = 0; - $this->rights[$r][0] = 50440; - $this->rights[$r][1] = 'Manage chart of accounts, setup of accountancy'; + $this->rights[$r][0] = 50440; + $this->rights[$r][1] = 'Manage chart of accounts, setup of accountancy'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'chartofaccount'; + $this->rights[$r][5] = ''; + $r++; + + $this->rights[$r][0] = 50430; + $this->rights[$r][1] = 'Define and close a fiscal year'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'chartofaccount'; + $this->rights[$r][4] = 'fiscalyear'; $this->rights[$r][5] = ''; $r++; - $this->rights[$r][0] = 50401; + $this->rights[$r][0] = 50401; $this->rights[$r][1] = 'Bind products and invoices with accounting accounts'; $this->rights[$r][2] = 'r'; $this->rights[$r][3] = 0; @@ -212,6 +220,30 @@ class modAccounting extends DolibarrModules $this->rights[$r][5] = 'creer'; $r++; + $this->rights[$r][0] = 50414; + $this->rights[$r][1] = 'Delete operations in Ledger'; + $this->rights[$r][2] = 'd'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'mouvements'; + $this->rights[$r][5] = 'supprimer'; + $r++; + + $this->rights[$r][0] = 50415; + $this->rights[$r][1] = 'Delete all operations by year and journal in Ledger'; + $this->rights[$r][2] = 'd'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'mouvements'; + $this->rights[$r][5] = 'supprimer_tous'; + $r++; + + $this->rights[$r][0] = 50418; + $this->rights[$r][1] = 'Export operations of the Ledger'; + $this->rights[$r][2] = 'r'; + $this->rights[$r][3] = 0; + $this->rights[$r][4] = 'mouvements'; + $this->rights[$r][5] = 'export'; + $r++; + $this->rights[$r][0] = 50420; $this->rights[$r][1] = 'Report and export reports (turnover, balance, journals, ledger)'; $this->rights[$r][2] = 'r'; @@ -220,14 +252,6 @@ class modAccounting extends DolibarrModules $this->rights[$r][5] = 'lire'; $r++; - $this->rights[$r][0] = 50430; - $this->rights[$r][1] = 'Define and close a fiscal year'; - $this->rights[$r][2] = 'r'; - $this->rights[$r][3] = 0; - $this->rights[$r][4] = 'fiscalyear'; - $this->rights[$r][5] = ''; - $r++; - // Menus //------- @@ -264,32 +288,36 @@ class modAccounting extends DolibarrModules $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('b'=>MAIN_DB_PREFIX.'accounting_bookkeeping'); // List of tables to insert into (insert done in same order) $this->import_fields_array[$r]=array( - 'b.doc_date'=>"Docdate", - 'b.piece_num'=>"TransactionNumShort", + 'b.piece_num'=>"TransactionNumShort", + 'b.doc_date'=>"Docdate", + //'b.doc_type'=>'Doctype', + 'b.doc_ref'=>'Piece', 'b.code_journal'=>'Codejournal', - 'b.journal_label'=>'JournalLabel', + //'b.journal_label'=>'JournalLabel', 'b.numero_compte'=>'AccountAccounting', - 'b.label_compte'=>'LabelAccount', + //'b.label_compte'=>'LabelAccount', 'b.subledger_account'=>'SubledgerAccount', 'b.subledger_label'=>'SubledgerAccountLabel', 'b.label_operation'=>'LabelOperation', 'b.debit'=>"Debit", 'b.credit'=>"Credit" ); - $this->import_fieldshidden_array[$r]=array('b.fk_user_author'=>'user->id'); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) + $this->import_fieldshidden_array[$r]=array('b.doc_type'=>'const-import_from_external', 'b.fk_doc'=>'const-0', 'b.fk_docdet'=>'const-0', 'b.fk_user_author'=>'user->id', 'b.date_creation'=>'const-'.dol_print_date(dol_now(), 'standard')); // aliastable.field => ('user->id' or 'lastrowid-'.tableparent) $this->import_regex_array[$r]=array('b.doc_date'=>'^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]$'); $this->import_examplevalues_array[$r]=array( - 'b.doc_date'=>'formatted as \'.dol_print_date(dol_now(),\'%Y-%m-%d\')', - 'b.piece_num'=>'1', + 'b.piece_num'=>'123 (!!! use next value not already used)', + 'b.doc_date'=>dol_print_date(dol_now(), "%Y-%m-%d"), + //'b.doc_type'=>'import', + 'b.doc_ref'=>'My document ABC', 'b.code_journal'=>"VTE", - 'b.journal_label'=>"Journal des ventes", + //'b.journal_label'=>"Sale journal", 'b.numero_compte'=>"707", - 'b.label_compte'=>'Ventes', + //'b.label_compte'=>'Product account 707', 'b.subledger_account'=>'', 'b.subledger_label'=>'', - 'b.label_operation'=>"Ventes services", - 'b.debit'=>"0,00", - 'b.credit'=>"100,00" + 'b.label_operation'=>"Sale of ABC", + 'b.debit'=>"0", + 'b.credit'=>"100" ); // Chart of accounts diff --git a/htdocs/core/modules/modApi.class.php b/htdocs/core/modules/modApi.class.php index b860bf5b9bc..11de955fdbe 100644 --- a/htdocs/core/modules/modApi.class.php +++ b/htdocs/core/modules/modApi.class.php @@ -53,6 +53,7 @@ class modApi extends DolibarrModules // Family can be 'crm','financial','hr','projects','products','ecm','technic','other' // It is used to group modules in module setup page $this->family = "interface"; + $this->module_position = '24'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); // Module description, used if translation string 'ModuleXXXDesc' not found (where XXX is value of numeric property 'numero' of module) diff --git a/htdocs/core/modules/modCategorie.class.php b/htdocs/core/modules/modCategorie.class.php index d8f8b6915f3..092d5ac10b7 100644 --- a/htdocs/core/modules/modCategorie.class.php +++ b/htdocs/core/modules/modCategorie.class.php @@ -230,7 +230,7 @@ class modCategorie extends DolibarrModules $this->export_code[$r]='category_'.$r; $this->export_label[$r]='CatProdList'; $this->export_icon[$r]='category'; - $this->export_enabled[$r]='$conf->produit->enabled'; + $this->export_enabled[$r]='$conf->product->enabled || $conf->service->enabled'; $this->export_permission[$r]=array(array("categorie","lire"),array("produit","lire")); $this->export_fields_array[$r]=array('u.rowid'=>"CategId",'u.label'=>"Label",'u.description'=>"Description",'p.rowid'=>'ProductId','p.ref'=>'Ref'); $this->export_TypeFields_array[$r]=array('u.label'=>"Text",'u.description'=>"Text",'p.ref'=>'Text'); diff --git a/htdocs/core/modules/modWebServices.class.php b/htdocs/core/modules/modWebServices.class.php index 2aa98e80679..f031d3cc5ec 100644 --- a/htdocs/core/modules/modWebServices.class.php +++ b/htdocs/core/modules/modWebServices.class.php @@ -41,6 +41,7 @@ class modWebServices extends DolibarrModules $this->numero = 2600; $this->family = "interface"; + $this->module_position = '25'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Enable the Dolibarr web services server"; diff --git a/htdocs/core/modules/modWebServicesClient.class.php b/htdocs/core/modules/modWebServicesClient.class.php index 33c7bae997a..8f2ba109bd7 100644 --- a/htdocs/core/modules/modWebServicesClient.class.php +++ b/htdocs/core/modules/modWebServicesClient.class.php @@ -41,6 +41,7 @@ class modWebServicesClient extends DolibarrModules $this->numero = 2660; $this->family = "interface"; + $this->module_position = '26'; // Module label (no space allowed), used if translation string 'ModuleXXXName' not found (where XXX is value of numeric property 'numero' of module) $this->name = preg_replace('/^mod/i', '', get_class($this)); $this->description = "Enable the web service client to call external supplier web services"; diff --git a/htdocs/core/modules/payment/mod_payment_ant.php b/htdocs/core/modules/payment/mod_payment_ant.php index 21ad0d91b9e..a9cde1b86cb 100644 --- a/htdocs/core/modules/payment/mod_payment_ant.php +++ b/htdocs/core/modules/payment/mod_payment_ant.php @@ -55,7 +55,7 @@ class mod_payment_ant extends ModeleNumRefPayments /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php index 49dc1b7598c..f8861380b2f 100644 --- a/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php +++ b/htdocs/core/modules/product/doc/doc_generic_product_odt.modules.php @@ -244,7 +244,7 @@ class doc_generic_product_odt extends ModelePDFProduct // Load translation files required by the page $outputlangs->loadLangs(array("main", "dict", "companies", "bills")); - if ($conf->produit->dir_output) + if ($conf->product->dir_output) { // If $object is id instead of object if (! is_object($object)) @@ -262,7 +262,7 @@ class doc_generic_product_odt extends ModelePDFProduct $supplierprices = $productFournisseur->list_product_fournisseur_price($object->id); $object->supplierprices = $supplierprices; - $dir = $conf->produit->dir_output; + $dir = $conf->product->dir_output; $objectref = dol_sanitizeFileName($object->ref); if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref; $file = $dir . "/" . $objectref . ".odt"; @@ -302,9 +302,9 @@ class doc_generic_product_odt extends ModelePDFProduct //print "newdir=".$dir; //print "newfile=".$newfile; //print "file=".$file; - //print "conf->produit->dir_temp=".$conf->produit->dir_temp; + //print "conf->product->dir_temp=".$conf->product->dir_temp; - dol_mkdir($conf->produit->dir_temp); + dol_mkdir($conf->product->dir_temp); // If CUSTOMER contact defined on product, we use it @@ -357,10 +357,10 @@ class doc_generic_product_odt extends ModelePDFProduct // Open and load template require_once ODTPHP_PATH.'odf.php'; try { - $odfHandler = new odf( + $odfHandler = new odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->produit->dir_temp, + 'PATH_TO_TMP' => $conf->product->dir_temp, 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' diff --git a/htdocs/core/modules/product/doc/pdf_standard.modules.php b/htdocs/core/modules/product/doc/pdf_standard.modules.php index 04d566248b9..89f0f67ae53 100644 --- a/htdocs/core/modules/product/doc/pdf_standard.modules.php +++ b/htdocs/core/modules/product/doc/pdf_standard.modules.php @@ -174,18 +174,18 @@ class pdf_standard extends ModelePDFProduct $nblignes = count($object->lines); - if ($conf->produit->dir_output) + if ($conf->product->dir_output) { // Definition of $dir and $file if ($object->specimen) { - $dir = $conf->produit->dir_output; + $dir = $conf->product->dir_output; $file = $dir . "/SPECIMEN.pdf"; } else { $objectref = dol_sanitizeFileName($object->ref); - $dir = $conf->produit->dir_output . "/" . $objectref; + $dir = $conf->product->dir_output . "/" . $objectref; $file = $dir . "/" . $objectref . ".pdf"; } diff --git a/htdocs/core/modules/project/mod_project_universal.php b/htdocs/core/modules/project/mod_project_universal.php index d9287109d6e..70394f92129 100644 --- a/htdocs/core/modules/project/mod_project_universal.php +++ b/htdocs/core/modules/project/mod_project_universal.php @@ -55,7 +55,7 @@ class mod_project_universal extends ModeleNumRefProjects /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/project/task/mod_task_universal.php b/htdocs/core/modules/project/task/mod_task_universal.php index f08067541e8..760caaa366e 100644 --- a/htdocs/core/modules/project/task/mod_task_universal.php +++ b/htdocs/core/modules/project/task/mod_task_universal.php @@ -55,7 +55,7 @@ class mod_task_universal extends ModeleNumRefTask /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php index 35c467c110c..ac9c0423694 100644 --- a/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php +++ b/htdocs/core/modules/stock/doc/doc_generic_stock_odt.modules.php @@ -244,7 +244,7 @@ class doc_generic_stock_odt extends ModelePDFStock // Load translation files required by the page $outputlangs->loadLangs(array("main", "dict", "companies", "bills")); - if ($conf->produit->dir_output) + if ($conf->product->dir_output) { // If $object is id instead of object if (! is_object($object)) @@ -262,7 +262,7 @@ class doc_generic_stock_odt extends ModelePDFStock $supplierprices = $stockFournisseur->list_stock_fournisseur_price($object->id); $object->supplierprices = $supplierprices; - $dir = $conf->produit->dir_output; + $dir = $conf->product->dir_output; $objectref = dol_sanitizeFileName($object->ref); if (! preg_match('/specimen/i', $objectref)) $dir.= "/" . $objectref; $file = $dir . "/" . $objectref . ".odt"; @@ -302,9 +302,9 @@ class doc_generic_stock_odt extends ModelePDFStock //print "newdir=".$dir; //print "newfile=".$newfile; //print "file=".$file; - //print "conf->produit->dir_temp=".$conf->produit->dir_temp; + //print "conf->product->dir_temp=".$conf->product->dir_temp; - dol_mkdir($conf->produit->dir_temp); + dol_mkdir($conf->product->dir_temp); // If CUSTOMER contact defined on stock, we use it @@ -360,7 +360,7 @@ class doc_generic_stock_odt extends ModelePDFStock $odfHandler = new odf( $srctemplatepath, array( - 'PATH_TO_TMP' => $conf->produit->dir_temp, + 'PATH_TO_TMP' => $conf->product->dir_temp, 'ZIP_PROXY' => 'PclZipProxy', // PhpZipProxy or PclZipProxy. Got "bad compression method" error when using PhpZipProxy. 'DELIMITER_LEFT' => '{', 'DELIMITER_RIGHT' => '}' diff --git a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php index 6154ba5e1d9..c816953a298 100644 --- a/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php +++ b/htdocs/core/modules/supplier_order/mod_commande_fournisseur_orchidee.php @@ -57,7 +57,7 @@ class mod_commande_fournisseur_orchidee extends ModeleNumRefSuppliersOrders /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php index e2407877a7b..d06a2ccfcf3 100644 --- a/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php +++ b/htdocs/core/modules/supplier_payment/mod_supplier_payment_brodator.php @@ -55,7 +55,7 @@ class mod_supplier_payment_brodator extends ModeleNumRefSupplierPayments /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/modules/ticket/mod_ticket_universal.php b/htdocs/core/modules/ticket/mod_ticket_universal.php index 361ecdd0c9d..007e0b318cd 100644 --- a/htdocs/core/modules/ticket/mod_ticket_universal.php +++ b/htdocs/core/modules/ticket/mod_ticket_universal.php @@ -53,7 +53,7 @@ class mod_ticket_universal extends ModeleNumRefTicket public $name='Universal'; /** - * Renvoi la description du modele de numerotation + * Returns the description of the numbering model * * @return string Texte descripif */ diff --git a/htdocs/core/tpl/admin_extrafields_add.tpl.php b/htdocs/core/tpl/admin_extrafields_add.tpl.php index 45c620db456..04720004492 100644 --- a/htdocs/core/tpl/admin_extrafields_add.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_add.tpl.php @@ -107,7 +107,7 @@ $langs->load("modulebuilder"); else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();jQuery("#helppassword").hide();} else if (type == 'separate') { langfile.val('').prop('disabled',true);size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); - jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide(); + jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").hide(); } else { // type = string size.val('').prop('disabled', true); diff --git a/htdocs/core/tpl/admin_extrafields_edit.tpl.php b/htdocs/core/tpl/admin_extrafields_edit.tpl.php index 1ba83bc393f..7ed41af9281 100644 --- a/htdocs/core/tpl/admin_extrafields_edit.tpl.php +++ b/htdocs/core/tpl/admin_extrafields_edit.tpl.php @@ -103,7 +103,7 @@ $langs->load("modulebuilder"); else if (type == 'checkbox') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").show();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").hide();} else if (type == 'chkbxlst') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").show();jQuery("#helplink").hide();jQuery("#helppassword").hide();} else if (type == 'link') { size.val('').prop('disabled', true); unique.removeAttr('disabled'); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").show();jQuery("#helppassword").hide();} - else if (type == 'separate') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").hide();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").hide();} + else if (type == 'separate') { size.val('').prop('disabled', true); unique.removeAttr('checked').prop('disabled', true); required.val('').prop('disabled', true); default_value.val('').prop('disabled', true); jQuery("#value_choice").show();jQuery("#helpselect").hide();jQuery("#helpsellist").hide();jQuery("#helpchkbxlst").hide();jQuery("#helplink").hide();jQuery("#helppassword").hide();} else { // type = string size.val('').prop('disabled', true); unique.removeAttr('disabled'); @@ -173,7 +173,7 @@ if((($type == 'select') || ($type == 'checkbox') || ($type == 'radio')) && is_ar } } } -elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password')) +elseif (($type== 'sellist') || ($type == 'chkbxlst') || ($type == 'link') || ($type == 'password') || ($type == 'separate')) { $paramlist=array_keys($param['options']); $param_chain = $paramlist[0]; diff --git a/htdocs/core/tpl/extrafields_view.tpl.php b/htdocs/core/tpl/extrafields_view.tpl.php index a34308432e4..10aff5637c8 100644 --- a/htdocs/core/tpl/extrafields_view.tpl.php +++ b/htdocs/core/tpl/extrafields_view.tpl.php @@ -48,8 +48,8 @@ if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'e //var_dump($extrafields->attributes[$object->table_element]); if (empty($reshook) && is_array($extrafields->attributes[$object->table_element]['label'])) - { + $extrafields_collapse_num = ''; foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $label) { // Discard if extrafield is a hidden field on form @@ -86,11 +86,25 @@ if (empty($reshook) && is_array($extrafields->attributes[$object->table_element] } if ($extrafields->attributes[$object->table_element]['type'][$key] == 'separate') { + $extrafields_collapse_num = ''; + $extrafield_param = $extrafields->attributes[$object->table_element]['param'][$key]; + if (!empty($extrafield_param) && is_array($extrafield_param)) { + $extrafield_param_list = array_keys($extrafield_param['options']); + + if (count($extrafield_param_list)>0) { + $extrafield_collapse_display_value = intval($extrafield_param_list[0]); + + if ($extrafield_collapse_display_value==1 || $extrafield_collapse_display_value==2) { + $extrafields_collapse_num = $extrafields->attributes[$object->table_element]['pos'][$key]; + } + } + } + print $extrafields->showSeparator($key, $object); } else { - print ''; + print ''; print ''; print ''; print ''; diff --git a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php index 03d26b931b6..3f4b81a5457 100644 --- a/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php +++ b/htdocs/core/triggers/interface_50_modBlockedlog_ActionsBlockedLog.class.php @@ -76,17 +76,18 @@ class InterfaceActionsBlockedLog extends DolibarrTriggers // Event/record is qualified $qualified = 0; $amounts = 0; - if ($action==='BILL_VALIDATE' || $action==='BILL_DELETE' || $action === 'BILL_SENTBYMAIL' - || $action==='BILL_SUPPLIER_VALIDATE' || $action==='BILL_SUPPLIER_DELETE' || $action === 'BILL_SUPPLIER_SENTBYMAIL' - || $action==='MEMBER_SUBSCRIPTION_CREATE' || $action==='MEMBER_SUBSCRIPTION_MODIFY' || $action==='MEMBER_SUBSCRIPTION_DELETE' - || $action==='DON_VALIDATE' || $action==='DON_MODIFY' || $action==='DON_DELETE' - || $action==='CASHCONTROL_VALIDATE' - || (in_array($object->element, array('facture','suplier_invoice')) && $action === 'DOC_DOWNLOAD') || (in_array($object->element, array('facture','suplier_invoice')) && $action === 'DOC_PREVIEW') + if ($action==='BILL_VALIDATE' || (($action==='BILL_DELETE' || $action === 'BILL_SENTBYMAIL') && $object->statut != 0) + || $action==='BILL_SUPPLIER_VALIDATE' || (($action==='BILL_SUPPLIER_DELETE' || $action === 'BILL_SUPPLIER_SENTBYMAIL') && $object->statut != 0) + || $action==='MEMBER_SUBSCRIPTION_CREATE' || $action==='MEMBER_SUBSCRIPTION_MODIFY' || $action==='MEMBER_SUBSCRIPTION_DELETE' + || $action==='DON_VALIDATE' || (($action==='DON_MODIFY' || $action==='DON_DELETE') && $object->statut != 0) + || $action==='CASHCONTROL_VALIDATE' + || (in_array($object->element, array('facture','supplier_invoice')) && $action === 'DOC_DOWNLOAD' && $object->statut != 0) + || (in_array($object->element, array('facture','supplier_invoice')) && $action === 'DOC_PREVIEW' && $object->statut != 0) ) { $qualified++; -if (in_array($action, array( + if (in_array($action, array( 'MEMBER_SUBSCRIPTION_CREATE','MEMBER_SUBSCRIPTION_MODIFY','MEMBER_SUBSCRIPTION_DELETE', 'DON_VALIDATE','DON_MODIFY','DON_DELETE'))) $amounts = (double) $object->amount; elseif ($action == 'CASHCONTROL_VALIDATE') diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 39a902ed979..f337a007a1a 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1046,7 +1046,7 @@ if ($action == 'create') if (!empty($conf->incoterm->enabled)) { print ''; - print ''; + print ''; print ''; @@ -1973,7 +1973,7 @@ elseif ($id || $ref) print ''; - print ''; + print ''; print ''; @@ -2151,7 +2151,7 @@ elseif (! empty($object->id)) print ''; - print ''; + print ''; print ''; @@ -2617,7 +2617,7 @@ else print '
'; print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); print '
'; if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } else { diff --git a/htdocs/expedition/class/expedition.class.php b/htdocs/expedition/class/expedition.class.php index 4676d48073c..a17da1c84b4 100644 --- a/htdocs/expedition/class/expedition.class.php +++ b/htdocs/expedition/class/expedition.class.php @@ -536,7 +536,7 @@ class Expedition extends CommonObject $sql.= ", e.fk_shipping_method, e.tracking_number"; $sql.= ", e.note_private, e.note_public"; $sql.= ', e.fk_incoterms, e.location_incoterms'; - $sql.= ', i.libelle as libelle_incoterms'; + $sql.= ', i.libelle as label_incoterms'; $sql.= ', s.libelle as shipping_method'; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; @@ -601,7 +601,7 @@ class Expedition extends CommonObject //Incoterms $this->fk_incoterms = $obj->fk_incoterms; $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->label_incoterms = $obj->label_incoterms; $this->db->free($result); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index 84681f049c4..bb1d106e393 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -529,7 +529,7 @@ if ($id > 0 || ! empty($ref)) print ''; if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } else { diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index f8697fb52fc..e54aa7940d3 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2011-2012 Juanjo Menent * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry - * Copyright (C) 2018 Ferran Marcet + * Copyright (C) 2018 Ferran Marcet * * 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 diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index bf0a3da62b3..96a43c91f3a 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -154,7 +154,7 @@ class CommandeFournisseur extends CommonOrder //Incoterms public $fk_incoterms; public $location_incoterms; - public $libelle_incoterms; //Used into tooltip + public $label_incoterms; //Used into tooltip public $extraparams=array(); @@ -267,7 +267,7 @@ class CommandeFournisseur extends CommonOrder $sql.= " cr.code as cond_reglement_code, cr.libelle as cond_reglement_libelle, cr.libelle_facture as cond_reglement_libelle_doc,"; $sql.= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle"; $sql.= ', c.fk_incoterms, c.location_incoterms'; - $sql.= ', i.libelle as libelle_incoterms'; + $sql.= ', i.libelle as label_incoterms'; $sql.= " FROM ".MAIN_DB_PREFIX."commande_fournisseur as c"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_payment_term as cr ON c.fk_cond_reglement = cr.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."c_paiement as p ON c.fk_mode_reglement = p.id"; @@ -335,7 +335,7 @@ class CommandeFournisseur extends CommonOrder //Incoterms $this->fk_incoterms = $obj->fk_incoterms; $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->label_incoterms = $obj->label_incoterms; // Multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php index 4e861cd146a..6bedfcb5c1f 100644 --- a/htdocs/fourn/class/fournisseur.facture.class.php +++ b/htdocs/fourn/class/fournisseur.facture.class.php @@ -91,6 +91,9 @@ class FactureFournisseur extends CommonInvoice */ public $ref; + public $label; + public $libelle; // @deprecated + public $product_ref; public $ref_supplier; public $socid; @@ -112,7 +115,6 @@ class FactureFournisseur extends CommonInvoice public $paye; public $author; - public $libelle; /** * Date creation record (datec) @@ -190,7 +192,7 @@ class FactureFournisseur extends CommonInvoice public $fk_incoterms; public $location_incoterms; - public $libelle_incoterms; //Used into tooltip + public $label_incoterms; //Used into tooltip public $extraparams=array(); @@ -341,7 +343,7 @@ class FactureFournisseur extends CommonInvoice $sql.= ", '".$this->db->escape($this->ref_supplier)."'"; $sql.= ", ".$conf->entity; $sql.= ", '".$this->db->escape($this->type)."'"; - $sql.= ", '".$this->db->escape($this->libelle)."'"; + $sql.= ", '".$this->db->escape($this->label?$this->label:$this->libelle)."'"; $sql.= ", ".$this->socid; $sql.= ", '".$this->db->idate($now)."'"; $sql.= ", '".$this->db->idate($this->date)."'"; @@ -482,7 +484,7 @@ class FactureFournisseur extends CommonInvoice { $idligne = $this->db->last_insert_id(MAIN_DB_PREFIX.'facture_fourn_det'); - $this->updateline( + $this->updateline( $idligne, $line->description, $line->pu_ht, @@ -509,8 +511,6 @@ class FactureFournisseur extends CommonInvoice $result=$this->update_price(); if ($result > 0) { - $action='create'; - // Actions on extra fields if (empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) // For avoid conflicts if trigger used { @@ -585,7 +585,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " t.datec,"; $sql.= " t.datef,"; $sql.= " t.tms,"; - $sql.= " t.libelle,"; + $sql.= " t.libelle as label,"; $sql.= " t.paye,"; $sql.= " t.amount,"; $sql.= " t.remise,"; @@ -594,7 +594,6 @@ class FactureFournisseur extends CommonInvoice $sql.= " t.tva,"; $sql.= " t.localtax1,"; $sql.= " t.localtax2,"; - //$sql.= " t.total,"; $sql.= " t.total_ht,"; $sql.= " t.total_tva,"; $sql.= " t.total_ttc,"; @@ -616,7 +615,7 @@ class FactureFournisseur extends CommonInvoice $sql.= " p.code as mode_reglement_code, p.libelle as mode_reglement_libelle,"; $sql.= ' s.nom as socnom, s.rowid as socid,'; $sql.= ' t.fk_incoterms, t.location_incoterms,'; - $sql.= " i.libelle as libelle_incoterms,"; + $sql.= " i.libelle as label_incoterms,"; $sql.= ' t.fk_multicurrency, t.multicurrency_code, t.multicurrency_tx, t.multicurrency_total_ht, t.multicurrency_total_tva, t.multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn as t'; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON (t.fk_soc = s.rowid)"; @@ -645,8 +644,8 @@ class FactureFournisseur extends CommonInvoice $this->date = $this->db->jdate($obj->datef); $this->datep = $this->db->jdate($obj->datef); $this->tms = $this->db->jdate($obj->tms); - $this->libelle = $obj->libelle; - $this->label = $obj->libelle; + $this->libelle = $obj->label; // deprecated + $this->label = $obj->label; $this->paye = $obj->paye; $this->amount = $obj->amount; $this->remise = $obj->remise; @@ -655,7 +654,6 @@ class FactureFournisseur extends CommonInvoice $this->tva = $obj->tva; $this->total_localtax1 = $obj->localtax1; $this->total_localtax2 = $obj->localtax2; - //$this->total = $obj->total; $this->total_ht = $obj->total_ht; $this->total_tva = $obj->total_tva; $this->total_ttc = $obj->total_ttc; @@ -685,7 +683,7 @@ class FactureFournisseur extends CommonInvoice //Incoterms $this->fk_incoterms = $obj->fk_incoterms; $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->label_incoterms = $obj->label_incoterms; // Multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; @@ -790,13 +788,13 @@ class FactureFournisseur extends CommonInvoice $line->localtax2_type = $obj->localtax2_type; $line->qty = $obj->qty; $line->remise_percent = $obj->remise_percent; - $line->tva = $obj->total_tva; + $line->tva = $obj->total_tva; // deprecated $line->total_ht = $obj->total_ht; + $line->total_ttc = $obj->total_ttc; $line->total_tva = $obj->total_tva; $line->total_localtax1 = $obj->total_localtax1; $line->total_localtax2 = $obj->total_localtax2; $line->fk_facture_fourn = $obj->fk_facture_fourn; - $line->total_ttc = $obj->total_ttc; $line->fk_product = $obj->fk_product; $line->product_type = $obj->product_type; $line->product_label = $obj->label; @@ -849,7 +847,8 @@ class FactureFournisseur extends CommonInvoice if (isset($this->entity)) $this->entity=trim($this->entity); if (isset($this->type)) $this->type=trim($this->type); if (isset($this->fk_soc)) $this->fk_soc=trim($this->fk_soc); - if (isset($this->libelle)) $this->libelle=trim($this->libelle); + if (isset($this->label)) $this->label=trim($this->label); + if (isset($this->libelle)) $this->libelle=trim($this->libelle); // deprecated if (isset($this->paye)) $this->paye=trim($this->paye); if (isset($this->amount)) $this->amount=trim($this->amount); if (isset($this->remise)) $this->remise=trim($this->remise); @@ -897,7 +896,6 @@ class FactureFournisseur extends CommonInvoice $sql.= " tva=".(isset($this->tva)?$this->tva:"null").","; $sql.= " localtax1=".(isset($this->localtax1)?$this->localtax1:"null").","; $sql.= " localtax2=".(isset($this->localtax2)?$this->localtax2:"null").","; - //$sql.= " total=".(isset($this->total)?$this->total:"null").","; $sql.= " total_ht=".(isset($this->total_ht)?$this->total_ht:"null").","; $sql.= " total_tva=".(isset($this->total_tva)?$this->total_tva:"null").","; $sql.= " total_ttc=".(isset($this->total_ttc)?$this->total_ttc:"null").","; @@ -2280,8 +2278,8 @@ class FactureFournisseur extends CommonInvoice $label .= '
' . $langs->trans('Ref') . ': ' . $this->ref; if (! empty($this->ref_supplier)) $label.= '
' . $langs->trans('RefSupplier') . ': ' . $this->ref_supplier; - if (! empty($this->libelle)) - $label.= '
' . $langs->trans('Label') . ': ' . $this->libelle; + if (! empty($this->label)) + $label.= '
' . $langs->trans('Label') . ': ' . $this->label; if (! empty($this->date)) $label .= '
' . $langs->trans('Date') . ': ' . dol_print_date($this->date, 'day'); if (! empty($this->total_ht)) @@ -2726,12 +2724,6 @@ class SupplierInvoiceLine extends CommonObjectLine */ public $ref_supplier; - /** - * @deprecated - * @see $label - */ - public $libelle; - /** * Product description * @var string @@ -2746,6 +2738,10 @@ class SupplierInvoiceLine extends CommonObjectLine */ public $pu_ht; + /** + * Unit price excluded taxes + * @var float + */ public $subprice; /** @@ -2754,15 +2750,6 @@ class SupplierInvoiceLine extends CommonObjectLine */ public $pu_ttc; - /** - * Total VAT amount - * @var float - * @deprecated Use $total_tva instead - * @see $total_tva - */ - public $tva; - - public $total_tva; /** * Id of the corresponding supplier invoice @@ -2805,6 +2792,7 @@ class SupplierInvoiceLine extends CommonObjectLine public $remise_percent; public $total_ht; public $total_ttc; + public $total_tva; public $total_localtax1; public $total_localtax2; @@ -2860,7 +2848,7 @@ class SupplierInvoiceLine extends CommonObjectLine $sql = 'SELECT f.rowid, f.ref as ref_supplier, f.description, f.date_start, f.date_end, f.pu_ht, f.pu_ttc, f.qty, f.remise_percent, f.tva_tx'; $sql.= ', f.localtax1_type, f.localtax2_type, f.localtax1_tx, f.localtax2_tx, f.total_localtax1, f.total_localtax2 '; $sql.= ', f.total_ht, f.tva as total_tva, f.total_ttc, f.fk_facture_fourn, f.fk_product, f.product_type, f.info_bits, f.rang, f.special_code, f.fk_parent_line, f.fk_unit'; - $sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as label, p.description as product_desc'; + $sql.= ', p.rowid as product_id, p.ref as product_ref, p.label as product_label, p.description as product_desc'; $sql.= ', f.multicurrency_subprice, f.multicurrency_total_ht, f.multicurrency_total_tva, multicurrency_total_ttc'; $sql.= ' FROM '.MAIN_DB_PREFIX.'facture_fourn_det as f'; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'product as p ON f.fk_product = p.rowid'; @@ -2901,7 +2889,7 @@ class SupplierInvoiceLine extends CommonObjectLine $this->localtax2_type = $obj->localtax2_type; $this->qty = $obj->qty; $this->remise_percent = $obj->remise_percent; - $this->tva = $obj->total_tva; + $this->tva = $obj->total_tva; // deprecated $this->total_ht = $obj->total_ht; $this->total_tva = $obj->total_tva; $this->total_localtax1 = $obj->total_localtax1; @@ -2909,7 +2897,7 @@ class SupplierInvoiceLine extends CommonObjectLine $this->total_ttc = $obj->total_ttc; $this->fk_product = $obj->fk_product; $this->product_type = $obj->product_type; - $this->product_label = $obj->label; + $this->product_label = $obj->product_label; $this->info_bits = $obj->info_bits; $this->tva_npr = ($obj->info_bits & 1 == 1) ? 1 : 0; $this->fk_parent_line = $obj->fk_parent_line; @@ -3112,6 +3100,7 @@ class SupplierInvoiceLine extends CommonObjectLine if (empty($this->localtax2_tx)) $this->localtax2_tx=0; if (empty($this->localtax1_type)) $this->localtax1_type='0'; if (empty($this->localtax2_type)) $this->localtax2_type='0'; + if (empty($this->total_tva)) $this->total_tva=0; if (empty($this->total_localtax1)) $this->total_localtax1=0; if (empty($this->total_localtax2)) $this->total_localtax2=0; if (empty($this->rang)) $this->rang=0; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index da2930ed667..9b27810e6bb 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -43,7 +43,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; if (! empty($conf->supplier_proposal->enabled)) require_once DOL_DOCUMENT_ROOT . '/supplier_proposal/class/supplier_proposal.class.php'; -if (!empty($conf->produit->enabled)) +if (!empty($conf->product->enabled)) require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; if (!empty($conf->projet->enabled)) { require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; @@ -1630,7 +1630,7 @@ if ($action=='create') if (!empty($conf->incoterm->enabled)) { print '
'; print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); print '
'; if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } else { diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index c25b0afa15b..dfab5ebf2ac 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -41,7 +41,7 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/discount.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/fourn.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/doleditor.class.php'; -if (!empty($conf->produit->enabled)) { +if (!empty($conf->product->enabled)) { require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; } if (!empty($conf->projet->enabled)) { @@ -2035,7 +2035,7 @@ if ($action == 'create') if (!empty($conf->incoterm->enabled)) { print '
'; print $form->select_incoterms((!empty($objectsrc->fk_incoterms) ? $objectsrc->fk_incoterms : ''), (!empty($objectsrc->location_incoterms)?$objectsrc->location_incoterms:'')); print '
'; if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } else { diff --git a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql index 2df656e3308..bf6c12e92ef 100644 --- a/htdocs/install/mysql/migration/10.0.0-11.0.0.sql +++ b/htdocs/install/mysql/migration/10.0.0-11.0.0.sql @@ -82,3 +82,6 @@ ALTER TABLE llx_c_shipment_mode ADD COLUMN entity integer DEFAULT 1 NOT NULL; ALTER TABLE llx_c_shipment_mode DROP INDEX uk_c_shipment_mode; ALTER TABLE llx_c_shipment_mode ADD UNIQUE INDEX uk_c_shipment_mode (code, entity); + +ALTER TABLE llx_facture_fourn DROP COLUMN total; + diff --git a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql index 2a841834735..57cb3ec16af 100644 --- a/htdocs/install/mysql/migration/9.0.0-10.0.0.sql +++ b/htdocs/install/mysql/migration/9.0.0-10.0.0.sql @@ -96,6 +96,8 @@ ALTER TABLE llx_adherent ADD gender VARCHAR(10); ALTER TABLE llx_adherent_type ADD morphy VARCHAR(3); ALTER TABLE llx_subscription ADD fk_type integer; +UPDATE llx_subscription as s SET fk_type = (SELECT fk_adherent_type FROM llx_adherent as a where a.rowid = s.fk_adherent) where fk_type IS NULL; + -- Add url_id into unique index of bank_url ALTER TABLE llx_bank_url DROP INDEX uk_bank_url; ALTER TABLE llx_bank_url ADD UNIQUE INDEX uk_bank_url (fk_bank, url_id, type); diff --git a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql index 5317254d79d..88aa6d4e129 100644 --- a/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql +++ b/htdocs/install/mysql/tables/llx_accounting_bookkeeping.sql @@ -21,8 +21,9 @@ CREATE TABLE llx_accounting_bookkeeping ( rowid integer NOT NULL AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- | multi company id - doc_date date NOT NULL, -- FEC:PieceDate - doc_type varchar(30) NOT NULL, -- | facture_client/reglement_client/facture_fournisseur/reglement_fournisseur + piece_num integer NOT NULL, -- FEC:EcritureNum | accounting transaction id + doc_date date NOT NULL, -- FEC:PieceDate | date of source document + doc_type varchar(30) NOT NULL, -- | facture_client/reglement_client/facture_fournisseur/reglement_fournisseur/import doc_ref varchar(300) NOT NULL, -- FEC:PieceRef | facture_client/reglement_client/... reference number fk_doc integer NOT NULL, -- | facture_client/reglement_client/... rowid fk_docdet integer NOT NULL, -- | facture_client/reglement_client/... line rowid @@ -48,7 +49,6 @@ CREATE TABLE llx_accounting_bookkeeping fk_user integer NULL, -- The id of user that validate the accounting source document code_journal varchar(32) NOT NULL, -- FEC:JournalCode journal_label varchar(255), -- FEC:JournalLib - piece_num integer NOT NULL, -- FEC:EcritureNum | accounting source document date_validated datetime, -- FEC:ValidDate | if empty: movement not validated / if not empty: movement validated (No deleting / No modification) date_export datetime DEFAULT NULL, -- import_key varchar(14), diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 167b2bde2fd..17ab05b0101 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -149,7 +149,7 @@ SystemToolsAreaDesc=This area provides administration functions. Use the menu to Purge=Purge PurgeAreaDesc=This page allows you to delete all files generated or stored by Dolibarr (temporary files or all files in %s directory). Using this feature is not normally necessary. It is provided as a workaround for users whose Dolibarr is hosted by a provider that does not offer permissions to delete files generated by the web server. PurgeDeleteLogFile=Delete log files, including %s defined for Syslog module (no risk of losing data) -PurgeDeleteTemporaryFiles=Delete all temporary files (no risk of losing data) +PurgeDeleteTemporaryFiles=Delete all temporary files (no risk of losing data). Note: Deletion is done only if the temp directory was created 24 hours ago. PurgeDeleteTemporaryFilesShort=Delete temporary files PurgeDeleteAllFilesInDocumentsDir=Delete all files in directory: %s.
This will delete all generated documents related to elements (third parties, invoices etc...), files uploaded into the ECM module, database backup dumps and temporary files. PurgeRunNow=Purge now @@ -907,6 +907,9 @@ Permission50202=Import transactions Permission50401=Bind products and invoices with accounting accounts Permission50411=Read operations in ledger Permission50412=Write/Edit operations in ledger +Permission50414=Delete operations in ledger +Permission50415=Delete all operations by year and journal in ledger +Permission50418=Export operations of the ledger Permission50420=Report and export reports (turnover, balance, journals, ledger) Permission50430=Define and close a fiscal year Permission50440=Manage chart of accounts, setup of accountancy @@ -1110,7 +1113,7 @@ AreaForAdminOnly=Setup parameters can be set by administrator users only. SystemInfoDesc=System information is miscellaneous technical information you get in read only mode and visible for administrators only. SystemAreaForAdminOnly=This area is available to administrator users only. Dolibarr user permissions cannot change this restriction. CompanyFundationDesc=Edit the information of the company/entity. Click on "%s" or "%s" button at the bottom of the page. -AccountantDesc=Edit the details of your accountant/bookkeeper +AccountantDesc=If you have an external accountant/bookkeeper, you can edit here its information. AccountantFileNumber=Accountant code DisplayDesc=Parameters affecting the look and behaviour of Dolibarr can be modified here. AvailableModules=Available app/modules diff --git a/htdocs/langs/en_US/mails.lang b/htdocs/langs/en_US/mails.lang index ba334d69a22..8b92cef3103 100644 --- a/htdocs/langs/en_US/mails.lang +++ b/htdocs/langs/en_US/mails.lang @@ -78,9 +78,9 @@ GroupEmails=Group emails OneEmailPerRecipient=One email per recipient (by default, one email per record selected) WarningIfYouCheckOneRecipientPerEmail=Warning, if you check this box, it means only one email will be sent for several different record selected, so, if your message contains substitution variables that refers to data of a record, it becomes not possible to replace them. ResultOfMailSending=Result of mass Email sending -NbSelected=No. selected -NbIgnored=No. ignored -NbSent=No. sent +NbSelected=Number selected +NbIgnored=Number ignored +NbSent=Number sent SentXXXmessages=%s message(s) sent. ConfirmUnvalidateEmailing=Are you sure you want to change email %s to draft status? MailingModuleDescContactsWithThirdpartyFilter=Contact with customer filters diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 8b33117cc66..acae5aa73fb 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -171,7 +171,7 @@ MembersStatisticsDesc=Choose statistics you want to read... MenuMembersStats=Statistics LastMemberDate=Latest member date LatestSubscriptionDate=Latest subscription date -Nature=Nature +MemberNature=Nature of member Public=Information are public NewMemberbyWeb=New member added. Awaiting approval NewMemberForm=New member form diff --git a/htdocs/langs/en_US/products.lang b/htdocs/langs/en_US/products.lang index 5f07a7f2eb0..46555a84528 100644 --- a/htdocs/langs/en_US/products.lang +++ b/htdocs/langs/en_US/products.lang @@ -159,7 +159,7 @@ SuppliersPrices=Vendor prices SuppliersPricesOfProductsOrServices=Vendor prices (of products or services) CustomCode=Customs / Commodity / HS code CountryOrigin=Origin country -Nature=Product Type (material/finished) +Nature=Nature of produt (material/finished) ShortLabel=Short label Unit=Unit p=u. diff --git a/htdocs/livraison/card.php b/htdocs/livraison/card.php index cdc12553401..45a851b43a5 100644 --- a/htdocs/livraison/card.php +++ b/htdocs/livraison/card.php @@ -529,7 +529,7 @@ else print '
'; if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } else { diff --git a/htdocs/livraison/class/livraison.class.php b/htdocs/livraison/class/livraison.class.php index 9a84274d0c5..9a5780b351d 100644 --- a/htdocs/livraison/class/livraison.class.php +++ b/htdocs/livraison/class/livraison.class.php @@ -278,7 +278,7 @@ class Livraison extends CommonObject $sql.= ", l.date_delivery, l.fk_address, l.model_pdf"; $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= ', l.fk_incoterms, l.location_incoterms'; - $sql.= ", i.libelle as libelle_incoterms"; + $sql.= ", i.libelle as label_incoterms"; $sql.= " FROM ".MAIN_DB_PREFIX."livraison as l"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = l.rowid AND el.targettype = '".$this->db->escape($this->element)."'"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON l.fk_incoterms = i.rowid'; @@ -313,7 +313,7 @@ class Livraison extends CommonObject //Incoterms $this->fk_incoterms = $obj->fk_incoterms; $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->label_incoterms = $obj->label_incoterms; $this->db->free($result); if ($this->statut == 0) $this->brouillon = 1; diff --git a/htdocs/modulebuilder/template/class/myobject.class.php b/htdocs/modulebuilder/template/class/myobject.class.php index 0025c00165d..8f79741727a 100644 --- a/htdocs/modulebuilder/template/class/myobject.class.php +++ b/htdocs/modulebuilder/template/class/myobject.class.php @@ -531,13 +531,6 @@ class MyObject extends CommonObject } $linkclose.=' title="'.dol_escape_htmltag($label, 1).'"'; $linkclose.=' class="classfortooltip'.($morecss?' '.$morecss:'').'"'; - - /* - $hookmanager->initHooks(array('myobjectdao')); - $parameters=array('id'=>$this->id); - $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) $linkclose = $hookmanager->resPrint; - */ } else $linkclose = ($morecss?' class="'.$morecss.'"':''); diff --git a/htdocs/modulebuilder/template/myobject_document.php b/htdocs/modulebuilder/template/myobject_document.php index 0f4df0012f4..2f2e8c45a1a 100644 --- a/htdocs/modulebuilder/template/myobject_document.php +++ b/htdocs/modulebuilder/template/myobject_document.php @@ -81,8 +81,8 @@ $extralabels = $extrafields->fetch_name_optionals_label('myobject'); // 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:1] . "/myobject/" . dol_sanitizeFileName($object->id); -if ($id > 0 || ! empty($ref)) $upload_dir = $conf->mymodule->multidir_output[$object->entity?$object->entity:1] . "/myobject/" . dol_sanitizeFileName($object->ref); +//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); /* diff --git a/htdocs/product/admin/price_rules.php b/htdocs/product/admin/price_rules.php index d50e474026e..5b2e931e7b6 100644 --- a/htdocs/product/admin/price_rules.php +++ b/htdocs/product/admin/price_rules.php @@ -113,7 +113,7 @@ while ($result = $db->fetch_object($query)) { $title = $langs->trans('ProductServiceSetup'); $tab = $langs->trans("ProductsAndServices"); -if (empty($conf->produit->enabled)) { +if (empty($conf->product->enabled)) { $title = $langs->trans('ServiceSetup'); $tab = $langs->trans('Services'); } elseif (empty($conf->service->enabled)) { diff --git a/htdocs/product/admin/product.php b/htdocs/product/admin/product.php index 888863e5e66..95f61d2f20a 100644 --- a/htdocs/product/admin/product.php +++ b/htdocs/product/admin/product.php @@ -272,7 +272,7 @@ $formbarcode=new FormBarCode($db); $title = $langs->trans('ProductServiceSetup'); $tab = $langs->trans("ProductsAndServices"); -if (empty($conf->produit->enabled)) +if (empty($conf->product->enabled)) { $title = $langs->trans('ServiceSetup'); $tab = $langs->trans('Services'); diff --git a/htdocs/product/admin/product_extrafields.php b/htdocs/product/admin/product_extrafields.php index a01ba46b624..e70e09a9640 100644 --- a/htdocs/product/admin/product_extrafields.php +++ b/htdocs/product/admin/product_extrafields.php @@ -61,7 +61,7 @@ require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php'; $title = $langs->trans('ProductServiceSetup'); $textobject = $langs->trans("ProductsAndServices"); -if (empty($conf->produit->enabled)) +if (empty($conf->product->enabled)) { $title = $langs->trans('ServiceSetup'); $textobject = $langs->trans('Services'); diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 847c6325b50..cdd94ae4a3c 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -148,7 +148,7 @@ if (empty($reshook)) } // Actions to build doc - $upload_dir = $conf->produit->dir_output; + $upload_dir = $conf->product->dir_output; $permissioncreate = $usercancreate; include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php'; @@ -1601,7 +1601,7 @@ else print ''; // Type - if (! empty($conf->produit->enabled) && ! empty($conf->service->enabled)) + if (! empty($conf->product->enabled) && ! empty($conf->service->enabled)) { // TODO change for compatibility with edit in place $typeformat='select;0:'.$langs->trans("Product").',1:'.$langs->trans("Service"); @@ -2158,7 +2158,7 @@ if ($action != 'create' && $action != 'edit' && $action != 'delete') // Documents $objectref = dol_sanitizeFileName($object->ref); $relativepath = $comref . '/' . $objectref . '.pdf'; - $filedir = $conf->produit->dir_output . '/' . $objectref; + $filedir = $conf->product->dir_output . '/' . $objectref; $urlsource=$_SERVER["PHP_SELF"]."?id=".$object->id; $genallowed=$usercanread; $delallowed=$usercancreate; diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php index 02de9b4d47d..50ddded3600 100644 --- a/htdocs/product/class/product.class.php +++ b/htdocs/product/class/product.class.php @@ -4034,13 +4034,6 @@ class Product extends CommonObject $linkclose.= ' title="'.dol_escape_htmltag($label, 1, 1).'"'; $linkclose.= ' class="classfortooltip"'; - - /* - $hookmanager->initHooks(array('productdao')); - $parameters=array('id'=>$this->id); - $reshook=$hookmanager->executeHooks('getnomurltooltip',$parameters,$this,$action); // Note that $action and $object may have been modified by some hooks - if ($reshook > 0) $linkclose = $hookmanager->resPrint; - */ } if ($option == 'supplier' || $option == 'category') { diff --git a/htdocs/product/fournisseurs.php b/htdocs/product/fournisseurs.php index dbcdec666e3..f1e27c02501 100644 --- a/htdocs/product/fournisseurs.php +++ b/htdocs/product/fournisseurs.php @@ -688,7 +688,7 @@ SCRIPT; print ''; print ''; print ''; print ''; } diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 7d766452186..1a9b5fa1f6f 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -165,13 +165,13 @@ $arrayfields=array( 'p.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), //'pfp.ref_fourn'=>array('label'=>$langs->trans("RefSupplier"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), 'p.label'=>array('label'=>$langs->trans("Label"), 'checked'=>1), - 'p.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled) && ! empty($conf->service->enabled))), + 'p.fk_product_type'=>array('label'=>$langs->trans("Type"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->service->enabled))), 'p.barcode'=>array('label'=>$langs->trans("Gencod"), 'checked'=>1, 'enabled'=>(! empty($conf->barcode->enabled))), 'p.duration'=>array('label'=>$langs->trans("Duration"), 'checked'=>($contextpage != 'productlist'), 'enabled'=>(! empty($conf->service->enabled))), - 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled))), - 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SIZE))), - 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SURFACE))), - 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(! empty($conf->produit->enabled) && ! empty($conf->global->PRODUCT_DISABLE_VOLUME))), + 'p.weight'=>array('label'=>$langs->trans("Weight"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled))), + 'p.length'=>array('label'=>$langs->trans("Length"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SIZE))), + 'p.surface'=>array('label'=>$langs->trans("Surface"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->global->PRODUCT_DISABLE_SURFACE))), + 'p.volume'=>array('label'=>$langs->trans("Volume"), 'checked'=>0, 'enabled'=>(! empty($conf->product->enabled) && ! empty($conf->global->PRODUCT_DISABLE_VOLUME))), 'p.sellprice'=>array('label'=>$langs->trans("SellingPrice"), 'checked'=>1, 'enabled'=>empty($conf->global->PRODUIT_MULTIPRICES)), 'p.minbuyprice'=>array('label'=>$langs->trans("BuyingPriceMinShort"), 'checked'=>1, 'enabled'=>(! empty($user->rights->fournisseur->lire))), 'p.numbuyprice'=>array('label'=>$langs->trans("BuyingPriceNumShort"), 'checked'=>0, 'enabled'=>(! empty($user->rights->fournisseur->lire))), diff --git a/htdocs/product/stock/class/api_stockmovements.class.php b/htdocs/product/stock/class/api_stockmovements.class.php index 7bc4054751e..113e45482a8 100644 --- a/htdocs/product/stock/class/api_stockmovements.class.php +++ b/htdocs/product/stock/class/api_stockmovements.class.php @@ -292,7 +292,7 @@ class StockMovements extends DolibarrApi unset($object->lastname); unset($object->name); unset($object->location_incoterms); - unset($object->libelle_incoterms); + unset($object->label_incoterms); unset($object->fk_incoterms); unset($object->lines); unset($object->total_ht); diff --git a/htdocs/projet/class/api_projects.class.php b/htdocs/projet/class/api_projects.class.php index 9680cd66591..48ae3cbf337 100644 --- a/htdocs/projet/class/api_projects.class.php +++ b/htdocs/projet/class/api_projects.class.php @@ -560,7 +560,7 @@ class Projects extends DolibarrApi unset($object->fk_account); unset($object->note); unset($object->fk_incoterms); - unset($object->libelle_incoterms); + unset($object->label_incoterms); unset($object->location_incoterms); unset($object->name); unset($object->lastname); diff --git a/htdocs/projet/class/api_tasks.class.php b/htdocs/projet/class/api_tasks.class.php index 9fafcb98343..2ca676f9c96 100644 --- a/htdocs/projet/class/api_tasks.class.php +++ b/htdocs/projet/class/api_tasks.class.php @@ -570,7 +570,7 @@ class Tasks extends DolibarrApi unset($object->fk_account); unset($object->note); unset($object->fk_incoterms); - unset($object->libelle_incoterms); + unset($object->label_incoterms); unset($object->location_incoterms); unset($object->name); unset($object->lastname); diff --git a/htdocs/projet/element.php b/htdocs/projet/element.php index a2c2ea36f7d..08351fc752f 100644 --- a/htdocs/projet/element.php +++ b/htdocs/projet/element.php @@ -776,7 +776,7 @@ foreach ($listofreferent as $key => $value) if (empty($conf->global->PROJECT_CREATE_ON_OVERVIEW_DISABLED) && $urlnew) { $addform.='
'; - if ($testnew) $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; + if ($testnew) $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; elseif (empty($conf->global->MAIN_BUTTON_HIDE_UNAUTHORIZED)) { $addform.=''.($buttonnew?$langs->trans($buttonnew):$langs->trans("Create")).''; } diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index b97710ba7b6..a6b8c583da2 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -773,7 +773,7 @@ while ($i < min($num, $limit)) } print ''; if (! $i) $totalarray['nbfield']++; - if (! $i) $totalarray['totalprogress_calculated']=$totalarray['nbfield']; + if (! $i) $totalarray['totalprogress_calculatedfield']=$totalarray['nbfield']; } // Declared progress if (! empty($arrayfields['t.progress']['checked'])) @@ -785,6 +785,8 @@ while ($i < min($num, $limit)) } print ''; if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalprogress_declaredfield']=$totalarray['nbfield']; + $totalarray['totaldurationdeclared'] += $obj->planned_workload * $obj->progress / 100; } // Time not billed if (! empty($arrayfields['t.tobill']['checked'])) @@ -883,6 +885,7 @@ if (isset($totalarray['totaldurationeffectivefield']) || isset($totalarray['tota elseif ($totalarray['totalplannedworkloadfield'] == $i) print '
'; elseif ($totalarray['totaldurationeffectivefield'] == $i) print ''; elseif ($totalarray['totalprogress_calculatedfield'] == $i) print ''; + elseif ($totalarray['totalprogress_declaredfield'] == $i) print ''; elseif ($totalarray['totaltobillfield'] == $i) print ''; elseif ($totalarray['totalbilledfield'] == $i) print ''; else print ''; diff --git a/htdocs/public/demo/index.php b/htdocs/public/demo/index.php index 7228778144f..0f6e21f0984 100644 --- a/htdocs/public/demo/index.php +++ b/htdocs/public/demo/index.php @@ -106,13 +106,13 @@ if (empty($reshook)) // Visible $alwayscheckedmodules=array('barcode','bookmark','categorie','externalrss','fckeditor','geoipmaxmind','gravatar','memcached','syslog','user','webservices'); // Technical module we always want - $alwaysuncheckedmodules=array('dynamicprices','incoterm','loan','multicurrency','paybox','paypal','stripe','google','printing','scanner','skype','workflow'); // Module we dont want by default + $alwaysuncheckedmodules=array('dav','dynamicprices','incoterm','loan','multicurrency','paybox','paypal','stripe','google','printing','scanner','skype','takepos','workflow','website'); // Module we dont want by default // Not visible $alwayshiddencheckedmodules=array('accounting','api','barcode','blockedlog','bookmark','clicktodial','comptabilite','cron','document','domain','externalrss','externalsite','fckeditor','geoipmaxmind','gravatar','label','ldap', 'mailmanspip','notification','oauth','syslog','user','webservices', // Extended modules 'memcached','numberwords','zipautofillfr'); - $alwayshiddenuncheckedmodules=array('ftp','hrm','webservicesclient','websites', + $alwayshiddenuncheckedmodules=array('debugbar','emailcollector','ftp','hrm','modulebuilder','webservicesclient','websites', // Extended modules 'awstats','bittorrent','bootstrap','cabinetmed','cmcic','concatpdf','customfield','deplacement','dolicloud','filemanager','lightbox','mantis','monitoring','moretemplates','multicompany','nltechno','numberingpack','openstreetmap', 'ovh','phenix','phpsysinfo','pibarcode','postnuke','selectbank','skincoloreditor','submiteverywhere','survey','thomsonphonebook','topten','tvacerfa','voyage','webcalendar','webmail'); diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 7cbd77dd4da..2153d8a53c7 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -890,7 +890,7 @@ if ($action == 'create') if (!empty($conf->incoterm->enabled)) { print ''; - print ''; + print ''; print ''; @@ -1602,7 +1602,7 @@ elseif ($id || $ref) print '
' . $langs->trans('BarcodeType') . ''; - print $formbarcode->selectBarcodeType(($rowid ? $object->fourn_fk_barcode_type : ''), 'fk_barcode_type', 1); + print $formbarcode->selectBarcodeType(($rowid ? $object->fourn_fk_barcode_type : $conf->global->PRODUIT_DEFAULT_BARCODE_TYPE), 'fk_barcode_type', 1); print '
'.convertSecondToTime($totalarray['totalplannedworkload'], $plannedworkloadoutputformat).''.convertSecondToTime($totalarray['totaldurationeffective'], $timespentoutputformat).''.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationeffective'] / $totalarray['totalplannedworkload'], 2).' %' : '').''.($totalarray['totalplannedworkload'] > 0 ? round(100 * $totalarray['totaldurationdeclared'] / $totalarray['totalplannedworkload'], 2).' %' : '').''.convertSecondToTime($totalarray['totaltobill'], $plannedworkloadoutputformat).''.convertSecondToTime($totalarray['totalbilled'], $plannedworkloadoutputformat).'
'; print $form->select_incoterms((!empty($object->fk_incoterms) ? $object->fk_incoterms : ''), (!empty($object->location_incoterms)?$object->location_incoterms:'')); print '
'; if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } else { diff --git a/htdocs/reception/class/reception.class.php b/htdocs/reception/class/reception.class.php index 811c2b8586f..f1877ace179 100644 --- a/htdocs/reception/class/reception.class.php +++ b/htdocs/reception/class/reception.class.php @@ -372,7 +372,7 @@ class Reception extends CommonObject $sql.= ", el.fk_source as origin_id, el.sourcetype as origin"; $sql.= ", e.note_private, e.note_public"; $sql.= ', e.fk_incoterms, e.location_incoterms'; - $sql.= ', i.libelle as libelle_incoterms'; + $sql.= ', i.libelle as label_incoterms'; $sql.= " FROM ".MAIN_DB_PREFIX."reception as e"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = '".$this->db->escape($this->element)."'"; $sql.= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_incoterms as i ON e.fk_incoterms = i.rowid'; @@ -431,7 +431,7 @@ class Reception extends CommonObject //Incoterms $this->fk_incoterms = $obj->fk_incoterms; $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->label_incoterms = $obj->label_incoterms; $this->db->free($result); diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d7034017691..26bfbc89b9f 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -2540,7 +2540,7 @@ else print ''; if ($action != 'editincoterm') { - print $form->textwithpicto($object->display_incoterms(), $object->libelle_incoterms, 1); + print $form->textwithpicto($object->display_incoterms(), $object->label_incoterms, 1); } else { diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 5d410b7c72d..16b690ecaf7 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -475,7 +475,7 @@ class Societe extends CommonObject public $fk_incoterms; public $location_incoterms; - public $libelle_incoterms; //Used into tooltip + public $label_incoterms; //Used into tooltip // Multicurrency /** @@ -1276,7 +1276,7 @@ class Societe extends CommonObject $sql .= ', d.code_departement as state_code, d.nom as state'; $sql .= ', st.libelle as stcomm'; $sql .= ', te.code as typent_code'; - $sql .= ', i.libelle as libelle_incoterms'; + $sql .= ', i.libelle as label_incoterms'; $sql .= ', sr.remise_client'; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_effectif as e ON s.fk_effectif = e.id'; @@ -1435,7 +1435,7 @@ class Societe extends CommonObject //Incoterms $this->fk_incoterms = $obj->fk_incoterms; $this->location_incoterms = $obj->location_incoterms; - $this->libelle_incoterms = $obj->libelle_incoterms; + $this->label_incoterms = $obj->label_incoterms; // multicurrency $this->fk_multicurrency = $obj->fk_multicurrency; @@ -4017,7 +4017,7 @@ class Societe extends CommonObject /** * Create a document onto disk according to template module. * - * @param string $modele Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf') for example. + * @param string $modele Generator to use. Caller must set it to obj->modelpdf or GETPOST('modelpdf','alpha') for example. * @param Translate $outputlangs objet lang a utiliser pour traduction * @param int $hidedetails Hide details of lines * @param int $hidedesc Hide description diff --git a/htdocs/takepos/dev/img/README.md b/htdocs/takepos/dev/img/README.md deleted file mode 100644 index 5cd4c76d010..00000000000 --- a/htdocs/takepos/dev/img/README.md +++ /dev/null @@ -1,53 +0,0 @@ -Source images -============= - -Used to generate icons and publication assets. - -Icons ------ - -### Dolibarr - -These resides in the [/img](../../img) directory. - -#### Small - -Required. -Name must begin by ```object_```. - -- Sample: ![object_takepos.png](../../img/object_takepos.png) [object_takepos.png](../../img/object_takepos.png) -- Size: 14×14 pixels -- Type: PNG - -#### Large - -Optional. - -- Sample: ![takepos.png](../../img/takepos.png) [takepos.png](../../img/takepos.png) -- Size: 32×32 pixels -- Type: PNG - -### Dolistore - -Designed to fit a 512×512 icon + publisher branding. - -- Size: 704×704 -- Type: PNG - -Export to 512×512 - -### Transifex - -- Size: 96×96 -- Type: PNG - -### Others - -To be on the safe side, you may also want to generate all popular sizes: -- 16×16 -- 32×32 -- 48×48 -- 64×64 -- 128×128 -- 256×256 -- 512×512 diff --git a/htdocs/takepos/dev/img/gfdl-129x44.png b/htdocs/takepos/dev/img/gfdl-129x44.png deleted file mode 100644 index f2bacfd179a..00000000000 Binary files a/htdocs/takepos/dev/img/gfdl-129x44.png and /dev/null differ diff --git a/htdocs/takepos/dev/img/gfdl-66x23.png b/htdocs/takepos/dev/img/gfdl-66x23.png deleted file mode 100644 index b43479bf3c8..00000000000 Binary files a/htdocs/takepos/dev/img/gfdl-66x23.png and /dev/null differ diff --git a/htdocs/takepos/dev/img/gfdl-logo.svg b/htdocs/takepos/dev/img/gfdl-logo.svg deleted file mode 100644 index a0daca0ead8..00000000000 --- a/htdocs/takepos/dev/img/gfdl-logo.svg +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - GFDL - - - - - - - diff --git a/htdocs/takepos/dev/img/gpl-v3-logo.svg b/htdocs/takepos/dev/img/gpl-v3-logo.svg deleted file mode 100644 index 6754c994bda..00000000000 --- a/htdocs/takepos/dev/img/gpl-v3-logo.svg +++ /dev/null @@ -1,389 +0,0 @@ - - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/htdocs/takepos/dev/img/gplv3-127x51.png b/htdocs/takepos/dev/img/gplv3-127x51.png deleted file mode 100644 index 3e9136e6266..00000000000 Binary files a/htdocs/takepos/dev/img/gplv3-127x51.png and /dev/null differ diff --git a/htdocs/takepos/dev/img/gplv3-88x31.png b/htdocs/takepos/dev/img/gplv3-88x31.png deleted file mode 100644 index ba78d4c4941..00000000000 Binary files a/htdocs/takepos/dev/img/gplv3-88x31.png and /dev/null differ diff --git a/htdocs/takepos/dev/img/takepos.svg b/htdocs/takepos/dev/img/takepos.svg deleted file mode 100644 index f51ead1a94e..00000000000 --- a/htdocs/takepos/dev/img/takepos.svg +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - M - - diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 7a585345130..e66e2e52eec 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -162,6 +162,7 @@ div.buttonpayment input { border-bottom: unset; font-weight: bold; text-transform: uppercase; + cursor: pointer; } input.buttonpaymentcb { background-image: url(); @@ -631,20 +632,20 @@ select.flat.selectlimit { .amountpaymentcomplete { color: #008800; font-weight: bold; - font-size: 1.4em; + font-size: 1.2em; } .amountremaintopay { color: #880000; font-weight: bold; - font-size: 1.4em; + font-size: 1.2em; } .amountremaintopayback { font-weight: bold; - font-size: 1.4em; + font-size: 1.2em; } .amountpaymentneutral { font-weight: bold; - font-size: 1.4em; + font-size: 1.2em; } .savingdocmask { margin-top: 6px; @@ -2421,6 +2422,10 @@ tr.nocellnopadd td.nobordernopadding, tr.nocellnopadd td.nocellnopadd margin: 0px 0px 0px 0px; } +table.tableforemailform tr td { + padding-top: 3px; + padding-bottom: 3px; +} table.border, table.bordernooddeven, table.dataTable, .table-border, .table-border-col, .table-key-border-col, .table-val-border-col, div.border { border-collapse: collapse !important; diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 8020a490181..6fd50fa42b3 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -374,6 +374,7 @@ div.buttonpayment input { font-weight: bold; text-transform: uppercase; color: #333; + cursor: pointer; } input.buttonpaymentcb { background-image: url(); diff --git a/htdocs/ticket/class/api_tickets.class.php b/htdocs/ticket/class/api_tickets.class.php index 818514868c2..1395d8acf2b 100644 --- a/htdocs/ticket/class/api_tickets.class.php +++ b/htdocs/ticket/class/api_tickets.class.php @@ -555,7 +555,7 @@ class Tickets extends DolibarrApi "total_localtax2", "total_ttc", "fk_incoterms", - "libelle_incoterms", + "label_incoterms", "location_incoterms", "name", "lastname", diff --git a/htdocs/user/card.php b/htdocs/user/card.php index a86a4a428f0..36514aafd8e 100644 --- a/htdocs/user/card.php +++ b/htdocs/user/card.php @@ -1790,7 +1790,7 @@ else if (! empty($object->email)) { $langs->load("mails"); - print ''; + print ''; } else { diff --git a/htdocs/user/class/api_users.class.php b/htdocs/user/class/api_users.class.php index 17e22a314ef..f570dd21285 100644 --- a/htdocs/user/class/api_users.class.php +++ b/htdocs/user/class/api_users.class.php @@ -378,7 +378,7 @@ class Users extends DolibarrApi unset($object->total_localtax2); unset($object->total_ttc); - unset($object->libelle_incoterms); + unset($object->label_incoterms); unset($object->location_incoterms); unset($object->fk_delivery_address); diff --git a/htdocs/webservices/README.md b/htdocs/webservices/README.md index 915fa2b0b84..bb26c480c1e 100644 --- a/htdocs/webservices/README.md +++ b/htdocs/webservices/README.md @@ -3,11 +3,13 @@ API SOAP howto This directory contains files to make Dolibarr a server of SOAP Web Services. +WARNING: It is highly recommended to use the REST APIs instead of SOAP APIs: You will find more API, faster and easier to use in the the module REST API than into this module. + Explore the api --------------- -* To see all Webservices provided by Dolibarr, just call following Url: +* To see all Webservices provided by Dolibarr, just call the following Url: http://mydomain.com/mydolibarr/webservices/admin/index.php diff --git a/scripts/cron/cron_run_jobs.php b/scripts/cron/cron_run_jobs.php index 0f20675cbfc..1bf31ebfd4b 100755 --- a/scripts/cron/cron_run_jobs.php +++ b/scripts/cron/cron_run_jobs.php @@ -174,9 +174,9 @@ if (is_array($qualifiedjobs) && (count($qualifiedjobs) > 0)) { echo "cron_run_jobs.php cronjobid: ".$line->id." priority=".$line->priority." entity=".$line->entity." label=".$line->label; // Force reload of setup for the current entity - if ($line->entity != $conf->entity) + if ((empty($line->entity)?1:$line->entity) != $conf->entity) { - dol_syslog("cron_run_jobs.php we work on another entity so we reload user and conf", LOG_DEBUG); + dol_syslog("cron_run_jobs.php we work on another entity conf than ".$conf->entity." so we reload user and conf", LOG_DEBUG); echo " -> we change entity so we reload user and conf"; $conf->entity = (empty($line->entity)?1:$line->entity); diff --git a/test/phpunit/FactureFournisseurTest.php b/test/phpunit/FactureFournisseurTest.php index 2d6218471aa..33d503825ac 100644 --- a/test/phpunit/FactureFournisseurTest.php +++ b/test/phpunit/FactureFournisseurTest.php @@ -135,7 +135,7 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase $localobject->initAsSpecimen(); $result=$localobject->create($user); - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0, $localobject->errorsToString()); print __METHOD__." result=".$result."\n"; return $result; } @@ -160,7 +160,7 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase $localobject=new FactureFournisseur($this->savdb); $result=$localobject->fetch($id); - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0, $localobject->errorsToString()); print __METHOD__." id=".$id." result=".$result."\n"; return $localobject; } @@ -186,7 +186,7 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase $result=$localobject->update($user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0, $localobject->errorsToString()); return $localobject; } @@ -210,7 +210,7 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase $result=$localobject->validate($user); print __METHOD__." id=".$localobject->id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0, $localobject->errorsToString()); return $localobject; } @@ -265,7 +265,7 @@ class FactureFournisseurTest extends PHPUnit_Framework_TestCase $result=$localobject->delete($user); print __METHOD__." id=".$id." result=".$result."\n"; - $this->assertLessThan($result, 0); + $this->assertLessThan($result, 0, $localobject->errorsToString()); return $result; } }