In case Model for document generation is not defined, the criteria to select the model is now:

1. Model for the object
 2. Custom default module
 3. Hardcoded default module
This commit is contained in:
Marcos García de La Fuente 2017-01-16 21:16:05 +01:00
parent da64d4d398
commit e0cbcadd98
12 changed files with 94 additions and 120 deletions

View File

@ -1818,16 +1818,14 @@ class Adherent extends CommonObject
$langs->load("orders"); $langs->load("orders");
// Positionne le modele sur le nom du modele a utiliser if (! dol_strlen($modele)) {
if (! dol_strlen($modele))
{
if (! empty($conf->global->ADHERENT_ADDON_PDF))
{
$modele = $conf->global->ADHERENT_ADDON_PDF;
}
else
{
$modele = 'standard'; $modele = 'standard';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->ADHERENT_ADDON_PDF)) {
$modele = $conf->global->ADHERENT_ADDON_PDF;
} }
} }

View File

@ -3434,16 +3434,14 @@ class Propal extends CommonObject
$langs->load("propale"); $langs->load("propale");
// Positionne le modele sur le nom du modele a utiliser if (! dol_strlen($modele)) {
if (! dol_strlen($modele))
{
if (! empty($conf->global->PROPALE_ADDON_PDF))
{
$modele = $conf->global->PROPALE_ADDON_PDF;
}
else
{
$modele = 'azur'; $modele = 'azur';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->PROPALE_ADDON_PDF)) {
$modele = $conf->global->PROPALE_ADDON_PDF;
} }
} }

View File

@ -3641,16 +3641,14 @@ class Commande extends CommonOrder
$langs->load("orders"); $langs->load("orders");
// Positionne le modele sur le nom du modele a utiliser if (! dol_strlen($modele)) {
if (! dol_strlen($modele))
{
if (! empty($conf->global->COMMANDE_ADDON_PDF))
{
$modele = $conf->global->COMMANDE_ADDON_PDF;
}
else
{
$modele = 'einstein'; $modele = 'einstein';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->COMMANDE_ADDON_PDF)) {
$modele = $conf->global->COMMANDE_ADDON_PDF;
} }
} }

View File

@ -3967,24 +3967,20 @@ class Facture extends CommonInvoice
$langs->load("bills"); $langs->load("bills");
// Positionne le modele sur le nom du modele a utiliser if (! dol_strlen($modele)) {
if (! dol_strlen($modele))
{
if (! empty($conf->global->FACTURE_ADDON_PDF))
{
$modele = $conf->global->FACTURE_ADDON_PDF;
}
else
{
$modele = 'crabe'; $modele = 'crabe';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->FACTURE_ADDON_PDF)) {
$modele = $conf->global->FACTURE_ADDON_PDF;
} }
} }
$modelpath = "core/modules/facture/doc/"; $modelpath = "core/modules/facture/doc/";
$result=$this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref); return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref);
return $result;
} }
/** /**

View File

@ -2199,20 +2199,18 @@ class Contrat extends CommonObject
*/ */
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
global $conf,$user,$langs; global $conf,$langs;
$langs->load("contracts"); $langs->load("contracts");
// Positionne le modele sur le nom du modele a utiliser if (! dol_strlen($modele)) {
if (! dol_strlen($modele))
{
if (! empty($conf->global->CONTRACT_ADDON_PDF))
{
$modele = $conf->global->CONTRACT_ADDON_PDF;
}
else
{
$modele = 'strato'; $modele = 'strato';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->CONTRACT_ADDON_PDF)) {
$modele = $conf->global->CONTRACT_ADDON_PDF;
} }
} }

View File

@ -2162,16 +2162,14 @@ class Expedition extends CommonObject
$langs->load("sendings"); $langs->load("sendings");
// Sets the model on the model name to use if (! dol_strlen($modele)) {
if (! dol_strlen($modele))
{
if (! empty($conf->global->EXPEDITION_ADDON_PDF))
{
$modele = $conf->global->EXPEDITION_ADDON_PDF;
}
else
{
$modele = 'rouget'; $modele = 'rouget';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->EXPEDITION_ADDON_PDF)) {
$modele = $conf->global->EXPEDITION_ADDON_PDF;
} }
} }

