From b97223edd7a3ae6f1839fd18be23da12a02a9699 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 3 Aug 2016 19:01:51 +0200 Subject: [PATCH 1/3] Fix: link to link to objects not visible --- htdocs/core/class/html.form.class.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 3354aa01209..813e1aa9a12 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5266,8 +5266,8 @@ class Form * Show block with links to link to other objects. * * @param CommonObject $object Object we want to show links to - * @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order') - * @return string <0 if KO, >0 if OK + * @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order'). null or array() if no restriction. + * @return string <0 if KO, >0 if OK */ function showLinkToObjectBlock($object, $restrictlinksto=array()) { @@ -5278,8 +5278,7 @@ class Form if (! is_object($object->thirdparty)) $object->fetch_thirdparty(); - - if (((! is_array($restrictlinksto)) || in_array('order',$restrictlinksto)) + if ((empty($restrictlinksto) || in_array('order',$restrictlinksto)) && ! empty($conf->commande->enabled)) { $linktoelem.=($linktoelem?'   ':'').'' . $langs->trans('LinkedOrder') . ''; @@ -5346,7 +5345,7 @@ class Form print ''; } - if ((in_array('fichinter',$restrictlinksto)) && ! empty($conf->ficheinter->enabled)) + if ((empty($restrictlinksto) || (in_array('fichinter',$restrictlinksto))) && ! empty($conf->ficheinter->enabled)) { $linktoelem.=($linktoelem?'   ':'').'' . $langs->trans('LinkedFichinter') . ''; @@ -5407,7 +5406,7 @@ class Form print ''; } - if (((! is_array($restrictlinksto)) || in_array('supplier_order',$restrictlinksto)) + if ((empty($restrictlinksto) || in_array('supplier_order',$restrictlinksto)) && ! empty($conf->fournisseur->enabled)) { $linktoelem.=($linktoelem?'   ':'').'' . $langs->trans('LinkedOrder') . ''; From 7f6e2a277a32aeabce0d88f569ee441e5535665e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Aug 2016 11:57:37 +0200 Subject: [PATCH 2/3] NEW Link between objects can be done on both side and on all objects --- htdocs/adherents/fiche_subscription.php | 2 +- htdocs/comm/propal/card.php | 6 +- htdocs/commande/card.php | 6 +- htdocs/compta/facture.php | 14 +- htdocs/contrat/card.php | 4 +- htdocs/core/actions_dellink.inc.php | 17 +- htdocs/core/class/commonobject.class.php | 28 ++- htdocs/core/class/html.form.class.php | 266 +++++++---------------- htdocs/expedition/card.php | 4 +- htdocs/expensereport/card.php | 8 +- htdocs/fichinter/card.php | 6 +- htdocs/fourn/commande/card.php | 4 +- htdocs/fourn/facture/card.php | 6 +- htdocs/langs/fr_FR/main.lang | 8 + htdocs/product/stock/productlot_card.php | 4 +- htdocs/supplier_proposal/card.php | 5 +- 16 files changed, 147 insertions(+), 241 deletions(-) diff --git a/htdocs/adherents/fiche_subscription.php b/htdocs/adherents/fiche_subscription.php index 28fb2268d4c..2e149dbc028 100644 --- a/htdocs/adherents/fiche_subscription.php +++ b/htdocs/adherents/fiche_subscription.php @@ -424,7 +424,7 @@ if ($rowid && $action != 'edit') // Show links to link elements /*$linktoelem = $form->showLinkToObjectBlock($object,array('order')); - if ($linktoelem) print '
'.$linktoelem; + if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; // Link for paypal payment if (! empty($conf->paypal->enabled) && $object->statut != 0) { diff --git a/htdocs/comm/propal/card.php b/htdocs/comm/propal/card.php index 1e580826e96..0e2a4219e55 100644 --- a/htdocs/comm/propal/card.php +++ b/htdocs/comm/propal/card.php @@ -2324,9 +2324,9 @@ if ($action == 'create') $somethingshown = $form->showLinkedObjectBlock($object); // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object); - if ($linktoelem) print '
'.$linktoelem; - + $linktoelem = $form->showLinkToObjectBlock($object, null, array('propal')); + if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + print '
'; // print ''; diff --git a/htdocs/commande/card.php b/htdocs/commande/card.php index f3240443a6e..21a6ed5fc97 100644 --- a/htdocs/commande/card.php +++ b/htdocs/commande/card.php @@ -2614,9 +2614,9 @@ if ($action == 'create' && $user->rights->commande->creer) $somethingshown = $form->showLinkedObjectBlock($object); // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object); - //if ($linktoelem) print '
'.$linktoelem; - + $linktoelem = $form->showLinkToObjectBlock($object, null, array('order')); + if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + print '
'; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 6535cee7c98..7a7cb0c8e62 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -134,14 +134,6 @@ if (empty($reshook)) include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php'; // Must be include, not include_once - // Link invoice to order - if (GETPOST('linkedOrder') && empty($cancel) && $id > 0) - { - $object->fetch($id); - $object->fetch_thirdparty(); - $result = $object->add_object_linked('commande', GETPOST('linkedOrder')); - } - // Action clone object if ($action == 'confirm_clone' && $confirm == 'yes' && $user->rights->facture->creer) { // if (1 == 0 && empty($_REQUEST["clone_content"]) && empty($_REQUEST["clone_receivers"])) { @@ -4103,9 +4095,9 @@ else if ($id > 0 || ! empty($ref)) $somethingshown = $form->showLinkedObjectBlock($object); // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object,array('order')); - if ($linktoelem) print '
'.$linktoelem; - + $linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice')); + if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + // Link for paypal payment if (! empty($conf->paypal->enabled) && $object->statut != 0) { include_once DOL_DOCUMENT_ROOT . '/paypal/lib/paypal.lib.php'; diff --git a/htdocs/contrat/card.php b/htdocs/contrat/card.php index 5a87d3b3d51..dfa61513f9e 100644 --- a/htdocs/contrat/card.php +++ b/htdocs/contrat/card.php @@ -2021,8 +2021,8 @@ else $somethingshown = $form->showLinkedObjectBlock($object); // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object); - if ($linktoelem) print '
'.$linktoelem; + $linktoelem = $form->showLinkToObjectBlock($object, null, array('contrat')); + if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; print '
'; diff --git a/htdocs/core/actions_dellink.inc.php b/htdocs/core/actions_dellink.inc.php index 45fb8c5f9ec..63218dde739 100644 --- a/htdocs/core/actions_dellink.inc.php +++ b/htdocs/core/actions_dellink.inc.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2015-2016 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -18,22 +18,29 @@ /** * \file htdocs/core/actions_dellink.inc.php - * \brief Code for actions on deleting link between elements + * \brief Code for actions on linking and deleting link between elements */ // $action must be defined // $object must be defined // $permissiondellink must be defined -// $uploaddir (example $conf->projet->dir_output . "/";) $dellinkid = GETPOST('dellinkid','int'); +$addlinkid = GETPOST('idtolinkto','int'); -// Set public note +// Link invoice to order +if ($action == 'addlink' && ! empty($permissiondellink) && ! GETPOST('cancel') && $id > 0 && $addlinkid > 0) +{ + $object->fetch($id); + $object->fetch_thirdparty(); + $result = $object->add_object_linked(GETPOST('addlink'), $addlinkid); +} + +// Delete link if ($action == 'dellink' && ! empty($permissiondellink) && ! GETPOST('cancel') && $dellinkid > 0) { $result=$object->deleteObjectLinked(0, '', 0, '', $dellinkid); if ($result < 0) setEventMessages($object->error,$object->errors,'errors'); } - diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 71540cf16d7..221e9c83062 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2364,6 +2364,10 @@ abstract class CommonObject $origin = (! empty($origin) ? $origin : $this->origin); $origin_id = (! empty($origin_id) ? $origin_id : $this->origin_id); + // Special case + if ($origin == 'order') $origin='commande'; + if ($origin == 'invoice') $origin='facture'; + $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."element_element ("; @@ -2548,7 +2552,10 @@ abstract class CommonObject // Set classfile $classfile = strtolower($subelement); $classname = ucfirst($subelement); - if ($objecttype == 'invoice_supplier') { + if ($objecttype == 'order') { + $classfile = 'commande'; $classname = 'Commande'; + } + else if ($objecttype == 'invoice_supplier') { $classfile = 'fournisseur.facture'; $classname = 'FactureFournisseur'; } else if ($objecttype == 'order_supplier') { @@ -2568,15 +2575,18 @@ abstract class CommonObject if ($conf->$module->enabled && (($element != $this->element) || $alsosametype)) { dol_include_once('/'.$classpath.'/'.$classfile.'.class.php'); - - foreach($objectids as $i => $objectid) // $i is rowid into llx_element_element + //print '/'.$classpath.'/'.$classfile.'.class.php'; + if (class_exists($classname)) { - $object = new $classname($this->db); - $ret = $object->fetch($objectid); - if ($ret >= 0) - { - $this->linkedObjects[$objecttype][$i] = $object; - } + foreach($objectids as $i => $objectid) // $i is rowid into llx_element_element + { + $object = new $classname($this->db); + $ret = $object->fetch($objectid); + if ($ret >= 0) + { + $this->linkedObjects[$objecttype][$i] = $object; + } + } } } } diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 813e1aa9a12..ccc6c7b2d0f 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5264,12 +5264,13 @@ class Form /** * Show block with links to link to other objects. - * + * * @param CommonObject $object Object we want to show links to * @param array $restrictlinksto Restrict links to some elements, for exemple array('order') or array('supplier_order'). null or array() if no restriction. + * @param array $excludelinksto Do not show links of this type, for exemple array('order') or array('supplier_order'). null or array() if no exclusion. * @return string <0 if KO, >0 if OK */ - function showLinkToObjectBlock($object, $restrictlinksto=array()) + function showLinkToObjectBlock($object, $restrictlinksto=array(), $excludelinksto=array()) { global $conf, $langs, $hookmanager; global $bc; @@ -5278,201 +5279,90 @@ class Form if (! is_object($object->thirdparty)) $object->fetch_thirdparty(); - if ((empty($restrictlinksto) || in_array('order',$restrictlinksto)) - && ! empty($conf->commande->enabled)) + $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), + '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), + 'fichinter'=>array('enabled'=>$conf->ficheinter->enabled, 'perms'=>1, 'label'=>'LinkToIntervention', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."fichinter as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), + 'supplier_proposal'=>array('enabled'=>$conf->supplier_proposal->enabled , 'perms'=>1, 'label'=>'LinkToSupplierProposal', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, '' as ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."supplier_proposal as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), + 'order_supplier'=>array('enabled'=>$conf->fournisseur->commande->enabled , 'perms'=>1, 'label'=>'LinkToSupplierOrder', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande_fournisseur as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id), + 'invoice_supplier'=>array('enabled'=>$conf->fournisseur->facture->enabled , 'perms'=>1, 'label'=>'LinkToSupplierInvoice', 'sql'=>"SELECT s.rowid as socid, s.nom as name, s.client, t.rowid, t.ref, t.ref_supplier, t.total_ht FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."facture_fourn as t WHERE t.fk_soc = s.rowid AND t.fk_soc = ".$object->thirdparty->id) + ); + + foreach($possiblelinks as $key => $possiblelink) { - $linktoelem.=($linktoelem?'   ':'').'' . $langs->trans('LinkedOrder') . ''; - - print ' - - '; - - print '
global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>'; - - $sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_client, c.total_ht"; - $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; - $sql .= ", " . MAIN_DB_PREFIX . "commande as c"; - $sql .= ' WHERE c.fk_soc = s.rowid AND c.fk_soc = ' . $object->thirdparty->id . ''; - - $resqlorderlist = $this->db->query($sql); - if ($resqlorderlist) + $num = 0; + + if (! empty($possiblelink['perms']) && (empty($restrictlinksto) || in_array($key, $restrictlinksto)) && (empty($excludelinksto) || ! in_array($key, $excludelinksto))) { - $num = $this->db->num_rows($resqlorderlist); - $i = 0; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - while ($i < $num) + print '
global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>'; + $sql = $possiblelink['sql']; + $resqllist = $this->db->query($sql); + if ($resqllist) { - $objp = $this->db->fetch_object($resqlorderlist); - - $var = ! $var; - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; + $num = $this->db->num_rows($resqllist); + $i = 0; + + print '
'; + print ''; + print ''; + print ''; + print '
' . $langs->trans("Ref") . '' . $langs->trans("RefCustomer") . '' . $langs->trans("AmountHTShort") . '' . $langs->trans("Company") . '
'; - print ''; - print '' . $objp->ref . '' . $objp->ref_client . '' . price($objp->total_ht) . '' . $objp->name . '
'; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; print ''; - - $i ++; + while ($i < $num) + { + $objp = $this->db->fetch_object($resqlorderlist); + + $var = ! $var; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $i++; + } + print '
' . $langs->trans("Ref") . '' . $langs->trans("RefCustomer") . '' . $langs->trans("AmountHTShort") . '' . $langs->trans("Company") . '
'; + print ''; + print '' . $objp->ref . '' . $objp->ref_client . '' . price($objp->total_ht) . '' . $objp->name . '
'; + print '
     
'; + + print '
'; + $this->db->free($resqllist); + } else { + dol_print_error($this->db); } - print ''; - print '
     
'; - - print ''; - $this->db->free($resqlorderlist); - } else { - dol_print_error($this->db); + print '
'; + if ($num > 0) + { + print ' + + + '; + } } - print '
'; + $linktoelem.=($linktoelem?'   ':''); + if ($num > 0) $linktoelem.='' . $langs->trans($possiblelink['label']) .' ('.$num.')'; + //else $linktoelem.=$langs->trans($possiblelink['label']); + else $linktoelem.='' . $langs->trans($possiblelink['label']) . ''; } - if ((empty($restrictlinksto) || (in_array('fichinter',$restrictlinksto))) && ! empty($conf->ficheinter->enabled)) - { - $linktoelem.=($linktoelem?'   ':'').'' . $langs->trans('LinkedFichinter') . ''; - - print ' - - '; - - print '
global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>'; - - $sql = "SELECT s.rowid as socid, s.nom as name, s.client, f.rowid, f.ref"; - $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; - $sql .= ", " . MAIN_DB_PREFIX . "fichinter as f"; - $sql .= ' WHERE f.fk_soc = s.rowid'; - - $resqlorderlist = $this->db->query($sql); - if ($resqlorderlist) - { - $num = $this->db->num_rows($resqlorderlist); - $i = 0; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - while ($i < $num) - { - $objp = $this->db->fetch_object($resqlorderlist); - - $var = ! $var; - print ''; - print ''; - print ''; - print ''; - print ''; - - $i ++; - } - print '
' . $langs->trans("Ref") . '' . $langs->trans("Company") . '
'; - print ''; - print '' . $objp->ref . '' . $objp->name . '
'; - print '
     
'; - print '
'; - $this->db->free($resqlorderlist); - } else { - dol_print_error($this->db); - } - - print '
'; - } - - if ((empty($restrictlinksto) || in_array('supplier_order',$restrictlinksto)) - && ! empty($conf->fournisseur->enabled)) - { - $linktoelem.=($linktoelem?'   ':'').'' . $langs->trans('LinkedOrder') . ''; - - print ' - - '; - - print '
global->MAIN_OPTIMIZEFORTEXTBROWSER)?' style="display:none"':'').'>'; - - $sql = "SELECT s.rowid as socid, s.nom as name, s.client, c.rowid, c.ref, c.ref_supplier, c.total_ht"; - $sql .= " FROM " . MAIN_DB_PREFIX . "societe as s"; - $sql .= ", " . MAIN_DB_PREFIX . "commande_fournisseur as c"; - $sql .= ' WHERE c.fk_soc = s.rowid AND c.fk_soc = ' . $object->thirdparty->id; - - $resqlorderlist = $this->db->query($sql); - if ($resqlorderlist) - { - $num = $this->db->num_rows($resqlorderlist); - $i = 0; - - print '
'; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - while ($i < $num) - { - $objp = $this->db->fetch_object($resqlorderlist); - - $var = ! $var; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - - $i ++; - } - print '
' . $langs->trans("Ref") . '' . $langs->trans("RefSupplier") . '' . $langs->trans("AmountHTShort") . '' . $langs->trans("Company") . '
'; - print ''; - print '' . $objp->ref . '' . $objp->ref_supplier . '' . price($objp->total_ht) . '' . $objp->name . '
'; - print '
 
'; - print '
'; - $this->db->free($resqlorderlist); - } else { - dol_print_error($this->db); - } - - print '
'; - } - - return $linktoelem; } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index e38ebd977e1..cbcee84451f 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -1836,8 +1836,8 @@ else if ($id || $ref) // Show links to link elements //$linktoelem = $form->showLinkToObjectBlock($object); - //if ($linktoelem) print '
'.$linktoelem; - + //if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + print '
'; // List of actions on element diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index e177312a7d6..1b9bd2592ea 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2099,11 +2099,9 @@ if ($action != 'create' && $action != 'edit' && ($id || $ref)) // Show links to link elements $linktoelements=array(); - if($conf->global->EXPENSES_LINK_TO_INTERVENTION) $linktoelements[]='fichinter'; - $linktoelem=''; - $linktoelem = $form->showLinkToObjectBlock($object,$linktoelements); - if ($linktoelem) print '
'.$linktoelem; - + if (! empty($conf->global->EXPENSES_LINK_TO_INTERVENTION)) $linktoelements[]='fichinter'; + $linktoelem = $form->showLinkToObjectBlock($object, $linktoelements, array('expensereport')); + if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; } llxFooter(); diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index 2a4ec4337f2..833f2140de9 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -1667,9 +1667,9 @@ else if ($id > 0 || ! empty($ref)) $somethingshown = $form->showLinkedObjectBlock($object); // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object); - //if ($linktoelem) print '
'.$linktoelem; - + $linktoelem = $form->showLinkToObjectBlock($object, null, array('fichinter')); + if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + print '
'; diff --git a/htdocs/fourn/commande/card.php b/htdocs/fourn/commande/card.php index fa93be5020d..a642855a241 100644 --- a/htdocs/fourn/commande/card.php +++ b/htdocs/fourn/commande/card.php @@ -2834,8 +2834,8 @@ elseif (! empty($object->id)) $somethingshown = $form->showLinkedObjectBlock($object); // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object); - //if ($linktoelem) print '
'.$linktoelem; + $linktoelem = $form->showLinkToObjectBlock($object, null, array('order_supplier')); + if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; print '
'; diff --git a/htdocs/fourn/facture/card.php b/htdocs/fourn/facture/card.php index 280664ea421..b2c823d68fd 100644 --- a/htdocs/fourn/facture/card.php +++ b/htdocs/fourn/facture/card.php @@ -2239,9 +2239,9 @@ else $somethingshown = $form->showLinkedObjectBlock($object); // Show links to link elements - $linktoelem = $form->showLinkToObjectBlock($object,array('supplier_order')); - if ($linktoelem) print '
'.$linktoelem; - + $linktoelem = $form->showLinkToObjectBlock($object, null, array('invoice_supplier')); + if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + print '
'; //print ''; diff --git a/htdocs/langs/fr_FR/main.lang b/htdocs/langs/fr_FR/main.lang index 5eb99eb0f43..fd7d8068f15 100644 --- a/htdocs/langs/fr_FR/main.lang +++ b/htdocs/langs/fr_FR/main.lang @@ -640,6 +640,14 @@ NewAttribute=Nouvel attribut AttributeCode=Code de l'attribut URLPhoto=URL de la photo/logo SetLinkToAnotherThirdParty=Lier vers un autre tiers +LinkToProposal=Link to proposal +LinkToOrder=Link to order +LinkToInvoice=Link to invoice +LinkToSupplierOrder=Link to supplier order +LinkToSupplierProposal=Link to supplier proposal +LinkToSupplierInvoice=Link to supplier invoice +LinkToContract=Link to contract +LinkToIntervention=Link to intervention CreateDraft=Créer brouillon SetToDraft=Retour en brouillon ClickToEdit=Cliquer ici pour éditer diff --git a/htdocs/product/stock/productlot_card.php b/htdocs/product/stock/productlot_card.php index 4af5b8a4d59..d1346088692 100644 --- a/htdocs/product/stock/productlot_card.php +++ b/htdocs/product/stock/productlot_card.php @@ -366,8 +366,8 @@ print ''.$langs->trans("Fieldimport_key").'showLinkedObjectBlock($object); //$linktoelem = $form->showLinkToObjectBlock($object); - //if ($linktoelem) print '
'.$linktoelem; - + //if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + } diff --git a/htdocs/supplier_proposal/card.php b/htdocs/supplier_proposal/card.php index 3e7871b2c4a..16029c5a95e 100644 --- a/htdocs/supplier_proposal/card.php +++ b/htdocs/supplier_proposal/card.php @@ -1809,9 +1809,10 @@ if ($action == 'create') $somethingshown = $form->showLinkedObjectBlock($object); // Show links to link elements - //$linktoelem = $form->showLinkToObjectBlock($object); - //if ($linktoelem) print '
'.$linktoelem; + $linktoelem = $form->showLinkToObjectBlock($object, null, array('supplier_proposal')); + if ($linktoelem) print ($somethingshown?'':'
').$linktoelem; + print '
'; // List of actions on element From 26f553a1a8be46c95223bd55eb08a15e6204a4b5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 4 Aug 2016 12:04:43 +0200 Subject: [PATCH 3/3] Fix bad position of test --- htdocs/core/class/html.form.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index eaf4ddd4d94..83f10b469c0 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5358,12 +5358,12 @@ class Form '; } + + $linktoelem.=($linktoelem?'   ':''); + if ($num > 0) $linktoelem.='' . $langs->trans($possiblelink['label']) .' ('.$num.')'; + //else $linktoelem.=$langs->trans($possiblelink['label']); + else $linktoelem.='' . $langs->trans($possiblelink['label']) . ''; } - - $linktoelem.=($linktoelem?'   ':''); - if ($num > 0) $linktoelem.='' . $langs->trans($possiblelink['label']) .' ('.$num.')'; - //else $linktoelem.=$langs->trans($possiblelink['label']); - else $linktoelem.='' . $langs->trans($possiblelink['label']) . ''; } return $linktoelem;