Version 5.0.0 beta 1
This commit is contained in:
1 parent
25ddeb65d6
commit
15c7beabc5
6736 files changed
+627902
-497943
No files matched your search
@@ -12,28 +12,50 @@
|
||||
namespace IPS\nexus\extensions\core\MemberHistory;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use BadFunctionCallException;
|
||||
use DateInterval;
|
||||
use IPS\Application;
|
||||
use IPS\downloads\File;
|
||||
use IPS\Extensions\MemberHistoryAbstract;
|
||||
use IPS\GeoLocation;
|
||||
use IPS\Math\Number;
|
||||
use IPS\Member;
|
||||
use IPS\nexus\Customer;
|
||||
use IPS\nexus\Invoice;
|
||||
use IPS\nexus\Money;
|
||||
use IPS\nexus\Payout;
|
||||
use IPS\nexus\Purchase;
|
||||
use IPS\nexus\Purchase\RenewalTerm;
|
||||
use IPS\nexus\Subscription\Package;
|
||||
use IPS\nexus\Transaction;
|
||||
use IPS\Settings;
|
||||
use IPS\Theme;
|
||||
use OutOfRangeException;
|
||||
use function defined;
|
||||
use function is_array;
|
||||
|
||||
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
{
|
||||
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
header( ( $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0' ) . ' 403 Forbidden' );
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Member History: Nexus
|
||||
*/
|
||||
class _Nexus
|
||||
class Nexus extends MemberHistoryAbstract
|
||||
{
|
||||
/**
|
||||
* Return the valid member history log types
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getTypes()
|
||||
public function getTypes(): array
|
||||
{
|
||||
return array(
|
||||
'invoice',
|
||||
'transaction',
|
||||
'shipping',
|
||||
'purchase',
|
||||
'comission',
|
||||
'giftvoucher',
|
||||
@@ -44,7 +66,6 @@ class _Nexus
|
||||
'payout',
|
||||
'lkey',
|
||||
'download',
|
||||
'support',
|
||||
'custom',
|
||||
'billingagreement',
|
||||
'note',
|
||||
@@ -59,7 +80,7 @@ class _Nexus
|
||||
* @param array $row entire log row
|
||||
* @return string
|
||||
*/
|
||||
public function parseLogData( $value, $row )
|
||||
public function parseLogData( string $value, array $row ): string
|
||||
{
|
||||
$val = json_decode( $value, TRUE );
|
||||
|
||||
@@ -69,10 +90,10 @@ class _Nexus
|
||||
{
|
||||
if ( $row['log_by'] === $row['log_member'] )
|
||||
{
|
||||
$byCustomer = \IPS\Member::loggedIn()->language()->addToStack('history_by_customer');
|
||||
$byCustomer = Member::loggedIn()->language()->addToStack('history_by_customer');
|
||||
}
|
||||
|
||||
$byStaff = \IPS\Member::loggedIn()->language()->addToStack('history_by_staff', FALSE, array( 'sprintf' => array( \IPS\Member::load( $row['log_by'] )->name ) ) );
|
||||
$byStaff = Member::loggedIn()->language()->addToStack('history_by_staff', FALSE, array( 'sprintf' => array( Member::load( $row['log_by'] )->name ) ) );
|
||||
}
|
||||
|
||||
switch ( $row['log_type'] )
|
||||
@@ -80,9 +101,9 @@ class _Nexus
|
||||
case 'invoice':
|
||||
try
|
||||
{
|
||||
$invoice = \IPS\Theme::i()->getTemplate('invoices', 'nexus')->link( \IPS\nexus\Invoice::load( $val['id'] ) );
|
||||
$invoice = Theme::i()->getTemplate('invoices', 'nexus')->link( Invoice::load( $val['id'] ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
$invoice = $val['title'];
|
||||
}
|
||||
@@ -92,27 +113,27 @@ class _Nexus
|
||||
switch ( $val['type'] )
|
||||
{
|
||||
case 'status':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_invoice_status', FALSE, array( 'htmlsprintf' => array( $invoice, mb_strtolower( \IPS\Member::loggedIn()->language()->addToStack( 'istatus_' . $val['new'] ) ), $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_invoice_status', FALSE, array( 'htmlsprintf' => array( $invoice, mb_strtolower( Member::loggedIn()->language()->addToStack( 'istatus_' . $val['new'] ) ), $byStaff ) ) );
|
||||
|
||||
case 'resend':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_invoice_resend', FALSE, array( 'htmlsprintf' => array( $invoice, $byStaff, isset( $val['email'] ) ? \IPS\Member::loggedIn()->language()->addToStack( $val['email'] ? 'history_invoice_resend_email' : 'history_invoice_resend_no_email' ) : '' ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_invoice_resend', FALSE, array( 'htmlsprintf' => array( $invoice, $byStaff, isset( $val['email'] ) ? Member::loggedIn()->language()->addToStack( $val['email'] ? 'history_invoice_resend_email' : 'history_invoice_resend_no_email' ) : '' ) ) );
|
||||
|
||||
case 'delete':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_invoice_delete', FALSE, array( 'htmlsprintf' => array( $invoice, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_invoice_delete', FALSE, array( 'htmlsprintf' => array( $invoice, $byStaff ) ) );
|
||||
|
||||
case 'expire':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_invoice_expired', FALSE, array( 'htmlsprintf' => array( $invoice ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_invoice_expired', FALSE, array( 'htmlsprintf' => array( $invoice ) ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isset( $val['system'] ) and $val['system'] )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_invoice_generated', FALSE, array( 'htmlsprintf' => array( $invoice, '' ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_invoice_generated', FALSE, array( 'htmlsprintf' => array( $invoice, '' ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_invoice_generated', FALSE, array( 'htmlsprintf' => array( $invoice, $byCustomer ?: $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_invoice_generated', FALSE, array( 'htmlsprintf' => array( $invoice, $byCustomer ?: $byStaff ) ) );
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -120,11 +141,11 @@ class _Nexus
|
||||
case 'transaction':
|
||||
try
|
||||
{
|
||||
$transaction = \IPS\Theme::i()->getTemplate('transactions', 'nexus')->link( \IPS\nexus\Transaction::load( $val['id'] ) );
|
||||
$transaction = Theme::i()->getTemplate('transactions', 'nexus')->link( Transaction::load( $val['id'] ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
$transaction = \IPS\Member::loggedIn()->language()->addToStack( 'transaction_number', FALSE, array( 'htmlsprintf' => array( $val['id'] ) ) );
|
||||
$transaction = Member::loggedIn()->language()->addToStack( 'transaction_number', FALSE, array( 'htmlsprintf' => array( $val['id'] ) ) );
|
||||
}
|
||||
|
||||
switch ( $val['type'] )
|
||||
@@ -133,116 +154,67 @@ class _Nexus
|
||||
|
||||
try
|
||||
{
|
||||
$invoice = \IPS\Theme::i()->getTemplate('invoices', 'nexus')->link( \IPS\nexus\Invoice::load( $val['invoice_id'] ), TRUE );
|
||||
$invoice = Theme::i()->getTemplate('invoices', 'nexus')->link( Invoice::load( $val['invoice_id'] ), TRUE );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
$invoice = \IPS\Member::loggedIn()->language()->addToStack( 'invoice_number', FALSE, array( 'sprintf' => array( $val['id'] ) ) );
|
||||
$invoice = Member::loggedIn()->language()->addToStack( 'invoice_number', FALSE, array( 'sprintf' => array( $val['id'] ) ) );
|
||||
}
|
||||
|
||||
if ( isset( $val['automatic'] ) and $val['automatic'] )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_auto', FALSE, array( 'htmlsprintf' => array( $transaction, $invoice, \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_status_' . $val['status'] ) ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_transaction_auto', FALSE, array( 'htmlsprintf' => array( $transaction, $invoice, Member::loggedIn()->language()->addToStack( 'history_transaction_status_' . $val['status'] ) ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_paid', FALSE, array( 'htmlsprintf' => array( $transaction, $invoice, $byStaff, \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_status_' . $val['status'] ) ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_transaction_paid', FALSE, array( 'htmlsprintf' => array( $transaction, $invoice, $byStaff, Member::loggedIn()->language()->addToStack( 'history_transaction_status_' . $val['status'] ) ) ) );
|
||||
}
|
||||
|
||||
case 'status':
|
||||
if ( $val['status'] === \IPS\nexus\Transaction::STATUS_REFUNDED or $val['status'] === \IPS\nexus\Transaction::STATUS_PART_REFUNDED )
|
||||
if ( $val['status'] === Transaction::STATUS_REFUNDED or $val['status'] === Transaction::STATUS_PART_REFUNDED )
|
||||
{
|
||||
if ( $val['refund'] === 'gateway' )
|
||||
{
|
||||
if ( isset( $val['amount'] ) and $val['amount'] )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_part_refunded', FALSE, array( 'htmlsprintf' => array( new \IPS\nexus\Money( $val['amount'], $val['currency'] ), $transaction, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_transaction_part_refunded', FALSE, array( 'htmlsprintf' => array( new Money( $val['amount'], $val['currency'] ), $transaction, $byStaff ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_refunded', FALSE, array( 'htmlsprintf' => array( $transaction, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_transaction_refunded', FALSE, array( 'htmlsprintf' => array( $transaction, $byStaff ) ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( isset( $val['amount'] ) and $val['amount'] )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_part_credited', FALSE, array( 'htmlsprintf' => array( new \IPS\nexus\Money( $val['amount'], $val['currency'] ), $transaction, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_transaction_part_credited', FALSE, array( 'htmlsprintf' => array( new Money( $val['amount'], $val['currency'] ), $transaction, $byStaff ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_credited', FALSE, array( 'htmlsprintf' => array( $transaction, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_transaction_credited', FALSE, array( 'htmlsprintf' => array( $transaction, $byStaff ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
if ( $val['status'] === \IPS\nexus\Transaction::STATUS_REFUNDED )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_refunded', FALSE, array( 'htmlsprintf' => array( $transaction, $refundedTo, $byStaff ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_part_refunded', FALSE, array( 'htmlsprintf' => array( new \IPS\nexus\Money( $val['amount'], $val['currency'] ), $transaction, $refundedTo, $byStaff ) ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_status', FALSE, array( 'htmlsprintf' => array( $transaction, \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_status_' . $val['status'] ), $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_transaction_status', FALSE, array( 'htmlsprintf' => array( $transaction, Member::loggedIn()->language()->addToStack( 'history_transaction_status_' . $val['status'] ), $byStaff ) ) );
|
||||
}
|
||||
|
||||
case 'undo_credit':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_undo_credit', FALSE, array( 'htmlsprintf' => array( new \IPS\nexus\Money( $val['amount'], $val['currency'] ), $transaction, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_transaction_undo_credit', FALSE, array( 'htmlsprintf' => array( new Money( $val['amount'], $val['currency'] ), $transaction, $byStaff ) ) );
|
||||
|
||||
case 'delete':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_transaction_delete', FALSE, array( 'htmlsprintf' => array( $transaction, $byStaff ) ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'shipping':
|
||||
try
|
||||
{
|
||||
$shipment = \IPS\Theme::i()->getTemplate('shiporders', 'nexus')->link( \IPS\nexus\Shipping\Order::load( $val['id'] ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
$shipment = \IPS\Member::loggedIn()->language()->addToStack( 'shipment_number', FALSE, array( 'sprintf' => array( $val['id'] ) ) );
|
||||
}
|
||||
|
||||
if ( isset( $val['type'] ) )
|
||||
{
|
||||
if ( $val['type'] === 'new' )
|
||||
{
|
||||
try
|
||||
{
|
||||
$invoice = \IPS\Theme::i()->getTemplate('invoices', 'nexus')->link( \IPS\nexus\Invoice::load( $val['invoice_id'] ), TRUE );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
$invoice = \IPS\Member::loggedIn()->language()->addToStack('invoice_number', FALSE, array( 'sprintf' => array( $val['id'] ) ) );
|
||||
}
|
||||
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_shipping_new', FALSE, array( 'htmlsprintf' => array( $shipment, $invoice ) ) );
|
||||
}
|
||||
elseif ( $val['type'] === 'canc' )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_shipping_canc', FALSE, array( 'htmlsprintf' => array( $shipment, $byStaff ) ) );
|
||||
}
|
||||
}
|
||||
elseif ( isset( $val['deleted'] ) and $val['deleted'] )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_shipping_deleted', FALSE, array( 'htmlsprintf' => array( $shipment, $byStaff ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_shipping_ship', FALSE, array( 'htmlsprintf' => array( $shipment, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_transaction_delete', FALSE, array( 'htmlsprintf' => array( $transaction, $byStaff ) ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'purchase':
|
||||
try
|
||||
{
|
||||
$purchase = \IPS\Theme::i()->getTemplate('purchases', 'nexus')->link( \IPS\nexus\Purchase::load( $val['id'] ), $val['type'] === 'change' );
|
||||
$purchase = Theme::i()->getTemplate('purchases', 'nexus')->link( Purchase::load( $val['id'] ), $val['type'] === 'change' );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
$purchase = $val['name'];
|
||||
}
|
||||
@@ -253,22 +225,21 @@ class _Nexus
|
||||
case 'renew':
|
||||
try
|
||||
{
|
||||
$invoice = \IPS\Theme::i()->getTemplate('invoices', 'nexus')->link( \IPS\nexus\Invoice::load( $val['invoice_id'] ), TRUE );
|
||||
$invoice = Theme::i()->getTemplate('invoices', 'nexus')->link( Invoice::load( $val['invoice_id'] ), TRUE );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
$invoice = \IPS\Member::loggedIn()->language()->addToStack('invoice_number', FALSE, array( 'sprintf' => array( $val['invoice_id'] ) ) );
|
||||
$invoice = Member::loggedIn()->language()->addToStack('invoice_number', FALSE, array( 'sprintf' => array( $val['invoice_id'] ) ) );
|
||||
}
|
||||
|
||||
if ( $val['type'] === 'new' )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_created', FALSE, array( 'htmlsprintf' => array( $purchase, $invoice ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_created', FALSE, array( 'htmlsprintf' => array( $purchase, $invoice ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_renewed', FALSE, array( 'htmlsprintf' => array( $purchase, $invoice ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_renewed', FALSE, array( 'htmlsprintf' => array( $purchase, $invoice ) ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'info':
|
||||
if ( isset( $val['info'] ) )
|
||||
@@ -281,79 +252,79 @@ class _Nexus
|
||||
{
|
||||
foreach ( $val['to']['cost'] as $currency => $amount )
|
||||
{
|
||||
$to = new \IPS\nexus\Purchase\RenewalTerm( new \IPS\nexus\Money( $amount['amount'], $currency ), new \DateInterval( 'P' . $val['to']['term'] . mb_strtoupper( $val['to']['unit'] ) ) );
|
||||
$to = new RenewalTerm( new Money( $amount['amount'], $currency ), new DateInterval( 'P' . $val['to']['term'] . mb_strtoupper( $val['to']['unit'] ) ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* This is the correct way */
|
||||
else
|
||||
{
|
||||
$to = new \IPS\nexus\Purchase\RenewalTerm( new \IPS\nexus\Money( $val['to']['cost'], $val['to']['currency'] ), new \DateInterval( 'P' . $val['to']['term']['term'] . mb_strtoupper( $val['to']['term']['unit'] ) ) );
|
||||
$to = new RenewalTerm( new Money( $val['to']['cost'], $val['to']['currency'] ), new DateInterval( 'P' . $val['to']['term']['term'] . mb_strtoupper( $val['to']['term']['unit'] ) ) );
|
||||
}
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_renewals_changed', FALSE, array( 'htmlsprintf' => array( $purchase, ( isset( $val['system'] ) and $val['system'] ) ? '' : $byStaff, $to ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_renewals_changed', FALSE, array( 'htmlsprintf' => array( $purchase, ( isset( $val['system'] ) and $val['system'] ) ? '' : $byStaff, $to ?? '' ) ) );
|
||||
|
||||
case 'remove_renewals':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_renewals_removed', FALSE, array( 'htmlsprintf' => array( $purchase, ( isset( $val['system'] ) and $val['system'] ) ? '' : $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_renewals_removed', FALSE, array( 'htmlsprintf' => array( $purchase, ( isset( $val['system'] ) and $val['system'] ) ? '' : $byStaff ) ) );
|
||||
|
||||
case 'never_expire':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_never_expire', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_never_expire', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
|
||||
case 'restored_expire':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_restored_expire', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_restored_expire', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
}
|
||||
}
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_edited', FALSE, array( 'htmlsprintf' => array( $purchase, ( isset( $val['system'] ) and $val['system'] ) ? '' : $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_edited', FALSE, array( 'htmlsprintf' => array( $purchase, ( isset( $val['system'] ) and $val['system'] ) ? '' : $byStaff ) ) );
|
||||
|
||||
case 'transfer_from':
|
||||
try
|
||||
{
|
||||
$to = \IPS\Theme::i()->getTemplate('global', 'nexus')->userLink( \IPS\nexus\Customer::load( $val['to'] ) );
|
||||
$to = Theme::i()->getTemplate('global', 'nexus')->userLink( Customer::load( $val['to'] ) );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException )
|
||||
{
|
||||
$to = \IPS\Member::loggedIn()->language()->addToStack( 'deleted_member' );
|
||||
$to = Member::loggedIn()->language()->addToStack( 'deleted_member' );
|
||||
}
|
||||
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_transfer_from', FALSE, array( 'htmlsprintf' => array( $purchase, $to, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_transfer_from', FALSE, array( 'htmlsprintf' => array( $purchase, $to, $byStaff ) ) );
|
||||
|
||||
case 'transfer_to':
|
||||
try
|
||||
{
|
||||
$from = \IPS\Theme::i()->getTemplate('global', 'nexus')->userLink( \IPS\nexus\Customer::load( $val['from'] ) );
|
||||
$from = Theme::i()->getTemplate('global', 'nexus')->userLink( Customer::load( $val['from'] ) );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException )
|
||||
{
|
||||
$from = \IPS\Member::loggedIn()->language()->addToStack( 'deleted_member' );
|
||||
$from = Member::loggedIn()->language()->addToStack( 'deleted_member' );
|
||||
}
|
||||
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_transfer_to', FALSE, array( 'htmlsprintf' => array( $purchase, $from, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_transfer_to', FALSE, array( 'htmlsprintf' => array( $purchase, $from, $byStaff ) ) );
|
||||
|
||||
case 'cancel':
|
||||
if( isset( $val['by'] ) AND $val['by'] == 'api' )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_canceled_api', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_canceled_api', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_canceled', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_canceled', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
}
|
||||
case 'uncancel':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_reactivated', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_reactivated', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
|
||||
case 'delete':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_deleted', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_deleted', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
|
||||
case 'expire':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_expired', FALSE, array( 'htmlsprintf' => array( $purchase ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_expired', FALSE, array( 'htmlsprintf' => array( $purchase ) ) );
|
||||
|
||||
case 'change':
|
||||
$by = ( isset( $val['system'] ) and $val['system'] ) ? '' : $byCustomer;
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_changed', FALSE, array( 'htmlsprintf' => array( $purchase, $val['old'], $val['name'], $by ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_changed', FALSE, array( 'htmlsprintf' => array( $purchase, $val['old'], $val['name'], $by ) ) );
|
||||
|
||||
case 'group':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_grouped', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_grouped', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
case 'ungroup':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_purchase_ungrouped', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_purchase_ungrouped', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff ) ) );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -365,42 +336,43 @@ class _Nexus
|
||||
case 'purchase_refund':
|
||||
try
|
||||
{
|
||||
$purchase = \IPS\Theme::i()->getTemplate('purchases', 'nexus')->link( \IPS\nexus\Purchase::load( $val['id'] ) );
|
||||
$purchase = Theme::i()->getTemplate('purchases', 'nexus')->link( Purchase::load( $val['id'] ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
$purchase = $val['name'];
|
||||
}
|
||||
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( "history_commission_{$val['type']}", FALSE, array( 'htmlsprintf' => array( new \IPS\nexus\Money( $val['amount'], $val['currency'] ), $purchase ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( "history_commission_{$val['type']}", FALSE, array( 'htmlsprintf' => array( new Money( $val['amount'], $val['currency'] ), $purchase ) ) );
|
||||
|
||||
case 'invoice':
|
||||
case 'invoice_refund':
|
||||
try
|
||||
{
|
||||
$invoice = \IPS\Theme::i()->getTemplate('invoices', 'nexus')->link( \IPS\nexus\Invoice::load( $val['invoice_id'] ), TRUE );
|
||||
$invoice = Theme::i()->getTemplate('invoices', 'nexus')->link( Invoice::load( $val['invoice_id'] ), TRUE );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
$invoice = \IPS\Member::loggedIn()->language()->addToStack('invoice_number', FALSE, array( 'sprintf' => array( $val['invoice_id'] ) ) );
|
||||
$invoice = Member::loggedIn()->language()->addToStack('invoice_number', FALSE, array( 'sprintf' => array( $val['invoice_id'] ) ) );
|
||||
}
|
||||
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( "history_commission_{$val['type']}", FALSE, array( 'htmlsprintf' => array( new \IPS\nexus\Money( $val['amount'], $val['currency'] ), $invoice ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( "history_commission_{$val['type']}", FALSE, array( 'htmlsprintf' => array( new Money( $val['amount'], $val['currency'] ), $invoice ) ) );
|
||||
|
||||
case 'bought':
|
||||
try
|
||||
{
|
||||
$invoice = \IPS\Theme::i()->getTemplate('invoices', 'nexus')->link( \IPS\nexus\Invoice::load( $val['invoice_id'] ), TRUE );
|
||||
$invoice = Theme::i()->getTemplate('invoices', 'nexus')->link( Invoice::load( $val['invoice_id'] ), TRUE );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
$invoice = \IPS\Member::loggedIn()->language()->addToStack( 'invoice_number', FALSE, array( 'sprintf' => array( $val['invoice_id'] ) ) );
|
||||
$invoice = Member::loggedIn()->language()->addToStack( 'invoice_number', FALSE, array( 'sprintf' => array( $val['invoice_id'] ) ) );
|
||||
}
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_commission_bought', FALSE, array( 'htmlsprintf' => array( new \IPS\nexus\Money( $val['new_amount'], $val['currency'] ), $invoice, new \IPS\nexus\Money( $val['amount'], $val['currency'] ) ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_commission_bought', FALSE, array( 'htmlsprintf' => array( new Money( $val['new_amount'], $val['currency'] ), $invoice, new Money( $val['amount'], $val['currency'] ) ) ) );
|
||||
|
||||
case 'manual':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_commission_manual', FALSE, array( 'sprintf' => array( $byStaff, new \IPS\nexus\Money( $val['new'], $val['currency'] ), new \IPS\nexus\Money( $val['old'], $val['currency'] ) ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_commission_manual', FALSE, array( 'sprintf' => array( $byStaff, new Money( $val['new'], $val['currency'] ), new Money( $val['old'], $val['currency'] ) ) ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'giftvoucher':
|
||||
switch ( $val['type'] )
|
||||
@@ -409,20 +381,20 @@ class _Nexus
|
||||
/* If the customer who used this gift card no longer exists, then we need to load up a guest customer object to avoid an OutOfRangeException */
|
||||
try
|
||||
{
|
||||
$customer = \IPS\nexus\Customer::load( $val['by'] );
|
||||
$customer = Customer::load( $val['by'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException )
|
||||
{
|
||||
$customer = new \IPS\nexus\Customer;
|
||||
$customer = new Customer;
|
||||
}
|
||||
|
||||
$currency = isset( $val['currency'] ) ? $val['currency'] : $customer->defaultCurrency();
|
||||
$currency = $val['currency'] ?? $customer->defaultCurrency();
|
||||
|
||||
return
|
||||
\IPS\Member::loggedIn()->language()->addToStack( 'history_giftvoucher_used', FALSE, array( 'htmlsprintf' => array(
|
||||
new \IPS\nexus\Money( $val['amount'], $currency ),
|
||||
Member::loggedIn()->language()->addToStack( 'history_giftvoucher_used', FALSE, array( 'htmlsprintf' => array(
|
||||
new Money( $val['amount'], $currency ),
|
||||
$val['code'],
|
||||
\IPS\Theme::i()->getTemplate('global', 'nexus')->userLink( $customer )
|
||||
Theme::i()->getTemplate('global', 'nexus')->userLink( $customer )
|
||||
) ) );
|
||||
break;
|
||||
|
||||
@@ -430,33 +402,33 @@ class _Nexus
|
||||
/* If the customer who redeemed this gift card no longer exists, then we need to load up a guest customer object to avoid an OutOfRangeException */
|
||||
try
|
||||
{
|
||||
$customer = \IPS\nexus\Customer::load( $val['ps_member'] );
|
||||
$customer = Customer::load( $val['ps_member'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException )
|
||||
{
|
||||
$customer = new \IPS\nexus\Customer;
|
||||
$customer = new Customer;
|
||||
}
|
||||
|
||||
$currency = isset( $val['currency'] ) ? $val['currency'] : $customer->defaultCurrency();
|
||||
$currency = $val['currency'] ?? $customer->defaultCurrency();
|
||||
|
||||
return
|
||||
\IPS\Member::loggedIn()->language()->addToStack( 'history_giftvoucher_redeemed', FALSE, array( 'htmlsprintf' => array(
|
||||
new \IPS\nexus\Money( $val['amount'], $currency ),
|
||||
Member::loggedIn()->language()->addToStack( 'history_giftvoucher_redeemed', FALSE, array( 'htmlsprintf' => array(
|
||||
new Money( $val['amount'], $currency ),
|
||||
$val['code'],
|
||||
\IPS\Theme::i()->getTemplate('global', 'nexus')->userLink( $customer ),
|
||||
new \IPS\nexus\Money( $val['newCreditAmount'], $currency )
|
||||
Theme::i()->getTemplate('global', 'nexus')->userLink( $customer ),
|
||||
new Money( $val['newCreditAmount'], $currency )
|
||||
) ) );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'info':
|
||||
$changes = array( \IPS\Member::loggedIn()->language()->addToStack('history_info_change', FALSE, array( 'sprintf' => array( $byCustomer ?: $byStaff ) ) ) );
|
||||
$changes = array( Member::loggedIn()->language()->addToStack('history_info_change', FALSE, array( 'sprintf' => array( $byCustomer ?: $byStaff ) ) ) );
|
||||
|
||||
if ( isset( $val['name'] ) )
|
||||
{
|
||||
$name = \is_array( $val['name'] ) ? implode( ' ', array_values( $val['name'] ) ) : $val['name'];
|
||||
$changes[] = \IPS\Member::loggedIn()->language()->addToStack('history_name_changed_from', FALSE, array( 'sprintf' => array( $name ) ) );
|
||||
$name = is_array( $val['name'] ) ? implode( ' ', array_values( $val['name'] ) ) : $val['name'];
|
||||
$changes[] = Member::loggedIn()->language()->addToStack('history_name_changed_from', FALSE, array( 'sprintf' => array( $name ) ) );
|
||||
}
|
||||
|
||||
if ( isset( $val['other'] ) )
|
||||
@@ -464,30 +436,30 @@ class _Nexus
|
||||
foreach ( $val['other'] as $change )
|
||||
{
|
||||
/* Older versions may not have stored the display value, so we need to account for that */
|
||||
if( mb_strpos( $change['name'], 'nexus_ccfield_' ) !== FALSE AND \is_array( $change['value'] ) )
|
||||
if( mb_strpos( $change['name'], 'nexus_ccfield_' ) !== FALSE AND is_array( $change['value'] ) )
|
||||
{
|
||||
try
|
||||
{
|
||||
/* If it's an array, we will start first by assuming it is probably an address */
|
||||
$value = \IPS\GeoLocation::buildFromJson( json_encode( $change['value'] ) )->toString( ', ' );
|
||||
$value = GeoLocation::buildFromJson( json_encode( $change['value'] ) )->toString();
|
||||
|
||||
/* A bad address will return an empty string */
|
||||
if( !$value )
|
||||
{
|
||||
throw new \BadFunctionCallException;
|
||||
throw new BadFunctionCallException;
|
||||
}
|
||||
|
||||
$change['value'] = $value;
|
||||
}
|
||||
/* Maybe it wasn't an address or geoip support is disabled */
|
||||
catch( \BadFunctionCallException $e )
|
||||
catch( BadFunctionCallException )
|
||||
{
|
||||
$_value = array();
|
||||
|
||||
/* We will just loop and implode so we have a string */
|
||||
foreach( $change['value'] as $k => $v )
|
||||
{
|
||||
if( \is_array( $v ) )
|
||||
if( is_array( $v ) )
|
||||
{
|
||||
foreach( $v as $_k => $_v )
|
||||
{
|
||||
@@ -508,11 +480,11 @@ class _Nexus
|
||||
|
||||
if ( isset( $change['old'] ) )
|
||||
{
|
||||
$changes[] = \IPS\Member::loggedIn()->language()->addToStack('history_field_changed_from', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack( $change['name'] ), $change['old'], $change['value'] ) ) );
|
||||
$changes[] = Member::loggedIn()->language()->addToStack('history_field_changed_from', FALSE, array( 'sprintf' => array( Member::loggedIn()->language()->addToStack( $change['name'] ), $change['old'], $change['value'] ) ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
$changes[] = \IPS\Member::loggedIn()->language()->addToStack('history_field_changed', FALSE, array( 'sprintf' => array( \IPS\Member::loggedIn()->language()->addToStack( $change['name'] ), $change['value'] ) ) );
|
||||
$changes[] = Member::loggedIn()->language()->addToStack('history_field_changed', FALSE, array( 'sprintf' => array( Member::loggedIn()->language()->addToStack( $change['name'] ), $change['value'] ) ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -523,15 +495,13 @@ class _Nexus
|
||||
switch ( $val['type'] )
|
||||
{
|
||||
case 'add':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_address_add', FALSE, array( 'sprintf' => array( (string) \IPS\GeoLocation::buildFromJson( $val['details'] ), $byCustomer ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_address_add', FALSE, array( 'sprintf' => array( (string) GeoLocation::buildFromJson( $val['details'] ), $byCustomer ) ) );
|
||||
case 'edit':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_address_edit', FALSE, array( 'sprintf' => array( (string) \IPS\GeoLocation::buildFromJson( $val['old'] ), (string) \IPS\GeoLocation::buildFromJson( $val['new'] ), $byCustomer ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_address_edit', FALSE, array( 'sprintf' => array( (string) GeoLocation::buildFromJson( $val['old'] ), (string) GeoLocation::buildFromJson( $val['new'] ), $byCustomer ) ) );
|
||||
case 'primary_billing':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_address_primary_billing', FALSE, array( 'sprintf' => array( (string) \IPS\GeoLocation::buildFromJson( $val['details'] ), $byCustomer ) ) );
|
||||
case 'primary_shipping':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_address_primary_shipping', FALSE, array( 'sprintf' => array( (string) \IPS\GeoLocation::buildFromJson( $val['details'] ), $byCustomer ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_address_primary_billing', FALSE, array( 'sprintf' => array( (string) GeoLocation::buildFromJson( $val['details'] ), $byCustomer ) ) );
|
||||
case 'delete':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_address_delete', FALSE, array( 'sprintf' => array( (string) \IPS\GeoLocation::buildFromJson( $val['details'] ), $byCustomer ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_address_delete', FALSE, array( 'sprintf' => array( (string) GeoLocation::buildFromJson( $val['details'] ), $byCustomer ) ) );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -540,20 +510,20 @@ class _Nexus
|
||||
switch ( $val['type'] )
|
||||
{
|
||||
case 'add':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_card_add', FALSE, array( 'sprintf' => array( $val['number'], $byCustomer ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_card_add', FALSE, array( 'sprintf' => array( $val['number'], $byCustomer ) ) );
|
||||
case 'delete':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_card_delete', FALSE, array( 'sprintf' => array( $val['number'], $byCustomer ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_card_delete', FALSE, array( 'sprintf' => array( $val['number'], $byCustomer ) ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'alternative':
|
||||
try
|
||||
{
|
||||
$altContact = \IPS\nexus\Customer::load( $val['alt_id'] );
|
||||
$altContact = Customer::load( $val['alt_id'] );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
catch( OutOfRangeException )
|
||||
{
|
||||
$altContact = new \IPS\nexus\Customer;
|
||||
$altContact = new Customer;
|
||||
}
|
||||
|
||||
$altContact = $altContact->member_id ? $altContact->link() : htmlspecialchars( $val['alt_name'], ENT_DISALLOWED, 'UTF-8', FALSE );
|
||||
@@ -561,11 +531,11 @@ class _Nexus
|
||||
switch ( $val['type'] )
|
||||
{
|
||||
case 'add':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_altcontact_add', FALSE, array( 'htmlsprintf' => array( $altContact, $byCustomer ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_altcontact_add', FALSE, array( 'htmlsprintf' => array( $altContact, $byCustomer ) ) );
|
||||
case 'edit':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_altcontact_edit', FALSE, array( 'htmlsprintf' => array( $altContact, $byCustomer ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_altcontact_edit', FALSE, array( 'htmlsprintf' => array( $altContact, $byCustomer ) ) );
|
||||
case 'delete':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_altcontact_delete', FALSE, array( 'htmlsprintf' => array( $altContact, $byCustomer ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_altcontact_delete', FALSE, array( 'htmlsprintf' => array( $altContact, $byCustomer ) ) );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -575,15 +545,16 @@ class _Nexus
|
||||
{
|
||||
if ( !isset( $val['payout_id'] ) )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
$payout = \IPS\Theme::i()->getTemplate('payouts', 'nexus')->link( \IPS\nexus\Payout::load( $val['payout_id'] ) );
|
||||
|
||||
$payout = Theme::i()->getTemplate('payouts', 'nexus')->link( Payout::load( $val['payout_id'] ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
if ( isset( $va['currency'] ) )
|
||||
if ( isset( $val['currency'] ) )
|
||||
{
|
||||
$payout = new \IPS\nexus\Money( $val['amount'], $val['currency'] );
|
||||
$payout = new Money( new Number( (string)$val['amount'] ), $val['currency'] );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -594,15 +565,15 @@ class _Nexus
|
||||
switch ( $val['type'] )
|
||||
{
|
||||
case 'autoprocess':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_payout_autoprocess', FALSE, array( 'htmlsprintf' => array( $payout ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_payout_autoprocess', FALSE, array( 'htmlsprintf' => array( $payout ) ) );
|
||||
case 'request':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_payout_request', FALSE, array( 'htmlsprintf' => array( $payout ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_payout_request', FALSE, array( 'htmlsprintf' => array( $payout ) ) );
|
||||
case 'cancel':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_payout_cancel', FALSE, array( 'htmlsprintf' => array( $payout, $byCustomer ?: $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_payout_cancel', FALSE, array( 'htmlsprintf' => array( $payout, $byCustomer ?: $byStaff ) ) );
|
||||
case 'processed':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_payout_processed', FALSE, array( 'htmlsprintf' => array( $payout, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_payout_processed', FALSE, array( 'htmlsprintf' => array( $payout, $byStaff ) ) );
|
||||
case 'dismissed':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_payout_dismissed', FALSE, array( 'htmlsprintf' => array( $payout, $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_payout_dismissed', FALSE, array( 'htmlsprintf' => array( $payout, $byStaff ) ) );
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -610,9 +581,9 @@ class _Nexus
|
||||
|
||||
try
|
||||
{
|
||||
$purchase = \IPS\Theme::i()->getTemplate('purchases', 'nexus')->link( \IPS\nexus\Purchase::load( $val['ps_id'] ) );
|
||||
$purchase = Theme::i()->getTemplate('purchases', 'nexus')->link( Purchase::load( $val['ps_id'] ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
if ( isset( $val['ps_name'] ) )
|
||||
{
|
||||
@@ -620,16 +591,16 @@ class _Nexus
|
||||
}
|
||||
else
|
||||
{
|
||||
$purchase = \IPS\Member::loggedIn()->language()->addToStack( 'purchase_number', FALSE, array( 'sprintf' => array( $val['ps_id'] ) ) );
|
||||
$purchase = Member::loggedIn()->language()->addToStack( 'purchase_number', FALSE, array( 'sprintf' => array( $val['ps_id'] ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
switch ( $val['type'] )
|
||||
{
|
||||
case 'activated':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_lkey_activated', FALSE, array( 'htmlsprintf' => array( $purchase ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_lkey_activated', FALSE, array( 'htmlsprintf' => array( $purchase ) ) );
|
||||
case 'reset':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack('history_lkey_reset', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff, $val['new'], $val['key'] ) ) );
|
||||
return Member::loggedIn()->language()->addToStack('history_lkey_reset', FALSE, array( 'htmlsprintf' => array( $purchase, $byStaff, $val['new'], $val['key'] ) ) );
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -641,66 +612,44 @@ class _Nexus
|
||||
case 'idm':
|
||||
try
|
||||
{
|
||||
if ( !\IPS\Application::appIsEnabled('downloads') )
|
||||
if ( !Application::appIsEnabled('downloads') )
|
||||
{
|
||||
throw new \OutOfRangeException;
|
||||
throw new OutOfRangeException;
|
||||
}
|
||||
|
||||
$options = array( 'htmlsprintf' => array( \IPS\Theme::i()->getTemplate( 'customers', 'nexus' )->downloadsLink( \IPS\downloads\File::load( $val['id'] ) ) ) );
|
||||
$options = array( 'htmlsprintf' => array( Theme::i()->getTemplate( 'customers', 'nexus' )->downloadsLink( File::load( $val['id'] ) ) ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
$options = array( 'sprintf' => array( $val['name'] ) );
|
||||
}
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_download', FALSE, $options );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_download', FALSE, $options );
|
||||
case 'attach':
|
||||
|
||||
$file = \IPS\Theme::i()->getTemplate( 'editor', 'core', 'global' )->attachedFile( \IPS\Settings::i()->base_url . "applications/core/interface/file/attachment.php?id=" . $val['id'], $val['name'], FALSE );
|
||||
$file = Theme::i()->getTemplate( 'editor', 'core', 'global' )->attachedFile( Settings::i()->base_url . "applications/core/interface/file/attachment.php?id=" . $val['id'], $val['name'], FALSE );
|
||||
if ( isset( $val['ps_id'] ) and $val['ps_id'] )
|
||||
{
|
||||
try
|
||||
{
|
||||
$options = array( 'htmlsprintf' => array( $file, \IPS\Theme::i()->getTemplate('purchases', 'nexus')->link( \IPS\nexus\Purchase::load( $val['ps_id'] ) ) ) );
|
||||
$options = array( 'htmlsprintf' => array( $file, Theme::i()->getTemplate('purchases', 'nexus')->link( Purchase::load( $val['ps_id'] ) ) ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
$options = array( 'htmlsprintf' => array( $file, htmlspecialchars( $val['ps_name'], ENT_QUOTES | ENT_DISALLOWED, 'UTF-8', FALSE ) ) );
|
||||
}
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_download_with_purchase', FALSE, $options );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_download_with_purchase', FALSE, $options );
|
||||
}
|
||||
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_download', FALSE, array( 'htmlsprintf' => $file ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_download', FALSE, array( 'htmlsprintf' => $file ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'support':
|
||||
|
||||
if ( isset( $val['type'] ) and $val['type'] == 'email' )
|
||||
{
|
||||
$by = \IPS\Member::loggedIn()->language()->addToStack( 'history_support_by_email' );
|
||||
}
|
||||
else
|
||||
{
|
||||
$by = $byCustomer ?: $byStaff;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$options = array( 'htmlsprintf' => array( \IPS\Theme::i()->getTemplate( 'support', 'nexus' )->link( \IPS\nexus\Support\Request::load( $val['id'] ), FALSE ), $by ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
{
|
||||
$options = array( 'sprintf' => array( $val['title'] ), 'htmlsprintf' => array( $by ) );
|
||||
}
|
||||
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_support', FALSE, $options );
|
||||
|
||||
case 'billingagreement':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_billingagreement_' . $val['type'], FALSE, array( 'sprintf' => array( $val['id'], $val['gw_id'], $byCustomer ?: $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_billingagreement_' . $val['type'], FALSE, array( 'sprintf' => array( $val['id'], $val['gw_id'], $byCustomer ?: $byStaff ) ) );
|
||||
break;
|
||||
|
||||
case 'note':
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'history_' . $val . '_note', FALSE, array( 'sprintf' => $byStaff ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'history_' . $val . '_note', FALSE, array( 'sprintf' => $byStaff ) );
|
||||
break;
|
||||
|
||||
case 'custom':
|
||||
@@ -714,22 +663,22 @@ class _Nexus
|
||||
case 'cancelrenewals':
|
||||
try
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'nexus_history_cancelrenewals_with_name', FALSE, array( 'sprintf' => array( \IPS\nexus\Subscription\Package::load( $val['id'] )->_title, $byCustomer ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'nexus_history_cancelrenewals_with_name', FALSE, array( 'sprintf' => array( Package::load( $val['id'] )->_title, $byCustomer ) ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'nexus_history_cancelrenewals', FALSE, array( 'sprintf' => array( $byCustomer ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'nexus_history_cancelrenewals', FALSE, array( 'sprintf' => array( $byCustomer ) ) );
|
||||
}
|
||||
break;
|
||||
|
||||
case 'change':
|
||||
try
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'nexus_history_subscription_changed_with_name', FALSE, array( 'sprintf' => array( $val['old'], ( isset( $val['system'] ) and $val['system'] ) ? '' : $byStaff, $val['name'] ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'nexus_history_subscription_changed_with_name', FALSE, array( 'sprintf' => array( $val['old'], ( isset( $val['system'] ) and $val['system'] ) ? '' : $byStaff, $val['name'] ) ) );
|
||||
}
|
||||
catch ( \OutOfRangeException $e )
|
||||
catch ( OutOfRangeException )
|
||||
{
|
||||
return \IPS\Member::loggedIn()->language()->addToStack( 'nexus_history_subscription_changed', FALSE, array( 'sprintf' => array( ( isset( $val['system'] ) and $val['system'] ) ? '' : $byStaff ) ) );
|
||||
return Member::loggedIn()->language()->addToStack( 'nexus_history_subscription_changed', FALSE, array( 'sprintf' => array( ( isset( $val['system'] ) and $val['system'] ) ? '' : $byStaff ) ) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -743,13 +692,13 @@ class _Nexus
|
||||
/**
|
||||
* Parse LogMember column
|
||||
*
|
||||
* @param string $value column value
|
||||
* @param array $row entire log row
|
||||
* @param string $value column value
|
||||
* @param array $row entire log row
|
||||
* @return string
|
||||
*/
|
||||
public function parseLogMember( $value, $row )
|
||||
public function parseLogMember( string $value, array $row ): string
|
||||
{
|
||||
\IPS\nexus\Customer::load( $value )->link();
|
||||
return Customer::load( $value )->link();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -759,8 +708,8 @@ class _Nexus
|
||||
* @param array $row entire log row
|
||||
* @return string
|
||||
*/
|
||||
public function parseLogType( $value, $row )
|
||||
public function parseLogType( string $value, array $row ): string
|
||||
{
|
||||
return \IPS\Theme::i()->getTemplate( 'customers', 'nexus' )->logType( $value );
|
||||
return Theme::i()->getTemplate( 'customers', 'nexus' )->logType( $value );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user