FIX #14979
This commit is contained in:
parent
ad922bfde6
commit
72160deef7
@ -717,6 +717,7 @@ if (empty($reshook))
|
||||
$outputlangs->load('products');
|
||||
}
|
||||
$model = $object->modelpdf;
|
||||
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
|
||||
$result = $object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
@ -2523,7 +2523,7 @@ class Facture extends CommonInvoice
|
||||
$this->db->begin();
|
||||
|
||||
// Check parameters
|
||||
if ($this->type == self::TYPE_REPLACEMENT) // si facture de remplacement
|
||||
if ($this->type == self::TYPE_REPLACEMENT) // if this is a replacement invoice
|
||||
{
|
||||
// Controle que facture source connue
|
||||
if ($this->fk_facture_source <= 0)
|
||||
@ -2533,7 +2533,7 @@ class Facture extends CommonInvoice
|
||||
return -10;
|
||||
}
|
||||
|
||||
// Charge la facture source a remplacer
|
||||
// Load source invoice that has been replaced
|
||||
$facreplaced = new Facture($this->db);
|
||||
$result = $facreplaced->fetch($this->fk_facture_source);
|
||||
if ($result <= 0)
|
||||
@ -2543,7 +2543,7 @@ class Facture extends CommonInvoice
|
||||
return -11;
|
||||
}
|
||||
|
||||
// Controle que facture source non deja remplacee par une autre
|
||||
// Check that source invoice not already replaced by another one.
|
||||
$idreplacement = $facreplaced->getIdReplacingInvoice('validated');
|
||||
if ($idreplacement && $idreplacement != $this->id)
|
||||
{
|
||||
@ -4397,15 +4397,14 @@ class Facture extends CommonInvoice
|
||||
* @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
|
||||
* @param null|array $moreparams Array to provide more information
|
||||
* @return int <0 if KO, >0 if OK
|
||||
*/
|
||||
public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$langs->load("bills");
|
||||
$outputlangs->load("products");
|
||||
$outputlangs->loadLangs(array("bills", "products"));
|
||||
|
||||
if (!dol_strlen($modele))
|
||||
{
|
||||
|
||||
@ -320,6 +320,7 @@ if ($action == 'confirm_validate' && $confirm == 'yes' && $permissiontoadd)
|
||||
$outputlangs->setDefaultLang($newlang);
|
||||
}
|
||||
$model = $object->modelpdf;
|
||||
|
||||
$ret = $object->fetch($id); // Reload to get new records
|
||||
|
||||
$object->generateDocument($model, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
@ -237,6 +237,8 @@ class doc_generic_bom_odt extends ModelePDFBom
|
||||
}
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$dir = $conf->bom->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
|
||||
|
||||
@ -249,6 +249,8 @@ class doc_generic_order_odt extends ModelePDFCommandes
|
||||
}
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$dir = $conf->commande->multidir_output[$object->entity];
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
|
||||
|
||||
@ -235,6 +235,8 @@ class doc_generic_contract_odt extends ModelePDFContract
|
||||
}
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$dir = $conf->contrat->dir_output;
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
|
||||
|
||||
@ -249,6 +249,8 @@ class doc_generic_shipment_odt extends ModelePdfExpedition
|
||||
}
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$dir = $conf->expedition->dir_output."/sending";
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
|
||||
|
||||
@ -248,6 +248,8 @@ class doc_generic_invoice_odt extends ModelePDFFactures
|
||||
}
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$dir = $conf->facture->dir_output;
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
|
||||
|
||||
@ -244,6 +244,8 @@ class doc_generic_mo_odt extends ModelePDFMo
|
||||
}
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$dir = $conf->mrp->multidir_output[isset($object->entity) ? $object->entity : 1];
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
|
||||
|
||||
@ -513,6 +513,8 @@ class doc_generic_project_odt extends ModelePDFProjects
|
||||
}
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$dir = $conf->projet->dir_output;
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
|
||||
|
||||
@ -227,7 +227,7 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
/**
|
||||
* Function to build a document on disk using the generic odt module.
|
||||
*
|
||||
* @param Propale $object Object source to build document
|
||||
* @param Propal $object Object source to build document
|
||||
* @param Translate $outputlangs Lang output object
|
||||
* @param string $srctemplatepath Full path of source filename for generator using a template file
|
||||
* @param int $hidedetails Do not show line details
|
||||
@ -277,6 +277,8 @@ class doc_generic_proposal_odt extends ModelePDFPropales
|
||||
}
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$dir = $conf->propal->multidir_output[$object->entity];
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
|
||||
|
||||
@ -241,6 +241,8 @@ class doc_generic_reception_odt extends ModelePdfReception
|
||||
}
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$dir = $conf->reception->dir_output."/reception";
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
|
||||
|
||||
@ -275,6 +275,8 @@ class doc_generic_supplier_proposal_odt extends ModelePDFSupplierProposal
|
||||
}
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$dir = $conf->supplier_proposal->dir_output;
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
|
||||
|
||||
@ -257,6 +257,8 @@ class doc_generic_user_odt extends ModelePDFUser
|
||||
}
|
||||
}
|
||||
|
||||
$object->fetch_thirdparty();
|
||||
|
||||
$dir = $conf->user->dir_output;
|
||||
$objectref = dol_sanitizeFileName($object->ref);
|
||||
if (!preg_match('/specimen/i', $objectref)) $dir .= "/".$objectref;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user