Fix: Il fallait générer 2 fois le document quand on changeait de modèle
This commit is contained in:
parent
0cb701b682
commit
ceb10ce850
@ -933,30 +933,32 @@ class Commande extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
/**
|
||||||
*
|
* \brief Positionne modele derniere generation
|
||||||
*
|
* \param user Objet use qui modifie
|
||||||
*/
|
* \param modelpdf Nom du modele
|
||||||
|
*/
|
||||||
function set_pdf_model($user, $modelpdf)
|
function set_pdf_model($user, $modelpdf)
|
||||||
{
|
{
|
||||||
if ($user->rights->commande->creer)
|
if ($user->rights->commande->creer)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande SET model_pdf = '$modelpdf'";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."commande SET model_pdf = '$modelpdf'";
|
||||||
$sql .= " WHERE rowid = $this->id AND fk_statut < 2 ;";
|
$sql .= " WHERE rowid = $this->id AND fk_statut < 2 ;";
|
||||||
|
|
||||||
if ($this->db->query($sql) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
return 1;
|
$this->modelpdf=$modelpdf;
|
||||||
}
|
return 1;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
dolibarr_print_error($this->db);
|
{
|
||||||
return 0;
|
dolibarr_print_error($this->db);
|
||||||
}
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Reinitialise le tableau lignes
|
* \brief Reinitialise le tableau lignes
|
||||||
|
|||||||
@ -1030,31 +1030,31 @@ class Facture extends CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
function set_pdf_model($user, $modelpdf)
|
/**
|
||||||
{
|
* \brief Positionne modele derniere generation
|
||||||
if ($user->rights->facture->creer)
|
* \param user Objet use qui modifie
|
||||||
{
|
* \param modelpdf Nom du modele
|
||||||
|
*/
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET model_pdf = '$modelpdf'";
|
function set_pdf_model($user, $modelpdf)
|
||||||
$sql .= " WHERE rowid = $this->id AND fk_statut < 2 ;";
|
{
|
||||||
|
if ($user->rights->facture->creer)
|
||||||
if ($this->db->query($sql) )
|
{
|
||||||
{
|
$sql = "UPDATE ".MAIN_DB_PREFIX."facture SET model_pdf = '$modelpdf'";
|
||||||
return 1;
|
$sql .= " WHERE rowid = $this->id AND fk_statut < 2 ;";
|
||||||
}
|
|
||||||
else
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
dolibarr_print_error($this->db);
|
$this->modelpdf=$modelpdf;
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
}
|
{
|
||||||
|
dolibarr_print_error($this->db);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Ajoute un produit dans les tableaux products, products_qty, products_date_start|end
|
* \brief Ajoute un produit dans les tableaux products, products_qty, products_date_start|end
|
||||||
|
|||||||
@ -780,29 +780,30 @@ class CommandeFournisseur extends Commande
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* \brief Positionne modele derniere generation
|
||||||
*
|
* \param user Objet use qui modifie
|
||||||
*
|
* \param modelpdf Nom du modele
|
||||||
*/
|
*/
|
||||||
function set_pdf_model($user, $modelpdf)
|
function set_pdf_model($user, $modelpdf)
|
||||||
{
|
{
|
||||||
if ($user->rights->fournisseur->commande->creer)
|
if ($user->rights->fournisseur->commande->creer)
|
||||||
{
|
{
|
||||||
|
|
||||||
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET model_pdf = '$modelpdf'";
|
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET model_pdf = '$modelpdf'";
|
||||||
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
|
$sql .= " WHERE rowid = $this->id AND fk_statut = 0 ;";
|
||||||
|
|
||||||
if ($this->db->query($sql) )
|
if ($this->db->query($sql) )
|
||||||
{
|
{
|
||||||
return 1;
|
$this->modelpdf=$modelpdf;
|
||||||
}
|
return 1;
|
||||||
else
|
}
|
||||||
{
|
else
|
||||||
dolibarr_print_error($this->db);
|
{
|
||||||
return 0;
|
dolibarr_print_error($this->db);
|
||||||
}
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user