Version 4.6.0
This commit is contained in:
1 parent
f79dcf067a
commit
517a5e1f70
2036 files changed
+110041
-26162
No files matched your search
@@ -88,25 +88,6 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
return;
|
||||
}
|
||||
|
||||
/* Create associated invoices table */
|
||||
try
|
||||
{
|
||||
$originalInvoice = $this->purchase->original_invoice;
|
||||
$invoices = \IPS\nexus\Invoice::table( array( array( 'i_id=? OR ' . \IPS\Db::i()->findInSet( 'i_renewal_ids', array( $this->purchase->id ) ), $originalInvoice->id ) ), $this->purchase->acpUrl(), "p.{$this->purchase->id}" );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
$invoices = \IPS\nexus\Invoice::table( array( array( \IPS\Db::i()->findInSet( 'i_renewal_ids', array( $this->purchase->id ) ) ) ), $this->purchase->acpUrl(), "p.{$this->purchase->id}" );
|
||||
}
|
||||
$invoices->filters = array(
|
||||
'paid' => array( 'i_status=?', \IPS\nexus\Invoice::STATUS_PAID )
|
||||
);
|
||||
$invoices->advancedSearch = array(
|
||||
'i_status' => array( \IPS\Helpers\Table\SEARCH_SELECT, array( 'options' => \IPS\nexus\Invoice::statuses(), 'multiple' => TRUE ) ),
|
||||
'i_total' => \IPS\Helpers\Table\SEARCH_NUMERIC,
|
||||
'i_date' => \IPS\Helpers\Table\SEARCH_DATE_RANGE,
|
||||
);
|
||||
|
||||
/* Custom Fields */
|
||||
$customFields = array();
|
||||
foreach ( $this->purchase->custom_fields as $k => $v )
|
||||
@@ -133,7 +114,38 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->sidebar['actions'] = $this->purchase->buttons();
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'purchases' )->view( $this->purchase, $customer, $children, $invoices, $customFields );
|
||||
\IPS\Output::i()->output = \IPS\Theme::i()->getTemplate( 'purchases' )->view( $this->purchase, $customer, $children, $customFields );
|
||||
\IPS\Output::i()->jsFiles = array_merge( \IPS\Output::i()->jsFiles, \IPS\Output::i()->js( 'admin_members.js', 'core' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the associated invoices table for a purchase
|
||||
*
|
||||
* @note This is lazy loaded after the purchase page is generated
|
||||
* @return void
|
||||
*/
|
||||
protected function showInvoices()
|
||||
{
|
||||
/* Create associated invoices table */
|
||||
try
|
||||
{
|
||||
$originalInvoice = $this->purchase->original_invoice;
|
||||
$invoices = \IPS\nexus\Invoice::table( array( array( 'i_id=? OR ' . \IPS\Db::i()->findInSet( 'i_renewal_ids', array( $this->purchase->id ) ), $originalInvoice->id ) ), $this->purchase->acpUrl()->setQueryString( 'do', 'showInvoices' ), "p.{$this->purchase->id}" );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
$invoices = \IPS\nexus\Invoice::table( array( array( \IPS\Db::i()->findInSet( 'i_renewal_ids', array( $this->purchase->id ) ) ) ), $this->purchase->acpUrl()->setQueryString( 'do', 'showInvoices' ), "p.{$this->purchase->id}" );
|
||||
}
|
||||
$invoices->filters = array(
|
||||
'paid' => array( 'i_status=?', \IPS\nexus\Invoice::STATUS_PAID )
|
||||
);
|
||||
$invoices->advancedSearch = array(
|
||||
'i_status' => array( \IPS\Helpers\Table\SEARCH_SELECT, array( 'options' => \IPS\nexus\Invoice::statuses(), 'multiple' => TRUE ) ),
|
||||
'i_total' => \IPS\Helpers\Table\SEARCH_NUMERIC,
|
||||
'i_date' => \IPS\Helpers\Table\SEARCH_DATE_RANGE,
|
||||
);
|
||||
|
||||
\IPS\Output::i()->output = (string) $invoices;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -414,6 +426,12 @@ class _purchases extends \IPS\Dispatcher\Controller
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'purchases_cancel' );
|
||||
\IPS\Session::i()->csrfCheck();
|
||||
|
||||
$error = NULL;
|
||||
if ( !$this->purchase->canAcpReactivate( $error ) )
|
||||
{
|
||||
\IPS\Output::i()->error( $error ?? 'can_not_reactivate', '2X195/K', 403, '' );
|
||||
}
|
||||
|
||||
$parent = $this->purchase->parent();
|
||||
|
||||
if ( ( $this->purchase->billing_agreement and !$this->purchase->billing_agreement->canceled ) or ( $this->purchase->grouped_renewals and $parent->billing_agreement and !$parent->billing_agreement->canceled ) )
|
||||
|
||||
Reference in new issue
Block a user