mirror of
https://github.com/Karaka-Management/oms-BusinessExpenses.git
synced 2026-02-11 05:58:41 +00:00
phpcs autofixes
This commit is contained in:
parent
80bb34ba35
commit
486d386489
|
|
@ -54,7 +54,7 @@ final class Installer extends InstallerAbstract
|
|||
}
|
||||
|
||||
/** @var array $types */
|
||||
$types = \json_decode($fileContent, true);
|
||||
$types = \json_decode($fileContent, true);
|
||||
$expenseTypes = self::createExpenseTypes($app, $types);
|
||||
|
||||
/* Element types */
|
||||
|
|
@ -64,7 +64,7 @@ final class Installer extends InstallerAbstract
|
|||
}
|
||||
|
||||
/** @var array $types */
|
||||
$types = \json_decode($fileContent, true);
|
||||
$types = \json_decode($fileContent, true);
|
||||
$elementTypes = self::createExpenseElementTypes($app, $types);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,9 +25,9 @@ use Modules\BusinessExpenses\Models\ExpenseMapper;
|
|||
use Modules\BusinessExpenses\Models\ExpenseStatus;
|
||||
use Modules\BusinessExpenses\Models\ExpenseType;
|
||||
use Modules\BusinessExpenses\Models\ExpenseTypeL11nMapper;
|
||||
use Modules\BusinessExpenses\Models\NullExpenseType;
|
||||
use Modules\BusinessExpenses\Models\ExpenseTypeMapper;
|
||||
use Modules\BusinessExpenses\Models\NullExpenseElementType;
|
||||
use Modules\BusinessExpenses\Models\NullExpenseType;
|
||||
use Modules\Media\Models\CollectionMapper;
|
||||
use Modules\Media\Models\MediaMapper;
|
||||
use Modules\Media\Models\PathSettings;
|
||||
|
|
@ -377,10 +377,10 @@ final class ApiController extends Controller
|
|||
*/
|
||||
private function createExpenseFromRequest(RequestAbstract $request) : Expense
|
||||
{
|
||||
$expense = new Expense();
|
||||
$expense->from = new NullAccount((int) $request->header->account);
|
||||
$expense->type = new NullExpenseType((int) $request->getDataInt('type'));
|
||||
$expense->status = (int) ($request->getDataInt('status') ?? ExpenseStatus::DRAFT);
|
||||
$expense = new Expense();
|
||||
$expense->from = new NullAccount((int) $request->header->account);
|
||||
$expense->type = new NullExpenseType((int) $request->getDataInt('type'));
|
||||
$expense->status = (int) ($request->getDataInt('status') ?? ExpenseStatus::DRAFT);
|
||||
$expense->description = $request->getDataString('description') ?? '';
|
||||
|
||||
$country = $request->getDataString('country') ?? '';
|
||||
|
|
@ -464,19 +464,19 @@ final class ApiController extends Controller
|
|||
*/
|
||||
private function createExpenseElementFromRequest(RequestAbstract $request) : ExpenseElement
|
||||
{
|
||||
$element = new ExpenseElement();
|
||||
$element->expense = (int) $request->getData('expense');
|
||||
$element = new ExpenseElement();
|
||||
$element->expense = (int) $request->getData('expense');
|
||||
$element->description = $request->getDataString('description') ?? '';
|
||||
$element->type = new NullExpenseElementType((int) $request->getData('type'));
|
||||
$element->type = new NullExpenseElementType((int) $request->getData('type'));
|
||||
|
||||
// @todo: fill from media if available
|
||||
|
||||
// @todo: handle different value set (net, gross, taxr, ...).
|
||||
// Depending on the value set the other values should be calculated
|
||||
$element->net = new FloatInt($request->getDataInt('net') ?? 0);
|
||||
$element->taxR = new FloatInt($request->getDataInt('taxr') ?? 0);
|
||||
$element->taxP = new FloatInt($request->getDataInt('taxp') ?? 0);
|
||||
$element->gross = new FloatInt($request->getDataInt('gross') ?? 0);
|
||||
$element->net = new FloatInt($request->getDataInt('net') ?? 0);
|
||||
$element->taxR = new FloatInt($request->getDataInt('taxr') ?? 0);
|
||||
$element->taxP = new FloatInt($request->getDataInt('taxp') ?? 0);
|
||||
$element->gross = new FloatInt($request->getDataInt('gross') ?? 0);
|
||||
$element->quantity = new FloatInt($request->getDataInt('quantity') ?? 0);
|
||||
|
||||
if ($request->hasData('supplier')) {
|
||||
|
|
@ -523,7 +523,7 @@ final class ApiController extends Controller
|
|||
|
||||
/** @var \Modules\BusinessExpenses\Models\Expense $expense */
|
||||
$expense = ExpenseMapper::get()->where('id', (int) $request->getData('expense'))->execute();
|
||||
$path = $this->createExpenseDir($expense);
|
||||
$path = $this->createExpenseDir($expense);
|
||||
|
||||
$element = (int) $request->getData('element');
|
||||
|
||||
|
|
|
|||
|
|
@ -58,21 +58,23 @@ class Expense {
|
|||
public FloatInt $taxP;
|
||||
|
||||
public \DateTime $start;
|
||||
|
||||
public \DateTime $end;
|
||||
|
||||
public \DateTimeImmutable $createdAt;
|
||||
|
||||
public string $country = ISO3166TwoEnum::_USA;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = new ExpenseType();
|
||||
$this->start = new \DateTime('now');
|
||||
$this->end = new \DateTime('now');
|
||||
$this->type = new ExpenseType();
|
||||
$this->start = new \DateTime('now');
|
||||
$this->end = new \DateTime('now');
|
||||
$this->createdAt = new \DateTimeImmutable('now');
|
||||
$this->from = new Account();
|
||||
$this->from = new Account();
|
||||
|
||||
$this->net = new FloatInt();
|
||||
$this->net = new FloatInt();
|
||||
$this->gross = new FloatInt();
|
||||
$this->taxP = new FloatInt();
|
||||
$this->taxP = new FloatInt();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,13 +65,13 @@ class ExpenseElement
|
|||
|
||||
public function __construct()
|
||||
{
|
||||
$this->type = new ExpenseElementType();
|
||||
$this->net = new FloatInt();
|
||||
$this->taxR = new FloatInt();
|
||||
$this->taxP = new FloatInt();
|
||||
$this->gross = new FloatInt();
|
||||
$this->type = new ExpenseElementType();
|
||||
$this->net = new FloatInt();
|
||||
$this->taxR = new FloatInt();
|
||||
$this->taxP = new FloatInt();
|
||||
$this->gross = new FloatInt();
|
||||
$this->quantity = new FloatInt();
|
||||
$this->start = new \DateTime('now');
|
||||
$this->end = new \DateTime('now');
|
||||
$this->start = new \DateTime('now');
|
||||
$this->end = new \DateTime('now');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,22 +39,22 @@ final class ExpenseElementMapper extends DataMapperFactory
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public const COLUMNS = [
|
||||
'bizexpenses_expense_element_id' => ['name' => 'bizexpenses_expense_element_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'bizexpenses_expense_element_id' => ['name' => 'bizexpenses_expense_element_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'bizexpenses_expense_element_description' => ['name' => 'bizexpenses_expense_element_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'bizexpenses_expense_element_approved' => ['name' => 'bizexpenses_expense_element_approved', 'type' => 'bool', 'internal' => 'approved'],
|
||||
'bizexpenses_expense_element_net' => ['name' => 'bizexpenses_expense_element_net', 'type' => 'Serializable', 'internal' => 'net'],
|
||||
'bizexpenses_expense_element_gross' => ['name' => 'bizexpenses_expense_element_gross', 'type' => 'Serializable', 'internal' => 'gross'],
|
||||
'bizexpenses_expense_element_taxp' => ['name' => 'bizexpenses_expense_element_taxp', 'type' => 'Serializable', 'internal' => 'taxP'],
|
||||
'bizexpenses_expense_element_taxr' => ['name' => 'bizexpenses_expense_element_taxr', 'type' => 'Serializable', 'internal' => 'taxR'],
|
||||
'bizexpenses_expense_element_quantity' => ['name' => 'bizexpenses_expense_element_quantity', 'type' => 'Serializable', 'internal' => 'quantity'],
|
||||
'bizexpenses_expense_element_taxid' => ['name' => 'bizexpenses_expense_element_taxid', 'type' => 'string', 'internal' => 'taxId'],
|
||||
'bizexpenses_expense_element_start' => ['name' => 'bizexpenses_expense_element_start', 'type' => 'DateTime', 'internal' => 'start'],
|
||||
'bizexpenses_expense_element_end' => ['name' => 'bizexpenses_expense_element_end', 'type' => 'DateTime', 'internal' => 'end'],
|
||||
'bizexpenses_expense_element_supplier' => ['name' => 'bizexpenses_expense_element_supplier', 'type' => 'int', 'internal' => 'supplier'],
|
||||
'bizexpenses_expense_element_ref' => ['name' => 'bizexpenses_expense_element_ref', 'type' => 'int', 'internal' => 'ref'],
|
||||
'bizexpenses_expense_element_type' => ['name' => 'bizexpenses_expense_element_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'bizexpenses_expense_element_country' => ['name' => 'bizexpenses_expense_element_country', 'type' => 'string', 'internal' => 'country'],
|
||||
'bizexpenses_expense_element_expense' => ['name' => 'bizexpenses_expense_element_expense', 'type' => 'int', 'internal' => 'expense'],
|
||||
'bizexpenses_expense_element_approved' => ['name' => 'bizexpenses_expense_element_approved', 'type' => 'bool', 'internal' => 'approved'],
|
||||
'bizexpenses_expense_element_net' => ['name' => 'bizexpenses_expense_element_net', 'type' => 'Serializable', 'internal' => 'net'],
|
||||
'bizexpenses_expense_element_gross' => ['name' => 'bizexpenses_expense_element_gross', 'type' => 'Serializable', 'internal' => 'gross'],
|
||||
'bizexpenses_expense_element_taxp' => ['name' => 'bizexpenses_expense_element_taxp', 'type' => 'Serializable', 'internal' => 'taxP'],
|
||||
'bizexpenses_expense_element_taxr' => ['name' => 'bizexpenses_expense_element_taxr', 'type' => 'Serializable', 'internal' => 'taxR'],
|
||||
'bizexpenses_expense_element_quantity' => ['name' => 'bizexpenses_expense_element_quantity', 'type' => 'Serializable', 'internal' => 'quantity'],
|
||||
'bizexpenses_expense_element_taxid' => ['name' => 'bizexpenses_expense_element_taxid', 'type' => 'string', 'internal' => 'taxId'],
|
||||
'bizexpenses_expense_element_start' => ['name' => 'bizexpenses_expense_element_start', 'type' => 'DateTime', 'internal' => 'start'],
|
||||
'bizexpenses_expense_element_end' => ['name' => 'bizexpenses_expense_element_end', 'type' => 'DateTime', 'internal' => 'end'],
|
||||
'bizexpenses_expense_element_supplier' => ['name' => 'bizexpenses_expense_element_supplier', 'type' => 'int', 'internal' => 'supplier'],
|
||||
'bizexpenses_expense_element_ref' => ['name' => 'bizexpenses_expense_element_ref', 'type' => 'int', 'internal' => 'ref'],
|
||||
'bizexpenses_expense_element_type' => ['name' => 'bizexpenses_expense_element_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'bizexpenses_expense_element_country' => ['name' => 'bizexpenses_expense_element_country', 'type' => 'string', 'internal' => 'country'],
|
||||
'bizexpenses_expense_element_expense' => ['name' => 'bizexpenses_expense_element_expense', 'type' => 'int', 'internal' => 'expense'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -38,20 +38,20 @@ final class ExpenseMapper extends DataMapperFactory
|
|||
* @since 1.0.0
|
||||
*/
|
||||
public const COLUMNS = [
|
||||
'bizexpenses_expense_id' => ['name' => 'bizexpenses_expense_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'bizexpenses_expense_status' => ['name' => 'bizexpenses_expense_status', 'type' => 'int', 'internal' => 'status'],
|
||||
'bizexpenses_expense_id' => ['name' => 'bizexpenses_expense_id', 'type' => 'int', 'internal' => 'id'],
|
||||
'bizexpenses_expense_status' => ['name' => 'bizexpenses_expense_status', 'type' => 'int', 'internal' => 'status'],
|
||||
'bizexpenses_expense_description' => ['name' => 'bizexpenses_expense_description', 'type' => 'string', 'internal' => 'description'],
|
||||
'bizexpenses_expense_approved' => ['name' => 'bizexpenses_expense_approved', 'type' => 'bool', 'internal' => 'approved'],
|
||||
'bizexpenses_expense_paid' => ['name' => 'bizexpenses_expense_paid', 'type' => 'bool', 'internal' => 'paid'],
|
||||
'bizexpenses_expense_net' => ['name' => 'bizexpenses_expense_net', 'type' => 'Serializable', 'internal' => 'net'],
|
||||
'bizexpenses_expense_gross' => ['name' => 'bizexpenses_expense_gross', 'type' => 'Serializable', 'internal' => 'gross'],
|
||||
'bizexpenses_expense_taxp' => ['name' => 'bizexpenses_expense_taxp', 'type' => 'Serializable', 'internal' => 'taxP'],
|
||||
'bizexpenses_expense_created' => ['name' => 'bizexpenses_expense_created', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
|
||||
'bizexpenses_expense_start' => ['name' => 'bizexpenses_expense_start', 'type' => 'DateTime', 'internal' => 'start'],
|
||||
'bizexpenses_expense_end' => ['name' => 'bizexpenses_expense_end', 'type' => 'DateTime', 'internal' => 'end'],
|
||||
'bizexpenses_expense_type' => ['name' => 'bizexpenses_expense_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'bizexpenses_expense_from' => ['name' => 'bizexpenses_expense_from', 'type' => 'int', 'internal' => 'from'],
|
||||
'bizexpenses_expense_country' => ['name' => 'bizexpenses_expense_country', 'type' => 'string', 'internal' => 'country'],
|
||||
'bizexpenses_expense_approved' => ['name' => 'bizexpenses_expense_approved', 'type' => 'bool', 'internal' => 'approved'],
|
||||
'bizexpenses_expense_paid' => ['name' => 'bizexpenses_expense_paid', 'type' => 'bool', 'internal' => 'paid'],
|
||||
'bizexpenses_expense_net' => ['name' => 'bizexpenses_expense_net', 'type' => 'Serializable', 'internal' => 'net'],
|
||||
'bizexpenses_expense_gross' => ['name' => 'bizexpenses_expense_gross', 'type' => 'Serializable', 'internal' => 'gross'],
|
||||
'bizexpenses_expense_taxp' => ['name' => 'bizexpenses_expense_taxp', 'type' => 'Serializable', 'internal' => 'taxP'],
|
||||
'bizexpenses_expense_created' => ['name' => 'bizexpenses_expense_created', 'type' => 'DateTimeImmutable', 'internal' => 'createdAt'],
|
||||
'bizexpenses_expense_start' => ['name' => 'bizexpenses_expense_start', 'type' => 'DateTime', 'internal' => 'start'],
|
||||
'bizexpenses_expense_end' => ['name' => 'bizexpenses_expense_end', 'type' => 'DateTime', 'internal' => 'end'],
|
||||
'bizexpenses_expense_type' => ['name' => 'bizexpenses_expense_type', 'type' => 'int', 'internal' => 'type'],
|
||||
'bizexpenses_expense_from' => ['name' => 'bizexpenses_expense_from', 'type' => 'int', 'internal' => 'from'],
|
||||
'bizexpenses_expense_country' => ['name' => 'bizexpenses_expense_country', 'type' => 'string', 'internal' => 'country'],
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -13,22 +13,22 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
return ['BusinessExpenses' => [
|
||||
'Expenses' => 'Expenses',
|
||||
'Status' => 'Status',
|
||||
'Title' => 'Title',
|
||||
'Paid' => 'Paid',
|
||||
'Approved' => 'Approved',
|
||||
'From' => 'From',
|
||||
'Amount' => 'Amount',
|
||||
'Start' => 'Start',
|
||||
'End' => 'End',
|
||||
'Expenses' => 'Expenses',
|
||||
'Status' => 'Status',
|
||||
'Title' => 'Title',
|
||||
'Paid' => 'Paid',
|
||||
'Approved' => 'Approved',
|
||||
'From' => 'From',
|
||||
'Amount' => 'Amount',
|
||||
'Start' => 'Start',
|
||||
'End' => 'End',
|
||||
'Description' => 'Description',
|
||||
'Report' => 'Report',
|
||||
'Net' => 'Net',
|
||||
'Gross' => 'Gross',
|
||||
'Notes' => 'Notes',
|
||||
'CreatedAt' => 'Created At',
|
||||
':status1' => 'Draft',
|
||||
':status2' => 'Finalized',
|
||||
':status3' => 'Inactive',
|
||||
'Report' => 'Report',
|
||||
'Net' => 'Net',
|
||||
'Gross' => 'Gross',
|
||||
'Notes' => 'Notes',
|
||||
'CreatedAt' => 'Created At',
|
||||
':status1' => 'Draft',
|
||||
':status2' => 'Finalized',
|
||||
':status3' => 'Inactive',
|
||||
]];
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ use Modules\BusinessExpenses\Models\ExpenseStatus;
|
|||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
$expenses = $this->getData('expenses') ?? [];
|
||||
$expenses = $this->getData('expenses') ?? [];
|
||||
$expenseStatus = ExpenseStatus::getConstants();
|
||||
|
||||
echo $this->getData('nav')->render(); ?>
|
||||
|
|
@ -122,7 +122,7 @@ echo $this->getData('nav')->render(); ?>
|
|||
</label>
|
||||
<tbody>
|
||||
<?php $count = 0; foreach ($expenses as $key => $value) : ++$count;
|
||||
$url = UriFactory::build('{/base}/businessexpenses/expense?{?}&id=' . $value->id);
|
||||
$url = UriFactory::build('{/base}/businessexpenses/expense?{?}&id=' . $value->id);
|
||||
?>
|
||||
<tr data-href="<?= $url; ?>">
|
||||
<td>
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@
|
|||
declare(strict_types=1);
|
||||
|
||||
use Modules\BusinessExpenses\Models\NullExpense;
|
||||
use phpOMS\Uri\UriFactory;
|
||||
|
||||
/** @var \phpOMS\Views\View $this */
|
||||
$expense = $this->getData('expense') ?? new NullExpense();
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user