mirror of
https://github.com/Karaka-Management/oms-Billing.git
synced 2026-02-04 10:38:42 +00:00
fix static analysis
This commit is contained in:
parent
587718774b
commit
ac6b22c47f
3
.github/user_feature_request.md
vendored
3
.github/user_feature_request.md
vendored
|
|
@ -8,11 +8,14 @@ assignees: ''
|
|||
---
|
||||
|
||||
# What is the feature you request
|
||||
|
||||
* A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
* A clear and concise description of what you want to happen.
|
||||
|
||||
# Alternatives
|
||||
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
# Additional Information
|
||||
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
|
|
|||
|
|
@ -63,7 +63,12 @@ final class Installer extends InstallerAbstract
|
|||
return;
|
||||
}
|
||||
|
||||
/** @var array $types */
|
||||
$types = \json_decode($fileContent, true);
|
||||
if ($types === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::createBillTypes($app, $types, $defaultTemplate);
|
||||
|
||||
/* Tax types */
|
||||
|
|
@ -72,7 +77,12 @@ final class Installer extends InstallerAbstract
|
|||
return;
|
||||
}
|
||||
|
||||
/** @var array $taxes */
|
||||
$taxes = \json_decode($fileContent, true);
|
||||
if ($taxes === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::createTaxCombination($app, $taxes);
|
||||
|
||||
/* Attributes */
|
||||
|
|
@ -81,7 +91,12 @@ final class Installer extends InstallerAbstract
|
|||
return;
|
||||
}
|
||||
|
||||
/** @var array $attributes */
|
||||
$attributes = \json_decode($fileContent, true);
|
||||
if ($attributes === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
$attrTypes = self::createBillAttributeTypes($app, $attributes);
|
||||
$attrValues = self::createBillAttributeValues($app, $attrTypes, $attributes);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,7 +205,6 @@ final class ApiBillController extends Controller
|
|||
$bill->payment = 0;
|
||||
$bill->paymentText = '';
|
||||
|
||||
/** @var \Modules\Billing\Modles\BillType */
|
||||
$bill->type = BillTypeMapper::get()
|
||||
->where('name', 'sales_invoice')
|
||||
->execute();
|
||||
|
|
@ -245,9 +244,9 @@ final class ApiBillController extends Controller
|
|||
];
|
||||
}
|
||||
|
||||
$billLanguage = $validLanguages[0];
|
||||
$billLanguage = $validLanguages[0] ?? ISO639x1Enum::_EN;
|
||||
|
||||
$clientBillLanguage = $client->getAttribute('bill_language')?->value->getValue();
|
||||
$clientBillLanguage = $client->getAttribute('bill_language')?->value->valueStr;
|
||||
if (!empty($clientBillLanguage) && \in_array($clientBillLanguage, $validLanguages)) {
|
||||
$billLanguage = $clientBillLanguage;
|
||||
} else {
|
||||
|
|
@ -330,18 +329,16 @@ final class ApiBillController extends Controller
|
|||
$bill = new Bill();
|
||||
$bill->createdBy = new NullAccount($request->header->account);
|
||||
$bill->type = $billType;
|
||||
$bill->billTo = (string) ($request->getDataString('billto')
|
||||
?? ($account->account->name1 . (!empty($account->account->name2)
|
||||
$bill->billTo = $request->getDataString('billto') ?? (
|
||||
$account->account->name1 . (!empty($account->account->name2)
|
||||
? ', ' . $account->account->name2
|
||||
: ''
|
||||
)));
|
||||
));
|
||||
$bill->billAddress = (string) ($request->getDataString('billaddress') ?? $account->mainAddress->address);
|
||||
$bill->billZip = (string) ($request->getDataString('billtopostal') ?? $account->mainAddress->postal);
|
||||
$bill->billCity = (string) ($request->getDataString('billtocity') ?? $account->mainAddress->city);
|
||||
$bill->billCountry = (string) (
|
||||
$request->getDataString('billtocountry') ?? (
|
||||
($country = $account->mainAddress->getCountry()) === ISO3166TwoEnum::_XXX ? '' : $country)
|
||||
);
|
||||
$bill->billCountry = $request->getDataString('billtocountry') ?? (
|
||||
($country = $account->mainAddress->getCountry()) === ISO3166TwoEnum::_XXX ? '' : $country);
|
||||
$bill->client = !$request->hasData('client') ? null : $account;
|
||||
$bill->supplier = !$request->hasData('supplier') ? null : $account;
|
||||
$bill->performanceDate = $request->getDataDateTime('performancedate') ?? new \DateTime('now');
|
||||
|
|
@ -933,7 +930,7 @@ final class ApiBillController extends Controller
|
|||
}
|
||||
|
||||
$model = $response->get($request->uri->__toString())['response'];
|
||||
$this->createModelRelation($request->header->account, $request->getData('id'), $model->getId(), BillMapper::class, 'bill_note', '', $request->getOrigin());
|
||||
$this->createModelRelation($request->header->account, $request->getDataInt('id'), $model->getId(), BillMapper::class, 'bill_note', '', $request->getOrigin());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ final class ApiPriceController extends Controller
|
|||
$supplier = null;
|
||||
|
||||
if ($request->hasData('price_client')) {
|
||||
/** @var null|\Modules\ClientManagement\Models\Client $client */
|
||||
/** @var \Modules\ClientManagement\Models\Client $client */
|
||||
$client = ClientMapper::get()
|
||||
->with('attributes')
|
||||
->with('attributes/type')
|
||||
|
|
@ -92,10 +92,10 @@ final class ApiPriceController extends Controller
|
|||
->where('id', (int) $request->getData('price_client'))
|
||||
->execute();
|
||||
|
||||
/** @var null|\Modules\ClientManagement\Models\Client|\Modules\SupplierManagement\Models\Supplier $account */
|
||||
/** @var \Modules\ClientManagement\Models\Client */
|
||||
$account = $client;
|
||||
} else {
|
||||
/** @var null|\Modules\SupplierManagement\Models\Supplier $supplier */
|
||||
/** @var \Modules\SupplierManagement\Models\Supplier $supplier */
|
||||
$supplier = SupplierMapper::get()
|
||||
->with('attributes')
|
||||
->with('attributes/type')
|
||||
|
|
@ -103,7 +103,7 @@ final class ApiPriceController extends Controller
|
|||
->where('id', (int) $request->getData('price_supplier'))
|
||||
->execute();
|
||||
|
||||
/** @var null|\Modules\ClientManagement\Models\Client|\Modules\SupplierManagement\Models\Supplier $account */
|
||||
/** @var \Modules\SupplierManagement\Models\Supplier $account */
|
||||
$account = $supplier;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -126,13 +126,15 @@ final class BackendController extends Controller
|
|||
|
||||
$view->setData('bill', $bill);
|
||||
|
||||
/** @var \Modules\Auditor\Models\Auditor[] $logsBill */
|
||||
$logsBill = AuditMapper::getAll()
|
||||
->with('createdBy')
|
||||
->where('module', 'Billing')
|
||||
->where('type', StringUtils::intHash(BillMapper::class))
|
||||
->where('ref', $bill->getId())
|
||||
->execute();
|
||||
->with('createdBy')
|
||||
->where('module', 'Billing')
|
||||
->where('type', StringUtils::intHash(BillMapper::class))
|
||||
->where('ref', $bill->getId())
|
||||
->execute();
|
||||
|
||||
/** @var \Modules\Auditor\Models\Auditor[] $logsElements */
|
||||
$logsElements = AuditMapper::getAll()
|
||||
->with('createdBy')
|
||||
->where('module', 'Billing')
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of Attribute
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class BillAttributeMapper extends DataMapperFactory
|
||||
{
|
||||
|
|
@ -60,7 +63,7 @@ final class BillAttributeMapper extends DataMapperFactory
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = Attribute::class;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ use phpOMS\Localization\BaseStringL11n;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of BaseStringL11n
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class BillAttributeTypeL11nMapper extends DataMapperFactory
|
||||
{
|
||||
|
|
@ -59,7 +62,7 @@ final class BillAttributeTypeL11nMapper extends DataMapperFactory
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11n::class;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of AttributeType
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class BillAttributeTypeMapper extends DataMapperFactory
|
||||
{
|
||||
|
|
@ -68,7 +71,7 @@ final class BillAttributeTypeMapper extends DataMapperFactory
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = AttributeType::class;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ use phpOMS\Localization\BaseStringL11n;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of BaseStringL11n
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class BillAttributeValueL11nMapper extends DataMapperFactory
|
||||
{
|
||||
|
|
@ -59,7 +62,7 @@ final class BillAttributeValueL11nMapper extends DataMapperFactory
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11n::class;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of AttributeValue
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class BillAttributeValueMapper extends DataMapperFactory
|
||||
{
|
||||
|
|
@ -63,7 +66,7 @@ final class BillAttributeValueMapper extends DataMapperFactory
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = AttributeValue::class;
|
||||
|
|
|
|||
|
|
@ -86,10 +86,10 @@ class Bill implements \JsonSerializable
|
|||
/**
|
||||
* Bill created at.
|
||||
*
|
||||
* @var null|\DateTime
|
||||
* @var \DateTime
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public ?\DateTime $billDate = null;
|
||||
public \DateTime $billDate;
|
||||
|
||||
/**
|
||||
* Bill created at.
|
||||
|
|
@ -463,6 +463,7 @@ class Bill implements \JsonSerializable
|
|||
$this->netDiscount = new Money(0);
|
||||
$this->grossDiscount = new Money(0);
|
||||
|
||||
$this->billDate = new \DateTime('now');
|
||||
$this->createdAt = new \DateTimeImmutable();
|
||||
$this->createdBy = new NullAccount();
|
||||
$this->referral = new NullAccount();
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of BillElement
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class BillElementMapper extends DataMapperFactory
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,6 +30,9 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of Bill
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
class BillMapper extends DataMapperFactory
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ use phpOMS\Localization\BaseStringL11n;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of BaseStringL11n
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class BillTypeL11nMapper extends DataMapperFactory
|
||||
{
|
||||
|
|
@ -59,7 +62,7 @@ final class BillTypeL11nMapper extends DataMapperFactory
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BaseStringL11n::class;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ declare(strict_types=1);
|
|||
namespace Modules\Billing\Models;
|
||||
|
||||
use Modules\Media\Models\CollectionMapper;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
||||
/**
|
||||
|
|
@ -25,6 +24,9 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of BillType
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class BillTypeMapper extends DataMapperFactory
|
||||
{
|
||||
|
|
@ -97,7 +99,7 @@ final class BillTypeMapper extends DataMapperFactory
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = BillType::class;
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Billing\Models\Price;
|
||||
|
||||
use Modules\Attribute\Models\AttributeValueMapper;
|
||||
use Modules\ClientManagement\Models\ClientAttributeValueMapper;
|
||||
use Modules\ClientManagement\Models\ClientMapper;
|
||||
use Modules\Attribute\Models\AttributeValueMapper;
|
||||
use Modules\ItemManagement\Models\ItemMapper;
|
||||
use Modules\SupplierManagement\Models\SupplierMapper;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
|
@ -29,6 +29,9 @@ use phpOMS\Localization\Defaults\CountryMapper;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of Price
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class PriceMapper extends DataMapperFactory
|
||||
{
|
||||
|
|
@ -131,7 +134,7 @@ final class PriceMapper extends DataMapperFactory
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = Price::class;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ final class PurchaseBillMapper extends BillMapper
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = Bill::class;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ final class SalesBillMapper extends BillMapper
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = Bill::class;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ final class StockBillMapper extends BillMapper
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = Bill::class;
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ declare(strict_types=1);
|
|||
|
||||
namespace Modules\Billing\Models\Tax;
|
||||
|
||||
use Modules\ClientManagement\Models\ClientAttributeValueMapper;
|
||||
use Modules\Attribute\Models\AttributeValueMapper;
|
||||
use Modules\ClientManagement\Models\ClientAttributeValueMapper;
|
||||
use Modules\SupplierManagement\Models\SupplierAttributeValueMapper;
|
||||
use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
||||
|
||||
|
|
@ -26,6 +26,9 @@ use phpOMS\DataStorage\Database\Mapper\DataMapperFactory;
|
|||
* @license OMS License 2.0
|
||||
* @link https://jingga.app
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @template T of TaxCombination
|
||||
* @extends DataMapperFactory<T>
|
||||
*/
|
||||
final class TaxCombinationMapper extends DataMapperFactory
|
||||
{
|
||||
|
|
@ -75,7 +78,7 @@ final class TaxCombinationMapper extends DataMapperFactory
|
|||
/**
|
||||
* Model to use by the mapper.
|
||||
*
|
||||
* @var class-string
|
||||
* @var class-string<T>
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public const MODEL = TaxCombination::class;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user