Version 4.7.6
This commit is contained in:
1 parent
8ba7d43898
commit
7b7404e741
1085 files changed
+30590
-7837
No files matched your search
@@ -151,6 +151,22 @@ class _Rule extends \IPS\Node\Model
|
||||
|
||||
$conditions[] = \IPS\Member::loggedIn()->language()->addToStack( 'f_blurb_products', FALSE, array( 'sprintf' => array( implode( ' ' . \IPS\Member::loggedIn()->language()->addToStack('or') . ' ', $packages ) ) ) );
|
||||
}
|
||||
|
||||
/* Subscriptions */
|
||||
if ( $this->subscriptions and $this->subscriptions != '*' )
|
||||
{
|
||||
$subscriptions = array();
|
||||
foreach ( explode( ',', $this->subscriptions ) as $id )
|
||||
{
|
||||
try
|
||||
{
|
||||
$subscriptions[] = \IPS\nexus\Subscription\Package::load( $id )->_title;
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
}
|
||||
|
||||
$conditions[] = \IPS\Member::loggedIn()->language()->addToStack( 'f_blurb_subscriptions', FALSE, array( 'sprintf' => array( implode( ' ' . \IPS\Member::loggedIn()->language()->addToStack('or') . ' ', $subscriptions ) ) ) );
|
||||
}
|
||||
|
||||
/* Coupon */
|
||||
if ( $this->coupon )
|
||||
@@ -444,6 +460,7 @@ class _Rule extends \IPS\Node\Model
|
||||
$form->addTab( 'fraud_rule_transaction' );
|
||||
$form->add( $this->_combine( 'f_amount', 'IPS\nexus\Form\Money' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'f_products', ( !$this->products or $this->products === '*' ) ? 0 : explode( ',', $this->products ), FALSE, array( 'class' => 'IPS\nexus\Package', 'multiple' => TRUE, 'zeroVal' => 'any' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'f_subscriptions', ( !$this->subscriptions or $this->subscriptions === '*' ) ? 0 : explode( ',', $this->subscriptions ), FALSE, array( 'class' => 'IPS\nexus\Subscription\Package', 'multiple' => TRUE, 'zeroVal' => 'any' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'f_methods', ( !$this->methods or $this->methods === '*' ) ? 0 : explode( ',', $this->methods ), FALSE, array( 'class' => 'IPS\nexus\Gateway', 'multiple' => TRUE, 'zeroVal' => 'any' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'f_coupon', $this->coupon, FALSE, array( 'options' => $yesNoEither ) ) );
|
||||
|
||||
@@ -645,7 +662,7 @@ class _Rule extends \IPS\Node\Model
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( array( 'f_methods', 'f_products' ) as $k )
|
||||
foreach ( array( 'f_methods', 'f_products', 'f_subscriptions' ) as $k )
|
||||
{
|
||||
if( isset( $values[ $k ] ) )
|
||||
{
|
||||
@@ -735,6 +752,25 @@ class _Rule extends \IPS\Node\Model
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Subscriptions */
|
||||
if ( $this->subscriptions and $this->subscriptions != '*' )
|
||||
{
|
||||
$match = FALSE;
|
||||
foreach ( $transaction->invoice->items as $item )
|
||||
{
|
||||
if ( $item instanceof \IPS\nexus\extensions\nexus\Item\Subscription and \in_array( $item->id, explode( ',', $this->subscriptions ) ) )
|
||||
{
|
||||
$match = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$match )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Coupon */
|
||||
if ( $this->coupon )
|
||||
@@ -1185,6 +1221,7 @@ class _Rule extends \IPS\Node\Model
|
||||
foreach ( array(
|
||||
'methods' => array_keys( \IPS\nexus\Gateway::roots() ),
|
||||
'products' => iterator_to_array( \IPS\Db::i()->select( 'p_id', 'nexus_packages' ) ),
|
||||
'subscriptions' => iterator_to_array( \IPS\Db::i()->select( 'sp_id', 'nexus_member_subscription_packages' ) ),
|
||||
'country' => array_values( \IPS\GeoLocation::$countries ),
|
||||
'customer_groups' => array_keys( \IPS\Member\Group::groups() )
|
||||
) as $k => $allValues )
|
||||
|
||||
Reference in new issue
Block a user