Promotion Backend v1

This commit is contained in:
Kevin Adametz 2021-10-15 16:35:47 +02:00
parent 0ed47d3553
commit f0da981737
43 changed files with 2765 additions and 45 deletions

View file

@ -197,22 +197,35 @@ class Payment
}
}
//if the order has action
if($shopping_order->shopping_user->is_from === 'user_order'){
//is margin -> set paid
$shopping_order->shopping_order_margin->paid = true;
$shopping_order->shopping_order_margin->save();
}
}
//if the order has action
if($shopping_order->shopping_user->is_from === 'user_order'){
//is margin -> set paid
$shopping_order->shopping_order_margin->paid = true;
$shopping_order->shopping_order_margin->save();
//is payment credit, reduce
return $send_link;
}
//remove form credit, every sale fnc / vor / etc from CheckoutController
//when stone, put it back SalesController
public static function handelUserPayCredits(ShoppingOrder $shopping_order, $do){
//is payment credit, reduce Sae
if($do === 'deduction'){
if($shopping_order->shopping_order_margin->from_payment_credit > 0){
$credit = $shopping_order->shopping_order_margin->from_payment_credit * -1;
self::addUserPayCredits($shopping_order->auth_user, $credit, 2, 'user_order_deduction', $shopping_order->id);
}
}
return $send_link;
if($do === 'return'){
if($shopping_order->shopping_order_margin->from_payment_credit > 0){
$credit = $shopping_order->shopping_order_margin->from_payment_credit;
self::addUserPayCredits($shopping_order->auth_user, $credit, 4, 'user_order_return', $shopping_order->id);
}
}
}
public static function paymentStatusSendMail(ShoppingOrder $shopping_order, $shopping_payment, $data){

View file

@ -66,6 +66,10 @@ class Util
return number_format($value, $dec, ',', '.');
}
public static function formatPlural($count, $singular, $plural){
return ($count === 1) ? $singular : $singular.$plural;
}
public static function utf8ize( $mixed ) {
if (is_array($mixed)) {
foreach ($mixed as $key => $value) {
@ -218,15 +222,27 @@ class Util
}
return url($uri);
}
public static function sanitize($string, $force_lowercase = true, $anal = false, $substr = false)
public static function sanitize($string, $force_lowercase = true, $anal = false, $substr = false, $anCon = false)
{
$strip = array("~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "=", "+", "[", "{", "]",
$strip = array("~", "`", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "=", "+", "[", "{", "]",
"}", "\\", "|", ";", ":", "\"", "'", "‘", "’", "“", "”", "–", "—",
"—", "–", ",", "<", ".", ">", "/", "?");
$clean = trim(str_replace($strip, "", strip_tags($string)));
$clean = preg_replace('/\s+/', "_", $clean);
$clean = ($anal) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ;
$clean = ($anal) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean;
if($anCon){
$ers = array(
'Ä' => 'Ae',
'Ö' => 'Oe',
'Ü' => 'Ue',
'ä' => 'ae',
'ö' => 'oe',
'ü' => 'ue',
'ß' => 'ss'
);
$clean = strtr($clean,$ers);
}
if($substr){
$clean = (strlen($clean) > 20) ? substr($clean,-20) : $clean;