From 836f6bf3c9252283967a323bea289228d140bfa8 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sun, 12 Nov 2017 12:39:23 +0100 Subject: [PATCH] Fix search filter when using extrafields 'links' --- htdocs/adherents/list.php | 10 ++-- htdocs/admin/mails_senderprofile_list.php | 4 +- htdocs/comm/index.php | 51 ++++++++++--------- htdocs/comm/propal/list.php | 10 ++-- htdocs/commande/list.php | 10 ++-- htdocs/compta/bank/bankentries_list.php | 14 ++--- htdocs/compta/bank/list.php | 14 ++--- htdocs/compta/facture/list.php | 10 ++-- htdocs/compta/index.php | 34 ++++++++----- htdocs/compta/resultat/clientfourn.php | 2 +- htdocs/compta/resultat/index.php | 2 +- .../sociales/class/chargesociales.class.php | 23 +++++---- htdocs/contact/list.php | 10 ++-- htdocs/contrat/list.php | 10 ++-- htdocs/contrat/services_list.php | 6 +-- htdocs/core/lib/functions.lib.php | 2 +- htdocs/cron/list.php | 14 ++--- htdocs/don/class/don.class.php | 13 +++-- htdocs/don/list.php | 2 +- htdocs/expedition/list.php | 10 ++-- htdocs/expensereport/list.php | 14 ++--- htdocs/fichinter/list.php | 10 ++-- htdocs/fourn/commande/list.php | 10 ++-- htdocs/fourn/facture/list.php | 10 ++-- .../modulebuilder/template/myobject_list.php | 6 +-- htdocs/product/card.php | 2 +- htdocs/product/inventory/list.php | 14 ++--- htdocs/product/list.php | 10 ++-- htdocs/product/stock/mouvement.php | 14 ++--- htdocs/product/stock/productlot_list.php | 10 ++-- htdocs/projet/list.php | 10 ++-- htdocs/projet/tasks/list.php | 10 ++-- htdocs/resource/list.php | 10 ++-- htdocs/societe/list.php | 10 ++-- htdocs/societe/website.php | 6 +-- htdocs/supplier_proposal/list.php | 10 ++-- htdocs/user/index.php | 10 ++-- 37 files changed, 213 insertions(+), 204 deletions(-) diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index dbded5d9a5b..4d699c4866d 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -249,12 +249,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/admin/mails_senderprofile_list.php b/htdocs/admin/mails_senderprofile_list.php index 5c78155f0f9..c0d4d54eac4 100644 --- a/htdocs/admin/mails_senderprofile_list.php +++ b/htdocs/admin/mails_senderprofile_list.php @@ -221,8 +221,8 @@ foreach ($search_array_options as $key => $val) $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; $mode_search=0; - if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); diff --git a/htdocs/comm/index.php b/htdocs/comm/index.php index 885be0dd37c..5ee7acbc8b9 100644 --- a/htdocs/comm/index.php +++ b/htdocs/comm/index.php @@ -109,7 +109,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele { $listofsearchfields['search_contract']=array('text'=>'Contract'); } - + if (count($listofsearchfields)) { print '
'; @@ -125,7 +125,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print ''; $i++; } - print ''; + print ''; print '
'; print '
'; } @@ -155,7 +155,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) { $total = 0; $num = $db->num_rows($resql); - + print ''; print ''; print ''; @@ -167,7 +167,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) while ($i < $num) { $obj = $db->fetch_object($resql); - + print '"; } } else { - + print ''; } print "
'.$langs->trans("ProposalsDraft").($num?' '.$num.'':'').'
'; $propalstatic->id=$obj->rowid; $propalstatic->ref=$obj->ref; @@ -192,13 +192,13 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) } if ($total>0) { - + print '
'.$langs->trans("Total").''.price($total)."
'.$langs->trans("NoProposal").'

"; @@ -236,7 +236,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos { $total = 0; $num = $db->num_rows($resql); - + print ''; print ''; print ''; @@ -248,7 +248,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos while ($i < $num) { $obj = $db->fetch_object($resql); - + print '"; } } else { - + print ''; } print "
'.$langs->trans("SupplierProposalsDraft").($num?' '.$num.'':'').'
'; $supplierproposalstatic->id=$obj->rowid; $supplierproposalstatic->ref=$obj->ref; @@ -272,13 +272,13 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos } if ($total>0) { - + print '
'.$langs->trans("Total").''.price($total)."
'.$langs->trans("NoProposal").'

