diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index df04fb4cea3..d66a830d90d 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($mysoc,$soc,GETPOST('lineid'));
+ if (! empty($object->lines)) $object->printObjectLines(GETPOST('action'),$mysoc,$soc,GETPOST('lineid'));
//print '';
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index fcfbbd29e7a..68cde7f28e2 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($mysoc,$soc,GETPOST('lineid'),1);
+ if (! empty($object->lines)) $object->printObjectLines(GETPOST('action'),$mysoc,$soc,GETPOST('lineid'),1);
/*
* Form to add new line
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index f71dff03761..d81daf75991 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($mysoc,$soc,GETPOST('lineid'),1);
+ if (! empty($object->lines)) $object->printObjectLines(GETPOST('action'),$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 e0cc7ca0b0a..ae4345a0369 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -1464,7 +1464,7 @@ class CommonObject
* @param $selected Object line selected
* @param $dateSelector 1=Show also date range input fields
*/
- function printObjectLines($seller,$buyer,$selected=0,$dateSelector=0)
+ function printObjectLines($action='viewline',$seller,$buyer,$selected=0,$dateSelector=0)
{
global $conf,$langs;
@@ -1509,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,$selected);
+ if (empty($line->fk_parent_line)) $this->hooks[$line->special_code]->printObjectLine($action,$this,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected);
}
else
{
- $this->printLine($line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected);
+ $this->printLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected);
}
$i++;
@@ -1527,6 +1527,7 @@ 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's possible as we keep a method available on overloaded objects.
+ * @param $action GET/POST action
* @param $line Selected object line to output
* @param $var Is it a an odd line
* @param $num Number of line
@@ -1536,7 +1537,7 @@ class CommonObject
* @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,$selected=0)
+ function printLine($action='viewline',$line,$var=true,$num=0,$i=0,$dateSelector=0,$seller,$buyer,$selected=0)
{
global $conf,$langs,$user;
global $html,$bc,$bcdd;
@@ -1552,8 +1553,7 @@ class CommonObject
if (! empty($line->date_end)) $type=1;
// Ligne en mode visu
- // TODO Do not use GET here, but put information into parameter of function
- if ($_GET['action'] != 'editline' || $selected != $line->id)
+ if ($action != 'editline' || $selected != $line->id)
{
// Produit
if ($line->fk_product > 0)
@@ -1580,7 +1580,7 @@ class CommonObject
}
// Ligne en mode update
- if ($this->statut == 0 && $_GET["action"] == 'editline' && $selected == $line->id)
+ if ($this->statut == 0 && $action == 'editline' && $selected == $line->id)
{
if ($line->fk_product > 0)
{