Fix: la sélection du modèle pdf n'était pas enregistré dans la facture
This commit is contained in:
parent
da1a5490e2
commit
8ce687ecd4
@ -622,6 +622,8 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
|
|||||||
{
|
{
|
||||||
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
|
||||||
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
$outputlangs->setDefaultLang($_REQUEST['lang_id']);
|
||||||
|
$facture = new Facture($db, 0, $_GET['facid']);
|
||||||
|
$facture->set_pdf_model($user, $_POST['model']);
|
||||||
$result=facture_pdf_create($db, $_REQUEST['facid'], '', $_REQUEST['model'], $outputlangs);
|
$result=facture_pdf_create($db, $_REQUEST['facid'], '', $_REQUEST['model'], $outputlangs);
|
||||||
if ($result <= 0)
|
if ($result <= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -893,6 +893,32 @@ class Facture
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
function set_pdf_model($user, $modelpdf)
|
||||||
|
{
|
||||||
|
if ($user->rights->facture->creer)
|
||||||
|
{
|
||||||
|
|
||||||
|
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET model_pdf = '$modelpdf'";
|
||||||
|
$sql .= " WHERE rowid = $this->id AND fk_statut < 2 ;";
|
||||||
|
|
||||||
|
if ($this->db->query($sql) )
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Ajoute un produit dans l'objet facture
|
* \brief Ajoute un produit dans l'objet facture
|
||||||
|
|||||||
@ -268,4 +268,7 @@ insert into llx_rights_def (id, libelle, module, type, bydefault, subperms, perm
|
|||||||
insert into llx_user_rights(fk_user,fk_id) select distinct fk_user, '262' from llx_user_rights where fk_id = 261;
|
insert into llx_user_rights(fk_user,fk_id) select distinct fk_user, '262' from llx_user_rights where fk_id = 261;
|
||||||
|
|
||||||
alter table llx_commandedet add column rang integer DEFAULT 0;
|
alter table llx_commandedet add column rang integer DEFAULT 0;
|
||||||
alter table llx_propaldet add column rang integer DEFAULT 0;
|
alter table llx_propaldet add column rang integer DEFAULT 0;
|
||||||
|
|
||||||
|
alter table llx_facture drop column model;
|
||||||
|
alter table llx_facture add column model_pdf varchar(50) after note_public;
|
||||||
@ -52,5 +52,5 @@ create table llx_facture
|
|||||||
|
|
||||||
note text,
|
note text,
|
||||||
note_public text,
|
note_public text,
|
||||||
model varchar(50)
|
model_pdf varchar(50)
|
||||||
)type=innodb;
|
)type=innodb;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user