mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Merge pull request #24734 from romain-neil/feat-buildoc-supplier-inv
Draft: api/documents: generate supplier invoices
This commit is contained in:
commit
37d709475d
|
|
@ -200,6 +200,19 @@ class Documents extends DolibarrApi
|
|||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
} elseif ($modulepart == 'facture_fournisseur' || $modulepart == 'invoice_supplier') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/fourn/class/fournisseur.facture.class.php';
|
||||
$this->supplier_invoice = new FactureFournisseur($this->db);
|
||||
$result = $this->supplier_invoice->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Supplier invoice not found');
|
||||
}
|
||||
|
||||
$templateused = $doctemplate ? $doctemplate : $this->supplier_invoice->model_pdf;
|
||||
$result = $this->supplier_invoice->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
if ($result < 0) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
} elseif ($modulepart == 'commande' || $modulepart == 'order') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/commande/class/commande.class.php';
|
||||
$this->order = new Commande($this->db);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user