diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 831aa15c68a..60fea392133 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,4 +1,7 @@ # .scrutinizer.yml +build: + - php-scrutinizer-run + imports: - javascript - php diff --git a/.travis.yml b/.travis.yml index 63e48a051f0..b710e17c773 100644 --- a/.travis.yml +++ b/.travis.yml @@ -164,12 +164,6 @@ before_script: echo echo "Set timezone" echo 'date.timezone = "Europe/Paris"' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini - if [ "$TRAVIS_PHP_VERSION" = '5.4' ]; then - # Documentation says it should be available for all PHP versions but it's not for 5.5 and 5.6, 7.0, 7.1, 7.2 and nightly! - echo - echo "Enabling Memcached for PHP <= 5.4" - echo 'extension = memcached.so' >> ~/.phpenv/versions/$PHP_VERSION_NAME/etc/php.ini - fi phpenv rehash echo @@ -350,6 +344,9 @@ script: php upgrade.php 9.0.0 10.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log php upgrade2.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log php step5.php 9.0.0 10.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log + php upgrade.php 10.0.0 11.0.0 ignoredbversion > $TRAVIS_BUILD_DIR/upgrade9001000.log + php upgrade2.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-2.log + php step5.php 10.0.0 11.0.0 > $TRAVIS_BUILD_DIR/upgrade9001000-3.log # Enable modules not enabled into original dump php upgrade2.php 0.0.0 0.0.0 MAIN_MODULE_API,MAIN_MODULE_SUPPLIERPROPOSAL,MAIN_MODULE_WEBSITE,MAIN_MODULE_TICKETSUP,MAIN_MODULE_ACCOUNTING > $TRAVIS_BUILD_DIR/enablemodule.log echo $? diff --git a/ChangeLog b/ChangeLog index ba739628d86..472c3ffba81 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,21 @@ 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. @@ -57,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 @@ -484,6 +499,41 @@ Following changes may create regressions for some external modules, but were nec * Remove the no more used and deprecated dol_print_graph function +***** ChangeLog for 8.0.6 compared to 8.0.5 ***** +FIX: #11244 +FIX: #11316 +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: 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: mail presend: can overwrite a file previously uploaded +FIX: mail presend: can overwrite a file previously uploaded (Issue #11056) +FIX: mass send mail +FIX: missing compatibility with multicompany transverse mode +FIX: modulebuilder: hardcoded llx_ +FIX: Not showing Contract and Project columns on ficheinter list +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: try to use WHERE EXISTS instead 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: var name +FIX: we need to fetch fourn invoice with ref in current entity +FIX: Wrong stock movement on supplier credit notes + ***** ChangeLog for 8.0.5 compared to 8.0.4 ***** FIX: #10381 FIX: #10460 compatibility with MariaDB 10.4 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 43f3d734a2e..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 . */ /** 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..616c8697c61 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -37,6 +37,8 @@ require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php'; // Load translation files required by the page $langs->loadLangs(array("accountancy")); +$socid = GETPOST('socid', 'int'); + $action = GETPOST('action', 'aZ09'); $search_mvt_num = GETPOST('search_mvt_num', 'int'); $search_doc_type = GETPOST("search_doc_type", 'alpha'); @@ -97,14 +99,15 @@ $pagenext = $page + 1; if ($sortorder == "") $sortorder = "ASC"; if ($sortfield == "") $sortfield = "t.piece_num,t.rowid"; - +// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context $object = new BookKeeping($db); +$hookmanager->initHooks(array('bookkeepinglist')); $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')) { @@ -160,147 +163,153 @@ if (empty($conf->global->ACCOUNTING_ENABLE_LETTERING)) unset($arrayfields['t.let if (GETPOST('cancel', 'alpha')) { $action='list'; $massaction=''; } if (! GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') { $massaction=''; } -include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; +$parameters=array('socid'=>$socid); +$reshook=$hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks +if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); -if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers +if (empty($reshook)) { - $search_mvt_num = ''; - $search_doc_type = ''; - $search_doc_ref = ''; - $search_doc_date = ''; - $search_accountancy_code = ''; - $search_accountancy_code_start = ''; - $search_accountancy_code_end = ''; - $search_accountancy_aux_code = ''; - $search_accountancy_aux_code_start = ''; - $search_accountancy_aux_code_end = ''; - $search_mvt_label = ''; - $search_direction = ''; - $search_ledger_code = ''; - $search_date_start = ''; - $search_date_end = ''; - $search_date_creation_start = ''; - $search_date_creation_end = ''; - $search_date_modification_start = ''; - $search_date_modification_end = ''; - $search_date_export_start = ''; - $search_date_export_end = ''; - $search_debit = ''; - $search_credit = ''; - $search_lettering_code = ''; + include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; + + if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) // All tests are required to be compatible with all browsers + { + $search_mvt_num = ''; + $search_doc_type = ''; + $search_doc_ref = ''; + $search_doc_date = ''; + $search_accountancy_code = ''; + $search_accountancy_code_start = ''; + $search_accountancy_code_end = ''; + $search_accountancy_aux_code = ''; + $search_accountancy_aux_code_start = ''; + $search_accountancy_aux_code_end = ''; + $search_mvt_label = ''; + $search_direction = ''; + $search_ledger_code = ''; + $search_date_start = ''; + $search_date_end = ''; + $search_date_creation_start = ''; + $search_date_creation_end = ''; + $search_date_modification_start = ''; + $search_date_modification_end = ''; + $search_date_export_start = ''; + $search_date_export_end = ''; + $search_debit = ''; + $search_credit = ''; + $search_lettering_code = ''; + } + + // Must be after the remove filter action, before the export. + $param = ''; + $filter = array (); + if (! empty($search_date_start)) { + $filter['t.doc_date>='] = $search_date_start; + $tmp=dol_getdate($search_date_start); + $param .= '&search_date_startmonth=' . $tmp['mon'] . '&search_date_startday=' . $tmp['mday'] . '&search_date_startyear=' . $tmp['year']; + } + if (! empty($search_date_end)) { + $filter['t.doc_date<='] = $search_date_end; + $tmp=dol_getdate($search_date_end); + $param .= '&search_date_endmonth=' . $tmp['mon'] . '&search_date_endday=' . $tmp['mday'] . '&search_date_endyear=' . $tmp['year']; + } + if (! empty($search_doc_date)) { + $filter['t.doc_date'] = $search_doc_date; + $tmp=dol_getdate($search_doc_date); + $param .= '&doc_datemonth=' . $tmp['mon'] . '&doc_dateday=' . $tmp['mday'] . '&doc_dateyear=' . $tmp['year']; + } + if (! empty($search_doc_type)) { + $filter['t.doc_type'] = $search_doc_type; + $param .= '&search_doc_type=' . urlencode($search_doc_type); + } + if (! empty($search_doc_ref)) { + $filter['t.doc_ref'] = $search_doc_ref; + $param .= '&search_doc_ref=' . urlencode($search_doc_ref); + } + if (! empty($search_accountancy_code)) { + $filter['t.numero_compte'] = $search_accountancy_code; + $param .= '&search_accountancy_code=' . urlencode($search_accountancy_code); + } + if (! empty($search_accountancy_code_start)) { + $filter['t.numero_compte>='] = $search_accountancy_code_start; + $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start); + } + if (! empty($search_accountancy_code_end)) { + $filter['t.numero_compte<='] = $search_accountancy_code_end; + $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end); + } + if (! empty($search_accountancy_aux_code)) { + $filter['t.subledger_account'] = $search_accountancy_aux_code; + $param .= '&search_accountancy_aux_code=' . urlencode($search_accountancy_aux_code); + } + if (! empty($search_accountancy_aux_code_start)) { + $filter['t.subledger_account>='] = $search_accountancy_aux_code_start; + $param .= '&search_accountancy_aux_code_start=' . urlencode($search_accountancy_aux_code_start); + } + if (! empty($search_accountancy_aux_code_end)) { + $filter['t.subledger_account<='] = $search_accountancy_aux_code_end; + $param .= '&search_accountancy_aux_code_end=' . urlencode($search_accountancy_aux_code_end); + } + if (! empty($search_mvt_label)) { + $filter['t.label_operation'] = $search_mvt_label; + $param .= '&search_mvt_label=' . urlencode($search_mvt_label); + } + if (! empty($search_direction)) { + $filter['t.sens'] = $search_direction; + $param .= '&search_direction=' . urlencode($search_direction); + } + if (! empty($search_ledger_code)) { + $filter['t.code_journal'] = $search_ledger_code; + $param .= '&search_ledger_code=' . urlencode($search_ledger_code); + } + if (! empty($search_mvt_num)) { + $filter['t.piece_num'] = $search_mvt_num; + $param .= '&search_mvt_num=' . urlencode($search_mvt_num); + } + if (! empty($search_date_creation_start)) { + $filter['t.date_creation>='] = $search_date_creation_start; + $tmp=dol_getdate($search_date_creation_start); + $param .= '&date_creation_startmonth=' . $tmp['mon'] . '&date_creation_startday=' . $tmp['mday'] . '&date_creation_startyear=' . $tmp['year']; + } + if (! empty($search_date_creation_end)) { + $filter['t.date_creation<='] = $search_date_creation_end; + $tmp=dol_getdate($search_date_creation_end); + $param .= '&date_creation_endmonth=' . $tmp['mon'] . '&date_creation_endday=' . $tmp['mday'] . '&date_creation_endyear=' . $tmp['year']; + } + if (! empty($search_date_modification_start)) { + $filter['t.tms>='] = $search_date_modification_start; + $tmp=dol_getdate($search_date_modification_start); + $param .= '&date_modification_startmonth=' . $tmp['mon'] . '&date_modification_startday=' . $tmp['mday'] . '&date_modification_startyear=' . $tmp['year']; + } + if (! empty($search_date_modification_end)) { + $filter['t.tms<='] = $search_date_modification_end; + $tmp=dol_getdate($search_date_modification_end); + $param .= '&date_modification_endmonth=' . $tmp['mon'] . '&date_modification_endday=' . $tmp['mday'] . '&date_modification_endyear=' . $tmp['year']; + } + if (! empty($search_date_export_start)) { + $filter['t.date_export>='] = $search_date_export_start; + $tmp=dol_getdate($search_date_export_start); + $param .= '&date_export_startmonth=' . $tmp['mon'] . '&date_export_startday=' . $tmp['mday'] . '&date_export_startyear=' . $tmp['year']; + } + if (! empty($search_date_export_end)) { + $filter['t.date_export<='] = $search_date_export_end; + $tmp=dol_getdate($search_date_export_end); + $param .= '&date_export_endmonth=' . $tmp['mon'] . '&date_export_endday=' . $tmp['mday'] . '&date_export_endyear=' . $tmp['year']; + } + if (! empty($search_debit)) { + $filter['t.debit'] = $search_debit; + $param .= '&search_debit=' . urlencode($search_debit); + } + if (! empty($search_credit)) { + $filter['t.credit'] = $search_credit; + $param .= '&search_credit=' . urlencode($search_credit); + } + if (! empty($search_lettering_code)) { + $filter['t.lettering_code'] = $search_lettering_code; + $param .= '&search_lettering_code=' . urlencode($search_lettering_code); + } } -// Must be after the remove filter action, before the export. -$param = ''; -$filter = array (); -if (! empty($search_date_start)) { - $filter['t.doc_date>='] = $search_date_start; - $tmp=dol_getdate($search_date_start); - $param .= '&search_date_startmonth=' . $tmp['mon'] . '&search_date_startday=' . $tmp['mday'] . '&search_date_startyear=' . $tmp['year']; -} -if (! empty($search_date_end)) { - $filter['t.doc_date<='] = $search_date_end; - $tmp=dol_getdate($search_date_end); - $param .= '&search_date_endmonth=' . $tmp['mon'] . '&search_date_endday=' . $tmp['mday'] . '&search_date_endyear=' . $tmp['year']; -} -if (! empty($search_doc_date)) { - $filter['t.doc_date'] = $search_doc_date; - $tmp=dol_getdate($search_doc_date); - $param .= '&doc_datemonth=' . $tmp['mon'] . '&doc_dateday=' . $tmp['mday'] . '&doc_dateyear=' . $tmp['year']; -} -if (! empty($search_doc_type)) { - $filter['t.doc_type'] = $search_doc_type; - $param .= '&search_doc_type=' . urlencode($search_doc_type); -} -if (! empty($search_doc_ref)) { - $filter['t.doc_ref'] = $search_doc_ref; - $param .= '&search_doc_ref=' . urlencode($search_doc_ref); -} -if (! empty($search_accountancy_code)) { - $filter['t.numero_compte'] = $search_accountancy_code; - $param .= '&search_accountancy_code=' . urlencode($search_accountancy_code); -} -if (! empty($search_accountancy_code_start)) { - $filter['t.numero_compte>='] = $search_accountancy_code_start; - $param .= '&search_accountancy_code_start=' . urlencode($search_accountancy_code_start); -} -if (! empty($search_accountancy_code_end)) { - $filter['t.numero_compte<='] = $search_accountancy_code_end; - $param .= '&search_accountancy_code_end=' . urlencode($search_accountancy_code_end); -} -if (! empty($search_accountancy_aux_code)) { - $filter['t.subledger_account'] = $search_accountancy_aux_code; - $param .= '&search_accountancy_aux_code=' . urlencode($search_accountancy_aux_code); -} -if (! empty($search_accountancy_aux_code_start)) { - $filter['t.subledger_account>='] = $search_accountancy_aux_code_start; - $param .= '&search_accountancy_aux_code_start=' . urlencode($search_accountancy_aux_code_start); -} -if (! empty($search_accountancy_aux_code_end)) { - $filter['t.subledger_account<='] = $search_accountancy_aux_code_end; - $param .= '&search_accountancy_aux_code_end=' . urlencode($search_accountancy_aux_code_end); -} -if (! empty($search_mvt_label)) { - $filter['t.label_operation'] = $search_mvt_label; - $param .= '&search_mvt_label=' . urlencode($search_mvt_label); -} -if (! empty($search_direction)) { - $filter['t.sens'] = $search_direction; - $param .= '&search_direction=' . urlencode($search_direction); -} -if (! empty($search_ledger_code)) { - $filter['t.code_journal'] = $search_ledger_code; - $param .= '&search_ledger_code=' . urlencode($search_ledger_code); -} -if (! empty($search_mvt_num)) { - $filter['t.piece_num'] = $search_mvt_num; - $param .= '&search_mvt_num=' . urlencode($search_mvt_num); -} -if (! empty($search_date_creation_start)) { - $filter['t.date_creation>='] = $search_date_creation_start; - $tmp=dol_getdate($search_date_creation_start); - $param .= '&date_creation_startmonth=' . $tmp['mon'] . '&date_creation_startday=' . $tmp['mday'] . '&date_creation_startyear=' . $tmp['year']; -} -if (! empty($search_date_creation_end)) { - $filter['t.date_creation<='] = $search_date_creation_end; - $tmp=dol_getdate($search_date_creation_end); - $param .= '&date_creation_endmonth=' . $tmp['mon'] . '&date_creation_endday=' . $tmp['mday'] . '&date_creation_endyear=' . $tmp['year']; -} -if (! empty($search_date_modification_start)) { - $filter['t.tms>='] = $search_date_modification_start; - $tmp=dol_getdate($search_date_modification_start); - $param .= '&date_modification_startmonth=' . $tmp['mon'] . '&date_modification_startday=' . $tmp['mday'] . '&date_modification_startyear=' . $tmp['year']; -} -if (! empty($search_date_modification_end)) { - $filter['t.tms<='] = $search_date_modification_end; - $tmp=dol_getdate($search_date_modification_end); - $param .= '&date_modification_endmonth=' . $tmp['mon'] . '&date_modification_endday=' . $tmp['mday'] . '&date_modification_endyear=' . $tmp['year']; -} -if (! empty($search_date_export_start)) { - $filter['t.date_export>='] = $search_date_export_start; - $tmp=dol_getdate($search_date_export_start); - $param .= '&date_export_startmonth=' . $tmp['mon'] . '&date_export_startday=' . $tmp['mday'] . '&date_export_startyear=' . $tmp['year']; -} -if (! empty($search_date_export_end)) { - $filter['t.date_export<='] = $search_date_export_end; - $tmp=dol_getdate($search_date_export_end); - $param .= '&date_export_endmonth=' . $tmp['mon'] . '&date_export_endday=' . $tmp['mday'] . '&date_export_endyear=' . $tmp['year']; -} -if (! empty($search_debit)) { - $filter['t.debit'] = $search_debit; - $param .= '&search_debit=' . urlencode($search_debit); -} -if (! empty($search_credit)) { - $filter['t.credit'] = $search_credit; - $param .= '&search_credit=' . urlencode($search_credit); -} -if (! empty($search_lettering_code)) { - $filter['t.lettering_code'] = $search_lettering_code; - $param .= '&search_lettering_code=' . urlencode($search_lettering_code); -} - - -if ($action == 'delbookkeeping') { +if ($action == 'delbookkeeping' && $user->rights->accounting->mouvements->supprimer) { $import_key = GETPOST('importkey', 'alpha'); @@ -315,7 +324,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 +355,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 +375,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 +524,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); @@ -526,6 +536,11 @@ $varpage=empty($contextpage)?$_SERVER["PHP_SELF"]:$contextpage; $selectedfields=$form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields if ($massactionbutton) $selectedfields.=$form->showCheckAddButtons('checkforselect', 1); +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook +if (empty($reshook)) $moreforfilter .= $hookmanager->resPrint; +else $moreforfilter = $hookmanager->resPrint; + print '
'; print ''; @@ -634,6 +649,13 @@ if (! empty($arrayfields['t.code_journal']['checked'])) { print ''; } + + +// Fields from hook +$parameters=array('arrayfields'=>$arrayfields); +$reshook=$hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; + // Date creation if (! empty($arrayfields['t.date_creation']['checked'])) { @@ -694,6 +716,10 @@ if (! empty($arrayfields['t.debit']['checked'])) print_liste_field_titre($arr if (! empty($arrayfields['t.credit']['checked'])) print_liste_field_titre($arrayfields['t.credit']['label'], $_SERVER['PHP_SELF'], "t.credit", "", $param, '', $sortfield, $sortorder, 'right '); if (! empty($arrayfields['t.lettering_code']['checked'])) print_liste_field_titre($arrayfields['t.lettering_code']['label'], $_SERVER['PHP_SELF'], "t.lettering_code", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['t.code_journal']['checked'])) print_liste_field_titre($arrayfields['t.code_journal']['label'], $_SERVER['PHP_SELF'], "t.code_journal", "", $param, '', $sortfield, $sortorder, 'center '); +// Hook fields +$parameters=array('arrayfields'=>$arrayfields,'param'=>$param,'sortfield'=>$sortfield,'sortorder'=>$sortorder); +$reshook=$hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook +print $hookmanager->resPrint; if (! empty($arrayfields['t.date_creation']['checked'])) print_liste_field_titre($arrayfields['t.date_creation']['label'], $_SERVER['PHP_SELF'], "t.date_creation", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['t.tms']['checked'])) print_liste_field_titre($arrayfields['t.tms']['label'], $_SERVER['PHP_SELF'], "t.tms", "", $param, '', $sortfield, $sortorder, 'center '); if (! empty($arrayfields['t.date_export']['checked'])) print_liste_field_titre($arrayfields['t.date_export']['label'], $_SERVER['PHP_SELF'], "t.date_export", "", $param, '', $sortfield, $sortorder, 'center '); @@ -795,6 +821,11 @@ if ($num > 0) if (! $i) $totalarray['nbfield']++; } + // Fields from hook + $parameters=array('arrayfields'=>$arrayfields, 'obj'=>$obj); + $reshook=$hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + // Creation operation date if (! empty($arrayfields['t.date_creation']['checked'])) { @@ -818,12 +849,17 @@ if ($num > 0) // Action column print ''; - if (! $i) $totalarray['nbfield']++; + print ''; + + if (! $i) $totalarray['nbfield']++; print "\n"; @@ -847,18 +883,24 @@ if ($num > 0) elseif ($totalarray['totalcreditfield'] == $i) print ''; else print ''; } + $parameters=array('arrayfields'=>$arrayfields, 'sql'=>$sql); + $reshook=$hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook + print $hookmanager->resPrint; + print ''; } } + 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 '
'.price($totalarray['totalcredit']).'
"; 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 e4a1fc01355..c6dda99dcb2 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -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 ''; @@ -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 '
'; diff --git a/htdocs/adherents/class/adherent.class.php b/htdocs/adherents/class/adherent.class.php index 115d1fb8ab4..1e940df2e26 100644 --- a/htdocs/adherents/class/adherent.class.php +++ b/htdocs/adherents/class/adherent.class.php @@ -11,6 +11,7 @@ * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Juanjo Menent * Copyright (C) 2018-2019 Thibault FOUCART + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -2123,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; } @@ -2460,8 +2461,8 @@ class Adherent extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore - /** + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + /** * Initialise tableau info (tableau des attributs LDAP) * * @return array Tableau info des attributs 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/index.php b/htdocs/adherents/index.php index 1d1232a9d58..3e26ae1ce3a 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -1,8 +1,9 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2017 Laurent Destailleur - * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2017 Laurent Destailleur + * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -29,6 +30,11 @@ require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/adherent_type.class.php'; require_once DOL_DOCUMENT_ROOT.'/adherents/class/subscription.class.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('membersindex')); + // Load translation files required by the page $langs->loadLangs(array("companies","members")); @@ -435,6 +441,9 @@ print "
"; print '
'; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardMembers', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/adherents/stats/index.php b/htdocs/adherents/stats/index.php index 5cad21cdd71..9955466b158 100644 --- a/htdocs/adherents/stats/index.php +++ b/htdocs/adherents/stats/index.php @@ -81,7 +81,6 @@ $mesg = $px1->isGraphKo(); if (! $mesg) { $px1->SetData($data); - $px1->SetPrecisionY(0); $i=$startyear; while ($i <= $endyear) { @@ -96,7 +95,6 @@ if (! $mesg) $px1->SetYLabel($langs->trans("NbOfSubscriptions")); $px1->SetShading(3); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->mode='depth'; $px1->SetTitle($langs->trans("NbOfSubscriptions")); @@ -116,7 +114,6 @@ $mesg = $px2->isGraphKo(); if (! $mesg) { $px2->SetData($data); - $px2->SetPrecisionY(0); $i=$startyear; while ($i <= $endyear) { @@ -131,7 +128,6 @@ if (! $mesg) $px2->SetYLabel($langs->trans("AmountOfSubscriptions")); $px2->SetShading(3); $px2->SetHorizTickIncrement(1); - $px2->SetPrecisionY(0); $px2->mode='depth'; $px2->SetTitle($langs->trans("AmountOfSubscriptions")); diff --git a/htdocs/adherents/subscription/list.php b/htdocs/adherents/subscription/list.php index e3eb9b595ee..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, d.statut, d.fk_adherent_type as type,"; +$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,"; 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/admin/company.php b/htdocs/admin/company.php index a6be1d181c5..8961385c584 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -75,13 +75,27 @@ if ( ($action == 'update' && ! GETPOST("cancel", 'alpha')) activateModulesRequiredByCountry($mysoc->country_code); } - $db->begin(); + $tmparray=getState(GETPOST('state_id', 'int'), 'all', $db, $langs, 0); + if (! empty($tmparray['id'])) + { + $mysoc->state_id =$tmparray['id']; + $mysoc->state_code =$tmparray['code']; + $mysoc->state_label=$tmparray['label']; - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity); + $s=$mysoc->state_id.':'.$mysoc->state_code.':'.$mysoc->state_label; + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", $s, 'chaine', 0, '', $conf->entity); + } + else + { + dolibarr_del_const($db, "MAIN_INFO_SOCIETE_STATE", $conf->entity); + } + + $db->begin(); + + dolibarr_set_const($db, "MAIN_INFO_SOCIETE_NOM", GETPOST("nom", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ADDRESS", GETPOST("MAIN_INFO_SOCIETE_ADDRESS", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TOWN", GETPOST("MAIN_INFO_SOCIETE_TOWN", 'nohtml'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_ZIP", GETPOST("MAIN_INFO_SOCIETE_ZIP", 'alpha'), 'chaine', 0, '', $conf->entity); - dolibarr_set_const($db, "MAIN_INFO_SOCIETE_STATE", GETPOST("state_id", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_REGION", GETPOST("region_code", 'alpha'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_MONNAIE", GETPOST("currency", 'aZ09'), 'chaine', 0, '', $conf->entity); dolibarr_set_const($db, "MAIN_INFO_SOCIETE_TEL", GETPOST("tel", 'alpha'), 'chaine', 0, '', $conf->entity); @@ -375,7 +389,13 @@ if ($action == 'edit' || $action == 'updateedit') print ''; - $formcompany->select_departement($conf->global->MAIN_INFO_SOCIETE_STATE, $mysoc->country_code, 'state_id'); + $state_id=0; + if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) + { + $tmp=explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE); + $state_id=$tmp[0]; + } + $formcompany->select_departement($state_id, $mysoc->country_code, 'state_id'); print ''."\n"; @@ -764,8 +784,12 @@ else if (! empty($conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT)) print ''.$langs->trans("Region-State").''; else print ''.$langs->trans("State").''; - if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) print getState($conf->global->MAIN_INFO_SOCIETE_STATE, $conf->global->MAIN_SHOW_STATE_CODE, 0, $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT); - else print ' '; + if (! empty($conf->global->MAIN_INFO_SOCIETE_STATE)) + { + $tmp=explode(':', $conf->global->MAIN_INFO_SOCIETE_STATE); + $state_id=$tmp[0]; + print getState($state_id, $conf->global->MAIN_SHOW_STATE_CODE, 0, $conf->global->MAIN_SHOW_REGION_IN_STATE_SELECT); + } print ''; diff --git a/htdocs/admin/stock.php b/htdocs/admin/stock.php index 2e934211970..7c22d1a4a58 100644 --- a/htdocs/admin/stock.php +++ b/htdocs/admin/stock.php @@ -27,6 +27,7 @@ */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; +require_once DOL_DOCUMENT_ROOT.'/core/lib/stock.lib.php'; // Load translation files required by the page $langs->loadLangs(array("admin", "stocks")); @@ -77,6 +78,10 @@ llxHeader('', $langs->trans("StockSetup")); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans("StockSetup"), $linkback, 'title_setup'); +$head = stock_admin_prepare_head(); + +dol_fiche_head($head, 'general', $langs->trans("StockSetup"), -1, 'stock'); + $form=new Form($db); 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 783ec6540e3..35ea7d79f5a 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -4,6 +4,7 @@ * Copyright (C) 2017 Regis Houssin * Copyright (C) 2017 Neil Orley * Copyright (C) 2018 Frédéric France + * Copyright (C) 2018-2019 Thibault FOUCART * * * This program is free software; you can redistribute it and/or modify @@ -448,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 @@ -460,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) { @@ -706,6 +717,127 @@ class Setup extends DolibarrApi return $list; } + + /** + * Get the list of shipping methods. + * + * @param int $limit Number of items per page + * @param int $page Page number {@min 0} + * @param int $active Shipping methodsm is active or not {@min 0} {@max 1} + * @param string $sqlfilters SQL criteria to filter. Syntax example "(t.code:=:'CHQ')" + * + * @url GET dictionary/shipping_methods + * + * @return array List of shipping methods + * + * @throws 400 RestException + * @throws 200 OK + */ + public function getShippingModes($limit = 100, $page = 0, $active = 1, $sqlfilters = '') + { + $list = array(); + + $sql = "SELECT rowid as id, code, libelle as label, description, tracking, module"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_shipment_mode as t"; + $sql.= " WHERE t.entity IN (".getEntity('c_shipment_mode').")"; + $sql.= " AND t.active = ".$active; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(400, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + //$sql.= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(400, $this->db->lasterror()); + } + + return $list; + } + + /** + * Get the list of measuring units. + * + * @param string $sortfield Sort field + * @param string $sortorder Sort order + * @param int $limit Number of items per page + * @param int $page Page number (starting from zero) + * @param int $active Payment term is active or not {@min 0} {@max 1} + * @param string $sqlfilters Other criteria to filter answers separated by a comma. Syntax example "(t.code:like:'A%') and (t.active:>=:0)" + * @return List of events types + * + * @url GET dictionary/units + * + * @throws RestException + */ + public function getListOfMeasuringUnits($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') + { + $list = array(); + //TODO link with multicurrency module + $sql = "SELECT t.rowid, t.code, t.label,t.short_label, t.active, t.scale, t.unit_type"; + $sql.= " FROM ".MAIN_DB_PREFIX."c_units as t"; + $sql.= " WHERE t.active = ".$active; + // Add sql filters + if ($sqlfilters) + { + if (! DolibarrApi::_checkFilters($sqlfilters)) + { + throw new RestException(503, 'Error when validating parameter sqlfilters '.$sqlfilters); + } + $regexstring='\(([^:\'\(\)]+:[^:\'\(\)]+:[^:\(\)]+)\)'; + $sql.=" AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")"; + } + + + $sql.= $this->db->order($sortfield, $sortorder); + + if ($limit) { + if ($page < 0) { + $page = 0; + } + $offset = $limit * $page; + + $sql .= $this->db->plimit($limit, $offset); + } + + $result = $this->db->query($sql); + + if ($result) { + $num = $this->db->num_rows($result); + $min = min($num, ($limit <= 0 ? $num : $limit)); + for ($i = 0; $i < $min; $i++) { + $list[] = $this->db->fetch_object($result); + } + } else { + throw new RestException(503, 'Error when retrieving list of measuring units: '.$this->db->lasterror()); + } + + return $list; + } /** * Get the list of tickets categories. diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php index 75cff3a8202..22b78b421f6 100644 --- a/htdocs/asterisk/wrapper.php +++ b/htdocs/asterisk/wrapper.php @@ -39,6 +39,7 @@ if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX', '1'); /** * Empty header * + * @ignore * @return void */ function llxHeader() @@ -48,9 +49,11 @@ function llxHeader() print 'Asterisk redirection from Dolibarr...'."\n"; print ''."\n"; } + /** * Empty footer * + * @ignore * @return void */ function llxFooter() 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/index.php b/htdocs/comm/index.php index 651d2c54ec7..15e4e226587 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2015 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -37,6 +38,11 @@ if (! empty($conf->fournisseur->enabled)) require_once DOL_DOCUMENT_ROOT.'/fourn if (! $user->rights->societe->lire) accessforbidden(); +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('commercialindex')); + // Load translation files required by the page $langs->loadLangs(array("commercial", "propal")); @@ -897,6 +903,9 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardCommercials', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/mailing/index.php b/htdocs/comm/mailing/index.php index c5d8bc47232..a835ca241a3 100644 --- a/htdocs/comm/mailing/index.php +++ b/htdocs/comm/mailing/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2005 Rodolphe Quiedeville * Copyright (C) 2005-2009 Laurent Destailleur * Copyright (C) 2010 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -27,6 +28,11 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT .'/comm/mailing/class/mailing.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('mailingindex')); + // Load translation files required by the page $langs->loadLangs(array('commercial', 'orders')); @@ -207,6 +213,9 @@ if ($langs->file_exists("html/spam.html", 0)) { print '
'; } +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardEmailings', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); 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/comm/propal/index.php b/htdocs/comm/propal/index.php index e69dbbc8b6c..309712ae76b 100644 --- a/htdocs/comm/propal/index.php +++ b/htdocs/comm/propal/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2004 Rodolphe Quiedeville * Copyright (C) 2004-2017 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -27,6 +28,11 @@ require '../../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php'; require_once DOL_DOCUMENT_ROOT .'/comm/propal/class/propal.class.php'; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('proposalindex')); + // Load translation files required by the page $langs->loadLangs(array('propal', 'companies')); @@ -540,6 +546,9 @@ if (! empty($conf->propal->enabled)) //print ''; print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardPropals', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index ff01690660a..555e89e7a61 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -162,6 +162,8 @@ $arrayfields=array( 'p.total_ht'=>array('label'=>"AmountHT", 'checked'=>1), 'p.total_vat'=>array('label'=>"AmountVAT", 'checked'=>0), 'p.total_ttc'=>array('label'=>"AmountTTC", 'checked'=>0), + 'p.total_ht_invoiced'=>array('label'=>$langs->trans("AmountInvoicedHT"), 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT), + 'p.total_invoiced'=>array('label'=>$langs->trans("AmountInvoicedTTC"), 'checked'=>0, 'enabled'=>$conf->global->PROPOSAL_SHOW_INVOICED_AMOUNT), 'u.login'=>array('label'=>"Author", 'checked'=>1, 'position'=>10), 'sale_representative'=>array('label'=>"SaleRepresentativesOfThirdParty", 'checked'=>1), 'p.datec'=>array('label'=>"DateCreation", 'checked'=>0, 'position'=>500), @@ -644,6 +646,18 @@ if ($resql) print ''; print ''; } + if (! empty($arrayfields['p.total_ht_invoiced']['checked'])) + { + // Amount invoiced + print ''; + print ''; + } + if (! empty($arrayfields['p.total_invoiced']['checked'])) + { + // Amount invoiced + print ''; + print ''; + } if (! empty($arrayfields['u.login']['checked'])) { // Author @@ -709,6 +723,8 @@ if ($resql) if (! empty($arrayfields['p.total_ht']['checked'])) print_liste_field_titre($arrayfields['p.total_ht']['label'], $_SERVER["PHP_SELF"], 'p.total_ht', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['p.total_vat']['checked'])) print_liste_field_titre($arrayfields['p.total_vat']['label'], $_SERVER["PHP_SELF"], 'p.tva', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['p.total_ttc']['checked'])) print_liste_field_titre($arrayfields['p.total_ttc']['label'], $_SERVER["PHP_SELF"], 'p.total', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['p.total_ht_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_ht_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); + if (! empty($arrayfields['p.total_invoiced']['checked'])) print_liste_field_titre($arrayfields['p.total_invoiced']['label'], $_SERVER["PHP_SELF"], '', '', $param, 'class="right"', $sortfield, $sortorder); if (! empty($arrayfields['u.login']['checked'])) print_liste_field_titre($arrayfields['u.login']['label'], $_SERVER["PHP_SELF"], 'u.login', '', $param, 'align="center"', $sortfield, $sortorder); if (! empty($arrayfields['sale_representative']['checked'])) print_liste_field_titre($arrayfields['sale_representative']['label'], $_SERVER["PHP_SELF"], "", "", "$param", '', $sortfield, $sortorder); // Extra fields @@ -933,6 +949,48 @@ if ($resql) if (! $i) $totalarray['totalttcfield']=$totalarray['nbfield']; $totalarray['totalttc'] += $obj->total_ttc; } + // Amount invoiced + if(! empty($arrayfields['p.total_ht_invoiced']['checked'])) { + $totalInvoiced = 0; + $p = new Propal($db); + $TInvoiceData = $p->InvoiceArrayList($obj->rowid); + + if(! empty($TInvoiceData)) { + foreach($TInvoiceData as $invoiceData) { + $invoice = new Facture($db); + $invoice->fetch($invoiceData->facid); + + if(! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type == Facture::TYPE_DEPOSIT) continue; + $totalInvoiced += $invoice->total_ht; + } + } + + print ''.price($totalInvoiced)."\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalhtinvoicedfield']=$totalarray['nbfield']; + $totalarray['totalhtinvoiced'] += $totalInvoiced; + } + // Amount invoiced + if(! empty($arrayfields['p.total_invoiced']['checked'])) { + $totalInvoiced = 0; + $p = new Propal($db); + $TInvoiceData = $p->InvoiceArrayList($obj->rowid); + + if(! empty($TInvoiceData)) { + foreach($TInvoiceData as $invoiceData) { + $invoice = new Facture($db); + $invoice->fetch($invoiceData->facid); + + if(! empty($conf->global->FACTURE_DEPOSITS_ARE_JUST_PAYMENTS) && $invoice->type == Facture::TYPE_DEPOSIT) continue; + $totalInvoiced += $invoice->total_ttc; + } + } + + print ''.price($totalInvoiced)."\n"; + if (! $i) $totalarray['nbfield']++; + if (! $i) $totalarray['totalinvoicedfield']=$totalarray['nbfield']; + $totalarray['totalinvoiced'] += $totalInvoiced; + } $userstatic->id=$obj->fk_user_author; $userstatic->login=$obj->login; @@ -1059,6 +1117,8 @@ if ($resql) elseif ($totalarray['totalhtfield'] == $i) print ''.price($totalarray['totalht']).''; elseif ($totalarray['totalvatfield'] == $i) print ''.price($totalarray['totalvat']).''; elseif ($totalarray['totalttcfield'] == $i) print ''.price($totalarray['totalttc']).''; + elseif ($totalarray['totalhtinvoicedfield'] == $i) print ''.price($totalarray['totalhtinvoiced']).''; + elseif ($totalarray['totalinvoicedfield'] == $i) print ''.price($totalarray['totalinvoiced']).''; elseif ($totalarray['totalizable']) { $printed = false; foreach ($totalarray['totalizable'] as $totalizable) { diff --git a/htdocs/comm/propal/stats/index.php b/htdocs/comm/propal/stats/index.php index aa47f1c226d..13b7b5fa2d2 100644 --- a/htdocs/comm/propal/stats/index.php +++ b/htdocs/comm/propal/stats/index.php @@ -110,7 +110,6 @@ $mesg = $px1->isGraphKo(); if (! $mesg) { $px1->SetData($data); - $px1->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -125,7 +124,6 @@ if (! $mesg) $px1->SetYLabel($langs->trans("NbOfProposals")); $px1->SetShading(3); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->mode='depth'; $px1->SetTitle($langs->trans("NumberOfProposalsByMonth")); @@ -152,7 +150,6 @@ $mesg = $px2->isGraphKo(); if (! $mesg) { $px2->SetData($data); - $px2->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -167,7 +164,6 @@ if (! $mesg) $px2->SetYLabel($langs->trans("AmountOfProposals")); $px2->SetShading(3); $px2->SetHorizTickIncrement(1); - $px2->SetPrecisionY(0); $px2->mode='depth'; $px2->SetTitle($langs->trans("AmountOfProposalsByMonthHT")); @@ -209,7 +205,6 @@ if (! $mesg) $px3->SetHeight($HEIGHT); $px3->SetShading(3); $px3->SetHorizTickIncrement(1); - $px3->SetPrecisionY(0); $px3->mode='depth'; $px3->SetTitle($langs->trans("AmountAverage")); 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/commande/index.php b/htdocs/commande/index.php index c0091b43af0..a0e87bf63a3 100644 --- a/htdocs/commande/index.php +++ b/htdocs/commande/index.php @@ -2,6 +2,7 @@ /* Copyright (C) 2003-2004 Rodolphe Quiedeville * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -31,6 +32,11 @@ require_once DOL_DOCUMENT_ROOT .'/commande/class/commande.class.php'; if (!$user->rights->commande->lire) accessforbidden(); +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('ordersindex')); + // Load translation files required by the page $langs->loadLangs(array('orders', 'bills')); @@ -478,6 +484,8 @@ if (! empty($conf->commande->enabled)) print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardOrders', $parameters, $object); // Note that $action and $object may have been modified by hook // End of page llxFooter(); diff --git a/htdocs/commande/stats/index.php b/htdocs/commande/stats/index.php index 81a477d07c5..1d2936263b8 100644 --- a/htdocs/commande/stats/index.php +++ b/htdocs/commande/stats/index.php @@ -119,7 +119,6 @@ $mesg = $px1->isGraphKo(); if (! $mesg) { $px1->SetData($data); - $px1->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -134,7 +133,6 @@ if (! $mesg) $px1->SetYLabel($langs->trans("NbOfOrder")); $px1->SetShading(3); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->mode='depth'; $px1->SetTitle($langs->trans("NumberOfOrdersByMonth")); @@ -178,7 +176,6 @@ if (! $mesg) $px2->SetYLabel($langs->trans("AmountOfOrders")); $px2->SetShading(3); $px2->SetHorizTickIncrement(1); - $px2->SetPrecisionY(0); $px2->mode='depth'; $px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT")); @@ -220,7 +217,6 @@ if (! $mesg) $px3->SetHeight($HEIGHT); $px3->SetShading(3); $px3->SetHorizTickIncrement(1); - $px3->SetPrecisionY(0); $px3->mode='depth'; $px3->SetTitle($langs->trans("AmountAverage")); diff --git a/htdocs/compta/bank/annuel.php b/htdocs/compta/bank/annuel.php index c4352b3b97e..6643a9f97fb 100644 --- a/htdocs/compta/bank/annuel.php +++ b/htdocs/compta/bank/annuel.php @@ -384,7 +384,6 @@ else $px1->setBgColor('onglet'); $px1->setBgColorGrid(array(255,255,255)); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->draw($file, $fileurl); $show1 = $px1->show(); @@ -471,7 +470,6 @@ else $px2->setBgColor('onglet'); $px2->setBgColorGrid(array(255,255,255)); $px2->SetHorizTickIncrement(1); - $px2->SetPrecisionY(0); $px2->draw($file, $fileurl); $show2 = $px2->show(); diff --git a/htdocs/compta/bank/graph.php b/htdocs/compta/bank/graph.php index cf355beeb77..cdd346c889f 100644 --- a/htdocs/compta/bank/graph.php +++ b/htdocs/compta/bank/graph.php @@ -252,7 +252,6 @@ else $px1->setBgColor('onglet'); $px1->setBgColorGrid(array(255,255,255)); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->draw($file, $fileurl); $show1=$px1->show(); @@ -389,7 +388,6 @@ else $px2->setBgColorGrid(array(255,255,255)); $px2->SetHideXGrid(true); //$px2->SetHorizTickIncrement(30.41); // 30.41 jours/mois en moyenne - $px2->SetPrecisionY(0); $px2->draw($file, $fileurl); $show2=$px2->show(); @@ -503,7 +501,6 @@ else $px3->SetType(array('linesnopoint','linesnopoint','linesnopoint')); $px3->setBgColor('onglet'); $px3->setBgColorGrid(array(255,255,255)); - $px3->SetPrecisionY(0); $px3->draw($file, $fileurl); $show3=$px3->show(); @@ -633,7 +630,6 @@ else $px4->setBgColor('onglet'); $px4->setBgColorGrid(array(255,255,255)); $px4->SetHorizTickIncrement(1); - $px4->SetPrecisionY(0); $px4->draw($file, $fileurl); $show4=$px4->show(); @@ -742,7 +738,6 @@ else $px5->setBgColor('onglet'); $px5->setBgColorGrid(array(255,255,255)); $px5->SetHorizTickIncrement(1); - $px5->SetPrecisionY(0); $px5->draw($file, $fileurl); $show5=$px5->show(); diff --git a/htdocs/compta/charges/index.php b/htdocs/compta/charges/index.php index 33a06e09136..4b62a98b80b 100644 --- a/htdocs/compta/charges/index.php +++ b/htdocs/compta/charges/index.php @@ -3,8 +3,9 @@ * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2010 Regis Houssin * Copyright (C) 2011-2016 Alexandre Spangaro - * Copyright (C) 2011-2014 Juanjo Menent + * Copyright (C) 2011-2014 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -34,6 +35,12 @@ require_once DOL_DOCUMENT_ROOT.'/compta/salaries/class/paymentsalary.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php'; require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; + +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('specialexpensesindex')); + // Load translation files required by the page $langs->loadLangs(array('compta', 'bills')); @@ -568,6 +575,9 @@ if (! empty($conf->salaries->enabled) && ! empty($user->rights->salaries->read)) print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardSpecialBills', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/deplacement/stats/index.php b/htdocs/compta/deplacement/stats/index.php index 33bec241d48..830a1bc7e4c 100644 --- a/htdocs/compta/deplacement/stats/index.php +++ b/htdocs/compta/deplacement/stats/index.php @@ -107,7 +107,6 @@ $mesg = $px1->isGraphKo(); if (! $mesg) { $px1->SetData($data); - $px1->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -121,7 +120,6 @@ if (! $mesg) $px1->SetYLabel($langs->trans("Number")); $px1->SetShading(3); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->mode='depth'; $px1->SetTitle($langs->trans("NumberByMonth")); @@ -155,7 +153,6 @@ if (! $mesg) $px2->SetYLabel($langs->trans("Amount")); $px2->SetShading(3); $px2->SetHorizTickIncrement(1); - $px2->SetPrecisionY(0); $px2->mode='depth'; $px2->SetTitle($langs->trans("AmountTotal")); @@ -197,7 +194,6 @@ if (! $mesg) $px3->SetHeight($HEIGHT); $px3->SetShading(3); $px3->SetHorizTickIncrement(1); - $px3->SetPrecisionY(0); $px3->mode='depth'; $px3->SetTitle($langs->trans("AmountAverage")); diff --git a/htdocs/compta/facture/card.php b/htdocs/compta/facture/card.php index 10de9581dfe..0adfb4e7ac2 100644 --- a/htdocs/compta/facture/card.php +++ b/htdocs/compta/facture/card.php @@ -181,7 +181,8 @@ if (empty($reshook)) // Change status of invoice elseif ($action == 'reopen' && $usercancreate) { $result = $object->fetch($id); - if ($object->statut == 2 || ($object->statut == 3 && $object->close_code != 'replaced') || ($object->statut == 1 && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted + + if ($object->statut == Facture::STATUS_CLOSED || ($object->statut == Facture::STATUS_ABANDONED && ($object->close_code != 'replaced' || $object->getIdReplacingInvoice() == 0)) || ($object->statut == Facture::STATUS_VALIDATED && $object->paye == 1)) { // ($object->statut == 1 && $object->paye == 1) should not happened but can be found when data are corrupted $result = $object->set_unpaid($user); if ($result > 0) { header('Location: ' . $_SERVER["PHP_SELF"] . '?facid=' . $id); @@ -1295,7 +1296,6 @@ if (empty($reshook)) $TTotalByTva[$line->tva_tx] += $line->total_ttc ; } - $amount_to_diff = 0; foreach ($TTotalByTva as $tva => &$total) { $coef = $total / $srcobject->total_ttc; // Calc coef @@ -2973,21 +2973,24 @@ if ($action == 'create') } else { - print '
'; - $tmp=' '; - $text = ' '; - $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); - print $desc; - print '
'; + if (! empty($conf->global->INVOICE_USE_SITUATION)) + { + print '
'; + $tmp=' '; + $text = ' '; + $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); + print $desc; + print '
'; - print '
'; - $tmp=' '; - $text = ' '; - $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; - $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); - print $desc; - print '
'; + print '
'; + $tmp=' '; + $text = ' '; + $text.= '('.$langs->trans("YouMustCreateInvoiceFromThird").') '; + $desc = $form->textwithpicto($text, $langs->transnoentities("InvoiceFirstSituationDesc"), 1, 'help', '', 0, 3); + print $desc; + print '
'; + } print '
'; $tmp=' '; @@ -3172,7 +3175,7 @@ if ($action == 'create') if (!empty($conf->incoterm->enabled)) { print ''; - print ''; + print ''; print ''; $incoterm_id = GETPOST('incoterm_id'); $incoterm_location = GETPOST('location_incoterms'); @@ -4008,7 +4011,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 { @@ -4651,7 +4654,7 @@ elseif ($id > 0 || ! empty($ref)) && ($object->statut == 2 || $object->statut == 3 || ($object->statut == 1 && $object->paye == 1)) // Condition ($object->statut == 1 && $object->paye == 1) should not happened but can be found due to corrupted data && ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && $usercancreate) || $usercanreopen)) // A paid invoice (partially or completely) { - if (! $objectidnext && $object->close_code != 'replaced') // Not replaced by another invoice + if ($object->close_code != 'replaced' || (! $objectidnext)) // Not replaced by another invoice or replaced but the replacement invoice has been deleted { print ''; } 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/compta/facture/list.php b/htdocs/compta/facture/list.php index 6c325c865a9..0a5efadd832 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -1298,6 +1298,7 @@ if ($resql) $filedir=$diroutputmassaction; $genallowed=$user->rights->facture->lire; $delallowed=$user->rights->facture->creer; + $title = ''; print $formfile->showdocuments('massfilesarea_invoices', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty); } diff --git a/htdocs/compta/facture/stats/index.php b/htdocs/compta/facture/stats/index.php index 5d8fee98676..99abd48cb49 100644 --- a/htdocs/compta/facture/stats/index.php +++ b/htdocs/compta/facture/stats/index.php @@ -103,7 +103,6 @@ $mesg = $px1->isGraphKo(); if (! $mesg) { $px1->SetData($data); - $px1->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -117,7 +116,6 @@ if (! $mesg) $px1->SetYLabel($langs->trans("NumberOfBills")); $px1->SetShading(3); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->mode='depth'; $px1->SetTitle($langs->trans("NumberOfBillsByMonth")); @@ -152,7 +150,6 @@ if (! $mesg) $px2->SetYLabel($langs->trans("AmountOfBills")); $px2->SetShading(3); $px2->SetHorizTickIncrement(1); - $px2->SetPrecisionY(0); $px2->mode='depth'; $px2->SetTitle($langs->trans("AmountOfBillsByMonthHT")); @@ -194,7 +191,6 @@ if (! $mesg) $px3->SetHeight($HEIGHT); $px3->SetShading(3); $px3->SetHorizTickIncrement(1); - $px3->SetPrecisionY(0); $px3->mode='depth'; $px3->SetTitle($langs->trans("AmountAverage")); diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index c57b073b487..932d9ed758c 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -2,10 +2,11 @@ /* Copyright (C) 2001-2005 Rodolphe Quiedeville * Copyright (C) 2004-2013 Laurent Destailleur * Copyright (C) 2005-2015 Regis Houssin - * Copyright (C) 2015-2016 Juanjo Menent + * Copyright (C) 2015-2016 Juanjo Menent * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Raphaël Doursenaud * Copyright (C) 2016 Marcos García + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -63,6 +64,7 @@ if ($user->societe_id > 0) $max=3; +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array $hookmanager->initHooks(array('invoiceindex')); /* @@ -1080,6 +1082,9 @@ if ($resql) print '
'; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardAccountancy', $parameters, $object); // Note that $action and $object may have been modified by hook + // End of page llxFooter(); $db->close(); diff --git a/htdocs/compta/salaries/stats/index.php b/htdocs/compta/salaries/stats/index.php index 0c64ed5865e..d6f94427cce 100644 --- a/htdocs/compta/salaries/stats/index.php +++ b/htdocs/compta/salaries/stats/index.php @@ -83,7 +83,6 @@ $mesg = $px1->isGraphKo(); if (! $mesg) { $px1->SetData($data); - $px1->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -97,7 +96,6 @@ if (! $mesg) $px1->SetYLabel($langs->trans("Number")); $px1->SetShading(3); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->mode='depth'; $px1->SetTitle($langs->trans("NumberByMonth")); @@ -131,7 +129,6 @@ if (! $mesg) $px2->SetYLabel($langs->trans("Amount")); $px2->SetShading(3); $px2->SetHorizTickIncrement(1); - $px2->SetPrecisionY(0); $px2->mode='depth'; $px2->SetTitle($langs->trans("AmountTotal")); @@ -163,7 +160,6 @@ if (! $mesg) $px3->SetHeight($HEIGHT); $px3->SetShading(3); $px3->SetHorizTickIncrement(1); - $px3->SetPrecisionY(0); $px3->mode='depth'; $px3->SetTitle($langs->trans("AmountAverage")); diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index de9494fca8b..ca58882b224 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -9,6 +9,7 @@ * Copyright (C) 2013 Alexandre Spangaro * Copyright (C) 2013 Juanjo Menent * Copyright (C) 2015 Marcos García + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -520,7 +521,7 @@ class Contact extends CommonObject // phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps - // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore + // phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore /** * Initialise tableau info (tableau des attributs LDAP) * 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/index.php b/htdocs/contrat/index.php index 10c2e2915b9..3bf047c87c8 100644 --- a/htdocs/contrat/index.php +++ b/htdocs/contrat/index.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2011 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * Copyright (C) 2015 Jean-François Ferry + * Copyright (C) 2019 Nicolas ZABOURI * * 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 @@ -28,6 +29,11 @@ require "../main.inc.php"; require_once DOL_DOCUMENT_ROOT."/contrat/class/contrat.class.php"; require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php"; +$hookmanager = new HookManager($db); + +// Initialize technical object to manage hooks. Note that conf->hooks_modules contains array +$hookmanager->initHooks(array('contractindex')); + // Load translation files required by the page $langs->loadLangs(array('products', 'companies', 'contracts')); @@ -609,6 +615,8 @@ else //print ''; print ''; +$parameters = array('user' => $user); +$reshook = $hookmanager->executeHooks('dashboardContracts', $parameters, $object); // Note that $action and $object may have been modified by hook llxFooter(); diff --git a/htdocs/core/actions_extrafields.inc.php b/htdocs/core/actions_extrafields.inc.php index b5eb5257ecc..0900c8c3ffe 100644 --- a/htdocs/core/actions_extrafields.inc.php +++ b/htdocs/core/actions_extrafields.inc.php @@ -27,7 +27,7 @@ $maxsizestring=255; $maxsizeint=10; $mesg=array(); -$extrasize=GETPOST('size', 'int'); +$extrasize=GETPOST('size', 'intcomma'); $type=GETPOST('type', 'alpha'); $param=GETPOST('param', 'alpha'); diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index 4323661370c..4ece2eae661 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -143,7 +143,6 @@ class box_graph_invoices_permonth extends ModeleBoxes $px1->SetData($data1); unset($data1); - $px1->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -157,7 +156,6 @@ class box_graph_invoices_permonth extends ModeleBoxes $px1->SetYLabel($langs->trans("NumberOfBills")); $px1->SetShading(3); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->SetCssPrefix("cssboxes"); $px1->mode='depth'; $px1->SetTitle($langs->trans("NumberOfBillsByMonth")); @@ -183,7 +181,6 @@ class box_graph_invoices_permonth extends ModeleBoxes $px2->SetData($data2); unset($data2); - $px2->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -197,7 +194,6 @@ class box_graph_invoices_permonth extends ModeleBoxes $px2->SetYLabel($langs->trans("AmountOfBillsHT")); $px2->SetShading(3); $px2->SetHorizTickIncrement(1); - $px2->SetPrecisionY(0); $px2->SetCssPrefix("cssboxes"); $px2->mode='depth'; $px2->SetTitle($langs->trans("AmountOfBillsByMonthHT")); diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index bba5185c94a..4e7849ab048 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -140,7 +140,6 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $px1->SetData($data1); unset($data1); - $px1->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -154,7 +153,6 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $px1->SetYLabel($langs->trans("NumberOfBills")); $px1->SetShading(3); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->SetCssPrefix("cssboxes"); $px1->mode='depth'; $px1->SetTitle($langs->trans("NumberOfBillsByMonth")); @@ -180,7 +178,6 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $px2->SetData($data2); unset($data2); - $px2->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -194,7 +191,6 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes $px2->SetYLabel($langs->trans("AmountOfBillsHT")); $px2->SetShading(3); $px2->SetHorizTickIncrement(1); - $px2->SetPrecisionY(0); $px2->SetCssPrefix("cssboxes"); $px2->mode='depth'; $px2->SetTitle($langs->trans("AmountOfBillsByMonthHT")); diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index b06558393aa..3ba42cc6d0a 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -141,7 +141,6 @@ class box_graph_orders_permonth extends ModeleBoxes { $px1->SetData($data1); unset($data1); - $px1->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -155,7 +154,6 @@ class box_graph_orders_permonth extends ModeleBoxes $px1->SetYLabel($langs->trans("NumberOfOrders")); $px1->SetShading(3); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->SetCssPrefix("cssboxes"); $px1->mode='depth'; $px1->SetTitle($langs->trans("NumberOfOrdersByMonth")); @@ -179,7 +177,6 @@ class box_graph_orders_permonth extends ModeleBoxes { $px2->SetData($data2); unset($data2); - $px2->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -193,7 +190,6 @@ class box_graph_orders_permonth extends ModeleBoxes $px2->SetYLabel($langs->trans("AmountOfOrdersHT")); $px2->SetShading(3); $px2->SetHorizTickIncrement(1); - $px2->SetPrecisionY(0); $px2->SetCssPrefix("cssboxes"); $px2->mode='depth'; $px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT")); diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index 9cb11aed7c1..6bfc47c504d 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -140,7 +140,6 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes { $px1->SetData($data1); unset($data1); - $px1->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -154,7 +153,6 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $px1->SetYLabel($langs->trans("NumberOfOrders")); $px1->SetShading(3); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->SetCssPrefix("cssboxes"); $px1->mode='depth'; $px1->SetTitle($langs->trans("NumberOfOrdersByMonth")); @@ -178,7 +176,6 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes { $px2->SetData($data2); unset($data2); - $px2->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -192,7 +189,6 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes $px2->SetYLabel($langs->trans("AmountOfOrdersHT")); $px2->SetShading(3); $px2->SetHorizTickIncrement(1); - $px2->SetPrecisionY(0); $px2->SetCssPrefix("cssboxes"); $px2->mode='depth'; $px2->SetTitle($langs->trans("AmountOfOrdersByMonthHT")); diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 0fe5c66d532..e085cd82f07 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -171,7 +171,6 @@ class box_graph_product_distribution extends ModeleBoxes unset($data1); if ($nocolor) $px1->SetDataColor(array(array(220,220,220))); - $px1->SetPrecisionY(0); $px1->SetLegend($legend); $px1->setShowLegend(0); $px1->setShowPointValue($showpointvalue); @@ -182,7 +181,6 @@ class box_graph_product_distribution extends ModeleBoxes //$px1->SetYLabel($langs->trans("NumberOfBills")); $px1->SetShading(3); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->SetCssPrefix("cssboxes"); //$px1->mode='depth'; $px1->SetType(array('pie')); @@ -231,7 +229,6 @@ class box_graph_product_distribution extends ModeleBoxes unset($data2); if ($nocolor) $px2->SetDataColor(array(array(220,220,220))); - $px2->SetPrecisionY(0); $px2->SetLegend($legend); $px2->setShowLegend(0); $px2->setShowPointValue($showpointvalue); @@ -242,7 +239,6 @@ class box_graph_product_distribution extends ModeleBoxes //$px2->SetYLabel($langs->trans("AmountOfBillsHT")); $px2->SetShading(3); $px2->SetHorizTickIncrement(1); - $px2->SetPrecisionY(0); $px2->SetCssPrefix("cssboxes"); //$px2->mode='depth'; $px2->SetType(array('pie')); @@ -292,7 +288,6 @@ class box_graph_product_distribution extends ModeleBoxes unset($data3); if ($nocolor) $px3->SetDataColor(array(array(220,220,220))); - $px3->SetPrecisionY(0); $px3->SetLegend($legend); $px3->setShowLegend(0); $px3->setShowPointValue($showpointvalue); @@ -303,7 +298,6 @@ class box_graph_product_distribution extends ModeleBoxes //$px3->SetYLabel($langs->trans("AmountOfBillsHT")); $px3->SetShading(3); $px3->SetHorizTickIncrement(1); - $px3->SetPrecisionY(0); $px3->SetCssPrefix("cssboxes"); //$px3->mode='depth'; $px3->SetType(array('pie')); diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index b21381473c2..9ced39271d0 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -141,7 +141,6 @@ class box_graph_propales_permonth extends ModeleBoxes $px1->SetType($datatype1); $px1->SetData($data1); unset($data1); - $px1->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -155,7 +154,6 @@ class box_graph_propales_permonth extends ModeleBoxes $px1->SetYLabel($langs->trans("NumberOfProposals")); $px1->SetShading(3); $px1->SetHorizTickIncrement(1); - $px1->SetPrecisionY(0); $px1->SetCssPrefix("cssboxes"); $px1->mode='depth'; $px1->SetTitle($langs->trans("NumberOfProposalsByMonth")); @@ -182,7 +180,6 @@ class box_graph_propales_permonth extends ModeleBoxes $px2->SetType($datatype2); $px2->SetData($data2); unset($data2); - $px2->SetPrecisionY(0); $i=$startyear;$legend=array(); while ($i <= $endyear) { @@ -196,7 +193,6 @@ class box_graph_propales_permonth extends ModeleBoxes $px2->SetYLabel($langs->trans("AmountOfProposalsHT")); $px2->SetShading(3); $px2->SetHorizTickIncrement(1); - $px2->SetPrecisionY(0); $px2->SetCssPrefix("cssboxes"); $px2->mode='depth'; $px2->SetTitle($langs->trans("AmountOfProposalsByMonthHT")); diff --git a/htdocs/core/class/ccountry.class.php b/htdocs/core/class/ccountry.class.php index a97d992bf89..a551857ded4 100644 --- a/htdocs/core/class/ccountry.class.php +++ b/htdocs/core/class/ccountry.class.php @@ -47,8 +47,8 @@ class Ccountry // extends CommonObject */ public $errors = array(); - //var $element='ccountry'; //!< Id that identify managed objects - //var $table_element='ccountry'; //!< Name of table without prefix where object is stored + public $element='ccountry'; //!< Id that identify managed objects + public $table_element='c_country'; //!< Name of table without prefix where object is stored /** * @var int ID @@ -65,7 +65,9 @@ class Ccountry // extends CommonObject public $active; - + public $fields=array( + 'label' => array('type'=>'varchar(250)', 'label'=>'Label', 'enabled'=>1, 'visible'=>1, 'position'=>15, 'notnull'=>-1, 'showoncombobox'=>'1') + ); /** diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c966f39680b..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) { 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/dolgraph.class.php b/htdocs/core/class/dolgraph.class.php index d7850871ee0..458f0bd4fad 100644 --- a/htdocs/core/class/dolgraph.class.php +++ b/htdocs/core/class/dolgraph.class.php @@ -61,8 +61,6 @@ class DolGraph public $MinValue=0; public $SetShading=0; - public $PrecisionY=-1; - public $horizTickIncrement=-1; public $SetNumXTicks=-1; public $labelInterval=-1; @@ -116,7 +114,6 @@ class DolGraph if (! $isgdinstalled) { $this->error="Error: PHP GD module is not available. It is required to build graphics."; - return -1; } } @@ -142,11 +139,11 @@ class DolGraph * * @param float $which_prec Precision * @return boolean + * @deprecated */ public function SetPrecisionY($which_prec) { // phpcs:enable - $this->PrecisionY = $which_prec; return true; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index eeb653aec8a..b8f5c0480b5 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1645,7 +1645,10 @@ class ExtraFields elseif ($type == 'double') { if (!empty($value)) { - $value=price($value); + //$value=price($value); + $sizeparts = explode(",", $size); + $number_decimals = $sizeparts[1]; + $value=price($value, 0, $langs, 0, 0, $number_decimals, ''); } } elseif ($type == 'boolean') @@ -1956,9 +1959,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.form.class.php b/htdocs/core/class/html.form.class.php index c4aaab27a84..12cf8893005 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5234,10 +5234,12 @@ class Form * @param int $fullday When a checkbox with this html name is on, hour and day are set with 00:00 or 23:59 * @param string $addplusone Add a link "+1 hour". Value must be name of another selectDate field. * @param datetime $adddateof Add a link "Date of invoice" using the following date. + * @param string $openinghours Specify hour strat and hour end for the select ex 8,20 + * @param int $stepminutes Specify step for minutes between 1 and 30 * @return string Html for selectDate * @see form_date(), select_month(), select_year(), select_dayofweek() */ - public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '') + public function selectDate($set_time = '', $prefix = 're', $h = 0, $m = 0, $empty = 0, $form_name = "", $d = 1, $addnowlink = 0, $disabled = 0, $fullday = '', $addplusone = '', $adddateof = '', $openinghours = '', $stepminutes = 1) { global $conf,$langs; @@ -5248,6 +5250,7 @@ class Form if ($m == '') $m=0; $emptydate=0; $emptyhours=0; + if ($stepminutes<=0 || $stepminutes>30) $stepminutes = 1; if ($empty == 1) { $emptydate=1; $emptyhours=1; } if ($empty == 2) { $emptydate=0; $emptyhours=1; } $orig_set_time=$set_time; @@ -5468,10 +5471,18 @@ class Form if ($h) { + $hourstart = 0; + $hourend = 24; + if ($openinghours != '') { + $openinghours = explode(',', $openinghours); + $hourstart = $openinghours[0]; + $hourend = $openinghours[1]; + if ($hourend<$hourstart) $hourend = $hourstart; + } // Show hour $retstring.=''; if ($emptyhours) $retstring.=''; - for ($hour = 0; $hour < 24; $hour++) + for ($hour = $hourstart; $hour < $hourend; $hour++) { if (strlen($hour) < 2) $hour = "0" . $hour; $retstring.=''; @@ -5485,7 +5496,7 @@ class Form // Show minutes $retstring.=''; if ($emptyhours) $retstring.=''; - for ($min = 0; $min < 60 ; $min++) + for ($min = 0; $min < 60 ; $min+=$stepminutes) { if (strlen($min) < 2) $min = "0" . $min; $retstring.=''; diff --git a/htdocs/core/class/html.formcompany.class.php b/htdocs/core/class/html.formcompany.class.php index d1366cb8511..17643e2d69a 100644 --- a/htdocs/core/class/html.formcompany.class.php +++ b/htdocs/core/class/html.formcompany.class.php @@ -211,13 +211,13 @@ class FormCompany * The key of the list is the code (there can be several entries for a given code but in this case, the country field differs). * Thus the links with the departments are done on a department independently of its name. * - * @param string $selected Code state preselected (mus be state id) + * @param int $selected Code state preselected (mus be state id) * @param integer $country_codeid Country code or id: 0=list for all countries, otherwise country code or country rowid to show * @param string $htmlname Id of department. If '', we want only the string with