Skip to content
GitLab
Erkunden
Anmelden
Registrieren
Primärnavigation
Suchen oder aufrufen …
Projekt
coupons
Verwalten
Aktivität
Mitglieder
Labels
Planen
Tickets
6
Ticketübersichten
Meilensteine
Wiki
Code
Merge Requests
0
Repository
Branch
Commits
Tags
Repository-Diagramm
Revisionen vergleichen
Build
Pipelines
Aufgaben
Pipeline-Zeitpläne
Artefakte
Bereitstellung
Releases
Betreiben
Umgebungen
Überwachen
Vorfälle
Service-Desk
Analysieren
Wertschöpfungskettenanalyse
Mitwirkenden-Analyse
CI/CD-Analyse
Repository-Analysen
Hilfe
Hilfe
Support
GitLab-Dokumentation
GitLab-Pläne vergleichen
Community-Forum
Zu GitLab beitragen
Feedback geben
Tastenkürzel
?
Code-Schnipsel
Gruppen
Projekte
Show more breadcrumbs
QUIQQER
coupons
Commits
6e822f7d
Commit
6e822f7d
erstellt
vor 3 Jahren
von
Henning Leutz
Dateien durchsuchen
Optionen
Downloads
Patches
Einfaches Diff
refactor: return hints
Übergeordneter
0997886c
No related branches found
Branches enthält Commit
No related tags found
Tags enthält Commit
Keine zugehörigen Merge Requests gefunden
Änderungen
1
Leerzeichenänderungen ausblenden
Inline
Nebeneinander
1 geänderte Datei
src/QUI/ERP/Coupons/CouponCode.php
+43
-28
43 Ergänzungen, 28 Löschungen
src/QUI/ERP/Coupons/CouponCode.php
wird angezeigt
mit
43 Ergänzungen
und
28 Löschungen
src/QUI/ERP/Coupons/CouponCode.php
+
43
−
28
Zeige Datei @
6e822f7d
...
...
@@ -2,9 +2,8 @@
namespace
QUI\ERP\Coupons
;
use
QUI\ERP\Order\OrderInterface
;
use
function
GuzzleHttp\Promise\queue
;
use
QUI
;
use
QUI\ERP\Order\OrderInterface
;
use
QUI\Permissions\Permission
;
use
QUI\ERP\Discount\Handler
as
DiscountHandler
;
...
...
@@ -94,16 +93,28 @@ class CouponCode
* CouponCode constructor.
*
* @param int $id - Invite Code ID
* @throws
\QUI\ERP\Coupons\
CouponCodeException
* @throws CouponCodeException
*/
public
function
__construct
(
$id
)
public
function
__construct
(
int
$id
)
{
$result
=
QUI
::
getDataBase
()
->
fetch
([
'from'
=>
Handler
::
getTable
(),
'where'
=>
[
'id'
=>
$id
]
]);
try
{
$result
=
QUI
::
getDataBase
()
->
fetch
([
'from'
=>
Handler
::
getTable
(),
'where'
=>
[
'id'
=>
$id
]
]);
}
catch
(
QUI\DataBase\Exception
$Exception
)
{
QUI\System\Log
::
addError
(
$Exception
->
getMessage
());
throw
new
CouponCodeException
([
'quiqqer/coupons'
,
'exception.CouponCode.not_found'
,
[
'id'
=>
$id
]
],
404
);
}
if
(
empty
(
$result
))
{
throw
new
CouponCodeException
([
...
...
@@ -153,7 +164,7 @@ public function __construct($id)
/**
* @return int
*/
public
function
getId
()
public
function
getId
()
:
int
{
return
$this
->
id
;
}
...
...
@@ -161,7 +172,7 @@ public function getId()
/**
* @return string
*/
public
function
getCode
()
public
function
getCode
()
:
string
{
return
$this
->
code
;
}
...
...
@@ -169,7 +180,7 @@ public function getCode()
/**
* @return \DateTime
*/
public
function
getCreateDate
()
public
function
getCreateDate
()
:
\DateTime
{
return
$this
->
CreateDate
;
}
...
...
@@ -179,7 +190,7 @@ public function getCreateDate()
*
* @return array
*/
public
function
getUsages
()
public
function
getUsages
()
:
array
{
return
$this
->
usages
;
}
...
...
@@ -187,7 +198,7 @@ public function getUsages()
/**
* @return \DateTime|null
*/
public
function
getValidUntilDate
()
public
function
getValidUntilDate
()
:
?
\DateTime
{
return
$this
->
ValidUntilDate
;
}
...
...
@@ -195,7 +206,7 @@ public function getValidUntilDate()
/**
* @return string
*/
public
function
getTitle
()
public
function
getTitle
()
:
?string
{
return
$this
->
title
;
}
...
...
@@ -203,7 +214,7 @@ public function getTitle()
/**
* @return int[]
*/
public
function
getDiscountIds
()
public
function
getDiscountIds
()
:
array
{
return
$this
->
discountIds
;
}
...
...
@@ -213,7 +224,7 @@ public function getDiscountIds()
*
* @return QUI\ERP\Discount\Discount[]
*/
public
function
getDiscounts
()
public
function
getDiscounts
()
:
array
{
$discounts
=
[];
$DiscountHandler
=
DiscountHandler
::
getInstance
();
...
...
@@ -454,7 +465,7 @@ public function checkOrderRedemption($Order)
* @param OrderInterface $Order
* @return bool
*/
public
function
isRedeemable
(
$User
=
null
,
$Order
=
null
)
public
function
isRedeemable
(
$User
=
null
,
$Order
=
null
)
:
bool
{
try
{
$this
->
checkRedemption
(
$User
);
...
...
@@ -480,7 +491,7 @@ public function isRedeemable($User = null, $Order = null)
*
* @return bool
*/
public
function
isValid
()
public
function
isValid
()
:
bool
{
return
$this
->
valid
;
}
...
...
@@ -491,7 +502,7 @@ public function isValid()
* @param QUI\Interfaces\Users\User $User
* @return bool
*/
public
function
hasUserRedeemed
(
$User
)
public
function
hasUserRedeemed
(
QUI
\Interfaces\Users\User
$User
):
bool
{
$userId
=
$User
->
getId
();
...
...
@@ -514,10 +525,14 @@ public function delete()
{
Permission
::
checkPermission
(
Handler
::
PERMISSION_DELETE
);
QUI
::
getDataBase
()
->
delete
(
Handler
::
getTable
(),
[
'id'
=>
$this
->
id
]
);
try
{
QUI
::
getDataBase
()
->
delete
(
Handler
::
getTable
(),
[
'id'
=>
$this
->
id
]
);
}
catch
(
QUI\DataBase\Exception
$Exception
)
{
QUI\System\Log
::
addError
(
$Exception
->
getMessage
());
}
}
/**
...
...
@@ -525,7 +540,7 @@ public function delete()
*
* @return array
*/
public
function
toArray
()
public
function
toArray
()
:
array
{
$data
=
[
'id'
=>
$this
->
getId
(),
...
...
@@ -682,7 +697,7 @@ public function addToOrder(QUI\ERP\Order\OrderInProcess $Order)
}
/**
* @param
QUI\ERP\Accounting\Articles\Text
$Article
* @param $Article
* @return boolean
*/
$isInArticles
=
function
(
$Article
)
use
(
$Order
)
{
...
...
@@ -712,7 +727,7 @@ public function addToOrder(QUI\ERP\Order\OrderInProcess $Order)
};
foreach
(
$articles
as
$Article
)
{
/* @var $PriceFactor QUI\ERP\Accounting\
Invoice\
Articles\Text */
/* @var $PriceFactor QUI\ERP\Accounting\Articles\Text */
if
(
$isInArticles
(
$Article
)
===
false
)
{
$Order
->
addArticle
(
$Article
);
}
...
...
This diff is collapsed.
Zum Erweitern klicken.
Vorschau
0%
Wiederholen
oder
Neue Datei anhängen
.
Abbrechen
You are about to add
0
people
to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Kommentar speichern
Abbrechen
Bitte
registrieren
oder
Anmelden
zum Kommentieren