From f353464bce1fe2698459672c0e97cfb1341c6930 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 26 Nov 2015 00:47:17 +0100 Subject: [PATCH] Prepare code to fix #4095 --- htdocs/core/class/html.formprojet.class.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/htdocs/core/class/html.formprojet.class.php b/htdocs/core/class/html.formprojet.class.php index 5486d19858b..b44a30dcd05 100644 --- a/htdocs/core/class/html.formprojet.class.php +++ b/htdocs/core/class/html.formprojet.class.php @@ -422,9 +422,10 @@ class FormProjets * @param string $table_element Table of the element to update * @param int $socid If of thirdparty to use as filter * @param string $morecss More CSS + * @param int $limitonstatus Add filters to limit length of list to opened status (for example to avoid ERR_RESPONSE_HEADERS_TOO_BIG on project/element.php page). TODO To implement * @return int|string The HTML select list of element or '' if nothing or -1 if KO */ - function select_element($table_element, $socid=0, $morecss='') + function select_element($table_element, $socid=0, $morecss='', $limitonstatus=-2) { global $conf, $langs; @@ -433,7 +434,9 @@ class FormProjets $linkedtothirdparty=false; if (! in_array($table_element, array('don','expensereport_det','expensereport'))) $linkedtothirdparty=true; + $sqlfilter=''; $projectkey="fk_projet"; + //print $table_element; switch ($table_element) { case "facture": @@ -443,7 +446,8 @@ class FormProjets $sql = "SELECT t.rowid, t.ref, t.ref_supplier"; break; case "commande_fourn": - $sql = "SELECT t.rowid, t.ref, t.ref_supplier"; + case "commande_fournisseur": + $sql = "SELECT t.rowid, t.ref, t.ref_supplier"; break; case "facture_rec": $sql = "SELECT t.rowid, t.titre as ref"; @@ -457,6 +461,11 @@ class FormProjets /*$sql = "SELECT rowid, '' as ref"; // table is llx_expensereport_det $projectkey="fk_projet"; break;*/ + case "commande": + case "contrat": + case "fichinter": + $sql = "SELECT t.rowid, t.ref"; + break; default: $sql = "SELECT t.rowid, t.ref"; break; @@ -468,6 +477,7 @@ class FormProjets if (! empty($socid) && $linkedtothirdparty) $sql.= " AND t.fk_soc=".$socid; if (! in_array($table_element, array('expensereport_det'))) $sql.= ' AND t.entity='.getEntity('project'); if ($linkedtothirdparty) $sql.=" AND s.rowid = t.fk_soc"; + if ($sqlfilter) $sql.= " AND ".$sqlfilter; $sql.= " ORDER BY ref DESC"; dol_syslog(get_class($this).'::select_element', LOG_DEBUG);