Fix search filter when using extrafields 'links'

This commit is contained in:
Laurent Destailleur 2017-11-12 12:39:23 +01:00
parent 3b4cbf54d7
commit 836f6bf3c9
37 changed files with 213 additions and 204 deletions

View File

@ -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

View File

@ -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);

View File

@ -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 '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
@ -125,7 +125,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
print '</tr>';
$i++;
}
print '</table>';
print '</table>';
print '</form>';
print '<br>';
}
@ -155,7 +155,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
{
$total = 0;
$num = $db->num_rows($resql);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<th colspan="3">'.$langs->trans("ProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</th></tr>';
@ -167,7 +167,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td class="nowrap">';
$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 '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
}
}
else
{
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoProposal").'</td></tr>';
}
print "</table><br>";
@ -236,7 +236,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos
{
$total = 0;
$num = $db->num_rows($resql);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<th colspan="3">'.$langs->trans("SupplierProposalsDraft").($num?' <span class="badge">'.$num.'</span>':'').'</th></tr>';
@ -248,7 +248,7 @@ if (! empty($conf->supplier_proposal->enabled) && $user->rights->supplier_propos
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td class="nowrap">';
$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 '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
}
}
else
{
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoProposal").'</td></tr>';
}
print "</table><br>";
@ -315,7 +315,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
{
$total = 0;
$num = $db->num_rows($resql);
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<th colspan="3">'.$langs->trans("DraftOrders").($num?' <span class="badge">'.$num.'</span>':'').'</th></tr>';
@ -326,7 +326,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td class="nowrap">';
$orderstatic->id=$obj->rowid;
@ -352,13 +352,13 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
}
if ($total>0)
{
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
}
}
else
{
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
}
print "</table><br>";
@ -407,7 +407,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
$i = 0;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven"><td class="nowrap">';
$supplierorderstatic->id=$obj->rowid;
@ -433,13 +433,13 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->fournisseur->commande
}
if ($total>0)
{
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" align="right">'.price($total)."</td></tr>";
}
}
else
{
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoSupplierOrder").'</td></tr>';
}
print "</table><br>";
@ -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 '</th>';
print '<th align="right">'.$langs->trans("DateModificationShort").'</th>';
print '<th align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/societe/list.php?type=p,c">'.$langs->trans("FullList").'</a></th>';
print '</tr>';
if ($num)
{
@ -510,7 +510,7 @@ if (! empty($conf->societe->enabled) && $user->rights->societe->lire)
print '<td align="right" nowrap>'.dol_print_date($db->jdate($objp->tms),'day')."</td>";
print '</tr>';
$i++;
}
@ -547,8 +547,9 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
$i = 0;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><th>'.$langs->trans("BoxTitleLastModifiedSuppliers",min($max,$num)).'</th>';
print '<th align="right">'.$langs->trans("DateModificationShort").'</th>';
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("BoxTitleLastModifiedSuppliers",min($max,$num)).'</th>';
print '<th align="right"><a class="commonlink" href="'.DOL_URL_ROOT.'/societe/list.php?type=f">'.$langs->trans("FullList").'</a></th>';
print '</tr>';
if ($num)
{
@ -564,7 +565,7 @@ if (! empty($conf->fournisseur->enabled) && $user->rights->societe->lire)
print '<td class="nowrap">'.$companystatic->getNomUrl(1,'supplier',44).'</td>';
print '<td align="right">'.dol_print_date($db->jdate($objp->dm),'day').'</td>';
print '</tr>';
$i++;
}
@ -644,7 +645,7 @@ if (! empty($conf->contrat->enabled) && $user->rights->contrat->lire && 0) // TO
print $companystatic->getNomUrl(1,'customer',44);
print '</td>'."\n";
print "<td align=\"right\">".$staticcontrat->LibStatut($obj->statut,3)."</td></tr>\n";
$i++;
}
print "</table><br>";
@ -690,7 +691,7 @@ if (! empty($conf->propal->enabled) && $user->rights->propal->lire)
while ($i < $nbofloop)
{
$obj = $db->fetch_object($result);
print '<tr class="oddeven">';
// Ref
@ -787,7 +788,7 @@ if (! empty($conf->commande->enabled) && $user->rights->commande->lire)
while ($i < $nbofloop)
{
$obj = $db->fetch_object($result);
print '<tr class="oddeven">';
// Ref

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -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();

View File

@ -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

View File

@ -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 '<form method="post" action="'.DOL_URL_ROOT.'/core/search.php">';
@ -123,7 +123,7 @@ if (! empty($conf->global->MAIN_SEARCH_FORM_ON_HOME_AREAS)) // This is usele
print '</tr>';
$i++;
}
print '</table>';
print '</table>';
print '</form>';
print '<br>';
}
@ -194,7 +194,7 @@ if (! empty($conf->facture->enabled) && $user->rights->facture->lire)
print '</tr>';
$tot_ttc+=$obj->total_ttc;
$i++;
}
print '<tr class="liste_total"><td align="left">'.$langs->trans("Total").'</td>';
@ -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 '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<th>'.$langs->trans("BoxTitleLastModifiedDonations",$max).'</th>';
print '<th></th>';
print '<th align="right">'.$langs->trans("AmountTTC").'</th>';
print '<th align="right">'.$langs->trans("DateModificationShort").'</th>';
print '<th align="right">'.$langs->trans("DateModificationShort").'</th>';
print '<th width="16">&nbsp;</th>';
print '</tr>';
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 '<tr class="oddeven">';
$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 '<tr class="oddeven">';
print '<td>'.$donationstatic->getNomUrl(1).'</td>';
print '<td align="right">'.price($objp->amount).'</td>';
print '<td>'.$label.'</td>';
print '<td align="right">'.price($objp->amount).'</td>';
print '<td align="right">'.dol_print_date($db->jdate($objp->dm),'day').'</td>';
print '<td>'.$donationstatic->LibStatut($objp->fk_statut,3).'</td>';
print '</tr>';
@ -594,11 +598,13 @@ if (! empty($conf->tax->enabled) && $user->rights->tax->charges->lire)
while ($i < $num)
{
$obj = $db->fetch_object($resql);
print '<tr class="oddeven">';
$chargestatic->id=$obj->rowid;
$chargestatic->ref=$obj->libelle;
$chargestatic->lib=$obj->libelle;
$chargestatic->paye=$obj->paye;
print '<tr class="oddeven">';
print '<td>'.$chargestatic->getNomUrl(1).'</td>';
print '<td align="center">'.dol_print_date($db->jdate($obj->date_ech),'day').'</td>';
print '<td align="right">'.price($obj->amount).'</td>';
@ -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 '<tr class="liste_total"><td colspan="2">'.$langs->trans("Total").' &nbsp; <font style="font-weight: normal">('.$langs->trans("RemainderToBill").': '.price($tot_tobill).')</font> </td>';
@ -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 "<tr ".$bc[$var]."><td>".dol_print_date($db->jdate($obj->da),"day")."</td>";
print '<td><a href="action/card.php">'.$obj->libelle.' '.$obj->label.'</a></td></tr>';

View File

@ -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))

View File

@ -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)."'";

View File

@ -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 = '<a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkstart = '<a href="'.DOL_URL_ROOT.'/compta/sociales/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
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;
}

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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)

View File

@ -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();

View File

@ -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 = '<a href="'.DOL_URL_ROOT.'/don/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkstart = '<a href="'.DOL_URL_ROOT.'/don/card.php?id='.$this->id.'" title="'.dol_escape_htmltag($label, 1).'" class="classfortooltip">';
$linkend='</a>';
$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;
}

View File

@ -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).")";

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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();

View File

@ -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

View File

@ -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();

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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

View File

@ -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