mirror of
https://github.com/Karaka-Management/oms-Billing.git
synced 2026-02-16 16:28:41 +00:00
fix bugs
This commit is contained in:
parent
0505984ba2
commit
eb4b435e41
|
|
@ -5,7 +5,7 @@
|
||||||
"type": 2,
|
"type": 2,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Billing",
|
"name": "Billing",
|
||||||
"uri": "{/base}/sales/bill/list?{?}",
|
"uri": "{/base}/sales/bill/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 10,
|
"order": 10,
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Open",
|
"name": "Open",
|
||||||
"uri": "{/base}/sales/bill/list?{?}",
|
"uri": "{/base}/sales/bill/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Archive",
|
"name": "Archive",
|
||||||
"uri": "{/base}/sales/bill/archive?{?}",
|
"uri": "{/base}/sales/bill/archive",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Create",
|
"name": "Create",
|
||||||
"uri": "{/base}/sales/bill/create?{?}",
|
"uri": "{/base}/sales/bill/create",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 10,
|
"order": 10,
|
||||||
|
|
@ -64,7 +64,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "PaymentTerms",
|
"name": "PaymentTerms",
|
||||||
"uri": "{/base}/bill/payment/list?{?}",
|
"uri": "{/base}/bill/payment/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 15,
|
"order": 15,
|
||||||
|
|
@ -79,7 +79,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "ShippingTerms",
|
"name": "ShippingTerms",
|
||||||
"uri": "{/base}/bill/shipping/list?{?}",
|
"uri": "{/base}/bill/shipping/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 20,
|
"order": 20,
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
"type": 2,
|
"type": 2,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Billing",
|
"name": "Billing",
|
||||||
"uri": "{/base}/purchase/bill/list?{?}",
|
"uri": "{/base}/purchase/bill/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 10,
|
"order": 10,
|
||||||
|
|
@ -110,7 +110,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Open",
|
"name": "Open",
|
||||||
"uri": "{/base}/purchase/bill/list?{?}",
|
"uri": "{/base}/purchase/bill/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
|
|
@ -125,7 +125,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Archive",
|
"name": "Archive",
|
||||||
"uri": "{/base}/purchase/bill/archive?{?}",
|
"uri": "{/base}/purchase/bill/archive",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
|
|
@ -140,7 +140,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Create",
|
"name": "Create",
|
||||||
"uri": "{/base}/purchase/bill/create?{?}",
|
"uri": "{/base}/purchase/bill/create",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 10,
|
"order": 10,
|
||||||
|
|
@ -155,7 +155,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Upload",
|
"name": "Upload",
|
||||||
"uri": "{/base}/purchase/bill/upload?{?}",
|
"uri": "{/base}/purchase/bill/upload",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 15,
|
"order": 15,
|
||||||
|
|
@ -172,7 +172,7 @@
|
||||||
"type": 2,
|
"type": 2,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Billing",
|
"name": "Billing",
|
||||||
"uri": "{/base}/warehouse/bill/list?{?}",
|
"uri": "{/base}/warehouse/bill/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
|
|
@ -186,7 +186,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "List",
|
"name": "List",
|
||||||
"uri": "{/base}/warehouse/bill/list?{?}",
|
"uri": "{/base}/warehouse/bill/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
|
|
@ -201,7 +201,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Archive",
|
"name": "Archive",
|
||||||
"uri": "{/base}/warehouse/bill/archive?{?}",
|
"uri": "{/base}/warehouse/bill/archive",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
|
|
@ -216,7 +216,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Create",
|
"name": "Create",
|
||||||
"uri": "{/base}/warehouse/bill/create?{?}",
|
"uri": "{/base}/warehouse/bill/create",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
|
|
@ -233,7 +233,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Bill",
|
"name": "Bill",
|
||||||
"uri": "{/base}/purchase/analysis/bill?{?}",
|
"uri": "{/base}/purchase/analysis/bill",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 15,
|
"order": 15,
|
||||||
|
|
@ -248,7 +248,7 @@
|
||||||
"type": 2,
|
"type": 2,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "InvoiceRecognition",
|
"name": "InvoiceRecognition",
|
||||||
"uri": "{/base}/private/purchase/recognition/dashboard?{?}",
|
"uri": "{/base}/private/purchase/recognition/dashboard",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
|
|
@ -262,7 +262,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "List",
|
"name": "List",
|
||||||
"uri": "{/base}/private/purchase/recognition/dashboard?{?}",
|
"uri": "{/base}/private/purchase/recognition/dashboard",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
|
|
@ -278,7 +278,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Upload",
|
"name": "Upload",
|
||||||
"uri": "{/base}/private/purchase/recognition/upload?{?}",
|
"uri": "{/base}/private/purchase/recognition/upload",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
|
|
@ -296,7 +296,7 @@
|
||||||
"type": 2,
|
"type": 2,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "InvoiceRecognition",
|
"name": "InvoiceRecognition",
|
||||||
"uri": "{/base}/purchase/recognition/dashboard?{?}",
|
"uri": "{/base}/purchase/recognition/dashboard",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
|
|
@ -310,7 +310,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "List",
|
"name": "List",
|
||||||
"uri": "{/base}/purchase/recognition/dashboard?{?}",
|
"uri": "{/base}/purchase/recognition/dashboard",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
|
|
@ -326,7 +326,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Upload",
|
"name": "Upload",
|
||||||
"uri": "{/base}/purchase/recognition/upload?{?}",
|
"uri": "{/base}/purchase/recognition/upload",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
|
|
@ -344,7 +344,7 @@
|
||||||
"type": 2,
|
"type": 2,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "TaxCombinations",
|
"name": "TaxCombinations",
|
||||||
"uri": "{/base}/finance/tax/combination/list?{?}",
|
"uri": "{/base}/finance/tax/combination/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 2,
|
"order": 2,
|
||||||
|
|
@ -358,7 +358,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "List",
|
"name": "List",
|
||||||
"uri": "{/base}/finance/tax/combination/list?{?}",
|
"uri": "{/base}/finance/tax/combination/list",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
|
|
@ -373,7 +373,7 @@
|
||||||
"type": 3,
|
"type": 3,
|
||||||
"subtype": 1,
|
"subtype": 1,
|
||||||
"name": "Create",
|
"name": "Create",
|
||||||
"uri": "{/base}/finance/tax/combination/create?{?}",
|
"uri": "{/base}/finance/tax/combination/create",
|
||||||
"target": "self",
|
"target": "self",
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'^/purchase/bill(\?.*$|$)' => [
|
'^/purchase/bill/view(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaseInvoice',
|
'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaseInvoice',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
@ -164,7 +164,7 @@ return [
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'^/warehouse/bill(\?.*$|$)' => [
|
'^/warehouse/bill/view(\?.*$|$)' => [
|
||||||
[
|
[
|
||||||
'dest' => '\Modules\Billing\Controller\BackendController:viewBillingStockInvoice',
|
'dest' => '\Modules\Billing\Controller\BackendController:viewBillingStockInvoice',
|
||||||
'verb' => RouteVerb::GET,
|
'verb' => RouteVerb::GET,
|
||||||
|
|
|
||||||
|
|
@ -734,88 +734,40 @@ final class ApiBillController extends Controller
|
||||||
$bill = BillMapper::get()->where('id', (int) $request->getData('bill'))->execute();
|
$bill = BillMapper::get()->where('id', (int) $request->getData('bill'))->execute();
|
||||||
$path = $this->createBillDir($bill);
|
$path = $this->createBillDir($bill);
|
||||||
|
|
||||||
$uploaded = [];
|
$uploaded = new NullCollection();
|
||||||
if (!empty($uploadedFiles = $request->files)) {
|
if (!empty($request->files)) {
|
||||||
$uploaded = $this->app->moduleManager->get('Media', 'Api')->uploadFiles(
|
$uploaded = $this->app->moduleManager->get('Media', 'Api')->uploadFiles(
|
||||||
names: [],
|
names: [],
|
||||||
fileNames: [],
|
fileNames: [],
|
||||||
files: $uploadedFiles,
|
files: $request->files,
|
||||||
account: $request->header->account,
|
account: $request->header->account,
|
||||||
basePath: __DIR__ . '/../../../Modules/Media/Files' . $path,
|
basePath: __DIR__ . '/../../../Modules/Media/Files' . $path,
|
||||||
virtualPath: $path,
|
virtualPath: $path,
|
||||||
pathSettings: PathSettings::FILE_PATH,
|
pathSettings: PathSettings::FILE_PATH,
|
||||||
hasAccountRelation: false,
|
hasAccountRelation: false,
|
||||||
readContent: $request->getDataBool('parse_content') ?? false
|
readContent: $request->getDataBool('parse_content') ?? false,
|
||||||
|
type: $request->getDataInt('type'),
|
||||||
|
rel: $bill->id,
|
||||||
|
mapper: BillMapper::class,
|
||||||
|
field: 'files'
|
||||||
);
|
);
|
||||||
|
|
||||||
$collection = null;
|
|
||||||
foreach ($uploaded as $media) {
|
|
||||||
$this->createModelRelation(
|
|
||||||
$request->header->account,
|
|
||||||
$bill->id,
|
|
||||||
$media->id,
|
|
||||||
BillMapper::class,
|
|
||||||
'files',
|
|
||||||
'',
|
|
||||||
$request->getOrigin()
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($request->hasData('type')) {
|
|
||||||
$this->createModelRelation(
|
|
||||||
$request->header->account,
|
|
||||||
$media->id,
|
|
||||||
$request->getDataInt('type'),
|
|
||||||
MediaMapper::class,
|
|
||||||
'types',
|
|
||||||
'',
|
|
||||||
$request->getOrigin()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($collection === null) {
|
|
||||||
/** @var \Modules\Media\Models\Collection $collection */
|
|
||||||
$collection = MediaMapper::getParentCollection($path)
|
|
||||||
->limit(1)
|
|
||||||
->execute();
|
|
||||||
|
|
||||||
if ($collection->id === 0) {
|
|
||||||
$collection = $this->app->moduleManager->get('Media')->createRecursiveMediaCollection(
|
|
||||||
$path,
|
|
||||||
$request->header->account,
|
|
||||||
__DIR__ . '/../../../Modules/Media/Files' . $path,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->createModelRelation(
|
|
||||||
$request->header->account,
|
|
||||||
$collection->id,
|
|
||||||
$media->id,
|
|
||||||
CollectionMapper::class,
|
|
||||||
'sources',
|
|
||||||
'',
|
|
||||||
$request->getOrigin()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$mediaFiles = $request->getDataJson('media');
|
if (!empty($media = $request->getDataJson('media'))) {
|
||||||
foreach ($mediaFiles as $media) {
|
$this->app->moduleManager->get('Media', 'Api')->addMediaToCollectionAndModel(
|
||||||
$this->createModelRelation(
|
|
||||||
$request->header->account,
|
$request->header->account,
|
||||||
|
$media,
|
||||||
$bill->id,
|
$bill->id,
|
||||||
(int) $media,
|
|
||||||
BillMapper::class,
|
BillMapper::class,
|
||||||
'files',
|
'files',
|
||||||
'',
|
$path
|
||||||
$request->getOrigin()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo media should be an array of NullMedia elements
|
// @todo media should be an array of NullMedia elements
|
||||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Media', 'Media added to bill.', [
|
$this->fillJsonResponse($request, $response, NotificationLevel::OK, '', $this->app->l11nManager->getText($response->header->l11n->language, '0', '0', 'SuccessfulAdd'), [
|
||||||
'upload' => $uploaded,
|
'upload' => $uploaded->sources,
|
||||||
'media' => $mediaFiles,
|
'media' => $media,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -422,7 +422,7 @@ echo $this->data['nav']->render(); ?>
|
||||||
<div class="col-xs-12 col-simple">
|
<div class="col-xs-12 col-simple">
|
||||||
<section id="mediaFile" class="portlet col-simple">
|
<section id="mediaFile" class="portlet col-simple">
|
||||||
<div class="portlet-body col-simple">
|
<div class="portlet-body col-simple">
|
||||||
<iframe class="col-simple" id="iPreviewBill" data-src="Resources/mozilla/Pdf/web/viewer.html?file=<?= \urlencode(UriFactory::build('{/api}bill/render/preview?bill=' . $bill->id) . '&bill_type='); ?>{#iBillPreviewType}" loading="lazy" allowfullscreen></iframe>
|
<iframe class="col-simple" id="iPreviewBill" data-src="Resources/mozilla/Pdf/web/viewer.html?file=<?= \urlencode(UriFactory::build('{/api}bill/render/preview?bill=' . $bill->id . '&csrf={$CSRF}') . '&bill_type='); ?>{#iBillPreviewType}" loading="lazy" allowfullscreen></iframe>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -436,7 +436,7 @@ echo $this->data['nav']->render(); ?>
|
||||||
<div class="col-xs-12 col-simple">
|
<div class="col-xs-12 col-simple">
|
||||||
<section id="mediaFile" class="portlet col-simple">
|
<section id="mediaFile" class="portlet col-simple">
|
||||||
<div class="portlet-body col-simple">
|
<div class="portlet-body col-simple">
|
||||||
<iframe class="col-simple" id="iBillArchive" src="Resources/mozilla/Pdf/web/viewer.html?file=<?= \urlencode(UriFactory::build('{/api}bill/render?id=' . $archive->id)); ?>" loading="lazy" allowfullscreen></iframe>
|
<iframe class="col-simple" id="iBillArchive" src="Resources/mozilla/Pdf/web/viewer.html?file=<?= \urlencode(UriFactory::build('{/api}bill/render?id=' . $archive->id . '&csrf={$CSRF}')); ?>" loading="lazy" allowfullscreen></iframe>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -421,7 +421,7 @@ echo $this->data['nav']->render(); ?>
|
||||||
<div class="col-xs-12 col-simple">
|
<div class="col-xs-12 col-simple">
|
||||||
<section id="mediaFile" class="portlet col-simple">
|
<section id="mediaFile" class="portlet col-simple">
|
||||||
<div class="portlet-body col-simple">
|
<div class="portlet-body col-simple">
|
||||||
<iframe class="col-simple" id="iPreviewBill" data-src="Resources/mozilla/Pdf/web/viewer.html?file=<?= \urlencode(UriFactory::build('{/api}bill/render/preview?bill=' . $bill->id) . '&bill_type='); ?>{#iBillPreviewType}" loading="lazy" allowfullscreen></iframe>
|
<iframe class="col-simple" id="iPreviewBill" data-src="Resources/mozilla/Pdf/web/viewer.html?file=<?= \urlencode(UriFactory::build('{/api}bill/render/preview?bill=' . $bill->id . '&csrf={$CSRF}') . '&bill_type='); ?>{#iBillPreviewType}" loading="lazy" allowfullscreen></iframe>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user