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 = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id);
exit; exit;
@ -198,7 +198,7 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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 else
{ {
@ -348,7 +348,7 @@ if ($_POST['action'] == 'add' && $user->rights->propale->creer)
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$id);
exit; exit;
@ -606,7 +606,7 @@ if ($_GET['action'] == 'modif' && $user->rights->propale->creer)
$outputlangs->setDefaultLang($newlang); $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) 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 = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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['qty']);
unset($_POST['type']); unset($_POST['type']);
@ -838,7 +838,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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 = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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) if ($result <= 0)
{ {
dol_print_error($db,$result); dol_print_error($db,$result);
@ -943,7 +943,7 @@ if ($_GET['action'] == 'up' && $user->rights->propale->creer)
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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']); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit; exit;
@ -965,7 +965,7 @@ if ($_GET['action'] == 'down' && $user->rights->propale->creer)
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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']); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'#'.$_GET['rowid']);
exit; exit;

View File

@ -165,7 +165,7 @@ if ($_REQUEST['action'] == 'confirm_deleteline' && $_REQUEST['confirm'] == 'yes'
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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 else
{ {
@ -612,7 +612,7 @@ if ($_POST['action'] == 'addline' && $user->rights->commande->creer)
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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['qty']);
unset($_POST['type']); unset($_POST['type']);
@ -720,7 +720,7 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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 else
{ {
@ -754,7 +754,7 @@ if ($_REQUEST['action'] == 'confirm_validate' && $_REQUEST['confirm'] == 'yes' &
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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 = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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); $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']); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$comid.'#'.$_GET['rowid']);
exit; exit;
@ -840,7 +840,7 @@ if ($_GET['action'] == 'down' && $user->rights->commande->creer)
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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']); Header ('Location: '.$_SERVER["PHP_SELF"].'?id='.$comid.'#'.$_GET['rowid']);
exit; exit;
@ -872,7 +872,7 @@ if ($_REQUEST['action'] == 'builddoc') // In get or post
$outputlangs = new Translate("",$conf); $outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang); $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) if ($result <= 0)
{ {
dol_print_error($db,$result); dol_print_error($db,$result);

View File

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

View File

@ -142,8 +142,10 @@ class ModeleNumRefCommandes
* @param outputlangs objet lang a utiliser pour traduction * @param outputlangs objet lang a utiliser pour traduction
* @param hidedetails Hide details of lines * @param hidedetails Hide details of lines
* @param hidedesc Hide description * @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; global $conf,$langs;
$langs->load("orders"); $langs->load("orders");

View File

@ -142,9 +142,10 @@ class ModeleNumRefFactures
* @param outputlangs objet lang a utiliser pour traduction * @param outputlangs objet lang a utiliser pour traduction
* @param hidedetails Hide details of lines * @param hidedetails Hide details of lines
* @param hidedesc Hide description * @param hidedesc Hide description
* @param hideref Hide ref
* @return int <0 if KO, >0 if OK * @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; global $conf,$langs;
$langs->load("bills"); $langs->load("bills");

View File

@ -138,9 +138,10 @@ class ModeleNumRefPropales
* @param outputlangs objet lang a utiliser pour traduction * @param outputlangs objet lang a utiliser pour traduction
* @param hidedetails Hide details of lines * @param hidedetails Hide details of lines
* @param hidedesc Hide description * @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; global $langs;
$langs->load("propale"); $langs->load("propale");