mirror of
https://github.com/Karaka-Management/oms-Billing.git
synced 2026-01-11 15:18:42 +00:00
fix bugs
This commit is contained in:
parent
0505984ba2
commit
eb4b435e41
|
|
@ -5,7 +5,7 @@
|
|||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "Billing",
|
||||
"uri": "{/base}/sales/bill/list?{?}",
|
||||
"uri": "{/base}/sales/bill/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 10,
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Open",
|
||||
"uri": "{/base}/sales/bill/list?{?}",
|
||||
"uri": "{/base}/sales/bill/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 1,
|
||||
|
|
@ -34,7 +34,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Archive",
|
||||
"uri": "{/base}/sales/bill/archive?{?}",
|
||||
"uri": "{/base}/sales/bill/archive",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Create",
|
||||
"uri": "{/base}/sales/bill/create?{?}",
|
||||
"uri": "{/base}/sales/bill/create",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 10,
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "PaymentTerms",
|
||||
"uri": "{/base}/bill/payment/list?{?}",
|
||||
"uri": "{/base}/bill/payment/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 15,
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "ShippingTerms",
|
||||
"uri": "{/base}/bill/shipping/list?{?}",
|
||||
"uri": "{/base}/bill/shipping/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 20,
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "Billing",
|
||||
"uri": "{/base}/purchase/bill/list?{?}",
|
||||
"uri": "{/base}/purchase/bill/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 10,
|
||||
|
|
@ -110,7 +110,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Open",
|
||||
"uri": "{/base}/purchase/bill/list?{?}",
|
||||
"uri": "{/base}/purchase/bill/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 1,
|
||||
|
|
@ -125,7 +125,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Archive",
|
||||
"uri": "{/base}/purchase/bill/archive?{?}",
|
||||
"uri": "{/base}/purchase/bill/archive",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
|
|
@ -140,7 +140,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Create",
|
||||
"uri": "{/base}/purchase/bill/create?{?}",
|
||||
"uri": "{/base}/purchase/bill/create",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 10,
|
||||
|
|
@ -155,7 +155,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Upload",
|
||||
"uri": "{/base}/purchase/bill/upload?{?}",
|
||||
"uri": "{/base}/purchase/bill/upload",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 15,
|
||||
|
|
@ -172,7 +172,7 @@
|
|||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "Billing",
|
||||
"uri": "{/base}/warehouse/bill/list?{?}",
|
||||
"uri": "{/base}/warehouse/bill/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
|
|
@ -186,7 +186,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "List",
|
||||
"uri": "{/base}/warehouse/bill/list?{?}",
|
||||
"uri": "{/base}/warehouse/bill/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 1,
|
||||
|
|
@ -201,7 +201,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Archive",
|
||||
"uri": "{/base}/warehouse/bill/archive?{?}",
|
||||
"uri": "{/base}/warehouse/bill/archive",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 1,
|
||||
|
|
@ -216,7 +216,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Create",
|
||||
"uri": "{/base}/warehouse/bill/create?{?}",
|
||||
"uri": "{/base}/warehouse/bill/create",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
|
|
@ -233,7 +233,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Bill",
|
||||
"uri": "{/base}/purchase/analysis/bill?{?}",
|
||||
"uri": "{/base}/purchase/analysis/bill",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 15,
|
||||
|
|
@ -248,7 +248,7 @@
|
|||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "InvoiceRecognition",
|
||||
"uri": "{/base}/private/purchase/recognition/dashboard?{?}",
|
||||
"uri": "{/base}/private/purchase/recognition/dashboard",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
|
|
@ -262,7 +262,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "List",
|
||||
"uri": "{/base}/private/purchase/recognition/dashboard?{?}",
|
||||
"uri": "{/base}/private/purchase/recognition/dashboard",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 1,
|
||||
|
|
@ -278,7 +278,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Upload",
|
||||
"uri": "{/base}/private/purchase/recognition/upload?{?}",
|
||||
"uri": "{/base}/private/purchase/recognition/upload",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
|
|
@ -296,7 +296,7 @@
|
|||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "InvoiceRecognition",
|
||||
"uri": "{/base}/purchase/recognition/dashboard?{?}",
|
||||
"uri": "{/base}/purchase/recognition/dashboard",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
|
|
@ -310,7 +310,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "List",
|
||||
"uri": "{/base}/purchase/recognition/dashboard?{?}",
|
||||
"uri": "{/base}/purchase/recognition/dashboard",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 1,
|
||||
|
|
@ -326,7 +326,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Upload",
|
||||
"uri": "{/base}/purchase/recognition/upload?{?}",
|
||||
"uri": "{/base}/purchase/recognition/upload",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
|
|
@ -344,7 +344,7 @@
|
|||
"type": 2,
|
||||
"subtype": 1,
|
||||
"name": "TaxCombinations",
|
||||
"uri": "{/base}/finance/tax/combination/list?{?}",
|
||||
"uri": "{/base}/finance/tax/combination/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 2,
|
||||
|
|
@ -358,7 +358,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "List",
|
||||
"uri": "{/base}/finance/tax/combination/list?{?}",
|
||||
"uri": "{/base}/finance/tax/combination/list",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 1,
|
||||
|
|
@ -373,7 +373,7 @@
|
|||
"type": 3,
|
||||
"subtype": 1,
|
||||
"name": "Create",
|
||||
"uri": "{/base}/finance/tax/combination/create?{?}",
|
||||
"uri": "{/base}/finance/tax/combination/create",
|
||||
"target": "self",
|
||||
"icon": null,
|
||||
"order": 5,
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^/purchase/bill(\?.*$|$)' => [
|
||||
'^/purchase/bill/view(\?.*$|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Billing\Controller\BackendController:viewBillingPurchaseInvoice',
|
||||
'verb' => RouteVerb::GET,
|
||||
|
|
@ -164,7 +164,7 @@ return [
|
|||
],
|
||||
],
|
||||
],
|
||||
'^/warehouse/bill(\?.*$|$)' => [
|
||||
'^/warehouse/bill/view(\?.*$|$)' => [
|
||||
[
|
||||
'dest' => '\Modules\Billing\Controller\BackendController:viewBillingStockInvoice',
|
||||
'verb' => RouteVerb::GET,
|
||||
|
|
|
|||
|
|
@ -734,88 +734,40 @@ final class ApiBillController extends Controller
|
|||
$bill = BillMapper::get()->where('id', (int) $request->getData('bill'))->execute();
|
||||
$path = $this->createBillDir($bill);
|
||||
|
||||
$uploaded = [];
|
||||
if (!empty($uploadedFiles = $request->files)) {
|
||||
$uploaded = new NullCollection();
|
||||
if (!empty($request->files)) {
|
||||
$uploaded = $this->app->moduleManager->get('Media', 'Api')->uploadFiles(
|
||||
names: [],
|
||||
fileNames: [],
|
||||
files: $uploadedFiles,
|
||||
files: $request->files,
|
||||
account: $request->header->account,
|
||||
basePath: __DIR__ . '/../../../Modules/Media/Files' . $path,
|
||||
virtualPath: $path,
|
||||
pathSettings: PathSettings::FILE_PATH,
|
||||
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');
|
||||
foreach ($mediaFiles as $media) {
|
||||
$this->createModelRelation(
|
||||
if (!empty($media = $request->getDataJson('media'))) {
|
||||
$this->app->moduleManager->get('Media', 'Api')->addMediaToCollectionAndModel(
|
||||
$request->header->account,
|
||||
$media,
|
||||
$bill->id,
|
||||
(int) $media,
|
||||
BillMapper::class,
|
||||
'files',
|
||||
'',
|
||||
$request->getOrigin()
|
||||
$path
|
||||
);
|
||||
}
|
||||
|
||||
// @todo media should be an array of NullMedia elements
|
||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Media', 'Media added to bill.', [
|
||||
'upload' => $uploaded,
|
||||
'media' => $mediaFiles,
|
||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, '', $this->app->l11nManager->getText($response->header->l11n->language, '0', '0', 'SuccessfulAdd'), [
|
||||
'upload' => $uploaded->sources,
|
||||
'media' => $media,
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -422,7 +422,7 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="col-xs-12 col-simple">
|
||||
<section id="mediaFile" class="portlet 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>
|
||||
</section>
|
||||
</div>
|
||||
|
|
@ -436,7 +436,7 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="col-xs-12 col-simple">
|
||||
<section id="mediaFile" class="portlet 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>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -421,7 +421,7 @@ echo $this->data['nav']->render(); ?>
|
|||
<div class="col-xs-12 col-simple">
|
||||
<section id="mediaFile" class="portlet 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>
|
||||
</section>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user