Version 4.5.0
This commit is contained in:
1 parent
1a0c7fd3c2
commit
f79dcf067a
3791 files changed
+248032
-76372
No files matched your search
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -101,7 +101,7 @@ class _CommissionRule extends \IPS\Node\Model
|
||||
$numberOfPurchasesField = array(
|
||||
'getHtml' => function( $field )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('customers')->numberOfPurchasesField( $field );
|
||||
return \IPS\Theme::i()->getTemplate('customers', 'nexus' )->numberOfPurchasesField( $field );
|
||||
},
|
||||
'formatValue'=> function( $field )
|
||||
{
|
||||
@@ -142,7 +142,7 @@ class _CommissionRule extends \IPS\Node\Model
|
||||
$form->add( new \IPS\Helpers\Form\Custom( 'rrule_purchase_amount', array( $this->purchase_amount_op, $this->purchase_amount_unit ), FALSE, array(
|
||||
'getHtml' => function( $field )
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate('customers')->purchaseValueField( $field );
|
||||
return \IPS\Theme::i()->getTemplate( 'customers', 'nexus' )->purchaseValueField( $field );
|
||||
},
|
||||
'formatValue' => function( $field )
|
||||
{
|
||||
@@ -151,7 +151,7 @@ class _CommissionRule extends \IPS\Node\Model
|
||||
{
|
||||
return array( '', '' );
|
||||
}
|
||||
$value[1] = is_array( $value[1] ) ? json_encode( $value[1] ) : $value[1];
|
||||
$value[1] = \is_array( $value[1] ) ? json_encode( $value[1] ) : $value[1];
|
||||
return $value;
|
||||
}
|
||||
) ) );
|
||||
@@ -319,8 +319,15 @@ class _CommissionRule extends \IPS\Node\Model
|
||||
$prices
|
||||
) ) );
|
||||
}
|
||||
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'ref_cond', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->formatList( $conditions ) ) ) );
|
||||
|
||||
if( \count( $conditions ) )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'ref_cond', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->formatList( $conditions ) ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'ref_no_cond', FALSE );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -331,13 +338,13 @@ class _CommissionRule extends \IPS\Node\Model
|
||||
public function commissionLimit()
|
||||
{
|
||||
$prices = array();
|
||||
if ( $this->commission_limit and $limits = json_decode( $this->commission_limit, TRUE ) and is_array( $limits ) )
|
||||
if ( $this->commission_limit and $limits = json_decode( $this->commission_limit, TRUE ) and \is_array( $limits ) )
|
||||
{
|
||||
foreach ( $limits as $currency => $amount )
|
||||
{
|
||||
$prices[] = new \IPS\nexus\Money( $amount['amount'], $currency );
|
||||
}
|
||||
}
|
||||
return count( $prices ) ? \IPS\Member::loggedIn()->language()->addToStack( 'ref_comm_limit', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->formatList( $prices, \IPS\Member::loggedIn()->language()->get('or_list_format') ) ) ) ) : '';
|
||||
return \count( $prices ) ? \IPS\Member::loggedIn()->language()->addToStack( 'ref_comm_limit', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->formatList( $prices, \IPS\Member::loggedIn()->language()->get('or_list_format') ) ) ) ) : '';
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace IPS\nexus\CommissionRule;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
@@ -22,7 +22,7 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
* Commission Rule Filter Iterator
|
||||
* @note When we require PHP 5.4+ this can just be replaced with a CallbackFilterIterator
|
||||
*/
|
||||
class _Iterator extends \FilterIterator
|
||||
class _Iterator extends \FilterIterator implements \Countable
|
||||
{
|
||||
/**
|
||||
* @brief Member
|
||||
@@ -39,6 +39,11 @@ class _Iterator extends \FilterIterator
|
||||
*/
|
||||
protected $valueOfPurchases = NULL;
|
||||
|
||||
/**
|
||||
* @brief Number of referral rules
|
||||
*/
|
||||
protected $numberOfRules= NULL;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
@@ -146,4 +151,18 @@ class _Iterator extends \FilterIterator
|
||||
}
|
||||
return $this->valueOfPurchases;
|
||||
}
|
||||
|
||||
/**
|
||||
* Countable
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
if ( $this->numberOfRules === NULL )
|
||||
{
|
||||
$this->numberOfRules = (int) \IPS\Db::i()->select( 'COUNT(*)', 'nexus_referral_rules' )->first();
|
||||
}
|
||||
return $this->numberOfRules;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user