mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-28 04:11:33 +01:00
Fixed expense report document generation. Cleaned error messages.
This commit is contained in:
@@ -268,7 +268,7 @@ class Documents extends DolibarrApi
|
||||
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document missing doctemplate parameter');
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
} elseif ($modulepart == 'expedition' || $modulepart == 'shipment') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/expedition/class/expedition.class.php';
|
||||
@@ -284,7 +284,7 @@ class Documents extends DolibarrApi
|
||||
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document missing doctemplate parameter');
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
} elseif ($modulepart == 'mrp') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/mrp/class/mo.class.php';
|
||||
@@ -300,7 +300,7 @@ class Documents extends DolibarrApi
|
||||
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document missing doctemplate parameter');
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
} elseif ($modulepart == 'expensereport') {
|
||||
require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php';
|
||||
@@ -309,7 +309,14 @@ class Documents extends DolibarrApi
|
||||
$result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file)));
|
||||
|
||||
if (!$result) {
|
||||
throw new RestException(404, 'Exepnse report not found');
|
||||
throw new RestException(404, 'Expense report not found');
|
||||
}
|
||||
|
||||
$templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf;
|
||||
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
} elseif ($modulepart == 'product') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
|
||||
@@ -325,7 +332,7 @@ class Documents extends DolibarrApi
|
||||
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document missing doctemplate parameter');
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
} elseif ($modulepart == 'stock' || $modulepart == 'entrepot') {
|
||||
require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php';
|
||||
@@ -341,7 +348,7 @@ class Documents extends DolibarrApi
|
||||
$result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref);
|
||||
|
||||
if ($result <= 0) {
|
||||
throw new RestException(500, 'Error generating document missing doctemplate parameter');
|
||||
throw new RestException(500, 'Error generating document');
|
||||
}
|
||||
} else {
|
||||
throw new RestException(403, 'Generation not available for this modulepart');
|
||||
|
||||
Reference in New Issue
Block a user