diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 4be8b18b41c..b07058ccd5a 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -42,7 +42,6 @@ $langs->load('orders'); $langs->load('products'); if ($conf->projet->enabled) require_once(DOL_DOCUMENT_ROOT.'/projet/project.class.php'); -if ($conf->commande->enabled) require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php'); require_once(DOL_DOCUMENT_ROOT.'/comm/propal/propal.class.php'); require_once(DOL_DOCUMENT_ROOT.'/comm/action/actioncomm.class.php'); @@ -1965,43 +1964,12 @@ if ($id > 0 || ! empty($ref)) foreach($propal->linked_object as $object => $objectid) { - // TODO en attendant que tout soit correct - if($conf->$object->enabled && $object == 'commande') + if($conf->$object->enabled) { $propal->showLinkedObjectBlock($object,$objectid,$somethingshown); } } -/* - if($conf->commande->enabled) - { - $propal->loadOrders(); - $coms = $propal->commandes; - if (sizeof($coms) > 0) - { - if ($somethingshown) { print '
'; $somethingshown=1; } - print_titre($langs->trans('RelatedOrders')); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - $var=true; - for ($i = 0 ; $i < sizeof($coms) ; $i++) - { - $var=!$var; - print '\n"; - print ''; - print ''; - print ''; - print "\n"; - } - print '
'.$langs->trans("Ref").''.$langs->trans("Date").''.$langs->trans("Price").''.$langs->trans("Status").'
'; - print ''.img_object($langs->trans("ShowOrder"),"order").' '.$coms[$i]->ref."'.dol_print_date($coms[$i]->date,'day').''.price($coms[$i]->total_ttc).''.$coms[$i]->getLibStatut(3).'
'; - } - } -*/ + print ''; // List of actions on element diff --git a/htdocs/commande/commande.class.php b/htdocs/commande/commande.class.php index 0a339452ee2..59d403e7b49 100644 --- a/htdocs/commande/commande.class.php +++ b/htdocs/commande/commande.class.php @@ -2357,44 +2357,6 @@ class Commande extends CommonObject return -1; } } - - /** - * - * - */ - function getLinkedObjectBlock($object,$objectid,$somethingshown=0) - { - global $langs; - - $num = sizeof($objectid); - - if ($num > 0) - { - if ($somethingshown) { print '
'; $somethingshown=1; } - print_titre($langs->trans('RelatedOrders')); - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - print ''; - $var=true; - for ($i = 0 ; $i < $num ; $i++) - { - $this->fetch($objectid[$i]); - - $var=!$var; - print '\n"; - print ''; - print ''; - print ''; - print "\n"; - } - print '
'.$langs->trans("Ref").''.$langs->trans("Date").''.$langs->trans("Price").''.$langs->trans("Status").'
'; - print ''.img_object($langs->trans("ShowOrder"),"order").' '.$this->ref."'.dol_print_date($this->date,'day').''.price($this->total_ttc).''.$this->getLibStatut(3).'
'; - } - } } diff --git a/htdocs/commande/tpl/linkedobjectblock.tpl.php b/htdocs/commande/tpl/linkedobjectblock.tpl.php new file mode 100644 index 00000000000..a63cac1f291 --- /dev/null +++ b/htdocs/commande/tpl/linkedobjectblock.tpl.php @@ -0,0 +1,51 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ +?> + + + +'; $somethingshown=1; } +print_titre($langs->trans('RelatedOrders')); +?> + + + + + + + +fetch($objectid[$i]); + $var=!$var; +?> + > + + + + + +
trans("Ref"); ?>trans("Date"); ?>trans("Price"); ?>trans("Status"); ?>
+ '.img_object($langs->trans("ShowOrder"),"order").' '.$linkedObjectBlock->ref; ?>date,'day'); ?>total_ttc); ?>getLibStatut(3); ?>
+ + \ No newline at end of file diff --git a/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php new file mode 100644 index 00000000000..447bb83f6b2 --- /dev/null +++ b/htdocs/compta/facture/tpl/linkedobjectblock.tpl.php @@ -0,0 +1,60 @@ + + * + * 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + */ +?> + + + +'; $somethingshown=1; } +if ($num > 1) print_titre($langs->trans("RelatedBills")); +else print_titre($langs->trans("RelatedBill")); +?> + + + + + + + +fetch($objectid[$i]); + $var=!$var; +?> + > + + + + +total_ht; +$i++; +} +?> + + + + +
trans("Ref"); ?>trans("Date"); ?>trans("Price"); ?>trans("Status"); ?>
+ '.img_object($langs->trans("ShowBill"),"bill").' '.$linkedObjectBlock->ref; ?>date,'day'); ?>total_ht); ?>getLibStatut(3); ?>
trans("TotalHT"); ?> 
+ + \ No newline at end of file diff --git a/htdocs/core/commonobject.class.php b/htdocs/core/commonobject.class.php index f993babf490..8121647dcc2 100644 --- a/htdocs/core/commonobject.class.php +++ b/htdocs/core/commonobject.class.php @@ -1019,10 +1019,20 @@ class CommonObject */ function showLinkedObjectBlock($object,$objectid,$somethingshown=0) { - $class = ucfirst($object); - if(!class_exists($class)) require(DOL_DOCUMENT_ROOT."/".$object."/class/".$object.".class.php"); - $linkedObjectBlock = new $class($this->db); - $linkedObjectBlock->getLinkedObjectBlock($object,$objectid,$somethingshown); + global $langs; + + $num = sizeof($objectid); + if ($num) + { + // TODO uniformiser emplacement classe + require_once(DOL_DOCUMENT_ROOT.'/commande/commande.class.php'); + require_once(DOL_DOCUMENT_ROOT.'/compta/facture/facture.class.php'); + $class = ucfirst($object); + if(!class_exists($class)) require(DOL_DOCUMENT_ROOT."/".$object."/class/".$object.".class.php"); + $linkedObjectBlock = new $class($this->db); + if ($object == 'facture') $object = 'compta/'.$object; + include(DOL_DOCUMENT_ROOT.'/'.$object.'/tpl/linkedobjectblock.tpl.php'); + } } }