Automated formatting changes

This commit is contained in:
Formatter Bot 2021-02-20 10:01:44 +00:00
parent 15923d8a3e
commit 93a6b13ebe
5 changed files with 80 additions and 81 deletions

View File

@ -14,11 +14,11 @@ declare(strict_types=1);
namespace Modules\Billing\Admin;
use Modules\Billing\Models\BillTransferType;
use Modules\Billing\Models\BillType;
use Modules\Billing\Models\BillTypeL11n;
use Modules\Billing\Models\BillTypeL11nMapper;
use Modules\Billing\Models\BillTypeMapper;
use Modules\Billing\Models\BillTransferType;
use phpOMS\Config\SettingsInterface;
use phpOMS\DataStorage\Database\DatabasePool;
use phpOMS\Localization\ISO639x1Enum;
@ -58,38 +58,38 @@ final class Installer extends InstallerAbstract
{
$billType = [];
$billType['offer'] = new BillType('Offer');
$billType['offer']->transferType = BillTransferType::SALES;
$billType['offer'] = new BillType('Offer');
$billType['offer']->transferType = BillTransferType::SALES;
$billType['offer']->transferStock = false;
BillTypeMapper::create($billType['offer']);
BillTypeL11nMapper::create(new BillTypeL11n($billType['offer']->getId(), 'Angebot', ISO639x1Enum::_DE));
$billType['order_confirmation'] = new BillType('Order Confirmation');
$billType['order_confirmation']->transferType = BillTransferType::SALES;
$billType['order_confirmation'] = new BillType('Order Confirmation');
$billType['order_confirmation']->transferType = BillTransferType::SALES;
$billType['order_confirmation']->transferStock = false;
BillTypeMapper::create($billType['order_confirmation']);
BillTypeL11nMapper::create(new BillTypeL11n($billType['order_confirmation']->getId(), 'Auftragsbestaetigung', ISO639x1Enum::_DE));
$billType['delivery_note'] = new BillType('Delivery Note');
$billType['delivery_note']->transferType = BillTransferType::SALES;
$billType['delivery_note'] = new BillType('Delivery Note');
$billType['delivery_note']->transferType = BillTransferType::SALES;
$billType['delivery_note']->transferStock = true;
BillTypeMapper::create($billType['delivery_note']);
BillTypeL11nMapper::create(new BillTypeL11n($billType['delivery_note']->getId(), 'Lieferschein', ISO639x1Enum::_DE));
$billType['invoice'] = new BillType('Invoice');
$billType['invoice']->transferType = BillTransferType::SALES;
$billType['invoice'] = new BillType('Invoice');
$billType['invoice']->transferType = BillTransferType::SALES;
$billType['invoice']->transferStock = false;
BillTypeMapper::create($billType['invoice']);
BillTypeL11nMapper::create(new BillTypeL11n($billType['invoice']->getId(), 'Rechnung', ISO639x1Enum::_DE));
$billType['credit_note'] = new BillType('Credit Note');
$billType['credit_note']->transferType = BillTransferType::SALES;
$billType['credit_note'] = new BillType('Credit Note');
$billType['credit_note']->transferType = BillTransferType::SALES;
$billType['credit_note']->transferStock = false;
BillTypeMapper::create($billType['credit_note']);
BillTypeL11nMapper::create(new BillTypeL11n($billType['credit_note']->getId(), 'Rechnungskorrektur', ISO639x1Enum::_DE));
$billType['reverse_invoice'] = new BillType('Credit Note');
$billType['reverse_invoice']->transferType = BillTransferType::SALES;
$billType['reverse_invoice'] = new BillType('Credit Note');
$billType['reverse_invoice']->transferType = BillTransferType::SALES;
$billType['reverse_invoice']->transferStock = false;
BillTypeMapper::create($billType['reverse_invoice']);
BillTypeL11nMapper::create(new BillTypeL11n($billType['reverse_invoice']->getId(), 'Gutschrift', ISO639x1Enum::_DE));
@ -108,38 +108,38 @@ final class Installer extends InstallerAbstract
{
$billType = [];
$billType['offer'] = new BillType('Offer');
$billType['offer']->transferType = BillTransferType::PURCHASE;
$billType['offer'] = new BillType('Offer');
$billType['offer']->transferType = BillTransferType::PURCHASE;
$billType['offer']->transferStock = false;
BillTypeMapper::create($billType['offer']);
BillTypeL11nMapper::create(new BillTypeL11n($billType['offer']->getId(), 'Angebot', ISO639x1Enum::_DE));
$billType['order_confirmation'] = new BillType('Order Confirmation');
$billType['order_confirmation']->transferType = BillTransferType::PURCHASE;
$billType['order_confirmation'] = new BillType('Order Confirmation');
$billType['order_confirmation']->transferType = BillTransferType::PURCHASE;
$billType['order_confirmation']->transferStock = false;
BillTypeMapper::create($billType['order_confirmation']);
BillTypeL11nMapper::create(new BillTypeL11n($billType['order_confirmation']->getId(), 'Auftragsbestaetigung', ISO639x1Enum::_DE));
$billType['delivery_note'] = new BillType('Delivery Note');
$billType['delivery_note']->transferType = BillTransferType::PURCHASE;
$billType['delivery_note'] = new BillType('Delivery Note');
$billType['delivery_note']->transferType = BillTransferType::PURCHASE;
$billType['delivery_note']->transferStock = true;
BillTypeMapper::create($billType['delivery_note']);
BillTypeL11nMapper::create(new BillTypeL11n($billType['delivery_note']->getId(), 'Lieferschein', ISO639x1Enum::_DE));
$billType['invoice'] = new BillType('Invoice');
$billType['invoice']->transferType = BillTransferType::PURCHASE;
$billType['invoice'] = new BillType('Invoice');
$billType['invoice']->transferType = BillTransferType::PURCHASE;
$billType['invoice']->transferStock = false;
BillTypeMapper::create($billType['invoice']);
BillTypeL11nMapper::create(new BillTypeL11n($billType['invoice']->getId(), 'Rechnung', ISO639x1Enum::_DE));
$billType['credit_note'] = new BillType('Credit Note');
$billType['credit_note']->transferType = BillTransferType::PURCHASE;
$billType['credit_note'] = new BillType('Credit Note');
$billType['credit_note']->transferType = BillTransferType::PURCHASE;
$billType['credit_note']->transferStock = false;
BillTypeMapper::create($billType['credit_note']);
BillTypeL11nMapper::create(new BillTypeL11n($billType['credit_note']->getId(), 'Rechnungskorrektur', ISO639x1Enum::_DE));
$billType['reverse_invoice'] = new BillType('Credit Note');
$billType['reverse_invoice']->transferType = BillTransferType::PURCHASE;
$billType['reverse_invoice'] = new BillType('Credit Note');
$billType['reverse_invoice']->transferType = BillTransferType::PURCHASE;
$billType['reverse_invoice']->transferStock = false;
BillTypeMapper::create($billType['reverse_invoice']);
BillTypeL11nMapper::create(new BillTypeL11n($billType['reverse_invoice']->getId(), 'Gutschrift', ISO639x1Enum::_DE));

View File

@ -21,21 +21,18 @@ use Modules\Billing\Models\BillElementMapper;
use Modules\Billing\Models\BillMapper;
use Modules\Billing\Models\NullBillType;
use Modules\ClientManagement\Models\ClientMapper;
use Modules\ClientManagement\Models\NullClient;
use Modules\SupplierManagement\Models\SupplierMapper;
use Modules\ItemManagement\Models\ItemMapper;
use Modules\Media\Models\CollectionMapper;
use Modules\Media\Models\UploadStatus;
use Modules\SupplierManagement\Models\SupplierMapper;
use phpOMS\Autoloader;
use phpOMS\Localization\Money;
use phpOMS\Message\Http\RequestStatusCode;
use phpOMS\Message\NotificationLevel;
use phpOMS\Message\RequestAbstract;
use phpOMS\Message\ResponseAbstract;
use phpOMS\Model\Message\FormValidation;
use Model\CoreSettings;
use Modules\Media\Models\CollectionMapper;
use Modules\Media\Models\UploadStatus;
use phpOMS\Views\View;
use phpOMS\System\MimeType;
use phpOMS\Autoloader;
/**
* Billing class.
@ -98,11 +95,11 @@ final class ApiController extends Controller
$bill->number = '{y}-{id}'; // @todo: use admin defined format
$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.)
$bill->billZip = $request->getData('billtopostal') ?? $account->mainAddress->postal;
$bill->billCity = $request->getData('billtocity') ?? $account->mainAddress->city;
$bill->billZip = $request->getData('billtopostal') ?? $account->mainAddress->postal;
$bill->billCity = $request->getData('billtocity') ?? $account->mainAddress->city;
$bill->billCountry = $request->getData('billtocountry') ?? $account->mainAddress->getCountry();
$bill->type = new NullBillType((int) $request->getData('type'));
$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->performanceDate = new \DateTime($request->getData('performancedate') ?? 'now');
@ -271,7 +268,7 @@ final class ApiController extends Controller
$bill = BillMapper::get($request->getData('bill'));
$defaultTemplate = $this->app->appSettings->get(null, 'default_template', self::MODULE_NAME);
$template = CollectionMapper::get((int) $defaultTemplate['content']);
$template = CollectionMapper::get((int) $defaultTemplate['content']);
$pdfDir = __DIR__ . '/../../../Modules/Media/Files/Modules/Billing/Bills/'
. $bill->createdAt->format('Y') . '/'
@ -291,11 +288,11 @@ final class ApiController extends Controller
$media = $this->app->moduleManager->get('Media')->createDbEntry(
[
'status' => UploadStatus::OK,
'name' => $request->getData('bill') . '.pdf',
'path' => $pdfDir,
'filename' => $request->getData('bill') . '.pdf',
'size' => \filesize($pdfDir . $request->getData('bill') . '.pdf'),
'status' => UploadStatus::OK,
'name' => $request->getData('bill') . '.pdf',
'path' => $pdfDir,
'filename' => $request->getData('bill') . '.pdf',
'size' => \filesize($pdfDir . $request->getData('bill') . '.pdf'),
'extension' => 'pdf',
],
$request->header->account,

View File

@ -52,7 +52,9 @@ class Bill implements \JsonSerializable
* @var int|BillType
* @since 1.0.0
*/
public int | BillType $type = 0;
public int |
BillType $type = 0;
/**
* Bill status.
@ -95,6 +97,7 @@ class Bill implements \JsonSerializable
public Account $createdBy;
public $client = 0;
public $supplier = 0;
/**
@ -1219,7 +1222,6 @@ class Bill implements \JsonSerializable
$this->elements[] = $element;
}
/**
* Get all media
*

View File

@ -16,8 +16,8 @@ namespace Modules\Billing\Models;
use Modules\Admin\Models\AccountMapper;
use Modules\ClientManagement\Models\ClientMapper;
use Modules\SupplierManagement\Models\SupplierMapper;
use Modules\Media\Models\MediaMapper;
use Modules\SupplierManagement\Models\SupplierMapper;
use phpOMS\DataStorage\Database\DataMapperAbstract;
use phpOMS\DataStorage\Database\Query\Builder;
use phpOMS\DataStorage\Database\RelationType;
@ -41,42 +41,42 @@ final class BillMapper extends DataMapperAbstract
* @since 1.0.0
*/
protected static array $columns = [
'billing_bill_id' => ['name' => 'billing_bill_id', 'type' => 'int', 'internal' => 'id'],
'billing_bill_number' => ['name' => 'billing_bill_number', 'type' => 'string', 'internal' => 'number'],
'billing_bill_type' => ['name' => 'billing_bill_type', 'type' => 'int', 'internal' => 'type'],
'billing_bill_info' => ['name' => 'billing_bill_info', 'type' => 'string', 'internal' => 'info'],
'billing_bill_status' => ['name' => 'billing_bill_status', 'type' => 'int', 'internal' => 'status'],
'billing_bill_shipTo' => ['name' => 'billing_bill_shipTo', 'type' => 'string', 'internal' => 'shipTo'],
'billing_bill_shipFAO' => ['name' => 'billing_bill_shipFAO', 'type' => 'string', 'internal' => 'shipFAO'],
'billing_bill_shipAddr' => ['name' => 'billing_bill_shipAddr', 'type' => 'string', 'internal' => 'shipAddress'],
'billing_bill_shipCity' => ['name' => 'billing_bill_shipCity', 'type' => 'string', 'internal' => 'shipCity'],
'billing_bill_shipZip' => ['name' => 'billing_bill_shipZip', 'type' => 'string', 'internal' => 'shipZip'],
'billing_bill_shipCountry' => ['name' => 'billing_bill_shipCountry', 'type' => 'string', 'internal' => 'shipCountry'],
'billing_bill_billTo' => ['name' => 'billing_bill_billTo', 'type' => 'string', 'internal' => 'billTo'],
'billing_bill_billFAO' => ['name' => 'billing_bill_billFAO', 'type' => 'string', 'internal' => 'billFAO'],
'billing_bill_billAddr' => ['name' => 'billing_bill_billAddr', 'type' => 'string', 'internal' => 'billAddress'],
'billing_bill_billCity' => ['name' => 'billing_bill_billCity', 'type' => 'string', 'internal' => 'billCity'],
'billing_bill_billZip' => ['name' => 'billing_bill_billZip', 'type' => 'string', 'internal' => 'billZip'],
'billing_bill_billCountry' => ['name' => 'billing_bill_billCountry', 'type' => 'string', 'internal' => 'billCountry'],
'billing_bill_gross' => ['name' => 'billing_bill_gross', 'type' => 'Serializable', 'internal' => 'gross'],
'billing_bill_net' => ['name' => 'billing_bill_net', 'type' => 'Serializable', 'internal' => 'net'],
'billing_bill_costs' => ['name' => 'billing_bill_costs', 'type' => 'Serializable', 'internal' => 'costs'],
'billing_bill_profit' => ['name' => 'billing_bill_profit', 'type' => 'Serializable', 'internal' => 'profit'],
'billing_bill_currency' => ['name' => 'billing_bill_currency', 'type' => 'int', 'internal' => 'currency'],
'billing_bill_referral' => ['name' => 'billing_bill_referral', 'type' => 'int', 'internal' => 'referral'],
'billing_bill_referral_name' => ['name' => 'billing_bill_referral_name', 'type' => 'string', 'internal' => 'referralName'],
'billing_bill_reference' => ['name' => 'billing_bill_reference', 'type' => 'int', 'internal' => 'reference'],
'billing_bill_payment' => ['name' => 'billing_bill_payment', 'type' => 'int', 'internal' => 'payment'],
'billing_bill_payment_text' => ['name' => 'billing_bill_payment_text', 'type' => 'string', 'internal' => 'paymentText'],
'billing_bill_paymentterms' => ['name' => 'billing_bill_paymentterms', 'type' => 'int', 'internal' => 'terms'],
'billing_bill_paymentterms_text' => ['name' => 'billing_bill_paymentterms_text', 'type' => 'string', 'internal' => 'termsText'],
'billing_bill_ship_type' => ['name' => 'billing_bill_ship_type', 'type' => 'int', 'internal' => 'shipping'],
'billing_bill_ship_text' => ['name' => 'billing_bill_ship_text', 'type' => 'string', 'internal' => 'shippingText'],
'billing_bill_client' => ['name' => 'billing_bill_client', 'type' => 'int', 'internal' => 'client'],
'billing_bill_id' => ['name' => 'billing_bill_id', 'type' => 'int', 'internal' => 'id'],
'billing_bill_number' => ['name' => 'billing_bill_number', 'type' => 'string', 'internal' => 'number'],
'billing_bill_type' => ['name' => 'billing_bill_type', 'type' => 'int', 'internal' => 'type'],
'billing_bill_info' => ['name' => 'billing_bill_info', 'type' => 'string', 'internal' => 'info'],
'billing_bill_status' => ['name' => 'billing_bill_status', 'type' => 'int', 'internal' => 'status'],
'billing_bill_shipTo' => ['name' => 'billing_bill_shipTo', 'type' => 'string', 'internal' => 'shipTo'],
'billing_bill_shipFAO' => ['name' => 'billing_bill_shipFAO', 'type' => 'string', 'internal' => 'shipFAO'],
'billing_bill_shipAddr' => ['name' => 'billing_bill_shipAddr', 'type' => 'string', 'internal' => 'shipAddress'],
'billing_bill_shipCity' => ['name' => 'billing_bill_shipCity', 'type' => 'string', 'internal' => 'shipCity'],
'billing_bill_shipZip' => ['name' => 'billing_bill_shipZip', 'type' => 'string', 'internal' => 'shipZip'],
'billing_bill_shipCountry' => ['name' => 'billing_bill_shipCountry', 'type' => 'string', 'internal' => 'shipCountry'],
'billing_bill_billTo' => ['name' => 'billing_bill_billTo', 'type' => 'string', 'internal' => 'billTo'],
'billing_bill_billFAO' => ['name' => 'billing_bill_billFAO', 'type' => 'string', 'internal' => 'billFAO'],
'billing_bill_billAddr' => ['name' => 'billing_bill_billAddr', 'type' => 'string', 'internal' => 'billAddress'],
'billing_bill_billCity' => ['name' => 'billing_bill_billCity', 'type' => 'string', 'internal' => 'billCity'],
'billing_bill_billZip' => ['name' => 'billing_bill_billZip', 'type' => 'string', 'internal' => 'billZip'],
'billing_bill_billCountry' => ['name' => 'billing_bill_billCountry', 'type' => 'string', 'internal' => 'billCountry'],
'billing_bill_gross' => ['name' => 'billing_bill_gross', 'type' => 'Serializable', 'internal' => 'gross'],
'billing_bill_net' => ['name' => 'billing_bill_net', 'type' => 'Serializable', 'internal' => 'net'],
'billing_bill_costs' => ['name' => 'billing_bill_costs', 'type' => 'Serializable', 'internal' => 'costs'],
'billing_bill_profit' => ['name' => 'billing_bill_profit', 'type' => 'Serializable', 'internal' => 'profit'],
'billing_bill_currency' => ['name' => 'billing_bill_currency', 'type' => 'int', 'internal' => 'currency'],
'billing_bill_referral' => ['name' => 'billing_bill_referral', 'type' => 'int', 'internal' => 'referral'],
'billing_bill_referral_name' => ['name' => 'billing_bill_referral_name', 'type' => 'string', 'internal' => 'referralName'],
'billing_bill_reference' => ['name' => 'billing_bill_reference', 'type' => 'int', 'internal' => 'reference'],
'billing_bill_payment' => ['name' => 'billing_bill_payment', 'type' => 'int', 'internal' => 'payment'],
'billing_bill_payment_text' => ['name' => 'billing_bill_payment_text', 'type' => 'string', 'internal' => 'paymentText'],
'billing_bill_paymentterms' => ['name' => 'billing_bill_paymentterms', 'type' => 'int', 'internal' => 'terms'],
'billing_bill_paymentterms_text' => ['name' => 'billing_bill_paymentterms_text', 'type' => 'string', 'internal' => 'termsText'],
'billing_bill_ship_type' => ['name' => 'billing_bill_ship_type', 'type' => 'int', 'internal' => 'shipping'],
'billing_bill_ship_text' => ['name' => 'billing_bill_ship_text', 'type' => 'string', 'internal' => 'shippingText'],
'billing_bill_client' => ['name' => 'billing_bill_client', 'type' => 'int', 'internal' => 'client'],
'billing_bill_supplier' => ['name' => 'billing_bill_supplier', 'type' => 'int', 'internal' => 'supplier'],
'billing_bill_created_by' => ['name' => 'billing_bill_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
'billing_bill_performance_date' => ['name' => 'billing_bill_performance_date', 'type' => 'DateTime', 'internal' => 'performanceDate', 'readonly' => true],
'billing_bill_created_at' => ['name' => 'billing_bill_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
'billing_bill_created_by' => ['name' => 'billing_bill_created_by', 'type' => 'int', 'internal' => 'createdBy', 'readonly' => true],
'billing_bill_performance_date' => ['name' => 'billing_bill_performance_date', 'type' => 'DateTime', 'internal' => 'performanceDate', 'readonly' => true],
'billing_bill_created_at' => ['name' => 'billing_bill_created_at', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt', 'readonly' => true],
];
/**

View File

@ -33,8 +33,8 @@ final class BillTypeMapper extends DataMapperAbstract
* @since 1.0.0
*/
protected static array $columns = [
'billing_type_id' => ['name' => 'billing_type_id', 'type' => 'int', 'internal' => 'id'],
'billing_type_transfer_type' => ['name' => 'billing_type_transfer_type', 'type' => 'int', 'internal' => 'transferType'],
'billing_type_id' => ['name' => 'billing_type_id', 'type' => 'int', 'internal' => 'id'],
'billing_type_transfer_type' => ['name' => 'billing_type_transfer_type', 'type' => 'int', 'internal' => 'transferType'],
'billing_type_transfer_stock' => ['name' => 'billing_type_transfer_stock', 'type' => 'bool', 'internal' => 'transferStock'],
];