From e99f190ff158489451eec64a2223012607358971 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 25 Nov 2017 15:56:36 +0100 Subject: [PATCH] Save search context on list of template invoices --- .../facture/class/facture-rec.class.php | 34 ++++++++++++------- .../compta/facture/invoicetemplate_list.php | 9 +++-- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 17e6d08fb2f..53a488a7323 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -998,14 +998,16 @@ class FactureRec extends CommonInvoice /** * Return clicable name (with picto eventually) * - * @param int $withpicto Add picto into link - * @param string $option Where point the link - * @param int $max Maxlength of ref - * @param int $short 1=Return just URL - * @param string $moretitle Add more text to title tooltip - * @return string String with URL + * @param int $withpicto Add picto into link + * @param string $option Where point the link + * @param int $max Maxlength of ref + * @param int $short 1=Return just URL + * @param string $moretitle Add more text to title tooltip + * @param int $notooltip 1=Disable tooltip + * @param int $save_lastsearch_value -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking + * @return string String with URL */ - function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='') + function getNomUrl($withpicto=0,$option='',$max=0,$short=0,$moretitle='',$notooltip='',$save_lastsearch_value=-1) { global $langs; @@ -1016,16 +1018,22 @@ class FactureRec extends CommonInvoice if ($short) return $url; - $picto='bill'; + if ($option != 'nolink') + { + // Add param to save lastsearch_values or not + $add_save_lastsearch_values=($save_lastsearch_value == 1 ? 1 : 0); + if ($save_lastsearch_value == -1 && preg_match('/list\.php/',$_SERVER["PHP_SELF"])) $add_save_lastsearch_values=1; + if ($add_save_lastsearch_values) $url.='&save_lastsearch_values=1'; + } - $link = ''; + $linkstart = ''; $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.= $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->ref.$linkend; return $result; } diff --git a/htdocs/compta/facture/invoicetemplate_list.php b/htdocs/compta/facture/invoicetemplate_list.php index 63d13ba935d..bae0d2a98cc 100644 --- a/htdocs/compta/facture/invoicetemplate_list.php +++ b/htdocs/compta/facture/invoicetemplate_list.php @@ -530,19 +530,22 @@ if ($resql) $companystatic->id=$objp->socid; $companystatic->name=$objp->name; - $invoicerectmp->id=$objp->id; + $invoicerectmp->id=$objp->id?$objp->id:$objp->facid; $invoicerectmp->frequency=$objp->frequency; $invoicerectmp->suspended=$objp->suspended; $invoicerectmp->unit_frequency=$objp->unit_frequency; $invoicerectmp->nb_gen_max=$objp->nb_gen_max; $invoicerectmp->nb_gen_done=$objp->nb_gen_done; + $invoicerectmp->ref=$objp->titre; print ''; if (! empty($arrayfields['f.titre']['checked'])) { - print ''.img_object($langs->trans("ShowBill"),"bill").' '.$objp->titre; - print "\n"; + print ''; + print $invoicerectmp->getNomUrl(1); + print ""; + print "\n"; if (! $i) $totalarray['nbfield']++; } if (! empty($arrayfields['s.nom']['checked']))