From e7b7633162c76ee37f16c77b37a1b184c0c7db35 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 16 Apr 2011 08:57:06 +0000 Subject: [PATCH] Fix: Do not use GET here, but put information into parameter of function --- htdocs/comm/propal.php | 2 +- htdocs/commande/fiche.php | 2 +- htdocs/compta/facture.php | 2 +- htdocs/core/class/commonobject.class.php | 18 +++++++++++------- .../tpl/predefinedproductline_edit.tpl.php | 2 +- 5 files changed, 15 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index b64eae56f2c..df04fb4cea3 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -1429,7 +1429,7 @@ if ($id > 0 || ! empty($ref)) print ''; // Show object lines - if (! empty($object->lines)) $object->printObjectLines(0,$mysoc,$soc); + if (! empty($object->lines)) $object->printObjectLines($mysoc,$soc,GETPOST('lineid')); //print '
'; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 467947cf1a3..fcfbbd29e7a 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -1819,7 +1819,7 @@ else print '
'; // Show object lines - if (! empty($object->lines)) $object->printObjectLines(1,$mysoc,$soc); + if (! empty($object->lines)) $object->printObjectLines($mysoc,$soc,GETPOST('lineid'),1); /* * Form to add new line diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index 261ead4e420..f71dff03761 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -2534,7 +2534,7 @@ else print '
'; // Show object lines - if (! empty($object->lines)) $object->printObjectLines(1,$mysoc,$soc); + if (! empty($object->lines)) $object->printObjectLines($mysoc,$soc,GETPOST('lineid'),1); /* * Form to add new line diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index c6289411731..e0cc7ca0b0a 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1459,8 +1459,12 @@ class CommonObject * TODO Move this into an output class file (htmlline.class.php) * If lines are into a template, title must also be into a template * But for the moment we don't know if it'st possible as we keep a method available on overloaded objects. + * @param $seller Object of seller third party + * @param $buyer Object of buyer third party + * @param $selected Object line selected + * @param $dateSelector 1=Show also date range input fields */ - function printObjectLines($dateSelector=0,$seller,$buyer) + function printObjectLines($seller,$buyer,$selected=0,$dateSelector=0) { global $conf,$langs; @@ -1505,11 +1509,11 @@ class CommonObject if (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)) { - if (empty($line->fk_parent_line)) $this->hooks[$line->special_code]->printObjectLine($this,$line,$var,$num,$i,$dateSelector,$seller,$buyer); + if (empty($line->fk_parent_line)) $this->hooks[$line->special_code]->printObjectLine($this,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected); } else { - $this->printLine($line,$var,$num,$i,$dateSelector,$seller,$buyer); + $this->printLine($line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected); } $i++; @@ -1521,7 +1525,6 @@ class CommonObject /** * Return HTML content of a detail line * TODO Move this into an output class file (htmlline.class.php) - * TODO Do not use GET here, but put information into parameter of function * If lines are into a template, title must also be into a template * But for the moment we don't know if it's possible as we keep a method available on overloaded objects. * @param $line Selected object line to output @@ -1531,8 +1534,9 @@ class CommonObject * @param $dateSelector 1=Show also date range input fields * @param $seller Object of seller third party * @param $buyer Object of buyer third party + * @param $selected Object line selected */ - function printLine($line,$var=true,$num=0,$i=0,$dateSelector=0,$seller,$buyer) + function printLine($line,$var=true,$num=0,$i=0,$dateSelector=0,$seller,$buyer,$selected=0) { global $conf,$langs,$user; global $html,$bc,$bcdd; @@ -1549,7 +1553,7 @@ class CommonObject // Ligne en mode visu // TODO Do not use GET here, but put information into parameter of function - if ($_GET['action'] != 'editline' || $_GET['lineid'] != $line->id) + if ($_GET['action'] != 'editline' || $selected != $line->id) { // Produit if ($line->fk_product > 0) @@ -1576,7 +1580,7 @@ class CommonObject } // Ligne en mode update - if ($this->statut == 0 && $_GET["action"] == 'editline' && $_GET["lineid"] == $line->id) + if ($this->statut == 0 && $_GET["action"] == 'editline' && $selected == $line->id) { if ($line->fk_product > 0) { diff --git a/htdocs/core/tpl/predefinedproductline_edit.tpl.php b/htdocs/core/tpl/predefinedproductline_edit.tpl.php index 58768013c97..c7a8092d58c 100644 --- a/htdocs/core/tpl/predefinedproductline_edit.tpl.php +++ b/htdocs/core/tpl/predefinedproductline_edit.tpl.php @@ -32,7 +32,7 @@ -"> +>