FIX Do not generate the contract PDF if not default template defined
This commit is contained in:
parent
87f82c1064
commit
eabafde91f
@ -2441,18 +2441,15 @@ class Contrat extends CommonObject
|
||||
* @param int $hidedetails Hide details of lines
|
||||
* @param int $hidedesc Hide description
|
||||
* @param int $hideref Hide ref
|
||||
* @param null|array $moreparams Array to provide more information
|
||||
* @return int 0 if KO, 1 if OK
|
||||
* @param null|array $moreparams Array to provide more information
|
||||
* @return int < 0 if KO, 0 = no doc generated, > 0 if OK
|
||||
*/
|
||||
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load("contracts");
|
||||
$outputlangs->load("products");
|
||||
|
||||
if (!dol_strlen($modele)) {
|
||||
$modele = 'strato';
|
||||
$modele = ''; // No doc template/generation by default
|
||||
|
||||
if (!empty($this->model_pdf)) {
|
||||
$modele = $this->model_pdf;
|
||||
@ -2463,9 +2460,15 @@ class Contrat extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
$modelpath = "core/modules/contract/doc/";
|
||||
if (empty($modele)) {
|
||||
return 0;
|
||||
} else {
|
||||
$langs->load("contracts");
|
||||
$outputlangs->load("products");
|
||||
|
||||
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
$modelpath = "core/modules/contract/doc/";
|
||||
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -3187,26 +3187,28 @@ class CommandeFournisseur extends CommonOrder
|
||||
* @param int $hidedesc Hide description
|
||||
* @param int $hideref Hide ref
|
||||
* @param null|array $moreparams Array to provide more information
|
||||
* @return int 0 if KO, 1 if OK
|
||||
* @return int < 0 if KO, 0 = no doc generated, > 0 if OK
|
||||
*/
|
||||
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load("suppliers");
|
||||
$outputlangs->load("products");
|
||||
|
||||
if (!dol_strlen($modele)) {
|
||||
$modele = '';
|
||||
if ($this->model_pdf) {
|
||||
$modele = ''; // No doc template/generation by default
|
||||
|
||||
if (!empty($this->model_pdf)) {
|
||||
$modele = $this->model_pdf;
|
||||
} elseif (!empty($conf->global->COMMANDE_SUPPLIER_ADDON_PDF)) {
|
||||
$modele = $conf->global->COMMANDE_SUPPLIER_ADDON_PDF;
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($modele)) {
|
||||
return 0;
|
||||
} else {
|
||||
$langs->load("suppliers");
|
||||
$outputlangs->load("products");
|
||||
|
||||
$modelpath = "core/modules/supplier_order/doc/";
|
||||
return $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user