mirror of
https://github.com/Karaka-Management/oms-Billing.git
synced 2026-02-18 01:08:42 +00:00
phpstan and phpcs fixes
This commit is contained in:
parent
b148909011
commit
3ccdcade6e
|
|
@ -10,7 +10,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1001601001,
|
"parent": 1001601001,
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1005104001,
|
"parent": 1005104001,
|
||||||
"children": []
|
"children": []
|
||||||
},
|
},
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1005104001,
|
"parent": 1005104001,
|
||||||
"children": []
|
"children": []
|
||||||
},
|
},
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 10,
|
"order": 10,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 4, "type": null, "element": null },
|
"permission": { "permission": 4, "category": null, "element": null },
|
||||||
"parent": 1005104001,
|
"parent": 1005104001,
|
||||||
"children": []
|
"children": []
|
||||||
}
|
}
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1002101001,
|
"parent": 1002101001,
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
|
@ -85,7 +85,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1005105001,
|
"parent": 1005105001,
|
||||||
"children": []
|
"children": []
|
||||||
},
|
},
|
||||||
|
|
@ -100,7 +100,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1005105001,
|
"parent": 1005105001,
|
||||||
"children": []
|
"children": []
|
||||||
},
|
},
|
||||||
|
|
@ -115,7 +115,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 10,
|
"order": 10,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 4, "type": null, "element": null },
|
"permission": { "permission": 4, "category": null, "element": null },
|
||||||
"parent": 1005105001,
|
"parent": 1005105001,
|
||||||
"children": []
|
"children": []
|
||||||
},
|
},
|
||||||
|
|
@ -130,7 +130,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 15,
|
"order": 15,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 4, "type": null, "element": null },
|
"permission": { "permission": 4, "category": null, "element": null },
|
||||||
"parent": 1005105001,
|
"parent": 1005105001,
|
||||||
"children": []
|
"children": []
|
||||||
}
|
}
|
||||||
|
|
@ -147,7 +147,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1001301001,
|
"parent": 1001301001,
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
|
@ -161,7 +161,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1005106001,
|
"parent": 1005106001,
|
||||||
"children": []
|
"children": []
|
||||||
},
|
},
|
||||||
|
|
@ -176,7 +176,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1005106001,
|
"parent": 1005106001,
|
||||||
"children": []
|
"children": []
|
||||||
},
|
},
|
||||||
|
|
@ -191,7 +191,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 4, "type": null, "element": null },
|
"permission": { "permission": 4, "category": null, "element": null },
|
||||||
"parent": 1005106001,
|
"parent": 1005106001,
|
||||||
"children": []
|
"children": []
|
||||||
}
|
}
|
||||||
|
|
@ -208,7 +208,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 15,
|
"order": 15,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1001602001,
|
"parent": 1001602001,
|
||||||
"children": []
|
"children": []
|
||||||
},
|
},
|
||||||
|
|
@ -223,7 +223,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 15,
|
"order": 15,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1001602001,
|
"parent": 1001602001,
|
||||||
"children": []
|
"children": []
|
||||||
},
|
},
|
||||||
|
|
@ -238,7 +238,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1003401001,
|
"parent": 1003401001,
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
|
@ -252,7 +252,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1005109001,
|
"parent": 1005109001,
|
||||||
"children": [
|
"children": [
|
||||||
]
|
]
|
||||||
|
|
@ -268,7 +268,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
"from": "Billing",
|
"from": "Billing",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1005109001,
|
"parent": 1005109001,
|
||||||
"children": [
|
"children": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,6 @@ final class ApiController extends Controller
|
||||||
$bill = new Bill();
|
$bill = new Bill();
|
||||||
$bill->createdBy = new NullAccount($request->header->account);
|
$bill->createdBy = new NullAccount($request->header->account);
|
||||||
$bill->type = $billType;
|
$bill->type = $billType;
|
||||||
$bill->setStatus((int) ($request->getData('status') ?? BillStatus::ACTIVE));
|
|
||||||
$bill->numberFormat = $billType->numberFormat;
|
$bill->numberFormat = $billType->numberFormat;
|
||||||
$bill->billTo = $request->getData('billto')
|
$bill->billTo = $request->getData('billto')
|
||||||
?? ($account->profile->account->name1 . (!empty($account->profile->account->name2) ? ', ' . $account->profile->account->name2 : '')); // @todo: use defaultInvoiceAddress or mainAddress. also consider to use billto1, billto2, billto3 (for multiple lines e.g. name2, fao etc.)
|
?? ($account->profile->account->name1 . (!empty($account->profile->account->name2) ? ', ' . $account->profile->account->name2 : '')); // @todo: use defaultInvoiceAddress or mainAddress. also consider to use billto1, billto2, billto3 (for multiple lines e.g. name2, fao etc.)
|
||||||
|
|
@ -205,6 +204,7 @@ final class ApiController extends Controller
|
||||||
$bill->client = $request->getData('client') === null ? null : $account;
|
$bill->client = $request->getData('client') === null ? null : $account;
|
||||||
$bill->supplier = $request->getData('supplier') === null ? null : $account;
|
$bill->supplier = $request->getData('supplier') === null ? null : $account;
|
||||||
$bill->performanceDate = new \DateTime($request->getData('performancedate') ?? 'now');
|
$bill->performanceDate = new \DateTime($request->getData('performancedate') ?? 'now');
|
||||||
|
$bill->setStatus((int) ($request->getData('status') ?? BillStatus::ACTIVE));
|
||||||
|
|
||||||
return $bill;
|
return $bill;
|
||||||
}
|
}
|
||||||
|
|
@ -286,7 +286,6 @@ final class ApiController extends Controller
|
||||||
|
|
||||||
if ($collection instanceof NullCollection) {
|
if ($collection instanceof NullCollection) {
|
||||||
$collection = $this->app->moduleManager->get('Media')->createRecursiveMediaCollection(
|
$collection = $this->app->moduleManager->get('Media')->createRecursiveMediaCollection(
|
||||||
'/Modules/Media/Files',
|
|
||||||
$path,
|
$path,
|
||||||
$request->header->account,
|
$request->header->account,
|
||||||
__DIR__ . '/../../../Modules/Media/Files' . $path,
|
__DIR__ . '/../../../Modules/Media/Files' . $path,
|
||||||
|
|
@ -318,6 +317,15 @@ final class ApiController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create media directory path
|
||||||
|
*
|
||||||
|
* @param Bill $bill Bill
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
private function createBillDir(Bill $bill): string
|
private function createBillDir(Bill $bill): string
|
||||||
{
|
{
|
||||||
return '/Modules/Billing/Bills/'
|
return '/Modules/Billing/Bills/'
|
||||||
|
|
@ -495,7 +503,7 @@ final class ApiController extends Controller
|
||||||
|
|
||||||
$template = $bill->type->template;
|
$template = $bill->type->template;
|
||||||
|
|
||||||
$path = $this->createBillDir($bill);;
|
$path = $this->createBillDir($bill);
|
||||||
$pdfDir = __DIR__ . '/../../../Modules/Media/Files' . $path;
|
$pdfDir = __DIR__ . '/../../../Modules/Media/Files' . $path;
|
||||||
|
|
||||||
$status = !\is_dir($pdfDir) ? \mkdir($pdfDir, 0755, true) : true;
|
$status = !\is_dir($pdfDir) ? \mkdir($pdfDir, 0755, true) : true;
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ class BillType
|
||||||
*/
|
*/
|
||||||
public function __construct(string $name = '')
|
public function __construct(string $name = '')
|
||||||
{
|
{
|
||||||
$this->media = new NullCollection();
|
$this->template = new NullCollection();
|
||||||
$this->setL11n($name);
|
$this->setL11n($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,5 +35,4 @@ abstract class PermissionCategory extends Enum
|
||||||
public const PRIVATE_DASHBOARD = 5;
|
public const PRIVATE_DASHBOARD = 5;
|
||||||
|
|
||||||
public const PRIVATE_BILL_UPLOAD = 6;
|
public const PRIVATE_BILL_UPLOAD = 6;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,4 @@ abstract class SettingsEnum extends Enum
|
||||||
public const PREVIEW_MEDIA_TYPE = '1005100001_1'; // internally generated preview
|
public const PREVIEW_MEDIA_TYPE = '1005100001_1'; // internally generated preview
|
||||||
|
|
||||||
public const ORIGINAL_MEDIA_TYPE = '1005100001_2'; // original document (mostly supplier invoice/delivery note)
|
public const ORIGINAL_MEDIA_TYPE = '1005100001_2'; // original document (mostly supplier invoice/delivery note)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user