From 642a86ba2556b55544684964aaabbb08ea145653 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 1 Dec 2018 16:55:45 +0100 Subject: [PATCH 01/36] Fix #8152 --- htdocs/core/actions_sendmails.inc.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/core/actions_sendmails.inc.php b/htdocs/core/actions_sendmails.inc.php index 67ac879ebf5..539306f3cb3 100644 --- a/htdocs/core/actions_sendmails.inc.php +++ b/htdocs/core/actions_sendmails.inc.php @@ -1,6 +1,7 @@ - * +* Copyright (C) 2013 Juanjo Menent +* * 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 * the Free Software Foundation; either version 3 of the License, or @@ -192,7 +193,7 @@ if (($action == 'send' || $action == 'relance') && ! $_POST['addfile'] && ! $_PO // Recipient was provided from combo list if ($val == 'thirdparty') // Id of third party { - $tmparray[] = $thirdparty->name.' <'.$thirdparty->email.'>'; + $tmparray[] = str_replace(","," ",$thirdparty->name).' <'.$thirdparty->email.'>'; } elseif ($val) // Id du contact { From dc93cccbe147b195798745765bf75dddeb16c400 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Fri, 28 Dec 2018 12:57:04 +0100 Subject: [PATCH 02/36] FIX: Loan impossible to account --- htdocs/accountancy/journal/bankjournal.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 7da96a65951..36b1ed8ce80 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -8,6 +8,7 @@ * Copyright (C) 2013-2014 Florian Henry * Copyright (C) 2013-2014 Olivier Geffroy * Copyright (C) 2017 Frédéric France + * Copyright (C) 2018 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -369,6 +370,18 @@ if ($result) { $tabpay[$obj->rowid]["lib"] .= ' ' . $paymentloanstatic->getNomUrl(2); $tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id; //$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount; + $sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest'; + $sqlmid.= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl RIGHT JOIN '.MAIN_DB_PREFIX.'loan as l ON l.rowid = pl.fk_loan'; + $sqlmid.= ' WHERE pl.fk_bank = '.$obj->rowid; + + dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); + $resultmid = $db->query($sqlmid); + if ($resultmid) { + $objmid = $db->fetch_object($resultmid); + $tabtp[$obj->rowid][$objmid->accountancy_account_capital] -= $objmid->amount_capital; + $tabtp[$obj->rowid][$objmid->accountancy_account_insurance] -= $objmid->amount_insurance; + $tabtp[$obj->rowid][$objmid->accountancy_account_interest] -= $objmid->amount_interest; + } } else if ($links[$key]['type'] == 'banktransfert') { $tabpay[$obj->rowid]["lib"] .= ' ' . $langs->trans("BankTransfer"); $tabtp[$obj->rowid][$account_transfer] += $obj->amount; From fc3da0f5be83fbed832cb81f00453073264372fe Mon Sep 17 00:00:00 2001 From: gauthier Date: Wed, 2 Jan 2019 10:02:30 +0100 Subject: [PATCH 03/36] FIX : holidays get natural_search if search params are set only --- htdocs/holiday/define_holiday.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/holiday/define_holiday.php b/htdocs/holiday/define_holiday.php index 87cb1920394..199787cbc06 100644 --- a/htdocs/holiday/define_holiday.php +++ b/htdocs/holiday/define_holiday.php @@ -205,7 +205,7 @@ if ($result < 0) setEventMessages($holiday->error, $holiday->errors, 'errors'); } -$filters=natural_search(array('u.firstname','u.lastname'), $search_name); +if(!empty($search_name)) $filters=natural_search(array('u.firstname','u.lastname'), $search_name); $listUsers = $holiday->fetchUsers(false,true,$filters); if (is_numeric($listUsers) && $listUsers < 0) From cad95c7dc2411587e3e8d79b54f9273c495d427f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 2 Jan 2019 15:39:22 +0100 Subject: [PATCH 04/36] Update societe.class.php --- htdocs/societe/class/societe.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index 4b1f9053353..fcdf4e9741a 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -1353,7 +1353,7 @@ class Societe extends CommonObject } // Use first price level if level not defined for third party - if (! empty($conf->global->PRODUIT_MULTIPRICES) && empty($this->price_level)) $this->price_level=1; + if ((! empty($conf->global->PRODUIT_MULTIPRICES) || ! empty($conf->global->PRODUIT_CUSTOMER_PRICES_BY_QTY_MULTIPRICES)) && empty($this->price_level)) $this->price_level=1; return $result; } From 8645a7f524ff2862ab9c5ab71ddec8bc7806160d Mon Sep 17 00:00:00 2001 From: ldestailleur Date: Wed, 2 Jan 2019 18:48:27 +0100 Subject: [PATCH 05/36] FIX Interface regression for bind people. Fix option MAIN_OPTIMIZEFORTEXTBROWSER --- htdocs/core/lib/ajax.lib.php | 1 + htdocs/core/lib/usergroups.lib.php | 40 ++++++++++++++++++++++++++++++ htdocs/user/param_ihm.php | 6 +++++ 3 files changed, 47 insertions(+) diff --git a/htdocs/core/lib/ajax.lib.php b/htdocs/core/lib/ajax.lib.php index 92f057b4b94..12088894896 100644 --- a/htdocs/core/lib/ajax.lib.php +++ b/htdocs/core/lib/ajax.lib.php @@ -400,6 +400,7 @@ function ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $ if (! empty($conf->global->MAIN_DISABLE_AJAX_COMBOX)) return ''; if (empty($conf->use_javascript_ajax)) return ''; if (empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) && ! defined('REQUIRE_JQUERY_MULTISELECT')) return ''; + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) return ''; if (empty($minLengthToAutocomplete)) $minLengthToAutocomplete=0; diff --git a/htdocs/core/lib/usergroups.lib.php b/htdocs/core/lib/usergroups.lib.php index b8833e42543..abe774950a5 100644 --- a/htdocs/core/lib/usergroups.lib.php +++ b/htdocs/core/lib/usergroups.lib.php @@ -458,6 +458,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; + print ''; } // Background color THEME_ELDY_BACKBODY @@ -503,6 +504,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print '   ('.$langs->trans("Default").': ffffff) '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; + print ''; } // TopMenuBackgroundColor @@ -550,6 +552,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; + print ''; } // LeftMenuBackgroundColor @@ -597,6 +600,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; + print ''; } // TextTitleColor @@ -678,6 +682,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; + print ''; } // BackgroundTableLineEvenColor @@ -706,6 +711,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print '   ('.$langs->trans("Default").': '.$default.') '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; + print ''; } // Text LinkColor @@ -755,6 +761,7 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print '   ('.$langs->trans("Default").': 000078) '; print $form->textwithpicto('', $langs->trans("NotSupportedByAllThemes").', '.$langs->trans("PressF5AfterChangingThis")); print ''; + print ''; } // Use Hover @@ -801,5 +808,38 @@ function show_theme($fuser,$edit=0,$foruserprofile=false) print ''; } + // Use MAIN_OPTIMIZEFORTEXTBROWSER + if ($foruserprofile) + { + $default=$langs->trans('No'); + print ''; + print ''.$langs->trans("MAIN_OPTIMIZEFORTEXTBROWSER").''; + print ''; + if ($edit) + { + print $form->selectyesno('MAIN_OPTIMIZEFORTEXTBROWSER', $fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER, 1); + } + else + { + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + { + print yn($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER); + } + else + { + print yn(1); + if (empty($fuser->conf->MAIN_OPTIMIZEFORTEXTBROWSER)) print ' ('.$langs->trans("ForcedByGlobalSetup").')'; + } + } + print '   ('.$langs->trans("Default").': '.yn(0).') '; + print $form->textwithpicto('', $langs->trans("MAIN_OPTIMIZEFORTEXTBROWSERDesc")); + print ''; + print ''; + } + else + { + // TODO + } + print ''; } diff --git a/htdocs/user/param_ihm.php b/htdocs/user/param_ihm.php index 64913683276..929720e983b 100644 --- a/htdocs/user/param_ihm.php +++ b/htdocs/user/param_ihm.php @@ -142,6 +142,12 @@ if (empty($reshook)) { $tabparam["THEME_ELDY_USE_HOVER"] = 0; } + if (GETPOST('MAIN_OPTIMIZEFORTEXTBROWSER')) { + $tabparam["MAIN_OPTIMIZEFORTEXTBROWSER"] = 1; + } else { + $tabparam["MAIN_OPTIMIZEFORTEXTBROWSER"] = 0; + } + $result = dol_set_user_param($db, $conf, $object, $tabparam); header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $id); From a39336c80d4f00c10b1ada840f843fa17d187a24 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 2 Jan 2019 19:50:23 +0100 Subject: [PATCH 06/36] Simple join is better than RIGHT JOIN --- htdocs/accountancy/journal/bankjournal.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/accountancy/journal/bankjournal.php b/htdocs/accountancy/journal/bankjournal.php index 36b1ed8ce80..6bf387c9b0e 100644 --- a/htdocs/accountancy/journal/bankjournal.php +++ b/htdocs/accountancy/journal/bankjournal.php @@ -371,8 +371,8 @@ if ($result) { $tabpay[$obj->rowid]["paymentloanid"] = $paymentloanstatic->id; //$tabtp[$obj->rowid][$account_pay_loan] += $obj->amount; $sqlmid = 'SELECT pl.amount_capital, pl.amount_insurance, pl.amount_interest, l.accountancy_account_capital, l.accountancy_account_insurance, l.accountancy_account_interest'; - $sqlmid.= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl RIGHT JOIN '.MAIN_DB_PREFIX.'loan as l ON l.rowid = pl.fk_loan'; - $sqlmid.= ' WHERE pl.fk_bank = '.$obj->rowid; + $sqlmid.= ' FROM '.MAIN_DB_PREFIX.'payment_loan as pl, '.MAIN_DB_PREFIX.'loan as l'; + $sqlmid.= ' WHERE l.rowid = pl.fk_loan AND pl.fk_bank = '.$obj->rowid; dol_syslog("accountancy/journal/bankjournal.php:: sqlmid=" . $sqlmid, LOG_DEBUG); $resultmid = $db->query($sqlmid); From 15cc45b8ae9273972b3824906ff708267104a5a3 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Fri, 4 Jan 2019 10:52:10 +0100 Subject: [PATCH 07/36] FIX: Can't generate invoice pdf --- htdocs/core/actions_massactions.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 4fad63ca840..0c66d51d589 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1,6 +1,7 @@ * Copyright (C) 2018 Juanjo Menent + * Copyright (C) 2019 Ferran Marcet * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -680,6 +681,7 @@ if ($massaction == 'confirm_createbills') } $id = $objecttmp->id; // For builddoc action + $object = $objecttmp; // Builddoc $donotredirect = 1; From 4694af048837c94c9b3e738f1724618b0a574a21 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Fri, 4 Jan 2019 11:45:02 +0100 Subject: [PATCH 08/36] FIX: Can't generate invoice pdf --- htdocs/commande/list.php | 1 + htdocs/core/actions_massactions.inc.php | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 04ef69b2638..27fa4bd48e3 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -102,6 +102,7 @@ if (! $sortorder) $sortorder='DESC'; $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'orderlist'; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context +$object = new Commande($db); $hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 0c66d51d589..a89b6dcdb2c 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -681,7 +681,6 @@ if ($massaction == 'confirm_createbills') } $id = $objecttmp->id; // For builddoc action - $object = $objecttmp; // Builddoc $donotredirect = 1; From f3dd875fc799a059225221629323e8d007458b33 Mon Sep 17 00:00:00 2001 From: Ferran Marcet Date: Fri, 4 Jan 2019 12:00:39 +0100 Subject: [PATCH 09/36] FIX: Can't generate invoice pdf --- htdocs/commande/list.php | 1 - htdocs/core/actions_massactions.inc.php | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 27fa4bd48e3..04ef69b2638 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -102,7 +102,6 @@ if (! $sortorder) $sortorder='DESC'; $contextpage=GETPOST('contextpage','aZ')?GETPOST('contextpage','aZ'):'orderlist'; // Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context -$object = new Commande($db); $hookmanager->initHooks(array($contextpage)); $extrafields = new ExtraFields($db); diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index a89b6dcdb2c..0c66d51d589 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -681,6 +681,7 @@ if ($massaction == 'confirm_createbills') } $id = $objecttmp->id; // For builddoc action + $object = $objecttmp; // Builddoc $donotredirect = 1; From 96967100ba61ac0f90e6cca92cf83b3b417e7c5c Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 5 Jan 2019 13:35:32 +0100 Subject: [PATCH 10/36] Prepare 7.0.5 --- ChangeLog | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/ChangeLog b/ChangeLog index 61b3f85edb3..b63cc948980 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,39 @@ English Dolibarr ChangeLog -------------------------------------------------------------- +***** ChangeLog for 7.0.5 compared to 7.0.4 ***** +FIX: #3234 +FIX: #6580 +FIX: #8741 +FIX: #9934 +FIX: avoid Class 'AdherentType' not found +FIX: Can't create a thirdparty from member if customer code is mandatory. +FIX: Can't generate invoice pdf +FIX: contact/adress tab: when changing company ajax combo, the first contact change is not taken into account +FIX: Error generating ODT when option to use contact on doc on +FIX: Error reported when creation of thirdparty from member fails +FIX: filter on product category doesn't work +FIX: form actions: select_type_actions could be too small + bad init +FIX: fourn payment modes musn't be available on customer docs +FIX: Function updatePrice with wrong parameters +FIX: If we change customer/supplier rule we can't edit old thirdparty. +FIX: Interface regression for bind people. Fix option MAIN_OPTIMIZEFORTEXTBROWSER +FIX: Lines are not inserted correctly if VAT have code +FIX: OppStatusShort doesn't exists +FIX: pdf typhon: order reference duplicate +FIX: propal pdf: missing parenthesis for customs code +FIX: Same on customer card +FIX: same on lines +FIX: Select first mail model by default +FIX: sql query performance on list_qualified_avoir_supplier_invoices. +FIX: task time screen: last fix was overkill +FIX: task time screen: prevent users with access to all project from assigning to tasks they're not allowed to do +FIX: use discount with multicurrency +FIX: Variable name +FIX: We want to be able to send PDF of paid invoices +FIX: When delete a product, llx_product_association rows are not deleted +FIX: wrong occurence number of contract on contact card, we must only count externals + ***** ChangeLog for 7.0.4 compared to 7.0.3 ***** FIX: #8984 button create expense report FIX: #9032 From 74442911a7f9c99b7da83ae9dc4400da84324bc2 Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Sat, 5 Jan 2019 14:45:23 +0100 Subject: [PATCH 11/36] Change to 7.0.6 --- htdocs/filefunc.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/filefunc.inc.php b/htdocs/filefunc.inc.php index dbc0e4bda8c..6675a1c3fb3 100644 --- a/htdocs/filefunc.inc.php +++ b/htdocs/filefunc.inc.php @@ -31,7 +31,7 @@ */ if (! defined('DOL_APPLICATION_TITLE')) define('DOL_APPLICATION_TITLE','Dolibarr'); -if (! defined('DOL_VERSION')) define('DOL_VERSION','7.0.5'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c +if (! defined('DOL_VERSION')) define('DOL_VERSION','7.0.6'); // a.b.c-alpha, a.b.c-beta, a.b.c-rcX or a.b.c if (! defined('EURO')) define('EURO',chr(128)); From 2c496d2ac06c8d5547c8d3013a7767f5390d5c28 Mon Sep 17 00:00:00 2001 From: Xebax Date: Sun, 6 Jan 2019 13:42:41 +0100 Subject: [PATCH 12/36] FIX Civility not saved when creating a member. --- htdocs/adherents/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/card.php b/htdocs/adherents/card.php index 0284155ddc1..0776a86d7d9 100644 --- a/htdocs/adherents/card.php +++ b/htdocs/adherents/card.php @@ -446,7 +446,7 @@ if (empty($reshook)) } $typeid=GETPOST("typeid",'int'); - $civility_id=GETPOST("civility_id",'int'); + $civility_id=GETPOST("civility_id",'alpha'); $lastname=GETPOST("lastname",'alpha'); $firstname=GETPOST("firstname",'alpha'); $societe=GETPOST("societe",'alpha'); From 087a4400b0db5ccf4e3d9b293758fcfe957df186 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Jan 2019 01:05:42 +0100 Subject: [PATCH 13/36] FIX Default value on sales representative on third party creation --- htdocs/societe/card.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index d90c8f2a1f0..7fd461000ef 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -1382,7 +1382,8 @@ else print ''.fieldLabel('AllocateCommercial','commercial_id').''; print ''; $userlist = $form->select_dolusers('', '', 0, null, 0, '', '', 0, 0, 0, '', 0, '', '', 0, 1); - print $form->multiselectarray('commercial', $userlist, (count(GETPOST('commercial', 'array')) > 0?GETPOST('commercial', 'array'):(empty($user->rights->societe->client->voir)?array($user->id):array())), null, null, null, null, "90%"); + $selected = (count(GETPOST('commercial', 'array')) > 0 ? GETPOST('commercial', 'array') : (GETPOST('commercial', 'int') > 0 ? array(GETPOST('commercial', 'int')) : (empty($user->rights->societe->client->voir)?array($user->id):array()))); + print $form->multiselectarray('commercial', $userlist, $selected, null, null, null, null, "90%"); print ''; // Incoterms From f85389ac296fc7e3fd28ae1c99b8ba20bf187946 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Jan 2019 01:11:34 +0100 Subject: [PATCH 14/36] Fix missing td column --- htdocs/admin/defaultvalues.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/admin/defaultvalues.php b/htdocs/admin/defaultvalues.php index 84271cff38f..6d56ba415c1 100644 --- a/htdocs/admin/defaultvalues.php +++ b/htdocs/admin/defaultvalues.php @@ -376,6 +376,11 @@ if ($result) print ''; } + if (! empty($conf->multicompany->enabled) && !$user->entity) + { + print ''; + } + // Actions print ''; if ($action != 'edit' || GETPOST('rowid') != $obj->rowid) From 68802c659e9307a61019e1e0f053b63dfe9e2735 Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio Date: Tue, 8 Jan 2019 11:41:58 +0100 Subject: [PATCH 15/36] FIX: action list: add printFieldListSelect and printFieldListWhere hooks --- htdocs/comm/action/list.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index ed2ce1340c7..d20b3050a55 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -235,8 +235,15 @@ $sql.= " a.fk_contact, a.note, a.percent as percent,"; $sql.= " a.fk_element, a.elementtype,"; $sql.= " c.code as type_code, c.libelle as type_label,"; $sql.= " sp.lastname, sp.firstname, sp.email, sp.phone, sp.address, sp.phone as phone_pro, sp.phone_mobile, sp.phone_perso, sp.fk_pays as country_id"; + // Add fields from extrafields foreach ($extrafields->attribute_label as $key => $val) $sql.=($extrafields->attribute_type[$key] != 'separate' ? ",ef.".$key.' as options_'.$key : ''); + +// Add fields from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListSelect',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql.= " FROM ".MAIN_DB_PREFIX."actioncomm as a"; $sql.=" LEFT JOIN ".MAIN_DB_PREFIX."actioncomm_extrafields as ef ON (a.id = ef.fk_object) "; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON a.fk_soc = sc.fk_soc"; @@ -307,9 +314,15 @@ if ($filtert > 0 || $usergroup > 0) if ($dateselect > 0) $sql.= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."') OR (a.datep2 IS NULL AND a.datep > '".$db->idate($dateselect-3600)."' AND a.datep <= '".$db->idate($dateselect+3600*24-1)."'))"; if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'"; if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'"; + // Add where from extra fields include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; +// Add where from hooks +$parameters=array(); +$reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook +$sql.=$hookmanager->resPrint; + $sql.= $db->order($sortfield,$sortorder); $nbtotalofrecords = ''; From 9a6c3ac3dfa10e3b975b474f2762789cf195f507 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 8 Jan 2019 14:05:07 +0100 Subject: [PATCH 16/36] FIX Selection of email recipient with option MAIN_OPTIMIZEFORTEXTBROWSER --- htdocs/core/class/html.form.class.php | 34 +++++++++++++++++++-------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 1dc334560ec..9915f1b4e4c 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5628,22 +5628,31 @@ class Form * @param int $width Force width of select box. May be used only when using jquery couch. Example: 250, 95% * @param string $moreattrib Add more options on select component. Example: 'disabled' * @param string $elemtype Type of element we show ('category', ...) + * @param string $placeholder String to use as placeholder + * @param int $addjscombo Add js combo * @return string HTML multiselect string * @see selectarray */ - static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='',$elemtype='') + static function multiselectarray($htmlname, $array, $selected=array(), $key_in_label=0, $value_as_key=0, $morecss='', $translate=0, $width=0, $moreattrib='',$elemtype='', $placeholder='', $addjscombo=-1) { global $conf, $langs; $out = ''; + if ($addjscombo < 0) { + if (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) $addjscombo = 1; + else $addjscombo = 0; + } + // Add code for jquery to use multiselect if (! empty($conf->global->MAIN_USE_JQUERY_MULTISELECT) || defined('REQUIRE_JQUERY_MULTISELECT')) { $tmpplugin=empty($conf->global->MAIN_USE_JQUERY_MULTISELECT)?constant('REQUIRE_JQUERY_MULTISELECT'):$conf->global->MAIN_USE_JQUERY_MULTISELECT; $out.="\n".' - '; + });'; + } + $out.=' '; } // Try also magic suggest @@ -6044,7 +6054,7 @@ class Form if (! empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || ! in_array($key, $excludelinksto))) { - print '
global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>'; + print '
use_javascript_ajax)?'':' style="display:none"').'>'; $sql = $possiblelink['sql']; $resqllist = $this->db->query($sql); @@ -6105,8 +6115,9 @@ class Form { $linktoelem='