Fix: Do not use GET here, but put information into parameter of function

This commit is contained in:
Regis Houssin 2011-04-16 09:09:04 +00:00
parent e7b7633162
commit 066ef17726
4 changed files with 10 additions and 10 deletions

View File

@ -1429,7 +1429,7 @@ if ($id > 0 || ! empty($ref))
print '<table id="tablelines" class="noborder" width="100%">'; print '<table id="tablelines" class="noborder" width="100%">';
// Show object lines // 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 '<table id="tablelines" class="noborder" width="100%">'; //print '<table id="tablelines" class="noborder" width="100%">';

View File

@ -1819,7 +1819,7 @@ else
print '<table id="tablelines" class="noborder" width="100%">'; print '<table id="tablelines" class="noborder" width="100%">';
// Show object lines // 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 * Form to add new line

View File

@ -2534,7 +2534,7 @@ else
print '<table id="tablelines" class="noborder" width="100%">'; print '<table id="tablelines" class="noborder" width="100%">';
// Show object lines // 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 * Form to add new line

View File

@ -1464,7 +1464,7 @@ class CommonObject
* @param $selected Object line selected * @param $selected Object line selected
* @param $dateSelector 1=Show also date range input fields * @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; global $conf,$langs;
@ -1509,11 +1509,11 @@ class CommonObject
if (($line->product_type == 9 && ! empty($line->special_code)) || ! empty($line->fk_parent_line)) 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 else
{ {
$this->printLine($line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected); $this->printLine($action,$line,$var,$num,$i,$dateSelector,$seller,$buyer,$selected);
} }
$i++; $i++;
@ -1527,6 +1527,7 @@ class CommonObject
* TODO Move this into an output class file (htmlline.class.php) * TODO Move this into an output class file (htmlline.class.php)
* If lines are into a template, title must also be into a template * 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. * 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 $line Selected object line to output
* @param $var Is it a an odd line * @param $var Is it a an odd line
* @param $num Number of line * @param $num Number of line
@ -1536,7 +1537,7 @@ class CommonObject
* @param $buyer Object of buyer third party * @param $buyer Object of buyer third party
* @param $selected Object line selected * @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 $conf,$langs,$user;
global $html,$bc,$bcdd; global $html,$bc,$bcdd;
@ -1552,8 +1553,7 @@ class CommonObject
if (! empty($line->date_end)) $type=1; if (! empty($line->date_end)) $type=1;
// Ligne en mode visu // Ligne en mode visu
// TODO Do not use GET here, but put information into parameter of function if ($action != 'editline' || $selected != $line->id)
if ($_GET['action'] != 'editline' || $selected != $line->id)
{ {
// Produit // Produit
if ($line->fk_product > 0) if ($line->fk_product > 0)
@ -1580,7 +1580,7 @@ class CommonObject
} }
// Ligne en mode update // 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) if ($line->fk_product > 0)
{ {