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:44:58 +00:00
parent 860563b347
commit bd8e0e88a5
6 changed files with 32 additions and 29 deletions

View File

@ -168,7 +168,7 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit;
@ -198,7 +198,7 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
}
else
{
@ -348,7 +348,7 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit;
@ -606,7 +606,7 @@ if ($_GET['action'] == 'modif' && $user->rights->propale->creer)
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
}
if ($_POST['action'] == "setabsolutediscount" && $user->rights->propale->creer)
@ -760,7 +760,7 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
unset($_POST['qty']);
unset($_POST['type']);
@ -838,7 +838,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
}
}
@ -865,7 +865,7 @@ if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=propale_pdf_create($db, $object, $object->modelpdf, $outputlangs);
$result=propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
if ($result <= 0)
{
dol_print_error($db,$result);
@ -943,7 +943,7 @@ if ($_GET['action'] == 'up' && $user->rights->propale->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit;
@ -965,7 +965,7 @@ if ($_GET['action'] == 'down' && $user->rights->propale->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs);
propale_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit;
@ -1425,7 +1425,7 @@ if ($id > 0 || ! empty($ref))
}
print '<table id="tablelines" class="noborder" width="100%">';
// Show object lines
if (! empty($object->lines)) $object->printObjectLines(0,$mysoc,$soc);

View File

@ -165,7 +165,7 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs);
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
}
else
{
@ -241,10 +241,10 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
{
$lines = $srcobject->lines;
if (empty($lines) && method_exists($srcobject,'fetch_lines')) $lines = $srcobject->fetch_lines();
$fk_parent_line=0;
$num=sizeof($lines);
for ($i=0;$i<$num;$i++)
{
$desc=($lines[$i]->desc?$lines[$i]->desc:$lines[$i]->libelle);
@ -258,7 +258,7 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
$date_end=$lines[$i]->date_fin_prevue;
if ($lines[$i]->date_fin_reel) $date_end=$lines[$i]->date_fin_reel;
if ($lines[$i]->date_end) $date_end=$lines[$i]->date_end;
// 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) {
$fk_parent_line = 0;
@ -291,13 +291,13 @@ if ($_POST['action'] == 'add' && $user->rights->commande->creer)
$error++;
break;
}
// Defined the new fk_parent_line
if ($result > 0 && $lines[$i]->product_type == 9) {
$fk_parent_line = $result;
}
}
// Hooks
if (! empty($object->hooks))
{
@ -612,7 +612,7 @@ if ($_POST['action'] == 'addline' && $user->rights->commande->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs);
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
unset($_POST['qty']);
unset($_POST['type']);
@ -720,7 +720,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs);
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
}
else
{
@ -754,7 +754,7 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs);
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
}
}
@ -793,7 +793,7 @@ if ($_GET['action'] == 'modif' && $user->rights->commande->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs);
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
}
}
@ -818,7 +818,7 @@ if ($_GET['action'] == 'up' && $user->rights->commande->creer)
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs);
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$comid.'#'.$_GET['rowid']);
exit;
@ -840,7 +840,7 @@ if ($_GET['action'] == 'down' && $user->rights->commande->creer)
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs);
commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$comid.'#'.$_GET['rowid']);
exit;
@ -872,7 +872,7 @@ if ($_REQUEST['action'] == 'builddoc') // In get or post
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$result=commande_pdf_create($db, $object, $object->modelpdf, $outputlangs);
$result=commande_pdf_create($db, $object, $object->modelpdf, $outputlangs, GETPOST('hidedetails'), GETPOST('hidedesc'), GETPOST('hideref'));
if ($result <= 0)
{
dol_print_error($db,$result);
@ -1377,7 +1377,7 @@ if ($_GET['action'] == 'create' && $user->rights->commande->creer)
print_titre($title);
print '<table class="noborder" width="100%">';
$objectsrc->printOriginLinesList($object);
print '</table>';

View File

@ -71,7 +71,6 @@ if ($_POST["action"] == 'builddoc')
else
{
$outputlangs->charset_output=$sav_charset_output;
dol_syslog("Erreur dans commande_pdf_create");
dol_print_error($db,$obj->error);
}

View File

@ -142,8 +142,10 @@ class ModeleNumRefCommandes
* @param outputlangs objet lang a utiliser pour traduction
* @param hidedetails Hide details of lines
* @param hidedesc Hide description
* @param hideref Hide ref
* @return int 0 if KO, 1 if OK
*/
function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0)
function commande_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$langs;
$langs->load("orders");

View File

@ -142,9 +142,10 @@ class ModeleNumRefFactures
* @param outputlangs objet lang a utiliser pour traduction
* @param hidedetails Hide details of lines
* @param hidedesc Hide description
* @param hideref Hide ref
* @return int <0 if KO, >0 if OK
*/
function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hidedetails=0, $hidedesc=0)
function facture_pdf_create($db, $object, $message, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $conf,$langs;
$langs->load("bills");

View File

@ -138,9 +138,10 @@ class ModeleNumRefPropales
* @param outputlangs objet lang a utiliser pour traduction
* @param hidedetails Hide details of lines
* @param hidedesc Hide description
* @return int 0 si KO, 1 si OK
* @param hideref Hide ref
* @return int 0 if KO, 1 if OK
*/
function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0)
function propale_pdf_create($db, $object, $modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{
global $langs;
$langs->load("propale");