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,18 +1818,16 @@ class Adherent extends CommonObject
$langs->load("orders");
// Positionne le modele sur le nom du modele a utiliser
if (! dol_strlen($modele))
{
if (! empty($conf->global->ADHERENT_ADDON_PDF))
{
$modele = $conf->global->ADHERENT_ADDON_PDF;
}
else
{
$modele = 'standard';
}
}
if (! dol_strlen($modele)) {
$modele = 'standard';
if ($this->modelpdf) {
$modele = $this->modelpdf;
} elseif (! empty($conf->global->ADHERENT_ADDON_PDF)) {
$modele = $conf->global->ADHERENT_ADDON_PDF;
}
}
$modelpath = "core/modules/member/doc/";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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