"; @@ -315,7 +315,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) { $total = 0; $num = $db->num_rows($resql); - + print ''; print ''; print ''; @@ -326,7 +326,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) $i = 0; while ($i < $num) { - + $obj = $db->fetch_object($resql); print '"; } } else { - + print ''; } print "
'.$langs->trans("DraftOrders").($num?' '.$num.'':'').'
'; $orderstatic->id=$obj->rowid; @@ -352,13 +352,13 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) } if ($total>0) { - + print '
'.$langs->trans("Total").''.price($total)."
'.$langs->trans("NoOrder").'

"; @@ -407,7 +407,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande $i = 0; while ($i < $num) { - + $obj = $db->fetch_object($resql); print ''; $supplierorderstatic->id=$obj->rowid; @@ -433,13 +433,13 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande } if ($total>0) { - + print ''.$langs->trans("Total").''.price($total).""; } } else { - + print ''.$langs->trans("NoSupplierOrder").''; } print "
"; @@ -489,7 +489,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) else if (! empty($conf->global->SOCIETE_DISABLE_CUSTOMERS)) print $langs->trans("BoxTitleLastModifiedProspects",$max); else print $langs->trans("BoxTitleLastModifiedCustomers",$max); print ''; - print ''.$langs->trans("DateModificationShort").''; + print ''.$langs->trans("FullList").''; print ''; if ($num) { @@ -510,7 +510,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire) print ''.dol_print_date($db->jdate($objp->tms),'day').""; print ''; $i++; - + } @@ -547,8 +547,9 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) $i = 0; print ''; - print ''; - print ''; + print ''; + print ''; + print ''; print ''; if ($num) { @@ -564,7 +565,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire) print ''; print ''; print ''; - + $i++; } @@ -644,7 +645,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO print $companystatic->getNomUrl(1,'customer',44); print ''."\n"; print "\n"; - + $i++; } print "
'.$langs->trans("BoxTitleLastModifiedSuppliers",min($max,$num)).''.$langs->trans("DateModificationShort").'
'.$langs->trans("BoxTitleLastModifiedSuppliers",min($max,$num)).''.$langs->trans("FullList").'
'.$companystatic->getNomUrl(1,'supplier',44).''.dol_print_date($db->jdate($objp->dm),'day').'
".$staticcontrat->LibStatut($obj->statut,3)."

