diff --git a/htdocs/comm/action/list.php b/htdocs/comm/action/list.php index 57337226f40..3e8d5d4ee99 100644 --- a/htdocs/comm/action/list.php +++ b/htdocs/comm/action/list.php @@ -241,8 +241,15 @@ $sql.= " a.fk_contact, a.note, a.percent as percent,"; $sql.= " a.fk_element, a.elementtype, a.datec, a.tms as datem,"; $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"; @@ -314,9 +321,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 = ''; diff --git a/htdocs/compta/facture/class/api_invoices.class.php b/htdocs/compta/facture/class/api_invoices.class.php index 1e6b1d35a8e..04c2bedeb41 100644 --- a/htdocs/compta/facture/class/api_invoices.class.php +++ b/htdocs/compta/facture/class/api_invoices.class.php @@ -454,7 +454,7 @@ class Invoices extends DolibarrApi } } - if($this->invoice->update($id, DolibarrApiAccess::$user)) + if($this->invoice->update(DolibarrApiAccess::$user)) return $this->get($id); return false; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 871225012ba..132c924d107 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5732,7 +5732,7 @@ class Form * @param int $disablebademail Check if an email is found into value and if not disable and colorize entry * @param int $nohtmlescape No html escaping. * @return string HTML select string. - * @see multiselectarray + * @see multiselectarray, selectArrayAjax, selectArrayFilter */ static function selectarray($htmlname, $array, $id='', $show_empty=0, $key_in_label=0, $value_as_key=0, $moreparam='', $translate=0, $maxlen=0, $disabled=0, $sort='', $morecss='', $addjscombo=0, $moreparamonempty='',$disablebademail=0, $nohtmlescape=0) { @@ -6062,14 +6062,18 @@ class Form * @param string $placeholder String to use as placeholder * @param int $addjscombo Add js combo * @return string HTML multiselect string - * @see selectarray + * @see selectarray, selectArrayAjax, selectArrayFilter */ - 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) + 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')) @@ -6520,7 +6524,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); @@ -6582,8 +6586,9 @@ class Form { $linktoelem='