mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-25 02:03:23 +01:00
wip: api/documents: generate supplier invoices
This commit is contained in:
@@ -198,6 +198,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);
|
||||
|
||||
Reference in New Issue
Block a user