From dc5d1432b1e36f0ff1251512b74d8bdf725b543b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Sep 2018 01:23:46 +0200 Subject: [PATCH 1/5] Fix code not reachable --- htdocs/ticket/class/ticket.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/ticket/class/ticket.class.php b/htdocs/ticket/class/ticket.class.php index 74f5c825e6c..33e5de92aaf 100644 --- a/htdocs/ticket/class/ticket.class.php +++ b/htdocs/ticket/class/ticket.class.php @@ -1489,8 +1489,6 @@ class Ticket extends CommonObject dol_syslog(get_class($this) . "::assignUser " . $this->error, LOG_ERR); return - 1; } - - return 0; } /** From 3ef808cb9bead0030abeb99b591ff824235bc0ee Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Sep 2018 11:23:28 +0200 Subject: [PATCH 2/5] Fix #9302 MAIN_ENABLE_IMPORT_LINKED_OBJECT_LINES broken --- htdocs/commande/class/commande.class.php | 96 +++++++++---------- htdocs/compta/facture/class/facture.class.php | 8 +- 2 files changed, 53 insertions(+), 51 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index 4c2cd368aac..f212c4efbdf 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -3456,60 +3456,60 @@ class Commande extends CommonOrder if (!$user->rights->commande->lire) $option = 'nolink'; - if ($option !== 'nolink') + if ($option !== 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } + + if ($short) return $url; + + $label = ''; + + if ($user->rights->commande->lire) { + $label = ''.$langs->trans("ShowOrder").''; + $label .= '
'.$langs->trans('Ref').': '.$this->ref; + $label .= '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); + if (!empty($this->total_ht)) { + $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_tva)) { + $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); + } + if (!empty($this->total_ttc)) { + $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); + } + } + + $linkclose=''; + if (empty($notooltip) && $user->rights->commande->lire) + { + if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - // Add param to save lastsearch_values or not - $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); - if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; - if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + $label=$langs->trans("ShowOrder"); + $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; } + $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; + $linkclose.=' class="classfortooltip"'; + } - if ($short) return $url; + $linkstart = ''; + $linkend=''; - $label = ''; + if ($option === 'nolink') { + $linkstart = ''; + $linkend = ''; + } - if ($user->rights->commande->lire) { - $label = ''.$langs->trans("ShowOrder").''; - $label .= '
'.$langs->trans('Ref').': '.$this->ref; - $label .= '
'.$langs->trans('RefCustomer').': '.($this->ref_customer ? $this->ref_customer : $this->ref_client); - if (!empty($this->total_ht)) { - $label .= '
'.$langs->trans('AmountHT').': '.price($this->total_ht, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_tva)) { - $label .= '
'.$langs->trans('VAT').': '.price($this->total_tva, 0, $langs, 0, -1, -1, $conf->currency); - } - if (!empty($this->total_ttc)) { - $label .= '
'.$langs->trans('AmountTTC').': '.price($this->total_ttc, 0, $langs, 0, -1, -1, $conf->currency); - } - } + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; - $linkclose=''; - if (empty($notooltip) && $user->rights->commande->lire) - { - if (! empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $label=$langs->trans("ShowOrder"); - $linkclose.=' alt="'.dol_escape_htmltag($label, 1).'"'; - } - $linkclose.= ' title="'.dol_escape_htmltag($label, 1).'"'; - $linkclose.=' class="classfortooltip"'; - } - - $linkstart = ''; - $linkend=''; - - if ($option === 'nolink') { - $linkstart = ''; - $linkend = ''; - } - - $result .= $linkstart; - if ($withpicto) $result.=img_object(($notooltip?'':$label), $this->picto, ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); - if ($withpicto != 2) $result.= $this->ref; - $result .= $linkend; - - return $result; + return $result; } diff --git a/htdocs/compta/facture/class/facture.class.php b/htdocs/compta/facture/class/facture.class.php index da0d66b2784..395d8b24c38 100644 --- a/htdocs/compta/facture/class/facture.class.php +++ b/htdocs/compta/facture/class/facture.class.php @@ -57,12 +57,12 @@ class Facture extends CommonInvoice * @var string ID to identify managed object */ public $element='facture'; - + /** * @var string Name of table without prefix where object is stored */ public $table_element='facture'; - + public $table_element_line = 'facturedet'; public $fk_element = 'fk_facture'; public $picto='bill'; @@ -1178,6 +1178,8 @@ class Facture extends CommonInvoice if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; } + if ($short) return $url; + $picto='bill'; if ($this->type == self::TYPE_REPLACEMENT) $picto.='r'; // Replacement invoice if ($this->type == self::TYPE_CREDIT_NOTE) $picto.='a'; // Credit note @@ -4262,7 +4264,7 @@ class FactureLigne extends CommonInvoiceLine * @var string ID to identify managed object */ public $element='facturedet'; - + /** * @var string Name of table without prefix where object is stored */ From 69cf7026eb7c6fff08fd9cb65bae4987507356d6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Sep 2018 11:29:52 +0200 Subject: [PATCH 3/5] NEW Close #9296 Add field ref_ext into llx_categorie --- htdocs/install/mysql/migration/8.0.0-9.0.0.sql | 3 +++ htdocs/install/mysql/tables/llx_categorie.sql | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql index b5e80f43593..87053d8ccb7 100644 --- a/htdocs/install/mysql/migration/8.0.0-9.0.0.sql +++ b/htdocs/install/mysql/migration/8.0.0-9.0.0.sql @@ -67,3 +67,6 @@ insert into llx_c_action_trigger (code,label,description,elementtype,rang) value insert into llx_c_action_trigger (code,label,description,elementtype,rang) values ('EXPENSE_DELETE','Expense report deleted','Executed when an expense report is deleted','expensereport',204); ALTER TABLE llx_payment_salary ADD COLUMN fk_projet integer DEFAULT NULL after amount; + +ALTER TABLE llx_categorie ADD COLUMN ref_ext varchar(255); + diff --git a/htdocs/install/mysql/tables/llx_categorie.sql b/htdocs/install/mysql/tables/llx_categorie.sql index fe2b03b2429..5493d2cfc8c 100644 --- a/htdocs/install/mysql/tables/llx_categorie.sql +++ b/htdocs/install/mysql/tables/llx_categorie.sql @@ -24,7 +24,8 @@ create table llx_categorie rowid integer AUTO_INCREMENT PRIMARY KEY, entity integer DEFAULT 1 NOT NULL, -- multi company id fk_parent integer DEFAULT 0 NOT NULL, - label varchar(180) NOT NULL, -- category name + label varchar(180) NOT NULL, -- category ref/name + ref_ext varchar(255), -- reference into an external system (not used by dolibarr) type tinyint DEFAULT 1 NOT NULL, -- category type (product, supplier, customer, member) description text, -- description of the category color varchar(8), -- color From c7fdd8686b85465724134023ff65318399254d5b Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Sep 2018 11:41:28 +0200 Subject: [PATCH 4/5] NEW Add civility in list of members. Close #9251 --- htdocs/adherents/list.php | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index db017d71f61..a17d9a84b29 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -107,6 +107,7 @@ $arrayfields=array( 'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), 'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1), 'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1), + 'd.civility'=>array('label'=>$langs->trans("Civility"), 'checked'=>0), 'd.company'=>array('label'=>$langs->trans("Company"), 'checked'=>1), 'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1), 'd.morphy'=>array('label'=>$langs->trans("MorPhy"), 'checked'=>1), @@ -202,7 +203,7 @@ $memberstatic=new Adherent($db); $now=dol_now(); -$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,"; +$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.civility, d.societe as company, d.fk_soc,"; $sql.= " d.datefin, d.address, d.zip, d.town, d.state_id, d.country,"; $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,"; $sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,"; @@ -427,37 +428,36 @@ if (! empty($arrayfields['d.ref']['checked'])) print ''; print ''; } - if (! empty($arrayfields['d.firstname']['checked'])) { print ''; print ''; } - if (! empty($arrayfields['d.lastname']['checked'])) { print ''; print ''; } - +if (! empty($arrayfields['d.civility']['checked'])) +{ + print ''; + print ''; +} if (! empty($arrayfields['d.company']['checked'])) { print ''; print ''; } - if (! empty($arrayfields['d.login']['checked'])) { print ''; print ''; } - if (! empty($arrayfields['d.morphy']['checked'])) { print ''; print ''; } - if (! empty($arrayfields['t.libelle']['checked'])) { print ''; @@ -570,6 +570,7 @@ if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) print_liste_field_titr if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.civility']['checked'])) print_liste_field_titre($arrayfields['d.civility']['label'],$_SERVER["PHP_SELF"],'d.civility','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.societe','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'],$_SERVER["PHP_SELF"],'d.login','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'],$_SERVER["PHP_SELF"],'d.morphy','',$param,'',$sortfield,$sortorder); @@ -605,6 +606,7 @@ while ($i < min($num, $limit)) $datefin=$db->jdate($obj->datefin); $memberstatic->id=$obj->rowid; $memberstatic->ref=$obj->rowid; + $memberstatic->civility_id=$obj->civility; $memberstatic->lastname=$obj->lastname; $memberstatic->firstname=$obj->firstname; $memberstatic->statut=$obj->statut; @@ -648,6 +650,13 @@ while ($i < min($num, $limit)) print $obj->lastname; print "\n"; } + // Civility + if (! empty($arrayfields['d.civility']['checked'])) + { + print ""; + print $obj->civility; + print "\n"; + } // Company if (! empty($arrayfields['d.company']['checked'])) { From 23f4e7cc36609071b576558da476ffac0011f221 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Sep 2018 11:49:11 +0200 Subject: [PATCH 5/5] FIX #9251 --- htdocs/adherents/list.php | 44 +++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index a17d9a84b29..7b90878dff7 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -48,6 +48,7 @@ $search=GETPOST("search",'alpha'); $search_ref=GETPOST("search_ref",'alpha'); $search_lastname=GETPOST("search_lastname",'alpha'); $search_firstname=GETPOST("search_firstname",'alpha'); +$search_civility=GETPOST("search_civility",'alpha'); $search_login=GETPOST("search_login",'alpha'); $search_address=GETPOST("search_address",'alpha'); $search_zip=GETPOST("search_zip",'alpha'); @@ -105,9 +106,9 @@ $fieldstosearchall = array( if($db->type == 'pgsql') unset($fieldstosearchall['d.rowid']); $arrayfields=array( 'd.ref'=>array('label'=>$langs->trans("Ref"), 'checked'=>1), + 'd.civility'=>array('label'=>$langs->trans("Civility"), 'checked'=>0), 'd.lastname'=>array('label'=>$langs->trans("Lastname"), 'checked'=>1), 'd.firstname'=>array('label'=>$langs->trans("Firstname"), 'checked'=>1), - 'd.civility'=>array('label'=>$langs->trans("Civility"), 'checked'=>0), 'd.company'=>array('label'=>$langs->trans("Company"), 'checked'=>1), 'd.login'=>array('label'=>$langs->trans("Login"), 'checked'=>1), 'd.morphy'=>array('label'=>$langs->trans("MorPhy"), 'checked'=>1), @@ -122,7 +123,7 @@ $arrayfields=array( 'state.nom'=>array('label'=>$langs->trans("State"), 'checked'=>0), 'country.code_iso'=>array('label'=>$langs->trans("Country"), 'checked'=>0), /*'d.note_public'=>array('label'=>$langs->trans("NotePublic"), 'checked'=>0), - 'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/ + 'd.note_private'=>array('label'=>$langs->trans("NotePrivate"), 'checked'=>0),*/ 'd.datefin'=>array('label'=>$langs->trans("EndSubscription"), 'checked'=>1, 'position'=>500), 'd.datec'=>array('label'=>$langs->trans("DateCreation"), 'checked'=>0, 'position'=>500), 'd.tms'=>array('label'=>$langs->trans("DateModificationShort"), 'checked'=>0, 'position'=>500), @@ -161,6 +162,7 @@ if (empty($reshook)) $search_ref=""; $search_lastname=""; $search_firstname=""; + $search_civility=""; $search_login=""; $search_company=""; $search_type=""; @@ -203,8 +205,8 @@ $memberstatic=new Adherent($db); $now=dol_now(); -$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.civility, d.societe as company, d.fk_soc,"; -$sql.= " d.datefin, d.address, d.zip, d.town, d.state_id, d.country,"; +$sql = "SELECT d.rowid, d.login, d.lastname, d.firstname, d.societe as company, d.fk_soc,"; +$sql.= " d.civility, d.datefin, d.address, d.zip, d.town, d.state_id, d.country,"; $sql.= " d.email, d.phone, d.phone_perso, d.phone_mobile, d.skype, d.birth, d.public, d.photo,"; $sql.= " d.fk_adherent_type as type_id, d.morphy, d.statut, d.datec as date_creation, d.tms as date_update,"; $sql.= " t.libelle as type, t.subscription,"; @@ -235,6 +237,7 @@ if ($search_ref) if (is_numeric($search_ref)) $sql.= " AND (d.rowid = ".$db->escape($search_ref).")"; else $sql.=" AND 1 = 2"; // Always wrong } +if ($search_civility) $sql.= natural_search("d.civility", $search_civility); if ($search_firstname) $sql.= natural_search("d.firstname", $search_firstname); if ($search_lastname) $sql.= natural_search(array("d.firstname", "d.lastname", "d.societe"), $search_lastname); if ($search_login) $sql.= natural_search("d.login", $search_login); @@ -323,6 +326,7 @@ if ($sall != "") $param.="&sall=".urlencode($sall); if ($statut != "") $param.="&statut=".urlencode($statut); if ($search_ref) $param.="&search_ref=".urlencode($search_ref); if ($search_nom) $param.="&search_nom=".urlencode($search_nom); +if ($search_civility) $param.="&search_civility=".urlencode($search_civility); if ($search_firstname) $param.="&search_firstname=".urlencode($search_firstname); if ($search_lastname) $param.="&search_lastname=".urlencode($search_lastname); if ($search_login) $param.="&search_login=".urlencode($search_login); @@ -428,6 +432,11 @@ if (! empty($arrayfields['d.ref']['checked'])) print ''; print ''; } +if (! empty($arrayfields['d.civility']['checked'])) +{ + print ''; + print ''; +} if (! empty($arrayfields['d.firstname']['checked'])) { print ''; @@ -438,11 +447,6 @@ if (! empty($arrayfields['d.lastname']['checked'])) print ''; print ''; } -if (! empty($arrayfields['d.civility']['checked'])) -{ - print ''; - print ''; -} if (! empty($arrayfields['d.company']['checked'])) { print ''; @@ -568,9 +572,9 @@ print "\n"; print ''; if (! empty($conf->global->MAIN_SHOW_TECHNICAL_ID)) print_liste_field_titre("ID",$_SERVER["PHP_SELF"],'','',$param,'align="center"',$sortfield,$sortorder); if (! empty($arrayfields['d.ref']['checked'])) print_liste_field_titre($arrayfields['d.ref']['label'],$_SERVER["PHP_SELF"],'d.rowid','',$param,'',$sortfield,$sortorder); +if (! empty($arrayfields['d.civility']['checked'])) print_liste_field_titre($arrayfields['d.civility']['label'],$_SERVER["PHP_SELF"],'d.civility','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.firstname']['checked'])) print_liste_field_titre($arrayfields['d.firstname']['label'],$_SERVER["PHP_SELF"],'d.firstname','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.lastname']['checked'])) print_liste_field_titre($arrayfields['d.lastname']['label'],$_SERVER["PHP_SELF"],'d.lastname','',$param,'',$sortfield,$sortorder); -if (! empty($arrayfields['d.civility']['checked'])) print_liste_field_titre($arrayfields['d.civility']['label'],$_SERVER["PHP_SELF"],'d.civility','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.company']['checked'])) print_liste_field_titre($arrayfields['d.company']['label'],$_SERVER["PHP_SELF"],'d.societe','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.login']['checked'])) print_liste_field_titre($arrayfields['d.login']['label'],$_SERVER["PHP_SELF"],'d.login','',$param,'',$sortfield,$sortorder); if (! empty($arrayfields['d.morphy']['checked'])) print_liste_field_titre($arrayfields['d.morphy']['label'],$_SERVER["PHP_SELF"],'d.morphy','',$param,'',$sortfield,$sortorder); @@ -632,10 +636,17 @@ while ($i < min($num, $limit)) // Ref if (! empty($arrayfields['d.ref']['checked'])) { - print ""; + print ""; print $memberstatic->getNomUrl(-1, 0, 'card', 'ref'); print "\n"; } + // Civility + if (! empty($arrayfields['d.civility']['checked'])) + { + print ""; + print $obj->civility; + print "\n"; + } // Firstname if (! empty($arrayfields['d.firstname']['checked'])) { @@ -650,13 +661,6 @@ while ($i < min($num, $limit)) print $obj->lastname; print "\n"; } - // Civility - if (! empty($arrayfields['d.civility']['checked'])) - { - print ""; - print $obj->civility; - print "\n"; - } // Company if (! empty($arrayfields['d.company']['checked'])) { @@ -667,12 +671,12 @@ while ($i < min($num, $limit)) // Login if (! empty($arrayfields['d.login']['checked'])) { - print "".$obj->login."\n"; + print "".$obj->login."\n"; } // Moral/Physique if (! empty($arrayfields['d.morphy']['checked'])) { - print "".$memberstatic->getmorphylib($obj->morphy)."\n"; + print "".$memberstatic->getmorphylib($obj->morphy)."\n"; } // Type label if (! empty($arrayfields['t.libelle']['checked']))