View File

@ -1573,16 +1573,14 @@ class ExpenseReport extends CommonObject
$langs->load("trips"); $langs->load("trips");
// Positionne le modele sur le nom du modele a utiliser if (! dol_strlen($modele)) {
if (! dol_strlen($modele))
{
if (! empty($conf->global->EXPENSEREPORT_ADDON_PDF))
{
$modele = $conf->global->EXPENSEREPORT_ADDON_PDF;
}
else
{
$modele = 'standard'; $modele = 'standard';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->EXPENSEREPORT_ADDON_PDF)) {
$modele = $conf->global->EXPENSEREPORT_ADDON_PDF;
} }
} }

View File

@ -2686,20 +2686,18 @@ class CommandeFournisseur extends CommonOrder
*/ */
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
global $conf, $user, $langs; global $conf, $langs;
$langs->load("suppliers"); $langs->load("suppliers");
// Sets the model on the model name to use if (! dol_strlen($modele)) {
if (! dol_strlen($modele))
{
if (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF))
{
$modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF;
}
else
{
$modele = 'muscadet'; $modele = 'muscadet';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) {
$modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF;
} }
} }

View File

@ -1009,16 +1009,14 @@ class Livraison extends CommonObject
$langs->load("deliveries"); $langs->load("deliveries");
// Positionne modele sur le nom du modele de bon de livraison a utiliser if (! dol_strlen($modele)) {
if (! dol_strlen($modele))
{
if (! empty($conf->global->LIVRAISON_ADDON_PDF))
{
$modele = $conf->global->LIVRAISON_ADDON_PDF;
}
else
{
$modele = 'typhon'; $modele = 'typhon';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->LIVRAISON_ADDON_PDF)) {
$modele = $conf->global->LIVRAISON_ADDON_PDF;
} }
} }

View File

@ -1569,16 +1569,14 @@ class Project extends CommonObject
$langs->load("projects"); $langs->load("projects");
// Positionne modele sur le nom du modele de projet a utiliser if (! dol_strlen($modele)) {
if (! dol_strlen($modele))
{
if (! empty($conf->global->PROJECT_ADDON_PDF))
{
$modele = $conf->global->PROJECT_ADDON_PDF;
}
else
{
$modele = 'baleine'; $modele = 'baleine';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->PROJECT_ADDON_PDF)) {
$modele = $conf->global->PROJECT_ADDON_PDF;
} }
} }

View File

@ -1619,16 +1619,14 @@ class Task extends CommonObject
$langs->load("projects"); $langs->load("projects");
// Positionne modele sur le nom du modele de projet a utiliser if (! dol_strlen($modele)) {
if (! dol_strlen($modele))
{
if (! empty($conf->global->PROJECT_TASK_ADDON_PDF))
{
$modele = $conf->global->PROJECT_TASK_ADDON_PDF;
}
else
{
$modele = 'nodefault'; $modele = 'nodefault';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->PROJECT_TASK_ADDON_PDF)) {
$modele = $conf->global->PROJECT_TASK_ADDON_PDF;
} }
} }

View File

@ -2510,20 +2510,18 @@ class SupplierProposal extends CommonObject
*/ */
public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0) public function generateDocument($modele, $outputlangs, $hidedetails=0, $hidedesc=0, $hideref=0)
{ {
global $conf,$user,$langs; global $conf, $langs;
$langs->load("supplier_proposal"); $langs->load("supplier_proposal");
// Positionne le modele sur le nom du modele a utiliser if (! dol_strlen($modele)) {
if (! dol_strlen($modele))
{
if (! empty($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF))
{
$modele = $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF;
}
else
{
$modele = 'aurore'; $modele = 'aurore';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->SUPPLIER_PROPOSAL_ADDON_PDF)) {
$modele = $conf->global->SUPPLIER_PROPOSAL_ADDON_PDF;
} }
} }