Fix: la slection du modle pdf n'tait pas enregistr dans la facture

This commit is contained in:
Regis Houssin 2006-06-02 16:47:59 +00:00
parent da1a5490e2
commit 8ce687ecd4
4 changed files with 33 additions and 2 deletions

View File

@ -622,6 +622,8 @@ if ($_REQUEST['action'] == 'builddoc') // En get ou en post
{
$outputlangs = new Translate(DOL_DOCUMENT_ROOT ."/langs");
$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);
if ($result <= 0)
{

View File

@ -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

View File

@ -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;
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;

View File

@ -52,5 +52,5 @@ create table llx_facture
note text,
note_public text,
model varchar(50)
model_pdf varchar(50)
)type=innodb;