From 6f718af1b667a4b1e0aec7d2642a3ceb8d5de535 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Sep 2014 09:29:40 +0200 Subject: [PATCH] Fix: list of interventions of thirdparties --- htdocs/core/lib/company.lib.php | 2 +- htdocs/societe/consumption.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/lib/company.lib.php b/htdocs/core/lib/company.lib.php index acd39a38901..4e810320467 100644 --- a/htdocs/core/lib/company.lib.php +++ b/htdocs/core/lib/company.lib.php @@ -106,7 +106,7 @@ function societe_prepare_head($object) if ($user->societe_id == 0) { - if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fournisseur->enabled)) + if (! empty($conf->commande->enabled) || ! empty($conf->propal->enabled) || ! empty($conf->facture->enabled) || ! empty($conf->fichinter->enabled) || ! empty($conf->fournisseur->enabled)) { $head[$h][0] = DOL_URL_ROOT.'/societe/consumption.php?socid='.$object->id; $head[$h][1] = $langs->trans("Referers"); diff --git a/htdocs/societe/consumption.php b/htdocs/societe/consumption.php index 8ed8ea227ee..cea1f16b127 100644 --- a/htdocs/societe/consumption.php +++ b/htdocs/societe/consumption.php @@ -180,8 +180,9 @@ if ($type_element == 'fichinter') require_once DOL_DOCUMENT_ROOT.'/fichinter/class/fichinter.class.php'; $documentstatic=new Fichinter($db); $sql_select = 'SELECT f.rowid as doc_id, f.ref as doc_number, \'1\' as doc_type, f.datec as dateprint, '; - $tables_from = MAIN_DB_PREFIX."fichinter as f,".MAIN_DB_PREFIX."fichinterdet as d"; - $where = " WHERE d.fk_fichinter = f.rowid AND f.entity = ".$conf->entity; + $tables_from = MAIN_DB_PREFIX."fichinter as f LEFT JOIN ".MAIN_DB_PREFIX."fichinterdet as d ON d.fk_fichinter = f.rowid"; // Must use left join to work also with option that disable usage of lines. + $where = " WHERE f.fk_soc = s.rowid AND s.rowid = ".$socid; + $where.= " AND f.entity = ".$conf->entity; $dateprint = 'f.datec'; $doc_number='f.ref'; } @@ -275,7 +276,7 @@ if ($sref) $sql.= " AND ".$doc_number." LIKE '%".$sref."%'"; if ($sprod_fulldescr) $sql.= " AND (d.description LIKE '%".$sprod_fulldescr."%' OR p.label LIKE '%".$sprod_fulldescr."%')"; $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit + 1, $offset); - +//print $sql; // Define type of elements $typeElementString = $form->selectarray("type_element", $elementTypeArray, GETPOST('type_element'), 2);