update 20.10.2025
This commit is contained in:
parent
8c11130b5d
commit
a939cd51ef
616 changed files with 84821 additions and 4121 deletions
|
|
@ -101,11 +101,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||
* @property int|null $abo_interval
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereAboInterval($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|ShoppingOrder whereIsAbo($value)
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\DhlShipment> $dhlOutboundShipments
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \Acme\Dhl\Models\DhlShipment> $dhlOutboundShipments
|
||||
* @property-read int|null $dhl_outbound_shipments_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\DhlShipment> $dhlReturnShipments
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \Acme\Dhl\Models\DhlShipment> $dhlReturnShipments
|
||||
* @property-read int|null $dhl_return_shipments_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\DhlShipment> $dhlShipments
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \Acme\Dhl\Models\DhlShipment> $dhlShipments
|
||||
* @property-read int|null $dhl_shipments_count
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
|
|
@ -138,7 +138,7 @@ class ShoppingOrder extends Model
|
|||
'weight',
|
||||
'paid',
|
||||
'is_abo',
|
||||
'abo_interval',
|
||||
'abo_interval',
|
||||
'txaction',
|
||||
'wp_invoice_path',
|
||||
'api_notice',
|
||||
|
|
@ -175,9 +175,9 @@ class ShoppingOrder extends Model
|
|||
];
|
||||
|
||||
public static $apiStatusTypes = [
|
||||
0 => 'ordered',
|
||||
1 => 'in_process',
|
||||
2 => 'paid',
|
||||
0 => 'ordered',
|
||||
1 => 'in_process',
|
||||
2 => 'paid',
|
||||
5 => 'removed',
|
||||
];
|
||||
public static $apiStatusColors = [
|
||||
|
|
@ -227,110 +227,120 @@ class ShoppingOrder extends Model
|
|||
|
||||
public function shopping_user()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ShoppingUser','shopping_user_id');
|
||||
return $this->belongsTo('App\Models\ShoppingUser', 'shopping_user_id');
|
||||
}
|
||||
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ShippingCountry','country_id');
|
||||
return $this->belongsTo('App\Models\ShippingCountry', 'country_id');
|
||||
}
|
||||
|
||||
public function shipping_country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\ShippingCountry','country_id');
|
||||
return $this->belongsTo('App\Models\ShippingCountry', 'country_id');
|
||||
}
|
||||
|
||||
public function homeparty()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Homeparty','homeparty_id');
|
||||
return $this->belongsTo('App\Models\Homeparty', 'homeparty_id');
|
||||
}
|
||||
|
||||
public function user_shop()
|
||||
{
|
||||
return $this->belongsTo('App\Models\UserShop','user_shop_id');
|
||||
return $this->belongsTo('App\Models\UserShop', 'user_shop_id');
|
||||
}
|
||||
|
||||
//can null
|
||||
public function member()
|
||||
{
|
||||
return $this->belongsTo('App\User','member_id');
|
||||
return $this->belongsTo('App\User', 'member_id');
|
||||
}
|
||||
//can null
|
||||
public function auth_user()
|
||||
{
|
||||
return $this->belongsTo('App\User','auth_user_id');
|
||||
return $this->belongsTo('App\User', 'auth_user_id');
|
||||
}
|
||||
|
||||
public function user_history()
|
||||
{
|
||||
return $this->hasOne('App\Models\UserHistory','shopping_order_id')->latest();
|
||||
return $this->hasOne('App\Models\UserHistory', 'shopping_order_id')->latest();
|
||||
}
|
||||
|
||||
public function user_invoice(){
|
||||
public function user_invoice()
|
||||
{
|
||||
return $this->hasOne('App\Models\UserInvoice', 'shopping_order_id', '');
|
||||
}
|
||||
|
||||
public function shopping_collect_order(){
|
||||
public function shopping_collect_order()
|
||||
{
|
||||
return $this->hasOne('App\Models\ShoppingCollectOrder', 'shopping_order_id', '');
|
||||
}
|
||||
|
||||
public function shopping_order_items(){
|
||||
|
||||
public function shopping_order_items()
|
||||
{
|
||||
return $this->hasMany('App\Models\ShoppingOrderItem', 'shopping_order_id');
|
||||
}
|
||||
|
||||
public function shopping_payments(){
|
||||
public function shopping_payments()
|
||||
{
|
||||
return $this->hasMany('App\Models\ShoppingPayment', 'shopping_order_id');
|
||||
}
|
||||
|
||||
public function user_sales_volume(){
|
||||
public function user_sales_volume()
|
||||
{
|
||||
return $this->hasOne('App\Models\UserSalesVolume', 'shopping_order_id');
|
||||
}
|
||||
|
||||
public function user_sales_volume_no_userid(){
|
||||
public function user_sales_volume_no_userid()
|
||||
{
|
||||
return $this->hasOne('App\Models\UserSalesVolume', 'shopping_order_id')->where('user_id', '=', NULL)->first();
|
||||
|
||||
}
|
||||
|
||||
public function getUserAbo(){
|
||||
public function getUserAbo()
|
||||
{
|
||||
$UserAboOrder = UserAboOrder::where('shopping_order_id', $this->id)->first();
|
||||
if($UserAboOrder && $UserAboOrder->user_abo){
|
||||
return $UserAboOrder->user_abo;
|
||||
}
|
||||
if ($UserAboOrder && $UserAboOrder->user_abo) {
|
||||
return $UserAboOrder->user_abo;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getLocale(){
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->language ? $this->language : \App::getLocale();
|
||||
}
|
||||
|
||||
public function setUserHistoryValue($values = []){
|
||||
if($user_history = $this->user_history){
|
||||
foreach ($values as $key=>$val){
|
||||
public function setUserHistoryValue($values = [])
|
||||
{
|
||||
if ($user_history = $this->user_history) {
|
||||
foreach ($values as $key => $val) {
|
||||
$user_history->{$key} = $val;
|
||||
}
|
||||
$user_history->save();
|
||||
}
|
||||
}
|
||||
|
||||
public function getLastShoppingPayment($key=false){
|
||||
public function getLastShoppingPayment($key = false)
|
||||
{
|
||||
$shopping_payment = $this->shopping_payments->last();
|
||||
if($shopping_payment){
|
||||
if($key === 'getPaymentType'){
|
||||
if ($shopping_payment) {
|
||||
if ($key === 'getPaymentType') {
|
||||
return $shopping_payment->getPaymentType();
|
||||
}
|
||||
if($key === 'reference'){
|
||||
if ($key === 'reference') {
|
||||
return $shopping_payment->reference;
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public function getLastShoppingPaymentTransaction(){
|
||||
if($this->shopping_payments){
|
||||
public function getLastShoppingPaymentTransaction()
|
||||
{
|
||||
if ($this->shopping_payments) {
|
||||
$shopping_payment = $this->shopping_payments->last();
|
||||
if($shopping_payment){
|
||||
if ($shopping_payment) {
|
||||
$payt = $shopping_payment->payment_transactions->last();
|
||||
if($payt){
|
||||
if ($payt) {
|
||||
return $payt;
|
||||
}
|
||||
}
|
||||
|
|
@ -338,30 +348,36 @@ class ShoppingOrder extends Model
|
|||
return false;
|
||||
}
|
||||
|
||||
public function getShippedType(){
|
||||
return isset(self::$shippedTypes[$this->shipped]) ? __('payment.'.self::$shippedTypes[$this->shipped]) : "";
|
||||
public function getShippedType()
|
||||
{
|
||||
return isset(self::$shippedTypes[$this->shipped]) ? __('payment.' . self::$shippedTypes[$this->shipped]) : "";
|
||||
}
|
||||
public static function getTransShippedType(){
|
||||
$ret = [];
|
||||
foreach(self::$shippedTypes as $key=>$val){
|
||||
$ret[$key] = trans('payment.'.$val);
|
||||
}
|
||||
return $ret;
|
||||
public static function getTransShippedType()
|
||||
{
|
||||
$ret = [];
|
||||
foreach (self::$shippedTypes as $key => $val) {
|
||||
$ret[$key] = trans('payment.' . $val);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function getAPIShippedType(){
|
||||
public function getAPIShippedType()
|
||||
{
|
||||
return isset(self::$apiShippedTypes[$this->shipped]) ? self::$apiShippedTypes[$this->shipped] : "free";
|
||||
}
|
||||
|
||||
public function getShippedColor(){
|
||||
public function getShippedColor()
|
||||
{
|
||||
return isset(self::$shippedColors[$this->shipped]) ? self::$shippedColors[$this->shipped] : "default";
|
||||
}
|
||||
|
||||
public function getAPIStatusType(){
|
||||
return isset(self::$apiStatusTypes[$this->api_status]) ? __('payment.'.self::$apiStatusTypes[$this->api_status]) : "bestellt";
|
||||
public function getAPIStatusType()
|
||||
{
|
||||
return isset(self::$apiStatusTypes[$this->api_status]) ? __('payment.' . self::$apiStatusTypes[$this->api_status]) : "bestellt";
|
||||
}
|
||||
|
||||
public function getAPIStatusColor(){
|
||||
public function getAPIStatusColor()
|
||||
{
|
||||
return isset(self::$apiStatusColors[$this->api_status]) ? self::$apiStatusColors[$this->api_status] : "warning";
|
||||
}
|
||||
|
||||
|
|
@ -389,7 +405,7 @@ class ShoppingOrder extends Model
|
|||
{
|
||||
return formatNumber($this->attributes['subtotal_ws']);
|
||||
}
|
||||
|
||||
|
||||
public function getFormattedSubtotalShipping()
|
||||
{
|
||||
return formatNumber($this->attributes['subtotal_shipping']);
|
||||
|
|
@ -407,79 +423,84 @@ class ShoppingOrder extends Model
|
|||
|
||||
public function getPriceVkNetBy($product_id)
|
||||
{
|
||||
if($product = Product::find($product_id)){
|
||||
if($this->shipping_country && $this->shipping_country->country){
|
||||
if ($product = Product::find($product_id)) {
|
||||
if ($this->shipping_country && $this->shipping_country->country) {
|
||||
return $product->getPriceWith(true, false, $this->shipping_country->country);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getPaymentForType(){
|
||||
return isset(self::$paymentForTypes[$this->payment_for]) ? __('payment.'.self::$paymentForTypes[$this->payment_for]) : "";
|
||||
|
||||
public function getPaymentForType()
|
||||
{
|
||||
return isset(self::$paymentForTypes[$this->payment_for]) ? __('payment.' . self::$paymentForTypes[$this->payment_for]) : "";
|
||||
}
|
||||
public function getPaymentForColor(){
|
||||
public function getPaymentForColor()
|
||||
{
|
||||
return isset(self::$paymentForColors[$this->payment_for]) ? self::$paymentForColors[$this->payment_for] : "";
|
||||
}
|
||||
|
||||
public function getUserDiscount()
|
||||
{
|
||||
if($this->auth_user && $this->auth_user->user_level){
|
||||
if ($this->auth_user && $this->auth_user->user_level) {
|
||||
return $this->auth_user->user_level->getFormattedMargin();
|
||||
}
|
||||
if($this->member && $this->member->user_level){
|
||||
}
|
||||
if ($this->member && $this->member->user_level) {
|
||||
return $this->member->user_level->getFormattedMargin();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function getItemsCount(){
|
||||
public function getItemsCount()
|
||||
{
|
||||
$count = 0;
|
||||
if($this->shopping_order_items){
|
||||
foreach ($this->shopping_order_items as $shopping_order_item){
|
||||
if ($this->shopping_order_items) {
|
||||
foreach ($this->shopping_order_items as $shopping_order_item) {
|
||||
$count += $shopping_order_item->qty;
|
||||
}
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
public function isInvoice(){
|
||||
public function isInvoice()
|
||||
{
|
||||
return $this->user_invoice ? true : false;
|
||||
}
|
||||
|
||||
public function getStatusByOrder(){
|
||||
if($this->payment_for){
|
||||
if($this->payment_for === 6){ //Kunde-Shop
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public function getStatusByOrder()
|
||||
{
|
||||
if ($this->payment_for) {
|
||||
if ($this->payment_for === 6) { //Kunde-Shop
|
||||
return 2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function makeHomepartyTaxSplit()
|
||||
{
|
||||
$tax_split = [];
|
||||
$net_split = [];
|
||||
|
||||
if($this->homeparty){
|
||||
foreach($this->homeparty->homeparty_order_items as $item){
|
||||
if ($this->homeparty) {
|
||||
foreach ($this->homeparty->homeparty_order_items as $item) {
|
||||
$tax_rate = intval($item->tax_rate);
|
||||
if($tax_rate > 0){
|
||||
if ($tax_rate > 0) {
|
||||
$vk_tax = round((($item->price - $item->price_net) * $item->qty), 2);
|
||||
$ek_tax = round((($item->ek_price - $item->ek_price_net) * $item->qty), 2);
|
||||
$vk_net = round(($item->price_net * $item->qty), 2);
|
||||
$ek_net = round(($item->ek_price_net * $item->qty), 2);
|
||||
if(isset($tax_split[$tax_rate])){
|
||||
if (isset($tax_split[$tax_rate])) {
|
||||
$tax_split[$tax_rate]['vk_tax'] = round($tax_split[$tax_rate]['vk_tax'] + $vk_tax, 2);
|
||||
$tax_split[$tax_rate]['ek_tax'] = round($tax_split[$tax_rate]['ek_tax'] + $ek_tax, 2);
|
||||
|
||||
$net_split[$tax_rate]['vk_net'] = round($net_split[$tax_rate]['vk_net'] + $vk_net, 2);
|
||||
$net_split[$tax_rate]['ek_net'] = round($net_split[$tax_rate]['ek_net'] + $ek_net, 2);
|
||||
}else{
|
||||
} else {
|
||||
$tax_split[$tax_rate] = ['vk_tax' => $vk_tax, 'ek_tax' => $ek_tax];
|
||||
$net_split[$tax_rate] = ['vk_net' => $vk_net, 'ek_net' => $ek_net];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$order_vk_tax = 0;
|
||||
|
|
@ -487,26 +508,26 @@ class ShoppingOrder extends Model
|
|||
$order_vk_net = 0;
|
||||
$order_ek_net = 0;
|
||||
|
||||
if($this->homeparty->order){
|
||||
if(isset($this->homeparty->order['ek_price_net'])){
|
||||
if ($this->homeparty->order) {
|
||||
if (isset($this->homeparty->order['ek_price_net'])) {
|
||||
$order_vk_tax = round((($this->homeparty->order['price'] - $this->homeparty->order['price_net'])), 2);
|
||||
$order_ek_tax = round((($this->homeparty->order['ek_price'] - $this->homeparty->order['ek_price_net'])), 2);
|
||||
$order_vk_net = $this->homeparty->order['price_net'];
|
||||
$order_ek_net = $this->homeparty->order['ek_price_net'];
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($tax_split[16])){
|
||||
|
||||
if (isset($tax_split[16])) {
|
||||
$tax_split[16] = ['vk_tax' => $order_vk_tax, 'ek_tax' => $order_ek_tax];
|
||||
$net_split[16] = ['vk_net' => $order_vk_net, 'ek_net' => $order_ek_net];
|
||||
}
|
||||
if(isset($tax_split[19])){
|
||||
if (isset($tax_split[19])) {
|
||||
$tax_split[19] = ['vk_tax' => $order_vk_tax, 'ek_tax' => $order_ek_tax];
|
||||
$net_split[19] = ['vk_net' => $order_vk_net, 'ek_net' => $order_ek_net];
|
||||
}
|
||||
|
||||
if(isset($tax_split[5])){
|
||||
if(!isset($tax_split[16])){
|
||||
if (isset($tax_split[5])) {
|
||||
if (!isset($tax_split[16])) {
|
||||
$tax_split[16] = ['vk_tax' => $order_vk_tax, 'ek_tax' => $order_ek_tax];
|
||||
$net_split[16] = ['vk_net' => $order_vk_net, 'ek_net' => $order_ek_net];
|
||||
}
|
||||
|
|
@ -514,9 +535,9 @@ class ShoppingOrder extends Model
|
|||
$tax_split[16]['ek_tax'] = round($tax_split[16]['ek_tax'] - $tax_split[5]['ek_tax'], 2);
|
||||
$net_split[16]['vk_net'] = round($net_split[16]['vk_net'] - $net_split[5]['vk_net'], 2);
|
||||
$net_split[16]['ek_net'] = round($net_split[16]['ek_net'] - $net_split[5]['ek_net'], 2);
|
||||
}
|
||||
if(isset($tax_split[7])){
|
||||
if(!isset($tax_split[19])){
|
||||
}
|
||||
if (isset($tax_split[7])) {
|
||||
if (!isset($tax_split[19])) {
|
||||
$tax_split[19] = ['vk_tax' => $order_vk_tax, 'ek_tax' => $order_ek_tax];
|
||||
$net_split[19] = ['vk_net' => $order_vk_net, 'ek_net' => $order_ek_net];
|
||||
}
|
||||
|
|
@ -524,30 +545,30 @@ class ShoppingOrder extends Model
|
|||
$tax_split[19]['ek_tax'] = round($tax_split[19]['ek_tax'] - $tax_split[7]['ek_tax'], 2);
|
||||
$net_split[19]['vk_net'] = round($net_split[19]['vk_net'] - $net_split[7]['vk_net'], 2);
|
||||
$net_split[19]['ek_net'] = round($net_split[19]['ek_net'] - $net_split[7]['ek_net'], 2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach($tax_split as $key=>$value){
|
||||
|
||||
foreach ($tax_split as $key => $value) {
|
||||
$tax_split[$key]['vk_tax'] = number_format($value['vk_tax'], 2);
|
||||
$tax_split[$key]['ek_tax'] = number_format($value['ek_tax'], 2);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($net_split as $key=>$value){
|
||||
foreach ($net_split as $key => $value) {
|
||||
$net_split[$key]['vk_net'] = number_format($value['vk_net'], 2);
|
||||
$net_split[$key]['ek_net'] = number_format($value['ek_net'], 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!isset($tax_split[16]) && !isset($tax_split[19])){
|
||||
if (!isset($tax_split[16]) && !isset($tax_split[19])) {
|
||||
$tax_split = NULL;
|
||||
}
|
||||
if(!isset($net_split[16]) && !isset($net_split[19])){
|
||||
if (!isset($net_split[16]) && !isset($net_split[19])) {
|
||||
$net_split = NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$this->tax_split = $tax_split;
|
||||
$this->net_split = $net_split;
|
||||
$this->save();
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function makeTaxSplit()
|
||||
|
|
@ -555,75 +576,72 @@ class ShoppingOrder extends Model
|
|||
$tax_split = NULL;
|
||||
$net_split = NULL;
|
||||
|
||||
if($this->tax > 0){
|
||||
if ($this->tax > 0) {
|
||||
$tax_split = [];
|
||||
$net_split = [];
|
||||
|
||||
foreach($this->shopping_order_items as $item){
|
||||
foreach ($this->shopping_order_items as $item) {
|
||||
$tax_rate = intval($item->tax_rate);
|
||||
if($tax_rate > 0){
|
||||
$tax_split[$tax_rate] = isset($tax_split[$tax_rate]) ?
|
||||
round($tax_split[$tax_rate] + ($item->tax * $item->qty), 2) :
|
||||
round(($item->tax * $item->qty), 2);
|
||||
if ($tax_rate > 0) {
|
||||
$tax_split[$tax_rate] = isset($tax_split[$tax_rate]) ?
|
||||
round($tax_split[$tax_rate] + ($item->tax * $item->qty), 2) :
|
||||
round(($item->tax * $item->qty), 2);
|
||||
|
||||
$net_split[$tax_rate] = isset($net_split[$tax_rate]) ?
|
||||
round($net_split[$tax_rate] + ($item->price_net * $item->qty), 2) :
|
||||
round(($item->price_net * $item->qty), 2);
|
||||
|
||||
$net_split[$tax_rate] = isset($net_split[$tax_rate]) ?
|
||||
round($net_split[$tax_rate] + ($item->price_net * $item->qty), 2) :
|
||||
round(($item->price_net * $item->qty), 2);
|
||||
}
|
||||
}
|
||||
if(isset($tax_split[16])){
|
||||
}
|
||||
if (isset($tax_split[16])) {
|
||||
$tax_split[16] = $this->tax;
|
||||
$net_split[16] = $this->subtotal_ws;
|
||||
|
||||
}
|
||||
if(isset($tax_split[19])){
|
||||
if (isset($tax_split[19])) {
|
||||
$tax_split[19] = $this->tax;
|
||||
$net_split[19] = $this->subtotal_ws;
|
||||
}
|
||||
|
||||
if(isset($tax_split[5])){
|
||||
if(!isset($tax_split[16])){
|
||||
if (isset($tax_split[5])) {
|
||||
if (!isset($tax_split[16])) {
|
||||
$tax_split[16] = $this->tax;
|
||||
$net_split[16] = $this->subtotal_ws;
|
||||
|
||||
}
|
||||
$tax_split[16] = round($tax_split[16] - $tax_split[5], 2);
|
||||
$net_split[16] = round($net_split[16] - $net_split[5], 2);
|
||||
}
|
||||
if(isset($tax_split[7])){
|
||||
if(!isset($tax_split[19])){
|
||||
}
|
||||
if (isset($tax_split[7])) {
|
||||
if (!isset($tax_split[19])) {
|
||||
$tax_split[19] = $this->tax;
|
||||
$net_split[19] = $this->subtotal_ws;
|
||||
|
||||
}
|
||||
$tax_split[19] = round($tax_split[19] - $tax_split[7], 2);
|
||||
$net_split[19] = round($net_split[19] - $net_split[7], 2);
|
||||
}
|
||||
}
|
||||
|
||||
foreach($tax_split as $key=>$value){
|
||||
foreach ($tax_split as $key => $value) {
|
||||
$tax_split[$key] = number_format($value, 2);
|
||||
}
|
||||
foreach($net_split as $key=>$value){
|
||||
}
|
||||
foreach ($net_split as $key => $value) {
|
||||
$net_split[$key] = number_format($value, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->tax_split = $tax_split;
|
||||
$this->net_split = $net_split;
|
||||
|
||||
$this->save();
|
||||
$this->save();
|
||||
}
|
||||
|
||||
public function getShoppingUserFullName(){
|
||||
|
||||
if($this->shopping_user){
|
||||
public function getShoppingUserFullName()
|
||||
{
|
||||
|
||||
if ($this->shopping_user) {
|
||||
$fullname = $this->shopping_user->getFullNameAsArray();
|
||||
$ret = "";
|
||||
$ret .= $fullname['company'] ? $fullname['company'].' | ' : '';
|
||||
$ret .= $fullname['salutation'] ? \App\Services\HTMLHelper::getSalutationLang($fullname['salutation']).' ' : '';
|
||||
$ret .= $fullname['firstname'] ? $fullname['firstname'].' ' : '';
|
||||
$ret .= $fullname['company'] ? $fullname['company'] . ' | ' : '';
|
||||
$ret .= $fullname['salutation'] ? \App\Services\HTMLHelper::getSalutationLang($fullname['salutation']) . ' ' : '';
|
||||
$ret .= $fullname['firstname'] ? $fullname['firstname'] . ' ' : '';
|
||||
$ret .= $fullname['lastname'] ? $fullname['lastname'] : '';
|
||||
$ret .= $fullname['email'] ? ' | '.$fullname['email'].'' : '';
|
||||
$ret .= $fullname['email'] ? ' | ' . $fullname['email'] . '' : '';
|
||||
}
|
||||
|
||||
return $ret;
|
||||
|
|
@ -634,7 +652,7 @@ class ShoppingOrder extends Model
|
|||
*/
|
||||
public function dhlShipments()
|
||||
{
|
||||
return $this->hasMany('App\Models\DhlShipment', 'shopping_order_id');
|
||||
return $this->hasMany('Acme\Dhl\Models\DhlShipment', 'order_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -642,7 +660,7 @@ class ShoppingOrder extends Model
|
|||
*/
|
||||
public function dhlOutboundShipments()
|
||||
{
|
||||
return $this->hasMany('App\Models\DhlShipment', 'shopping_order_id')->where('type', 'outbound');
|
||||
return $this->hasMany('Acme\Dhl\Models\DhlShipment', 'order_id')->where('type', 'outbound');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -650,7 +668,7 @@ class ShoppingOrder extends Model
|
|||
*/
|
||||
public function dhlReturnShipments()
|
||||
{
|
||||
return $this->hasMany('App\Models\DhlShipment', 'shopping_order_id')->where('type', 'return');
|
||||
return $this->hasMany('Acme\Dhl\Models\DhlShipment', 'order_id')->where('type', 'return');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -668,5 +686,4 @@ class ShoppingOrder extends Model
|
|||
{
|
||||
return $this->dhlShipments()->latest()->first();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue