Skip to content
Code-Schnipsel Gruppen Projekte
Commit 55232d57 erstellt von Henning Leutz's avatar Henning Leutz :martial_arts_uniform:
Dateien durchsuchen

Merge branch 'dev' into 'next'

feat!: quiqqer v2

See merge request !47
Übergeordnete c3248296 e068340a
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!48feat!: quiqqer v2,!47feat!: quiqqer v2
Pipeline-Nr. 7306 bestanden
werden angezeigt mit 65 Ergänzungen und 50 Löschungen
tools/
phpstan.neon
.phpunit.result.cache
phpunit.xml
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="^1.10.67" installed="1.10.67" location="./tools/phpstan" copy="false"/>
</phive>
......@@ -17,10 +17,10 @@ function ($userId, $data) {
$User = QUI::getUsers()->get($userId);
$Address = $User->addAddress(
\json_decode($data, true)
json_decode($data, true)
);
$User->setAttribute('quiqqer.erp.address', $Address->getId());
$User->setAttribute('quiqqer.erp.address', $Address->getUUID());
$User->save();
},
['userId', 'data'],
......
......@@ -7,7 +7,7 @@
/**
* Add a comment to an invoice
*
* @param string|integer invoiceId - ID of the invoice
* @param string|integer $invoiceId - ID of the invoice
* @param string $comment - amount of the payment
*/
QUI::$Ajax->registerFunction(
......@@ -15,7 +15,7 @@
function ($invoiceId, $comment) {
try {
$Invoice = QUI\ERP\Accounting\Invoice\Utils\Invoice::getInvoiceByString($invoiceId);
} catch (\Exception $Exception) {
} catch (Exception $Exception) {
QUI\System\Log::addDebug($Exception->getMessage());
throw $Exception;
}
......
......@@ -10,7 +10,7 @@
/**
* Add a payment to an invoice
*
* @param string|integer invoiceId - ID of the invoice
* @param string|integer $invoiceId - ID of the invoice
* @param string|int $amount - amount of the payment
* @param string $paymentMethod - Payment method
* @param string|int $date - Date of the payment
......@@ -23,7 +23,7 @@ function ($invoiceId, $amount, $paymentMethod, $date) {
try {
$Invoice = $Invoices->getInvoice($invoiceId);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
$Invoice = $Invoices->getInvoiceByHash($invoiceId);
}
......@@ -31,7 +31,7 @@ function ($invoiceId, $amount, $paymentMethod, $date) {
TransactionFactory::createPaymentTransaction(
$amount,
$Invoice->getCurrency(),
$Invoice->getHash(),
$Invoice->getUUID(),
$Payment->getPaymentType()->getName(),
[],
QUI::getUserBySession(),
......
......@@ -15,7 +15,7 @@
'package_quiqqer_invoice_ajax_invoices_articleHtml',
function ($invoiceId) {
$Invoices = QUI\ERP\Accounting\Invoice\Handler::getInstance();
$Invoice = $Invoices->get($invoiceId);
$Invoice = $Invoices->get($invoiceId);
$Articles = $Invoice->getArticles();
return $Articles->toHTMLWithCSS();
......
......@@ -14,7 +14,7 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_invoice_ajax_invoices_copy',
function ($invoiceId) {
return InvoiceUtils::getInvoiceByString($invoiceId)->copy()->getId();
return InvoiceUtils::getInvoiceByString($invoiceId)->copy()->getUUID();
},
['invoiceId'],
'Permission::checkAdminUser'
......
......@@ -15,7 +15,7 @@ function () {
$Factory = QUI\ERP\Accounting\Invoice\Factory::getInstance();
$Invoice = $Factory->createInvoice();
return $Invoice->getId();
return $Invoice->getUUID();
},
false,
['Permission::checkAdminUser', 'quiqqer.invoice.create']
......
......@@ -24,7 +24,7 @@ function ($invoiceId, $invoiceData) {
$invoiceData = [];
}
$Settings = QUI\ERP\Accounting\Invoice\Settings::getInstance();
$Settings = QUI\ERP\Accounting\Invoice\Settings::getInstance();
$currentSetting = $Settings->sendMailAtInvoiceCreation();
$Settings->set('invoice', 'sendMailAtCreation', false);
......@@ -40,7 +40,7 @@ function ($invoiceId, $invoiceData) {
$Settings->set('invoice', 'sendMailAtCreation', $currentSetting);
return $CreditNote->getId();
return $CreditNote->getUUID();
},
['invoiceId', 'invoiceData'],
'Permission::checkAdminUser'
......
......@@ -20,29 +20,29 @@ function ($invoiceId) {
try {
$Invoice = $Invoices->get($invoiceId);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
$Invoice = $Invoices->getInvoiceByHash($invoiceId);
}
QUI\ERP\Accounting\Calc::calculatePayments($Invoice);
$attributes = $Invoice->toArray();
$Currency = $Invoice->getCurrency();
$attributes = $Invoice->toArray();
$Currency = $Invoice->getCurrency();
$DateFormatter = QUI::getLocale()->getDateFormatter();
$attributes['display_subsum'] = $Currency->format($attributes['subsum']);
$attributes['display_sum'] = $Currency->format($attributes['sum']);
$attributes['vatsum'] = QUI\ERP\Accounting\Calc::calculateTotalVatOfInvoice($attributes['vat_array']);
$attributes['display_sum'] = $Currency->format($attributes['sum']);
$attributes['vatsum'] = QUI\ERP\Accounting\Calc::calculateTotalVatOfInvoice($attributes['vat_array']);
$attributes['display_vatsum'] = $Currency->format($attributes['vatsum']);
if (!empty($attributes['time_for_payment'])) {
$attributes['time_for_payment'] = $DateFormatter->format(
\strtotime($attributes['time_for_payment'])
strtotime($attributes['time_for_payment'])
);
}
$attributes['articles'] = InvoiceUtils::formatArticlesArray($attributes['articles']);
$attributes['getType'] = $Invoice->getType();
$attributes['getType'] = $Invoice->getType();
return $attributes;
},
......
......@@ -11,6 +11,10 @@
*
* @return array
*/
use QUI\ERP\Accounting\Invoice\Invoice;
use QUI\ERP\Accounting\Payments\Transactions\Transaction;
QUI::$Ajax->registerFunction(
'package_quiqqer_invoice_ajax_invoices_getHistory',
function ($invoiceId) {
......@@ -18,48 +22,48 @@ function ($invoiceId) {
try {
$Invoice = $Invoices->get($invoiceId);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
try {
$Invoice = $Invoices->getInvoiceByHash($invoiceId);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
$Invoice = $Invoices->getTemporaryInvoiceByHash($invoiceId);
}
}
/* @var $Invoice \QUI\ERP\Accounting\Invoice\Invoice */
/* @var $Invoice Invoice */
QUI\ERP\Accounting\Calc::calculatePayments($Invoice);
$History = $Invoice->getHistory();
$history = \array_map(function ($history) {
$history = array_map(function ($history) {
$history['type'] = 'history';
return $history;
}, $History->toArray());
$Comments = $Invoice->getComments();
$comments = \array_map(function ($comment) {
$comments = array_map(function ($comment) {
$comment['type'] = 'comment';
return $comment;
}, $Comments->toArray());
$history = \array_merge($history, $comments);
$history = array_merge($history, $comments);
// transactions
$Transactions = QUI\ERP\Accounting\Payments\Transactions\Handler::getInstance();
$transactions = $Transactions->getTransactionsByHash($Invoice->getHash());
$transactions = $Transactions->getTransactionsByHash($Invoice->getUUID());
foreach ($transactions as $Tx) {
/* @var $Tx \QUI\ERP\Accounting\Payments\Transactions\Transaction */
/* @var $Tx Transaction */
$history[] = [
'message' => $Tx->parseToText(),
'time' => \strtotime($Tx->getDate()),
'type' => 'transaction',
'time' => strtotime($Tx->getDate()),
'type' => 'transaction',
];
}
// sort
\usort($history, function ($a, $b) {
usort($history, function ($a, $b) {
if ($a['time'] == $b['time']) {
return 0;
}
......
......@@ -12,13 +12,16 @@
*
* @return array
*/
use QUI\ERP\Accounting\Payments\Transactions\Transaction;
QUI::$Ajax->registerFunction(
'package_quiqqer_invoice_ajax_invoices_getTransactions',
function ($invoiceId) {
$transactions = QUI\ERP\Accounting\Invoice\Utils\Invoice::getTransactionsByInvoice($invoiceId);
return \array_map(function ($Transaction) {
/* @var $Transaction \QUI\ERP\Accounting\Payments\Transactions\Transaction */
return array_map(function ($Transaction) {
/* @var $Transaction Transaction */
return $Transaction->getAttributes();
}, $transactions);
},
......
......@@ -18,7 +18,7 @@ function ($invoiceId) {
try {
$Invoice = $Invoices->get($invoiceId);
} catch (QUI\Exception $Exception) {
} catch (QUI\Exception) {
$Invoice = $Invoices->getInvoiceByHash($invoiceId);
}
......
......@@ -11,9 +11,9 @@
* @throws QUI\Exception
*/
use QUI\Exception;
use QUI\ERP\Accounting\Payments\Transactions\Handler as TransactionHandler;
use QUI\ERP\Accounting\Invoice\Handler as InvoiceHandler;
use QUI\ERP\Accounting\Payments\Transactions\Handler as TransactionHandler;
use QUI\Exception;
use QUI\Utils\Security\Orthos;
QUI::$Ajax->registerFunction(
......@@ -23,12 +23,12 @@ function ($invoiceHash, $txId) {
$Invoice = $Invoices->getInvoiceByHash(Orthos::clear($invoiceHash));
$Transaction = TransactionHandler::getInstance()->get(Orthos::clear($txId));
if ($Transaction->isHashLinked($Invoice->getHash())) {
if ($Transaction->isHashLinked($Invoice->getUUID())) {
throw new Exception([
'quiqqer/invoice',
'message.ajax.invoices.linkTransaction.error.tx_already_linked',
[
'invoiceNo' => $Invoice->getId(),
'invoiceNo' => $Invoice->getUUID(),
'txId' => $Transaction->getTxId()
]
]);
......
......@@ -17,13 +17,13 @@
'package_quiqqer_invoice_ajax_invoices_list',
function ($params) {
$Search = InvoiceSearch::getInstance();
$Grid = new QUI\Utils\Grid();
$Grid = new QUI\Utils\Grid();
// query params
$query = $Grid->parseDBParams(\json_decode($params, true));
$query = $Grid->parseDBParams(json_decode($params, true));
if (isset($query['limit'])) {
$limit = \explode(',', $query['limit']);
$limit = explode(',', $query['limit']);
$Search->limit($limit[0], $limit[1]);
}
......
......@@ -13,7 +13,7 @@
'package_quiqqer_invoice_ajax_invoices_preview',
function ($invoiceId, $onlyArticles) {
$Invoice = InvoiceUtils::getInvoiceByString($invoiceId);
$View = $Invoice->getView();
$View = $Invoice->getView();
if (!isset($onlyArticles)) {
$onlyArticles = false;
......
......@@ -11,7 +11,7 @@
'package_quiqqer_invoice_ajax_invoices_refund',
function ($txid, $refund, $message = '') {
$Transactions = QUI\ERP\Accounting\Payments\Transactions\Handler::getInstance();
$Transaction = $Transactions->get($txid);
$Transaction = $Transactions->get($txid);
$Transaction->refund($refund, $message);
},
......
......@@ -12,16 +12,16 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_invoice_ajax_invoices_reversal',
function ($invoiceId, $reason) {
$Settings = QUI\ERP\Accounting\Invoice\Settings::getInstance();
$Settings = QUI\ERP\Accounting\Invoice\Settings::getInstance();
$currentSetting = $Settings->sendMailAtInvoiceCreation();
$Settings->set('invoice', 'sendMailAtCreation', false);
$result = InvoiceUtils::getInvoiceByString($invoiceId)->reversal($reason);
$result = InvoiceUtils::getInvoiceByString($invoiceId)->reversal($reason);
$Reversal = InvoiceUtils::getInvoiceByString($result);
$Settings->set('invoice', 'sendMailAtCreation', $currentSetting);
return $Reversal->getHash();
return $Reversal->getUUID();
},
['invoiceId', 'reason'],
'Permission::checkAdminUser'
......
......@@ -21,17 +21,17 @@ function ($params, $filter) {
$Grid = new QUI\Utils\Grid();
// filter
$filter = \json_decode($filter);
$filter = json_decode($filter);
foreach ($filter as $entry => $value) {
$Search->setFilter($entry, $value);
}
// query params
$query = $Grid->parseDBParams(\json_decode($params, true));
$query = $Grid->parseDBParams(json_decode($params, true));
if (isset($query['limit'])) {
$limit = \explode(',', $query['limit']);
$limit = explode(',', $query['limit']);
$Search->limit($limit[0], $limit[1]);
}
......@@ -46,7 +46,7 @@ function ($params, $filter) {
try {
return $Search->searchForGrid();
} catch (\Exception $Exception) {
} catch (Exception $Exception) {
QUI\System\Log::writeException($Exception);
return [
......
......@@ -12,7 +12,7 @@
QUI::$Ajax->registerFunction(
'package_quiqqer_invoice_ajax_invoices_setCustomerFiles',
function ($invoiceHash, $customerFiles) {
$customerFiles = \json_decode($customerFiles, true);
$customerFiles = json_decode($customerFiles, true);
$Invoice = QUI\ERP\Accounting\Invoice\Utils\Invoice::getInvoiceByString($invoiceHash);
$Invoice->clearCustomerFiles();
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren