forked from Wavyzz/dolibarr
Fix: Gestion multilangue sur les modeles de document gnrs
This commit is contained in:
@@ -96,9 +96,12 @@ if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes
|
||||
{
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET['propalid']);
|
||||
$propal->delete_product($_GET['ligne']);
|
||||
$result=$propal->delete_product($_GET['ligne']);
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
|
||||
}
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$_GET['propalid']);
|
||||
@@ -112,8 +115,11 @@ if ($_POST['action'] == 'confirm_validate' && $_POST['confirm'] == 'yes')
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET['propalid']);
|
||||
$result=$propal->update_price($_GET['propalid']);
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
|
||||
$result=$propal->valid($user);
|
||||
}
|
||||
@@ -229,8 +235,11 @@ if ($_POST['action'] == 'add')
|
||||
$db->commit();
|
||||
|
||||
// Generation document PDF
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
propale_pdf_create($db, $id, $_POST['model'], $outputlangs);
|
||||
|
||||
Header ('Location: '.$_SERVER["PHP_SELF"].'?propalid='.$id);
|
||||
@@ -465,8 +474,11 @@ if ($_POST['action'] == "addligne" && $user->rights->propale->creer)
|
||||
$_POST['remise_percent']
|
||||
);
|
||||
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
|
||||
}
|
||||
}
|
||||
@@ -486,8 +498,11 @@ if ($_POST['action'] == 'updateligne' && $user->rights->propale->creer && $_POST
|
||||
$_POST['tva_tx'],
|
||||
$_POST['desc']);
|
||||
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
|
||||
}
|
||||
|
||||
@@ -499,8 +514,11 @@ if ($_REQUEST['action'] == 'builddoc' && $user->rights->propale->creer)
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET['propalid']);
|
||||
if ($_POST['model']) $propal->set_pdf_model($user, $_POST['model']);
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
|
||||
}
|
||||
|
||||
@@ -513,8 +531,11 @@ if ($_GET['action'] == 'del_ligne' && $user->rights->propale->creer && !$conf->g
|
||||
$propal = new Propal($db);
|
||||
$propal->fetch($_GET['propalid']);
|
||||
$propal->delete_product($_GET['ligne']);
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
propale_pdf_create($db, $propal->id, $propal->modelpdf, $outputlangs);
|
||||
}
|
||||
|
||||
|
||||
@@ -253,8 +253,11 @@ if ($_POST['action'] == 'addligne' && $user->rights->commande->creer)
|
||||
$_POST['remise_percent']
|
||||
);
|
||||
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
|
||||
}
|
||||
}
|
||||
@@ -276,9 +279,12 @@ if ($_POST['action'] == 'updateligne' && $user->rights->commande->creer && $_POS
|
||||
);
|
||||
|
||||
if ($result >= 0)
|
||||
{
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
commande_pdf_create($db, $commande->id, $commande->modelpdf, $outputlangs);
|
||||
}
|
||||
else
|
||||
@@ -301,7 +307,12 @@ if ($_GET['action'] == 'deleteline' && $user->rights->commande->creer && !$conf-
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($_GET['id']);
|
||||
$result = $commande->delete_line($_GET['lineid']);
|
||||
commande_pdf_create($db, $_GET['id'], $commande->modelpdf);
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
commande_pdf_create($db, $_GET['id'], $commande->modelpdf, $outputlangs);
|
||||
Header('Location: fiche.php?id='.$_GET['id']);
|
||||
exit;
|
||||
}
|
||||
@@ -348,7 +359,12 @@ if ($_POST['action'] == 'confirm_deleteproductline' && $_POST['confirm'] == 'yes
|
||||
$commande = new Commande($db);
|
||||
$commande->fetch($_GET['id']);
|
||||
$commande->delete_line($_GET['lineid']);
|
||||
commande_pdf_create($db, $_GET['id'], $commande->modelpdf);
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
commande_pdf_create($db, $_GET['id'], $commande->modelpdf, $outputlangs);
|
||||
}
|
||||
Header('Location: '.$_SERVER["PHP_SELF"].'?id='.$_GET['id']);
|
||||
exit;
|
||||
@@ -386,13 +402,16 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
||||
* Generation de la commande
|
||||
* d<>finit dans /includes/modules/commande/modules_commande.php
|
||||
*/
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
|
||||
// Sauvegarde le dernier mod<6F>le choisi pour g<>n<EFBFBD>rer un document
|
||||
$commande = new Commande($db, 0, $_REQUEST['id']);
|
||||
$commande->set_pdf_model($user, $_REQUEST['model']);
|
||||
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
$result=commande_pdf_create($db, $_REQUEST['id'],$_REQUEST['model'],$outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
@@ -1697,9 +1716,12 @@ else
|
||||
|
||||
// Construit PDF si non existant
|
||||
if (! is_readable($file))
|
||||
{
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
$result=commande_pdf_create($db, $_REQUEST['id'], '', $_REQUEST['model'], $outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
|
||||
@@ -141,9 +141,12 @@ if ($_POST['action'] == 'confirm_valid' && $_POST['confirm'] == 'yes' && $user->
|
||||
$soc->fetch($fac->socidp);
|
||||
$result = $fac->set_valid($fac->id, $user, $soc);
|
||||
if ($result)
|
||||
{
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
facture_pdf_create($db, $fac->id, '', $_REQUEST['model'], $outputlangs);
|
||||
}
|
||||
}
|
||||
@@ -477,8 +480,11 @@ if ($_POST['action'] == 'updateligne' && $user->rights->facture->creer && $_POST
|
||||
$_POST['tva_tx']
|
||||
);
|
||||
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
facture_pdf_create($db, $fac->id, '', $fac->modelpdf, $outputlangs);
|
||||
|
||||
$_GET['facid']=$_POST['facid']; // Pour r<>affichage de la fiche en cours d'<27>dition
|
||||
@@ -682,8 +688,11 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
||||
$facture = new Facture($db, 0, $_GET['facid']);
|
||||
$facture->fetch($_GET['facid']);
|
||||
if ($_REQUEST['model']) $facture->set_pdf_model($user, $_REQUEST['model']);
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
$result=facture_pdf_create($db, $facture->id, '', $facture->modelpdf, $outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
@@ -2269,9 +2278,12 @@ else
|
||||
|
||||
// Construit PDF si non existant
|
||||
if (! is_readable($file))
|
||||
{
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
$result=facture_pdf_create($db, $fac->id, '', $_REQUEST['model'], $outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
@@ -2320,9 +2332,12 @@ else
|
||||
|
||||
// Construit PDF si non existant
|
||||
if (! is_readable($file))
|
||||
{
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
if ($_REQUEST['lang_id']) $outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
$result=facture_pdf_create($db, $fac->id, '', $_REQUEST['model'], $outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
|
||||
@@ -134,8 +134,11 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
|
||||
*/
|
||||
if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
||||
{
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
$result=expedition_pdf_create($db, $_REQUEST['id'],$_REQUEST['model'],$outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
|
||||
@@ -105,8 +105,11 @@ if ($_POST["action"] == 'update')
|
||||
*/
|
||||
if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
||||
{
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
$result=fichinter_pdf_create($db, $_REQUEST['id'], $_REQUEST['model'], $outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
|
||||
@@ -202,13 +202,23 @@ if ($_POST["action"] == 'confirm_cancel' && $_POST["confirm"] == yes && $user->r
|
||||
*/
|
||||
if ($_POST['action'] == 'builddoc')
|
||||
{
|
||||
commande_supplier_pdf_create($db, $_GET['id'],$_POST['model']);
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
commande_supplier_pdf_create($db, $_GET['id'],$_POST['model'],$outputlangs);
|
||||
}
|
||||
if($_GET['action'] == 'builddoc')
|
||||
{
|
||||
$commande = new CommandeFournisseur($db);
|
||||
$commande->fetch($_GET['id']);
|
||||
commande_supplier_pdf_create($db, $_GET['id'],$commande->modelpdf);
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
commande_supplier_pdf_create($db, $_GET['id'],$commande->modelpdf,$outputlangs);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -135,7 +135,7 @@ class ModeleNumRefCommandesSuppliers
|
||||
}
|
||||
|
||||
}
|
||||
function commande_supplier_pdf_create($db, $comid, $modele='')
|
||||
function commande_supplier_pdf_create($db, $comid, $modele='',$outputlangs='')
|
||||
{
|
||||
global $langs;
|
||||
$langs->load("suppliers");
|
||||
@@ -164,7 +164,7 @@ function commande_supplier_pdf_create($db, $comid, $modele='')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ( $obj->write_pdf_file($comid) > 0)
|
||||
if ($obj->write_pdf_file($comid,$outputlangs) > 0)
|
||||
{
|
||||
// on supprime l'image correspondant au preview
|
||||
commande_supplier_delete_preview($db, $comid);
|
||||
|
||||
@@ -184,7 +184,7 @@ function commande_pdf_create($db, $id, $modele='', $outputlangs='')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ( $obj->write_pdf_file($id, $outputlangs) > 0)
|
||||
if ($obj->write_pdf_file($id, $outputlangs) > 0)
|
||||
{
|
||||
// on supprime l'image correspondant au preview
|
||||
commande_delete_preview($db, $id);
|
||||
|
||||
@@ -799,7 +799,7 @@ class pdf_crabe extends ModelePDFFactures
|
||||
$pdf->SetTextColor(0,0,60);
|
||||
$pdf->MultiCell(100, 4, $outputlangs->trans("Ref")." : " . $fac->ref, '', 'R');
|
||||
|
||||
$pdf->SetFont('Arial','B',12);
|
||||
$pdf->SetFont('Arial','',12);
|
||||
|
||||
$posy+=6;
|
||||
$pdf->SetXY(100,$posy);
|
||||
|
||||
@@ -178,7 +178,7 @@ function fichinter_pdf_create($db, $id, $modele='', $outputlangs='')
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ( $obj->write_pdf_file($id,$outputlangs) > 0)
|
||||
if ($obj->write_pdf_file($id,$outputlangs) > 0)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -140,8 +140,11 @@ if ($_POST["action"] == 'confirm_delete' && $_POST["confirm"] == 'yes')
|
||||
*/
|
||||
if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
||||
{
|
||||
if ($_REQUEST['lang_id'])
|
||||
{
|
||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||
}
|
||||
$result=delivery_order_pdf_create($db, $_REQUEST['id'],$_REQUEST['model'],$outputlangs);
|
||||
if ($result <= 0)
|
||||
{
|
||||
|
||||
@@ -164,7 +164,7 @@ function delivery_order_pdf_create($db, $deliveryid, $modele='', $outputlangs=''
|
||||
|
||||
$obj = new $classname($db);
|
||||
|
||||
if ( $obj->write_pdf_file($deliveryid) > 0)
|
||||
if ($obj->write_pdf_file($deliveryid,$outputlangs) > 0)
|
||||
{
|
||||
// on supprime l'image correspondant au preview
|
||||
delivery_order_delete_preview($db, $deliveryid);
|
||||
|
||||
Reference in New Issue
Block a user