Version 4.3.6
This commit is contained in:
1 parent
fe1acf984a
commit
1a0c7fd3c2
609 files changed
+14707
-5726
No files matched your search
@@ -112,13 +112,17 @@ class _Package extends \IPS\Node\Model
|
||||
parent::__clone();
|
||||
|
||||
/* Copy across images */
|
||||
try
|
||||
{
|
||||
$file = \IPS\File::get( 'nexus_Products', $old->image );
|
||||
$this->image = (string) \IPS\File::create( 'nexus_Products', $file->originalFilename, $file->contents() );
|
||||
$this->save();
|
||||
}
|
||||
catch( \Exception $e ) {}
|
||||
if ( $old->image )
|
||||
{
|
||||
try
|
||||
{
|
||||
$file = \IPS\File::get( 'nexus_Products', $old->image );
|
||||
$this->image = (string) \IPS\File::create( 'nexus_Products', $file->originalFilename, $file->contents() );
|
||||
$this->save();
|
||||
}
|
||||
catch( \Exception $e ) {}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -421,9 +425,31 @@ class _Package extends \IPS\Node\Model
|
||||
{
|
||||
if ( $price = $this->price() )
|
||||
{
|
||||
/* Include tax? */
|
||||
if ( \IPS\Settings::i()->nexus_show_tax and $this->tax )
|
||||
{
|
||||
try
|
||||
{
|
||||
$taxRate = new \IPS\Math\Number( \IPS\nexus\Tax::load( $this->tax )->rate( \IPS\nexus\Customer::loggedIn()->estimatedLocation() ) );
|
||||
|
||||
$price->amount = $price->amount->add( $price->amount->multiply( $taxRate ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$renewalTerm = $this->renewalTerm( $price->currency );
|
||||
|
||||
/* Include tax? */
|
||||
if ( \IPS\Settings::i()->nexus_show_tax and $this->tax and isset( $taxRate ) and $renewalTerm )
|
||||
{
|
||||
try
|
||||
{
|
||||
$renewalTerm->cost->amount = $renewalTerm->cost->amount->add( $renewalTerm->cost->amount->multiply( $taxRate ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
}
|
||||
|
||||
if ( $renewalTerm and $renewalTerm->cost->amount == $price->amount )
|
||||
{
|
||||
@@ -582,14 +608,14 @@ class _Package extends \IPS\Node\Model
|
||||
|
||||
if ( $newPackage->gateways and $newPackage->gateways != '*' )
|
||||
{
|
||||
$item->paymentMethodIds = explode( ',', $newPackage->methods );
|
||||
$item->paymentMethodIds = explode( ',', $newPackage->gateways );
|
||||
}
|
||||
|
||||
$invoice = new \IPS\nexus\Invoice;
|
||||
$invoice->member = $purchase->member;
|
||||
$invoice->currency = $costToUpgrade->currency;
|
||||
$invoice->addItem( $item );
|
||||
$invoice->return_uri = "app=nexus&module=subscriptons&controller=subscriptons";
|
||||
$invoice->return_uri = "app=nexus&module=subscriptions&controller=subscriptions";
|
||||
$invoice->renewal_ids = array( $purchase->id );
|
||||
$invoice->save();
|
||||
return $invoice;
|
||||
@@ -781,7 +807,7 @@ class _Package extends \IPS\Node\Model
|
||||
}
|
||||
|
||||
/* Secondary Groups */
|
||||
$secondary = array_filter( explode( ',', $this->secondary_group ), create_function( '$v', 'return (bool) $v;' ) );
|
||||
$secondary = array_filter( explode( ',', $this->secondary_group ), function( $v ){ return (bool) $v; } );
|
||||
|
||||
$current_secondary = $member->mgroup_others ? explode( ',', $member->mgroup_others ) : array();
|
||||
$newSecondary = $current_secondary;
|
||||
@@ -949,11 +975,12 @@ class _Package extends \IPS\Node\Model
|
||||
}
|
||||
else if ( $secondaryGroupsAwardedByThisPurchase )
|
||||
{
|
||||
$currentSecondaryGroups = $membersSecondaryGroups;
|
||||
foreach( $membersSecondaryGroups as $group )
|
||||
{
|
||||
if ( in_array( $group, $secondaryGroupsAwardedByThisPurchase ) )
|
||||
{
|
||||
unset( $membersSecondaryGroups[ array_search( $groupId, $membersSecondaryGroups ) ] );
|
||||
unset( $membersSecondaryGroups[ array_search( $group, $membersSecondaryGroups ) ] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user