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

Merge branch 'dev' into 'next'

fix: use global process not for itself

See merge request !29
Übergeordnete f36496c1 004af25f
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
2 Merge Requests!30Next,!29fix: use global process not for itself
Pipeline-Nr. 6037 bestanden
......@@ -22,22 +22,20 @@ class Factory extends QUI\Utils\Singleton
* Creates a new temporary invoice
*
* @param QUI\Interfaces\Users\User|null $User
* @param string|bool $hash - hash of the process
* @param bool|string $globalProcessId - hash of the process
* @return InvoiceTemporary
* @throws
*/
public function createInvoice($User = null, $hash = false): InvoiceTemporary
{
public function createInvoice(
QUI\Interfaces\Users\User $User = null,
bool|string $globalProcessId = false
): InvoiceTemporary {
if ($User === null) {
$User = QUI::getUserBySession();
}
if ($hash === false) {
$hash = QUI\Utils\Uuid::get();
}
$processId = $hash;
$hash = QUI\Utils\Uuid::get();
// check if hash already exists, if hash exists, we cant use it twice
try {
......@@ -46,7 +44,7 @@ public function createInvoice($User = null, $hash = false): InvoiceTemporary
// if invoice hash exist, we need a new hash
$hash = QUI\Utils\Uuid::get();
} catch (QUI\Exception $Exception) {
QUI\System\Log::writeDebugException($Exception);
// nothing
}
......@@ -68,7 +66,7 @@ public function createInvoice($User = null, $hash = false): InvoiceTemporary
'editor_id' => $editor,
'editor_name' => '-',
'hash' => $hash,
'global_process_id' => $processId,
'global_process_id' => $globalProcessId,
'customer_id' => 0,
'type' => Handler::TYPE_INVOICE_TEMPORARY,
'paid_status' => QUI\ERP\Constants::PAYMENT_STATUS_OPEN,
......
......@@ -728,15 +728,17 @@ public function storno(string $reason, $PermissionUser = null): int
* Copy the invoice to a temporary invoice
*
* @param null|QUI\Interfaces\Users\User $PermissionUser
* @param false|string $globalProcessId
* @param bool|string $globalProcessId
* @return InvoiceTemporary
*
* @throws Exception
* @throws QUI\Exception
* @throws QUI\Permissions\Exception
*/
public function copy($PermissionUser = null, $globalProcessId = false): InvoiceTemporary
{
public function copy(
QUI\Interfaces\Users\User $PermissionUser = null,
bool|string $globalProcessId = false
): InvoiceTemporary {
if ($PermissionUser === null) {
$PermissionUser = QUI::getUserBySession();
}
......
......@@ -1096,7 +1096,7 @@ public function copy($PermissionUser = null): InvoiceTemporary
$Handler = Handler::getInstance();
$Factory = Factory::getInstance();
$New = $Factory->createInvoice($PermissionUser);
$New = $Factory->createInvoice($PermissionUser, $this->getGlobalProcessId());
$currentData = QUI::getDataBase()->fetch([
'from' => $Handler->temporaryInvoiceTable(),
......@@ -1140,7 +1140,7 @@ public function copy($PermissionUser = null): InvoiceTemporary
* @throws QUI\Permissions\Exception
* @throws QUI\Exception
*/
public function post($PermissionUser = null): Invoice
public function post(QUI\Interfaces\Users\User $PermissionUser = null): Invoice
{
if ($PermissionUser === null) {
$PermissionUser = QUI::getUserBySession();
......
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