From 9ec520a37aea52978c8b3f4006cd9e3bb1040e9c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 4 Oct 2016 20:52:15 +0200 Subject: [PATCH] Fix link to on proposal --- htdocs/core/class/html.form.class.php | 38 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index d05102b5568..205ed471673 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5275,11 +5275,12 @@ class Form global $bc; $linktoelem=''; - + $linktoelemlist=''; + if (! is_object($object->thirdparty)) $object->fetch_thirdparty(); $possiblelinks=array( - 'propal'=>array('enabled'=>$conf->propale->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), + 'propal'=>array('enabled'=>$conf->propal->enabled, 'perms'=>1, 'label'=>'LinkToProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."propal as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), 'order'=>array('enabled'=>$conf->commande->enabled, 'perms'=>1, 'label'=>'LinkToOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_client, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), 'invoice'=>array('enabled'=>$conf->facture->enabled, 'perms'=>1, 'label'=>'LinkToInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.facnumber as ref, t.ref_client, t.total as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), 'contrat'=>array('enabled'=>$conf->contrat->enabled , 'perms'=>1, 'label'=>'LinkToContract', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, '' as total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), @@ -5295,7 +5296,7 @@ class Form $num = 0; if (empty($possiblelink['enabled'])) continue; - + if (! empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || ! in_array($key, $excludelinksto))) { print '
global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>'; @@ -5348,22 +5349,29 @@ class Form } //$linktoelem.=($linktoelem?'   ':''); - if ($num > 0) $linktoelem.='
  • ' . $langs->trans($possiblelink['label']) .' ('.$num.')
  • '; + if ($num > 0) $linktoelemlist.='
  • ' . $langs->trans($possiblelink['label']) .' ('.$num.')
  • '; //else $linktoelem.=$langs->trans($possiblelink['label']); - else $linktoelem.='
  • ' . $langs->trans($possiblelink['label']) . ' (0)
  • '; + else $linktoelemlist.='
  • ' . $langs->trans($possiblelink['label']) . ' (0)
  • '; } } - $linktoelem=' - '; + if ($linktoelemlist) + { + $linktoelem=' + '; + } + else + { + $linktoelem=''; + } print '