Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -74,10 +74,36 @@ class _generateRenewalInvoices extends \IPS\Task
|
||||
$invoice->system = TRUE;
|
||||
$invoice->currency = $currency;
|
||||
$invoice->member = $member;
|
||||
$items = array();
|
||||
|
||||
foreach ( $purchases as $purchase )
|
||||
{
|
||||
$invoice->addItem( \IPS\nexus\Invoice\Item\Renewal::create( $purchase ) );
|
||||
/* Check the renewal is valid */
|
||||
if( $purchase->canBeRenewed() )
|
||||
{
|
||||
$items[] = $purchase;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Remove renewals for this purchase */
|
||||
$purchase->renewals = NULL;
|
||||
$purchase->member->log( 'purchase', array( 'type' => 'info', 'id' => $purchase->id, 'name' => $purchase->name, 'info' => 'remove_renewals' ) );
|
||||
$purchase->can_reactivate = TRUE;
|
||||
$purchase->save();
|
||||
}
|
||||
|
||||
/* Continue to next invoice if no items left */
|
||||
if( !count( $items ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Add items to invoice */
|
||||
foreach( $items as $item )
|
||||
{
|
||||
$invoice->addItem( \IPS\nexus\Invoice\Item\Renewal::create( $item ) );
|
||||
}
|
||||
|
||||
$invoice->save();
|
||||
|
||||
/* Nothing to pay? */
|
||||
@@ -193,7 +219,7 @@ class _generateRenewalInvoices extends \IPS\Task
|
||||
$invoice->status = $transaction->invoice->status;
|
||||
}
|
||||
// error with card, move on
|
||||
catch ( \LogicException $e ){}
|
||||
catch ( \Exception $e ){}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user