Version 4.1.2
This commit is contained in:
1 parent
3ba79295ee
commit
28bd025b35
1131 files changed
+63658
-20579
No files matched your search
@@ -824,7 +824,7 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
|
||||
/* Add it all together */
|
||||
$return['total'] = new \IPS\nexus\Money( $subtotal + $shipping + $tax, $this->currency );
|
||||
$return['total'] = $return['total']->round(); // Total value must also be a valid currency amount
|
||||
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -1050,10 +1050,10 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
|
||||
|
||||
/* If we're still here, we're applying commission */
|
||||
$amountToGive = round( ( ( $amountToApplyCommissionOn / 100 ) * $commissionRule->commission ), 2 );
|
||||
if ( $commissionRule->commission_limit )
|
||||
if ( $commissionRule->commission_limit and $commissionRule->commission_limit != '*' )
|
||||
{
|
||||
$limit = json_decode( $commissionRule->commission_limit, TRUE );
|
||||
if ( $amountToGive > $limit[ $this->currency ]['amount'] )
|
||||
if ( isset( $limit[ $this->currency ] ) and $amountToGive > $limit[ $this->currency ]['amount'] )
|
||||
{
|
||||
$amountToGive = $limit[ $this->currency ]['amount'];
|
||||
}
|
||||
@@ -1135,7 +1135,7 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
|
||||
}
|
||||
}
|
||||
|
||||
return $amountToPay;
|
||||
return $amountToPay->round();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1361,6 +1361,27 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
|
||||
|
||||
/* Update associated transactions */
|
||||
\IPS\Db::i()->update( 'nexus_transactions', array( 't_member' => $this->member->member_id ), array( 't_invoice=? AND t_member=0', $this->id ) );
|
||||
|
||||
/* Did we use any coupons? */
|
||||
foreach ( $this->items as $item )
|
||||
{
|
||||
if ( $item instanceof \IPS\nexus\extensions\nexus\Item\CouponDiscount )
|
||||
{
|
||||
$coupon = \IPS\nexus\Coupon::load( $item->id );
|
||||
$uses = $coupon->used_by ? json_decode( $coupon->used_by, TRUE ) : array();
|
||||
if ( isset( $uses[ $this->member->email ] ) )
|
||||
{
|
||||
$uses[ $this->member->member_id ] = $uses[ $this->member->email ];
|
||||
unset( $uses[ $this->member->email ] );
|
||||
}
|
||||
else
|
||||
{
|
||||
$uses[ $this->member->member_id ] = 1;
|
||||
}
|
||||
$coupon->used_by = json_encode( $uses );
|
||||
$coupon->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Init */
|
||||
|
||||
Reference in new issue
Block a user