diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index db8251d05624a..22925f09a3e9b 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -79,9 +79,9 @@ $param=''; if ($search_keyword) $param.='&search_keyword='.urlencode($search_keyword); -if ($search_status > -1) $param.='&search_status='.urlencode($search_status); -if ($search_nature > -1) $param.='&search_nature='.urlencode($search_nature); -if ($search_version > -1) $param.='&search_version='.urlencode($search_version); +if ($search_status && $search_status != '-1') $param.='&search_status='.urlencode($search_status); +if ($search_nature && $search_nature != '-1') $param.='&search_nature='.urlencode($search_nature); +if ($search_version && $search_version != '-1') $param.='&search_version='.urlencode($search_version); $dirins=DOL_DOCUMENT_ROOT.'/custom'; $urldolibarrmodules='https://www.dolistore.com/'; @@ -462,7 +462,7 @@ { dol_set_focus('#search_keyword'); - print '
'; + print ''; if ($optioncss != '') print ''; print ''; print ''; diff --git a/htdocs/admin/payment.php b/htdocs/admin/payment.php index fdf0e9f9beed1..339b4fef566f9 100644 --- a/htdocs/admin/payment.php +++ b/htdocs/admin/payment.php @@ -257,17 +257,6 @@ print ''; print "\n"; -// Add js auto fill amount on paiement form -/* always on now -$var=! $var; -print ''; -print $langs->trans("JSOnPaimentBill"); -print ''; -print $form->selectyesno("INVOICE_AUTO_FILLJS",$conf->global->INVOICE_AUTO_FILLJS,1); -print ''; -print "\n"; -*/ - print ''; print '
'; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 5bdc58cc61a0a..92a4208a5d019 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1428,19 +1428,24 @@ function setValueFrom($field, $value, $table='', $id=null, $format='', $id_field if (empty($format)) $format='text'; if (empty($id_field)) $id_field='rowid'; + $fk_user_field = 'fk_user_modif'; + $error=0; $this->db->begin(); // Special case if ($table == 'product' && $field == 'note_private') $field='note'; + if (in_array($table, array('actioncomm', 'adherent', 'advtargetemailing', 'cronjob', 'establishment'))) { + $fk_user_field = 'fk_user_mod'; + } $sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET "; if ($format == 'text') $sql.= $field." = '".$this->db->escape($value)."'"; else if ($format == 'int') $sql.= $field." = ".$this->db->escape($value); else if ($format == 'date') $sql.= $field." = ".($value ? "'".$this->db->idate($value)."'" : "null"); - if (! empty($fuser) && is_object($fuser)) $sql.=", fk_user_modif = ".$fuser->id; - elseif (empty($fuser) || $fuser != 'none') $sql.=", fk_user_modif = ".$user->id; + if (! empty($fuser) && is_object($fuser)) $sql.=", ".$fk_user_field." = ".$fuser->id; + elseif (empty($fuser) || $fuser != 'none') $sql.=", ".$fk_user_field." = ".$user->id; $sql.= " WHERE ".$id_field." = ".$id; dol_syslog(get_class($this)."::".__FUNCTION__."", LOG_DEBUG); @@ -2437,11 +2442,13 @@ function update_note($note,$suffix='') if (! $this->table_element) { + $this->error='update_note was called on objet with property table_element not defined'; dol_syslog(get_class($this)."::update_note was called on objet with property table_element not defined", LOG_ERR); return -1; } if (! in_array($suffix,array('','_public','_private'))) { + $this->error='update_note Parameter suffix must be empty, \'_private\' or \'_public\''; dol_syslog(get_class($this)."::update_note Parameter suffix must be empty, '_private' or '_public'", LOG_ERR); return -2; } @@ -4991,6 +4998,7 @@ function updateExtraField($key, $trigger, $userused) if ($error) { + dol_syslog(get_class($this) . "::".__METHOD__ . $this->error, LOG_ERR); $this->db->rollback(); return -1; } diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index d2177dfa33b60..bf9bcf587f8e2 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -740,6 +740,7 @@ function fetch_name_optionals_label($elementtype,$forceload=false) if (!$forceload && !empty($conf->global->MAIN_EXTRAFIELDS_DISABLED)) return $array_name_label; // Set array of label of entity + // TODO Remove completely loading of label. This should be done by presentation. $labelmulticompany=array(); if (!empty($conf->multicompany->enabled)) { @@ -757,8 +758,7 @@ function fetch_name_optionals_label($elementtype,$forceload=false) // We should not have several time this log. If we have, there is some optimization to do by calling a simple $object->fetch_optionals() that include cache management. dol_syslog("fetch_name_optionals_label elementtype=".$elementtype); - $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed"; - $sql.= ",entity"; + $sql = "SELECT rowid,name,label,type,size,elementtype,fieldunique,fieldrequired,param,pos,alwayseditable,perms,langs,list,fielddefault,fieldcomputed,entity"; $sql.= " FROM ".MAIN_DB_PREFIX."extrafields"; $sql.= " WHERE entity IN (0,".$conf->entity.")"; if ($elementtype) $sql.= " AND elementtype = '".$elementtype."'"; diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index f516d142670a9..1f2fb48f4cc11 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -835,6 +835,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $form = new Form($db); + $optioncss = GETPOST('optioncss', 'alpha'); $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST('page','int'); @@ -886,7 +887,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') { if (GETPOST('search_'.$key,'alpha')) $search[$key]=GETPOST('search_'.$key,'alpha'); } - + $search_array_options=$extrafields->getOptionalsFromPost($extralabels,'','search_'); // Purge search criteria 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 @@ -933,9 +934,12 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') print '
'; // You can use div-table-responsive-no-min if you dont need reserved height for your table print "\n".''."\n"; - $param="socid=".$object->id; - if ($search_status != '') $param.='&search_status='.$search_status; - if ($search_name != '') $param.='&search_name='.urlencode($search_name); + $param="socid=".urlencode($object->id); + if ($search_status != '') $param.='&search_status='.urlencode($search_status); + if ($search_name != '') $param.='&search_name='.urlencode($search_name); + if ($optioncss != '') $param.='&optioncss='.urlencode($optioncss); + // Add $param from extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php'; $sql = "SELECT t.rowid, t.lastname, t.firstname, t.fk_pays as country_id, t.civility, t.poste, t.phone as phone_pro, t.phone_mobile, t.phone_perso, t.fax, t.email, t.skype, t.statut, t.photo,"; $sql .= " t.civility as civility_id, t.address, t.zip, t.town"; @@ -943,7 +947,9 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."socpeople_extrafields as ef on (t.rowid = ef.fk_object)"; $sql .= " WHERE t.fk_soc = ".$object->id; if ($search_status!='' && $search_status != '-1') $sql .= " AND t.statut = ".$db->escape($search_status); - if ($search_name) $sql .= " AND (t.lastname LIKE '%".$db->escape($search_name)."%' OR t.firstname LIKE '%".$db->escape($search_name)."%')"; + if ($search_name) $sql .= natural_search(array('t.lastname', 't.firstname'), $search_name); + // Add where from extra fields + include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php'; if ($sortfield == "t.name") $sql.=" ORDER BY t.lastname $sortorder, t.firstname $sortorder"; else $sql.= " ORDER BY $sortfield $sortorder"; @@ -1107,7 +1113,7 @@ function show_contacts($conf,$langs,$db,$object,$backtopage='') // Edit if ($user->rights->societe->contact->creer) { - print ''; + print ''; print img_edit(); print ''; } diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 6fcc8e6494a72..eea3545bb07dc 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2090,7 +2090,7 @@ if (! empty($conf->projet->enabled)) { print ''; } diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index c3a6b2341f16f..57b3f9b34c8a7 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1241,7 +1241,7 @@ function setApproved($fuser, $notrigger=0) $error = 0; // date approval - $this->date_approve = $this->db->idate($now); + $this->date_approve = $now; if ($this->fk_statut != 5) { $this->db->begin(); diff --git a/htdocs/societe/class/societe.class.php b/htdocs/societe/class/societe.class.php index bb9748b1af3b5..5d452cabcb62e 100644 --- a/htdocs/societe/class/societe.class.php +++ b/htdocs/societe/class/societe.class.php @@ -2694,18 +2694,15 @@ function get_codecompta($type) if (! empty($conf->global->SOCIETE_CODECOMPTA_ADDON)) { - $file=''; + $res=false; $dirsociete=array_merge(array('/core/modules/societe/'), $conf->modules_parts['societe']); foreach ($dirsociete as $dirroot) { - if (file_exists(DOL_DOCUMENT_ROOT.'/'.$dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.".php")) - { - $file=$dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.".php"; - break; - } + $res=dol_include_once($dirroot.$conf->global->SOCIETE_CODECOMPTA_ADDON.'.php'); + if ($res) break; } - if (! empty($file)) + if ($res) { dol_include_once($file);
'; - $formproject->select_projects(-1, $line->fk_projet,'fk_projet', 0, 0, 1, 1); + $formproject->select_projects(-1, $line->fk_projet,'fk_projet', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth300'); print '