From f40ab59b37df0a312a58608854fc654dc70ca042 Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 19 Jul 2022 16:08:38 +0200 Subject: [PATCH 1/4] FIX contacts disabled are not returned on create invoice --- htdocs/contact/class/contact.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index bb3f2ae035d..ce74f82b412 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1776,10 +1776,13 @@ class Contact extends CommonObject $sql = "SELECT sc.fk_socpeople as id, sc.fk_c_type_contact"; $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; $sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc"; + $sql .= " INNER JOIN ".MAIN_DB_PREFIX."socpeople sp"; + $sql .= " ON sc.fk_socpeople = sp.rowid"; $sql .= " WHERE sc.fk_soc =".((int) $this->socid); $sql .= " AND sc.fk_c_type_contact=tc.rowid"; $sql .= " AND tc.element = '".$this->db->escape($element)."'"; $sql .= " AND tc.active = 1"; + $sql .= " AND sp.statut = 1"; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); From 8cc9d72b37a534b5d90556ba9cb1a1f846c3b18c Mon Sep 17 00:00:00 2001 From: GregM Date: Tue, 30 Aug 2022 16:53:14 +0200 Subject: [PATCH 2/4] update sql --- htdocs/contact/class/contact.class.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/htdocs/contact/class/contact.class.php b/htdocs/contact/class/contact.class.php index ce74f82b412..3ae7e7d8645 100644 --- a/htdocs/contact/class/contact.class.php +++ b/htdocs/contact/class/contact.class.php @@ -1777,12 +1777,11 @@ class Contact extends CommonObject $sql .= " FROM ".MAIN_DB_PREFIX."c_type_contact tc"; $sql .= ", ".MAIN_DB_PREFIX."societe_contacts sc"; $sql .= " INNER JOIN ".MAIN_DB_PREFIX."socpeople sp"; - $sql .= " ON sc.fk_socpeople = sp.rowid"; + $sql .= " ON sc.fk_socpeople = sp.rowid AND sp.statut = 1"; $sql .= " WHERE sc.fk_soc =".((int) $this->socid); $sql .= " AND sc.fk_c_type_contact=tc.rowid"; $sql .= " AND tc.element = '".$this->db->escape($element)."'"; $sql .= " AND tc.active = 1"; - $sql .= " AND sp.statut = 1"; dol_syslog(__METHOD__, LOG_DEBUG); $resql = $this->db->query($sql); From 24651aaa6c060ebaf1d7ad407713a6343c92aaaa Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 12 Jan 2023 12:41:02 +0100 Subject: [PATCH 3/4] FIX #22731 #23524 --- htdocs/commande/list.php | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ed00efdf10a..eb8b824ef3e 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -51,6 +51,7 @@ require_once DOL_DOCUMENT_ROOT.'/projet/class/project.class.php'; // Load translation files required by the page $langs->loadLangs(array("orders", 'sendings', 'deliveries', 'companies', 'compta', 'bills', 'stocks', 'products')); +// Get Parameters $action = GETPOST('action', 'aZ09'); $massaction = GETPOST('massaction', 'alpha'); $show_files = GETPOST('show_files', 'int'); @@ -58,6 +59,7 @@ $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist'; +// Search Parameters $search_datecloture_start = GETPOST('search_datecloture_start', 'int'); if (empty($search_datecloture_start)) { $search_datecloture_start = dol_mktime(0, 0, 0, GETPOST('search_datecloture_startmonth', 'int'), GETPOST('search_datecloture_startday', 'int'), GETPOST('search_datecloture_startyear', 'int')); @@ -103,6 +105,7 @@ $search_remove_btn = GETPOST('button_removefilter', 'alpha'); $search_project_ref = GETPOST('search_project_ref', 'alpha'); $search_project = GETPOST('search_project', 'alpha'); $search_shippable = GETPOST('search_shippable', 'aZ09'); + $search_fk_cond_reglement = GETPOST("search_fk_cond_reglement", 'int'); $search_fk_shipping_method = GETPOST("search_fk_shipping_method", 'int'); $search_fk_mode_reglement = GETPOST("search_fk_mode_reglement", 'int'); @@ -803,7 +806,7 @@ if (!empty($extrafields->attributes[$object->table_element]['label'])) { } // Add fields from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' FROM '.MAIN_DB_PREFIX.'societe as s'; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_country as country on (country.rowid = s.fk_pays)"; @@ -836,7 +839,7 @@ if ($search_user > 0) { // Add table from hooks $parameters = array(); -$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook +$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $sql .= $hookmanager->resPrint; $sql .= ' WHERE c.fk_soc = s.rowid'; @@ -1197,7 +1200,7 @@ if ($resql) { // Add $param from hooks $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object, $action); // Note that $action and $object may have been modified by hook $param .= $hookmanager->resPrint; // List of mass actions available @@ -1364,7 +1367,7 @@ if ($resql) { $moreforfilter .= ''; } $parameters = array(); - $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook if (empty($reshook)) { $moreforfilter .= $hookmanager->resPrint; } else { @@ -1575,7 +1578,7 @@ if ($resql) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields); - $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation if (!empty($arrayfields['c.datec']['checked'])) { @@ -1769,7 +1772,7 @@ if ($resql) { 'sortorder' => $sortorder, 'totalarray' => &$totalarray, ); - $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; if (!empty($arrayfields['c.datec']['checked'])) { print_liste_field_titre($arrayfields['c.datec']['label'], $_SERVER["PHP_SELF"], "c.date_creation", "", $param, '', $sortfield, $sortorder, 'center nowrap '); @@ -1825,8 +1828,10 @@ if ($resql) { $total_ht = 0; $total_margin = 0; + $savnbfield = $totalarray['nbfield']; + $totalarray = array(); + $totalarray['nbfield'] = 0; $imaxinloop = ($limit ? min($num, $limit) : $num); - $last_num = min($num, $limit); while ($i < $imaxinloop) { $obj = $db->fetch_object($resql); @@ -2063,7 +2068,7 @@ if ($resql) { } // Amount HT if (!empty($arrayfields['c.total_ht']['checked'])) { - print ''.price($obj->total_ht)."\n"; + print ''.price($obj->total_ht)."\n"; if (!$i) { $totalarray['nbfield']++; } @@ -2247,7 +2252,7 @@ if ($resql) { if (!$i) { $totalarray['pos'][$totalarray['nbfield']] = 'total_mark_rate'; } - if ($i >= $last_num - 1) { + if ($i >= $imaxinloop - 1) { if (!empty($total_ht)) { $totalarray['val']['total_mark_rate'] = price2num($total_margin * 100 / $total_ht, 'MT'); } else { @@ -2260,7 +2265,7 @@ if ($resql) { include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php'; // Fields from hook $parameters = array('arrayfields'=>$arrayfields, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray); - $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; // Date creation @@ -2479,7 +2484,7 @@ if ($resql) { $db->free($resql); $parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql); - $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters); // Note that $action and $object may have been modified by hook + $reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook print $hookmanager->resPrint; print ''."\n"; From a06a5d0f65e47010263b4d3aa5825ece10dc35e2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 13 Jan 2023 11:09:06 +0100 Subject: [PATCH 4/4] Fix lang file not loaded --- scripts/emailings/mailing-send.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/emailings/mailing-send.php b/scripts/emailings/mailing-send.php index fcaa40e1fde..71d1604df4e 100755 --- a/scripts/emailings/mailing-send.php +++ b/scripts/emailings/mailing-send.php @@ -66,6 +66,8 @@ if (empty($conf->global->MAILING_LIMIT_SENDBYCLI)) $conf->global->MAILING_LIMIT_SENDBYCLI = 0; } +$langs->loadLangs(array("main", "mails")); + /* * Main