Fix: Libraries not used inside a web container must not use a GETPOST function.

This commit is contained in:
Laurent Destailleur 2011-04-13 13:38:56 +00:00
parent a8a9a4c283
commit 860563b347

View File

@ -175,7 +175,7 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$result=facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs); $result=facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
if ($result > 0) if ($result > 0)
{ {
Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$facid); Header('Location: '.$_SERVER["PHP_SELF"].'?facid='.$facid);
@ -328,7 +328,7 @@ if ($_REQUEST['action'] == 'confirm_valid' && $_REQUEST['confirm'] == 'yes' && $
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs); facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
} }
else else
{ {
@ -385,7 +385,7 @@ if ($_GET['action'] == 'modif' && $user->rights->facture->unvalidate)
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs); facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
} }
} }
@ -699,10 +699,10 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
{ {
$lines = $srcobject->lines; $lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines(); if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
$fk_parent_line=0; $fk_parent_line=0;
$num=sizeof($lines); $num=sizeof($lines);
for ($i=0;$i<$num;$i++) for ($i=0;$i<$num;$i++)
{ {
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle); $desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
@ -716,7 +716,7 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$date_end=$lines[$i]->date_fin_prevue; $date_end=$lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel; if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end; if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
// Reset fk_parent_line for no child products and special product // Reset fk_parent_line for no child products and special product
if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) { if (($lines[$i]->product_type != 9 && empty($lines[$i]->fk_parent_line)) || $lines[$i]->product_type == 9) {
$fk_parent_line = 0; $fk_parent_line = 0;
@ -752,13 +752,13 @@ if ($_POST['action'] == 'add' && $user->rights->facture->creer)
$error++; $error++;
break; break;
} }
// Defined the new fk_parent_line // Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9) { if ($result > 0 && $lines[$i]->product_type == 9) {
$fk_parent_line = $result; $fk_parent_line = $result;
} }
} }
// Hooks // Hooks
if (! empty($object->hooks)) if (! empty($object->hooks))
{ {
@ -975,7 +975,7 @@ if (($_POST['action'] == 'addline' || $_POST['action'] == 'addline_predef') && $
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs); facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
unset($_POST['qty']); unset($_POST['qty']);
unset($_POST['type']); unset($_POST['type']);
@ -1073,7 +1073,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs); facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
} }
} }
@ -1104,7 +1104,7 @@ if ($_GET['action'] == 'up' && $user->rights->facture->creer)
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs); facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'#'.$_GET['rowid']); Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'#'.$_GET['rowid']);
exit; exit;
@ -1126,7 +1126,7 @@ if ($_GET['action'] == 'down' && $user->rights->facture->creer)
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs); facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'#'.$_GET['rowid']); Header ('Location: '.$_SERVER["PHP_SELF"].'?facid='.$object->id.'#'.$_GET['rowid']);
exit; exit;
@ -1360,7 +1360,7 @@ if (GETPOST('action') == 'builddoc') // En get ou en post
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$result=facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs); $result=facture_pdf_create($db, $object, '', $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
if ($result <= 0) if ($result <= 0)
{ {
dol_print_error($db,$result); dol_print_error($db,$result);
@ -2856,7 +2856,7 @@ else
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$result=facture_pdf_create($db, $object, '', $_REQUEST['model'], $outputlangs); $result=facture_pdf_create($db, $object, '', $_REQUEST['model'], $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
if ($result <= 0) if ($result <= 0)
{ {
dol_print_error($db,$result); dol_print_error($db,$result);