"; @@ -690,7 +691,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire) while ($i < $nbofloop) { $obj = $db->fetch_object($result); - + print ''; // Ref @@ -787,7 +788,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire) while ($i < $nbofloop) { $obj = $db->fetch_object($result); - + print ''; // Ref diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 220f50b5838..0ed67601846 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -320,12 +320,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index a41505a7f42..b5780966a0e 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -334,12 +334,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/compta/bank/bankentries_list.php b/htdocs/compta/bank/bankentries_list.php index 001a6a23d9f..2adec26bb2b 100644 --- a/htdocs/compta/bank/bankentries_list.php +++ b/htdocs/compta/bank/bankentries_list.php @@ -507,13 +507,13 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) - { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); - } + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); + } } // Add where from hooks $parameters=array(); diff --git a/htdocs/compta/bank/list.php b/htdocs/compta/bank/list.php index a6dd7c75c7e..74d1526f68b 100644 --- a/htdocs/compta/bank/list.php +++ b/htdocs/compta/bank/list.php @@ -164,13 +164,13 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) - { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); - } + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); + } } // Add where from hooks $parameters=array(); diff --git a/htdocs/compta/facture/list.php b/htdocs/compta/facture/list.php index 8828b78bad2..1c32ecf2716 100644 --- a/htdocs/compta/facture/list.php +++ b/htdocs/compta/facture/list.php @@ -476,12 +476,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index d00c54cc9e2..8e174f108d1 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -107,7 +107,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele $langs->load("donations"); $listofsearchfields['search_donation']=array('text'=>'Donation'); } - + if (count($listofsearchfields)) { print '
'; @@ -123,7 +123,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele print ''; $i++; } - print ''; + print ''; print '
'; print '
'; } @@ -194,7 +194,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) print ''; $tot_ttc+=$obj->total_ttc; $i++; - + } print ''.$langs->trans("Total").''; @@ -382,7 +382,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $total_ttc += $obj->total_ttc; $total += $obj->total_ht; $totalam += $obj->am; - + $i++; } } @@ -499,7 +499,7 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire) $sql = "SELECT d.rowid, d.lastname, d.firstname, d.societe, d.datedon as date, d.tms as dm, d.amount, d.fk_statut"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d"; - $sql.= " WHERE d.entity = ".$conf->entity; + $sql.= " WHERE d.entity IN (".getEntity('donation').")"; $sql.= $db->order("d.tms","DESC"); $sql.= $db->plimit($max, 0); @@ -514,8 +514,9 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire) print ''; print ''; print ''; + print ''; print ''; - print ''; + print ''; print ''; print ''; if ($num) @@ -527,16 +528,19 @@ if (! empty($conf->don->enabled) && $user->rights->societe->lire) while ($i < $num && $i < $max) { $objp = $db->fetch_object($result); - - print ''; + $donationstatic->id=$objp->rowid; + $donationstatic->ref=$objp->rowid; $donationstatic->lastname=$objp->lastname; $donationstatic->firstname=$objp->firstname; + $label=$donationstatic->getFullName($langs); if ($objp->societe) $label.=($label?' - ':'').$objp->societe; - $donationstatic->ref=$label; + + print ''; print ''; - print ''; + print ''; + print ''; print ''; print ''; print ''; @@ -594,11 +598,13 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire) while ($i < $num) { $obj = $db->fetch_object($resql); - print ''; + $chargestatic->id=$obj->rowid; $chargestatic->ref=$obj->libelle; $chargestatic->lib=$obj->libelle; $chargestatic->paye=$obj->paye; + + print ''; print ''; print ''; print ''; @@ -719,7 +725,7 @@ if (! empty($conf->facture->enabled) && ! empty($conf->commande->enabled) && $us //print "x".$tot_ttc."z".$obj->tot_fttc; $tot_tobill += ($obj->total_ttc-$obj->tot_fttc); $i++; - + } print ''; @@ -831,7 +837,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire) $total_ttc += $obj->total_ttc; $total += $obj->total_ht; $totalam += $obj->am; - + $i++; } @@ -972,7 +978,7 @@ if ($resql) while ($i < $db->num_rows($resql)) { $obj = $db->fetch_object($resql); - + print ""; print ''; diff --git a/htdocs/compta/resultat/clientfourn.php b/htdocs/compta/resultat/clientfourn.php index 485b9a9b47a..6d773c05315 100644 --- a/htdocs/compta/resultat/clientfourn.php +++ b/htdocs/compta/resultat/clientfourn.php @@ -907,7 +907,7 @@ else $sql.= " FROM ".MAIN_DB_PREFIX."don as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity = " . getEntity('c_paiement'); - $sql.= " WHERE p.entity = ".getEntity('donation'); + $sql.= " WHERE p.entity IN (".getEntity('donation').")"; $sql.= " AND fk_statut >= 2"; } if (! empty($date_start) && ! empty($date_end)) diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 20333675542..a3efc558a90 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -762,7 +762,7 @@ if (! empty($conf->don->enabled) && ($modecompta == 'CREANCES-DETTES' || $modeco $sql.= " FROM ".MAIN_DB_PREFIX."don as p"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."payment_donation as pe ON pe.fk_donation = p.rowid"; $sql.= " INNER JOIN ".MAIN_DB_PREFIX."c_paiement as c ON pe.fk_typepayment = c.id AND c.entity = " . getEntity('c_paiement'); - $sql.= " WHERE p.entity = ".getEntity('donation'); + $sql.= " WHERE p.entity IN (".getEntity('donation').")"; $sql.= " AND fk_statut >= 2"; if (! empty($date_start) && ! empty($date_end)) $sql.= " AND pe.datep >= '".$db->idate($date_start)."' AND pe.datep <= '".$db->idate($date_end)."'"; diff --git a/htdocs/compta/sociales/class/chargesociales.class.php b/htdocs/compta/sociales/class/chargesociales.class.php index dc089c13e30..ce5ff71aae0 100644 --- a/htdocs/compta/sociales/class/chargesociales.class.php +++ b/htdocs/compta/sociales/class/chargesociales.class.php @@ -451,13 +451,14 @@ class ChargeSociales extends CommonObject /** - * Return clicable name (with picto eventually) - * - * @param int $withpicto 0=No picto, 1=Include picto into link, 2=Only picto - * @param int $maxlen Longueur max libelle - * @return string Chaine avec URL + * Return a link to the object card (with optionaly the picto) + * + * @param int $withpicto Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto) + * @param int $maxlen Max length of label + * @param int $notooltip 1=Disable tooltip + * @return string String with link */ - function getNomUrl($withpicto=0,$maxlen=0) + function getNomUrl($withpicto=0, $maxlen=0, $notooltip=0) { global $langs; @@ -466,12 +467,14 @@ class ChargeSociales extends CommonObject if (empty($this->ref)) $this->ref=$this->lib; $label = $langs->trans("ShowSocialContribution").': '.$this->ref; - $link = ''; + $linkstart = ''; $linkend=''; - if ($withpicto) $result.=($link.img_object($label, 'bill', 'class="classfortooltip"').$linkend.' '); - if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$link.($maxlen?dol_trunc($this->ref,$maxlen):$this->ref).$linkend; + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= ($maxlen?dol_trunc($this->ref,$maxlen):$this->ref); + $result .= $linkend; + return $result; } diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index ebbd0f7494b..106701baaca 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -327,12 +327,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/contrat/list.php b/htdocs/contrat/list.php index 4edc6503a5b..1f39599e7ac 100644 --- a/htdocs/contrat/list.php +++ b/htdocs/contrat/list.php @@ -273,12 +273,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/contrat/services_list.php b/htdocs/contrat/services_list.php index 8bfdd27b9f1..05fd2b57e12 100644 --- a/htdocs/contrat/services_list.php +++ b/htdocs/contrat/services_list.php @@ -253,9 +253,9 @@ foreach ($search_array_options as $key => $val) $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; $mode_search=0; - if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index d23265d0456..bc3027f5aa4 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -109,7 +109,7 @@ function getDoliDBInstance($type, $host, $user, $pass, $name, $port) * 'categorie', 'bank_account', 'bank_account', 'adherent', 'user', * 'commande', 'commande_fournisseur', 'expedition', 'intervention', 'survey', * 'contract', 'tax', 'expensereport', 'holiday', 'multicurrency', 'project', - * 'email_template', 'event', + * 'email_template', 'event', 'donation' * 'c_paiement', ... * @param int $shared 0=Return id of current entity only, * 1=Return id of current entity + shared entities (default) diff --git a/htdocs/cron/list.php b/htdocs/cron/list.php index b701c689050..b08ec473028 100644 --- a/htdocs/cron/list.php +++ b/htdocs/cron/list.php @@ -210,13 +210,13 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) - { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); - } + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); + } } // Add where from hooks $parameters=array(); diff --git a/htdocs/don/class/don.class.php b/htdocs/don/class/don.class.php index 6bd44d7f385..dd0243a632b 100644 --- a/htdocs/don/class/don.class.php +++ b/htdocs/don/class/don.class.php @@ -818,7 +818,7 @@ class Don extends CommonObject $sql = "SELECT count(d.rowid) as nb"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d"; $sql.= " WHERE d.fk_statut > 0"; - $sql.= " AND d.entity IN (".getEntity('don').")"; + $sql.= " AND d.entity IN (".getEntity('donation').")"; $resql=$this->db->query($sql); if ($resql) @@ -851,15 +851,14 @@ class Don extends CommonObject $result=''; $label=$langs->trans("ShowDonation").': '.$this->id; - $link = ''; + $linkstart = ''; $linkend=''; - $picto='generic'; + $result .= $linkstart; + if ($withpicto) $result.=img_object(($notooltip?'':$label), ($this->picto?$this->picto:'generic'), ($notooltip?(($withpicto != 2) ? 'class="paddingright"' : ''):'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip?0:1); + if ($withpicto != 2) $result.= $this->ref; + $result .= $linkend; - - if ($withpicto) $result.=($link.img_object($label, $picto, 'class="classfortooltip"').$linkend); - if ($withpicto && $withpicto != 2) $result.=' '; - if ($withpicto != 2) $result.=$link.$this->id.$linkend; return $result; } diff --git a/htdocs/don/list.php b/htdocs/don/list.php index 1da2274e394..cb5ab766ae9 100644 --- a/htdocs/don/list.php +++ b/htdocs/don/list.php @@ -89,7 +89,7 @@ $sql = "SELECT d.rowid, d.datedon, d.firstname, d.lastname, d.societe,"; $sql.= " d.amount, d.fk_statut as statut, "; $sql.= " p.rowid as pid, p.ref, p.title, p.public"; $sql.= " FROM ".MAIN_DB_PREFIX."don as d LEFT JOIN ".MAIN_DB_PREFIX."projet AS p"; -$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('don').")"; +$sql.= " ON p.rowid = d.fk_projet WHERE d.entity IN (".getEntity('donation').")"; if ($statut != '' && $statut != '-1') { $sql .= " AND d.fk_statut IN (".$db->escape($statut).")"; diff --git a/htdocs/expedition/list.php b/htdocs/expedition/list.php index 6cada0b16a9..5c7bf296485 100644 --- a/htdocs/expedition/list.php +++ b/htdocs/expedition/list.php @@ -233,12 +233,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/expensereport/list.php b/htdocs/expensereport/list.php index 58ed3f50216..a9f1e0ecde4 100644 --- a/htdocs/expensereport/list.php +++ b/htdocs/expensereport/list.php @@ -324,13 +324,13 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) - { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); - } + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); + } } // Add where from hooks $parameters=array(); diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index 8f9d2fcf4bb..baf90355249 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -222,12 +222,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 9d20023abd8..db947f4011f 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -580,12 +580,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 0cf949d38de..bdf9349763b 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -372,12 +372,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/modulebuilder/template/myobject_list.php b/htdocs/modulebuilder/template/myobject_list.php index 70e40a4b3fb..37345e1356d 100644 --- a/htdocs/modulebuilder/template/myobject_list.php +++ b/htdocs/modulebuilder/template/myobject_list.php @@ -228,9 +228,9 @@ foreach ($search_array_options as $key => $val) $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; $mode_search=0; - if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 54b4ae33de8..6f3846f17fb 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1957,7 +1957,7 @@ if (($action == 'delete' && (empty($conf->use_javascript_ajax) || ! empty($conf- if (($action == 'clone' && (empty($conf->use_javascript_ajax) || ! empty($conf->dol_use_jmobile))) // Output when action = clone if jmobile or no js || (! empty($conf->use_javascript_ajax) && empty($conf->dol_use_jmobile))) // Always output when not jmobile nor js { - print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestionclone,'yes','action-clone',250,600); + print $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id,$langs->trans('CloneProduct'),$langs->trans('ConfirmCloneProduct',$object->ref),'confirm_clone',$formquestionclone,'yes','action-clone',260,600); } diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 5f99e2f365f..722844c619f 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -195,13 +195,13 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) - { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); - } + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); + } } // Add where from hooks $parameters=array(); diff --git a/htdocs/product/list.php b/htdocs/product/list.php index a26af04fae5..2d14f3179fb 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -324,12 +324,12 @@ else $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/product/stock/mouvement.php b/htdocs/product/stock/mouvement.php index a3fe120ceeb..63698319fdf 100644 --- a/htdocs/product/stock/mouvement.php +++ b/htdocs/product/stock/mouvement.php @@ -464,13 +464,13 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) - { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); - } + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) + { + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); + } } // Add where from hooks $parameters=array(); diff --git a/htdocs/product/stock/productlot_list.php b/htdocs/product/stock/productlot_list.php index cf0f1171a63..72048f4641b 100644 --- a/htdocs/product/stock/productlot_list.php +++ b/htdocs/product/stock/productlot_list.php @@ -243,12 +243,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/projet/list.php b/htdocs/projet/list.php index d9f2a1e2e81..4bf6282e546 100644 --- a/htdocs/projet/list.php +++ b/htdocs/projet/list.php @@ -322,12 +322,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/projet/tasks/list.php b/htdocs/projet/tasks/list.php index 3342074882c..8014bba1c5d 100644 --- a/htdocs/projet/tasks/list.php +++ b/htdocs/projet/tasks/list.php @@ -320,12 +320,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/resource/list.php b/htdocs/resource/list.php index 1b5c11df748..cb16ebcc807 100644 --- a/htdocs/resource/list.php +++ b/htdocs/resource/list.php @@ -75,12 +75,12 @@ foreach ($search_array_options as $key => $val) if ($val != '') { $param.='&search_options_'.$tmpkey.'='.urlencode($val); } - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $filter['ef.'.$tmpkey]=natural_search('ef.'.$tmpkey, $crit, $mode); + $filter['ef.'.$tmpkey] = natural_search('ef.'.$tmpkey, $crit, $mode_search); } } if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage; diff --git a/htdocs/societe/list.php b/htdocs/societe/list.php index d7fe420674d..44e8e3b3cf5 100644 --- a/htdocs/societe/list.php +++ b/htdocs/societe/list.php @@ -472,12 +472,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } diff --git a/htdocs/societe/website.php b/htdocs/societe/website.php index 8c2f6c9a58f..c0fdcc73219 100644 --- a/htdocs/societe/website.php +++ b/htdocs/societe/website.php @@ -273,9 +273,9 @@ foreach ($search_array_options as $key => $val) $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; $mode_search=0; - if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } diff --git a/htdocs/supplier_proposal/list.php b/htdocs/supplier_proposal/list.php index 449a5bbab60..16da59c1b93 100644 --- a/htdocs/supplier_proposal/list.php +++ b/htdocs/supplier_proposal/list.php @@ -323,12 +323,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks diff --git a/htdocs/user/index.php b/htdocs/user/index.php index 7e5820dac66..233efc4d8b7 100644 --- a/htdocs/user/index.php +++ b/htdocs/user/index.php @@ -220,12 +220,12 @@ foreach ($search_array_options as $key => $val) $crit=$val; $tmpkey=preg_replace('/search_options_/','',$key); $typ=$extrafields->attribute_type[$tmpkey]; - $mode=0; - if (in_array($typ, array('int','double','real'))) $mode=1; // Search on a numeric - if (in_array($typ, array('sellist')) && $crit != '0' && $crit != '-1') $mode=2; // Search on a foreign key int - if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0')) + $mode_search=0; + if (in_array($typ, array('int','double','real'))) $mode_search=1; // Search on a numeric + if (in_array($typ, array('sellist','link')) && $crit != '0' && $crit != '-1') $mode_search=2; // Search on a foreign key int + if ($crit != '' && (! in_array($typ, array('select','sellist')) || $crit != '0') && (! in_array($typ, array('link')) || $crit != '-1')) { - $sql .= natural_search('ef.'.$tmpkey, $crit, $mode); + $sql .= natural_search('ef.'.$tmpkey, $crit, $mode_search); } } // Add where from hooks
'.$langs->trans("BoxTitleLastModifiedDonations",$max).''.$langs->trans("AmountTTC").''.$langs->trans("DateModificationShort").''.$langs->trans("DateModificationShort").' 
'.$donationstatic->getNomUrl(1).''.price($objp->amount).''.$label.''.price($objp->amount).''.dol_print_date($db->jdate($objp->dm),'day').''.$donationstatic->LibStatut($objp->fk_statut,3).'
'.$chargestatic->getNomUrl(1).''.dol_print_date($db->jdate($obj->date_ech),'day').''.price($obj->amount).'
'.$langs->trans("Total").'   ('.$langs->trans("RemainderToBill").': '.price($tot_tobill).')
".dol_print_date($db->jdate($obj->da),"day")."'.$obj->libelle.' '.$obj->label.'