Version 4.1.2

This commit is contained in:
Neo committed 2025-12-19 05:32:19 -08:00
1 parent 3ba79295ee
commit 28bd025b35
1131 files changed
+63658 -20579

No files matched your search

+5 -4
View File
@@ -290,9 +290,10 @@ class _Coupon extends \IPS\Node\Model
/* Maximum uses per member? */
$uses = $this->used_by ? json_decode( $this->used_by, TRUE ) : array();
$customerIdentifier = $customer->member_id ?: $invoice->guest_data['member']['email'];
if ( $this->member_uses != -1 )
{
if ( isset( $uses[ $customer->member_id ] ) and $uses[ $customer->member_id ] >= $this->member_uses )
if ( isset( $uses[ $customerIdentifier ] ) and $uses[ $customerIdentifier ] >= $this->member_uses )
{
throw new \DomainException( 'coupon_exceeded_member_uses' );
}
@@ -395,13 +396,13 @@ class _Coupon extends \IPS\Node\Model
}
/* Save that we've used it */
if ( isset( $uses[ $customer->member_id ] ) )
if ( isset( $uses[ $customerIdentifier ] ) )
{
$uses[ $customer->member_id ]++;
$uses[ $customerIdentifier ]++;
}
else
{
$uses[ $customer->member_id ] = 1;
$uses[ $customerIdentifier ] = 1;
}
$this->used_by = json_encode( $uses );
$this->save();
@@ -142,4 +142,40 @@ class _CustomField extends \IPS\CustomField
$this->save();
}
}
/**
* [ActiveRecord] Save Changed Columns
*
* @return void
*/
public function save()
{
parent::save();
\IPS\Widget::deleteCaches( 'donations', 'nexus' );
static::recountCustomerFields();
}
/**
* [ActiveRecord] Delete
*
* @return void
*/
public function delete()
{
parent::delete();
static::recountCustomerFields();
}
/**
* Recount card storage gateays
*
* @return void
*/
protected static function recountCustomerFields()
{
$count = count( static::roots() );
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $count ), array( 'conf_key=?', 'customer_fields' ) );
\IPS\Settings::i()->customer_fields = $count;
unset( \IPS\Data\Store::i()->settings );
}
}
@@ -368,20 +368,40 @@ class _History extends \IPS\Helpers\Table\Db
switch ( $val['type'] )
{
case 'used':
/* 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'] );
}
catch( \OutOfRangeException $e )
{
$customer = new \IPS\nexus\Customer;
}
return
\IPS\Member::loggedIn()->language()->addToStack( 'history_giftvoucher_used', FALSE, array( 'htmlsprintf' => array(
new \IPS\nexus\Money( $val['amount'], $currency ),
$val['code'],
\IPS\Theme::i()->getTemplate('global', 'nexus')->userLink( \IPS\nexus\Customer::load( $val['by'] ) )
\IPS\Theme::i()->getTemplate('global', 'nexus')->userLink( $customer )
) ) );
break;
case 'redeemed':
/* 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'] );
}
catch( \OutOfRangeException $e )
{
$customer = new \IPS\nexus\Customer;
}
return
\IPS\Member::loggedIn()->language()->addToStack( 'history_giftvoucher_redeemed', FALSE, array( 'htmlsprintf' => array(
new \IPS\nexus\Money( $val['amount'], $currency ),
$val['code'],
\IPS\Theme::i()->getTemplate('global', 'nexus')->userLink( \IPS\nexus\Customer::load( $val['ps_member'] ) ),
\IPS\Theme::i()->getTemplate('global', 'nexus')->userLink( $customer ),
new \IPS\nexus\Money( $val['newCreditAmount'], $currency )
) ) );
break;
@@ -557,7 +577,7 @@ class _History extends \IPS\Helpers\Table\Db
}
catch ( \OutOfRangeException $e )
{
$options = array( 'htmlsprintf' => array( $file, htmlentities( $val['ps_name'], ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ) ) );
$options = array( 'htmlsprintf' => array( $file, htmlspecialchars( $val['ps_name'], ENT_QUOTES | \IPS\HTMLENTITIES, 'UTF-8', FALSE ) ) );
}
return \IPS\Member::loggedIn()->language()->addToStack( 'history_download_with_purchase', FALSE, $options );
}
+27 -2
View File
@@ -142,9 +142,9 @@ class _Goal extends \IPS\Node\Model
return $values;
}
/**
* Save Changed Columns
* [ActiveRecord] Save Changed Columns
*
* @return void
*/
@@ -152,6 +152,31 @@ class _Goal extends \IPS\Node\Model
{
parent::save();
\IPS\Widget::deleteCaches( 'donations', 'nexus' );
static::recountDonationGoals();
}
/**
* [ActiveRecord] Delete
*
* @return void
*/
public function delete()
{
parent::delete();
static::recountDonationGoals();
}
/**
* Recount card storage gateays
*
* @return void
*/
protected static function recountDonationGoals()
{
$count = count( static::roots() );
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $count ), array( 'conf_key=?', 'donation_goals' ) );
\IPS\Settings::i()->donation_goals = $count;
unset( \IPS\Data\Store::i()->settings );
}
/**
+36 -13
View File
@@ -52,9 +52,7 @@ class _StateSelect extends \IPS\Helpers\Form\FormAbstract
* @return mixed
*/
public function getValue()
{
$value = array();
{
if ( $this->options['unlimitedLang'] )
{
$unlimitedName = "{$this->name}_unlimited";
@@ -64,21 +62,46 @@ class _StateSelect extends \IPS\Helpers\Form\FormAbstract
}
}
foreach ( parent::getValue() as $v )
return parent::getValue();
}
/**
* Get Value
*
* @return mixed
*/
public function formatValue()
{
if ( is_array( $this->value ) )
{
if ( preg_match( '/^([A-Z]{2})-(.*)$/', $v, $matches ) )
$value = array();
foreach ( $this->value as $k => $v )
{
if ( !isset( $value[ $matches[1] ] ) )
if ( in_array( (string) $k, \IPS\GeoLocation::$countries ) )
{
$value[ $matches[1] ] = array();
$value[ $k ] = $v;
}
else
{
if ( preg_match( '/^([A-Z]{2})-(.*)$/', $v, $matches ) )
{
if ( !isset( $value[ $matches[1] ] ) )
{
$value[ $matches[1] ] = array();
}
$value[ $matches[1] ][] = $matches[2];
}
else
{
$value[ $v ] = '*';
}
}
$value[ $matches[1] ][] = $matches[2];
}
else
{
$value[ $v ] = '*';
}
return $value;
}
else
{
return $this->value;
}
return $value;
}
}
@@ -227,6 +227,41 @@ class _Gateway extends \IPS\Node\Model
return $return;
}
/**
* [ActiveRecord] Save Changed Columns
*
* @return void
*/
public function save()
{
parent::save();
static::recountCardStorageGateways();
}
/**
* [ActiveRecord] Delete
*
* @return void
*/
public function delete()
{
parent::delete();
static::recountCardStorageGateways();
}
/**
* Recount card storage gateays
*
* @return void
*/
protected static function recountCardStorageGateways()
{
$count = count( static::cardStorageGateways() );
\IPS\Db::i()->update( 'core_sys_conf_settings', array( 'conf_value' => $count ), array( 'conf_key=?', 'card_storage_gateways' ) );
\IPS\Settings::i()->card_storage_gateways = $count;
unset( \IPS\Data\Store::i()->settings );
}
/* !Features (Each gateway will override) */
const SUPPORTS_REFUNDS = FALSE;
@@ -55,7 +55,7 @@ class _Manual extends \IPS\nexus\Gateway
*/
public function settings( &$form )
{
$form->add( new \IPS\Helpers\Form\Translatable( 'manual_instructions', NULL, TRUE, array( 'app' => 'nexus', 'key' => ( $this->id ? "nexus_gateway_{$this->id}_ins" : NULL ), 'editor' => array( 'app' => 'nexus', 'key' => 'Admin', 'autoSaveKey' => ( $this->id ? "nexus-gateway-{$this->id}" : "nexus-new-gateway" ), 'attachIds' => $this->id ? array( $this->id, NULL, 'description' ) : NULL, 'minimize' => 'forum_description_placeholder' ) ) ) );
$form->add( new \IPS\Helpers\Form\Translatable( 'manual_instructions', NULL, TRUE, array( 'app' => 'nexus', 'key' => ( $this->id ? "nexus_gateway_{$this->id}_ins" : NULL ), 'editor' => array( 'app' => 'nexus', 'key' => 'Admin', 'autoSaveKey' => ( $this->id ? "nexus-gateway-{$this->id}" : "nexus-new-gateway" ), 'attachIds' => $this->id ? array( $this->id, NULL, 'description' ) : NULL, 'minimize' => 'manual_gateway_description_placeholder' ) ) ) );
}
/**
@@ -336,8 +336,8 @@ class _PayPal extends \IPS\nexus\Gateway
'expire_month' => intval( $card->expMonth ),
'expire_year' => intval( $card->expYear ),
'cvv2' => intval( $card->ccv ),
'first_name' => $transaction->member->cm_first_name,
'last_name' => $transaction->member->cm_last_name,
'first_name' => $transaction->invoice->member->cm_first_name,
'last_name' => $transaction->invoice->member->cm_last_name,
'billing_address' => $billingAddress
)
),
+25 -4
View File
@@ -824,7 +824,7 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
/* Add it all together */
$return['total'] = new \IPS\nexus\Money( $subtotal + $shipping + $tax, $this->currency );
$return['total'] = $return['total']->round(); // Total value must also be a valid currency amount
return $return;
}
@@ -1050,10 +1050,10 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
/* If we're still here, we're applying commission */
$amountToGive = round( ( ( $amountToApplyCommissionOn / 100 ) * $commissionRule->commission ), 2 );
if ( $commissionRule->commission_limit )
if ( $commissionRule->commission_limit and $commissionRule->commission_limit != '*' )
{
$limit = json_decode( $commissionRule->commission_limit, TRUE );
if ( $amountToGive > $limit[ $this->currency ]['amount'] )
if ( isset( $limit[ $this->currency ] ) and $amountToGive > $limit[ $this->currency ]['amount'] )
{
$amountToGive = $limit[ $this->currency ]['amount'];
}
@@ -1135,7 +1135,7 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
}
}
return $amountToPay;
return $amountToPay->round();
}
/**
@@ -1361,6 +1361,27 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
/* Update associated transactions */
\IPS\Db::i()->update( 'nexus_transactions', array( 't_member' => $this->member->member_id ), array( 't_invoice=? AND t_member=0', $this->id ) );
/* Did we use any coupons? */
foreach ( $this->items as $item )
{
if ( $item instanceof \IPS\nexus\extensions\nexus\Item\CouponDiscount )
{
$coupon = \IPS\nexus\Coupon::load( $item->id );
$uses = $coupon->used_by ? json_decode( $coupon->used_by, TRUE ) : array();
if ( isset( $uses[ $this->member->email ] ) )
{
$uses[ $this->member->member_id ] = $uses[ $this->member->email ];
unset( $uses[ $this->member->email ] );
}
else
{
$uses[ $this->member->member_id ] = 1;
}
$coupon->used_by = json_encode( $uses );
$coupon->save();
}
}
}
/* Init */
+33 -1
View File
@@ -123,10 +123,42 @@ class _Money
{
/* If the server has intl installed, use that */
if ( function_exists( 'numfmt_format_currency' ) )
{
{
/* Unfortunately a bug in intl means that locales which use commas for decimal separation are broken.
@link https://community.invisionpower.com/4bugtrack/active-reports/nexus-money-formatting-r6911/ .
What we'll do is store the current locale, reset to English, then reset back to current locale afterwards. */
$currentLocale = setlocale( LC_ALL, '0' );
if( mb_strtoupper( mb_substr( PHP_OS, 0, 3 ) ) === 'WIN' )
{
setlocale( LC_ALL, 'english' );
}
else
{
setlocale( LC_ALL, 'en_US' );
}
$format = numfmt_create( $language->short, \NumberFormatter::CURRENCY );
if ( $return = numfmt_format_currency( $format, $this->amount, $this->currency ) and $return !== 'NaN' )
{
/* Now we have to reset locale back to what it was */
foreach( explode( ";", $currentLocale ) as $locale )
{
if( mb_strpos( $locale, '=' ) !== FALSE )
{
$parts = explode( "=", $locale );
if( in_array( $parts[0], array( 'LC_ALL', 'LC_COLLATE', 'LC_CTYPE', 'LC_MONETARY', 'LC_NUMERIC', 'LC_TIME' ) ) )
{
setlocale( constant( $parts[0] ), $parts[1] );
}
}
else
{
setLocale( LC_ALL, $locale );
}
}
return $return;
}
}
+9 -6
View File
@@ -140,14 +140,17 @@ class _Ad extends \IPS\nexus\Package
unset( $values['p_max_dims'] );
}
$locations = $values['p_locations'];
$customKey = array_search( '_ad_custom_', $locations );
if ( $customKey !== FALSE )
if ( isset( $values['p_locations'] ) )
{
unset( $locations[ $customKey ] );
$locations = array_merge( $locations, $values['p_locations_custom'] );
$locations = $values['p_locations'];
$customKey = array_search( '_ad_custom_', $locations );
if ( $customKey !== FALSE )
{
unset( $locations[ $customKey ] );
$locations = array_merge( $locations, $values['p_locations_custom'] );
}
$values['p_locations'] = implode( ',', $locations );
}
$values['p_locations'] = implode( ',', $locations );
unset( $values['p_locations_custom'] );
return parent::formatFormValues( $values );
@@ -257,4 +257,19 @@ class _Item extends \IPS\Content\Item implements \IPS\Content\Featurable, \IPS\C
$product = \IPS\nexus\Package::load( $this->id );
return $product->_data['image'] ? \IPS\File::get( 'nexus_Products', $product->_data['image'] ) : NULL;
}
/**
* Get mapped value
*
* @param string $key date,content,ip_address,first
* @return mixed
*/
public function mapped( $key )
{
if ( $key === 'title' )
{
return $this->title;
}
return parent::mapped($key);
}
}
+19 -16
View File
@@ -791,7 +791,13 @@ class _Package extends \IPS\Node\Model
$form->add( $field );
}
$form->addHeader('package_registration');
$form->add( new \IPS\Helpers\Form\YesNo( 'p_reg', $this->reg ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'p_reg', $this->reg, FALSE, array(), function( $val )
{
if ( $val and ( !\IPS\Request::i()->p_store_checkbox or ( \IPS\Request::i()->p_member_groups and !in_array( \IPS\Settings::i()->guest_group, \IPS\Request::i()->p_member_groups ) ) ) )
{
throw new \DomainException( \IPS\Member::loggedIn()->language()->addToStack( 'p_reg_err', FALSE, array( 'sprintf' => array( \IPS\Member\Group::load( \IPS\Settings::i()->guest_group )->name ) ) ) );
}
} ) );
$form->addHeader('package_associations');
$form->addMessage('package_associations_desc');
$form->add( new \IPS\Helpers\Form\Radio( 'p_associate', ( $this->force_assoc and count( $this->associablePackages() ) ) ? 2 : ( count( $this->associablePackages() ) ? 1 : 0 ), FALSE, array(
@@ -1300,19 +1306,22 @@ class _Package extends \IPS\Node\Model
{
$newRenewTerms = array();
}
$key = 'x';
foreach ( $changes['renew_options'] as $k => $data )
if ( $purchase->renewals )
{
if ( $data['old'] != 'x' )
foreach ( $changes['renew_options'] as $k => $data )
{
if ( $data['old']['cost'][ $purchase->renewals->cost->currency ]['amount'] == $purchase->renewals->cost->amount )
if ( $data['old'] != 'x' )
{
$term = $purchase->renewals->getTerm();
if ( $data['old']['term'] == $term['term'] and $data['old']['unit'] == $term['unit'] )
if ( $data['old']['cost'][ $purchase->renewals->cost->currency ]['amount'] == $purchase->renewals->cost->amount )
{
$key = $k;
break;
$term = $purchase->renewals->getTerm();
if ( $data['old']['term'] == $term['term'] and $data['old']['unit'] == $term['unit'] )
{
$key = $k;
break;
}
}
}
}
@@ -2802,13 +2811,7 @@ class _Package extends \IPS\Node\Model
catch ( \UnderflowException $e )
{
$purchase->member->member_group_id = $purchase->member->cm_return_group;
/* Don't move them back into validating */
if ( $purchase->member->member_group_id == \IPS\Settings::i()->auth_group )
{
$purchase->member->member_group_id = \IPS\Settings::i()->member_group;
}
/* Does this group exist? */
try
{
@@ -35,13 +35,13 @@ class _Purchase extends \IPS\Node\Model
* @return \IPS\Helpers\Tree
*/
public static function tree( \IPS\Http\Url $url, array $where, $ref = 'c', \IPS\nexus\Purchase $root = NULL, $includeRoot = TRUE )
{
{
$where[] = array( 'ps_show=1' );
return new \IPS\Helpers\Tree\Tree(
$url,
'Purchases',
function() use ( $url, $where, $ref, $root, $includeRoot )
function( $limit ) use ( $url, $where, $ref, $root, $includeRoot )
{
if ( $root )
{
@@ -60,7 +60,7 @@ class _Purchase extends \IPS\Node\Model
}
$rows = array();
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_purchases', $where ), 'IPS\nexus\Purchase' ) as $purchase )
foreach( new \IPS\Patterns\ActiveRecordIterator( \IPS\Db::i()->select( '*', 'nexus_purchases', $where, 'ps_start DESC', $limit ), 'IPS\nexus\Purchase' ) as $purchase )
{
$rows[ $purchase->id ] = $purchase->treeRow( $url, $ref );
}
@@ -82,6 +82,16 @@ class _Purchase extends \IPS\Node\Model
$rows[ $child->id ] = $child->treeRow( $url, $ref );
}
return $rows;
},
NULL,
FALSE,
FALSE,
FALSE,
NULL,
function()
{
$where[] = array( 'ps_parent=0' );
return \IPS\Db::i()->select( 'COUNT(*)', 'nexus_purchases', $where )->first();
}
);
}
@@ -40,12 +40,15 @@ class _EasyPostRate implements \IPS\nexus\Shipping\Rate
}
/**
* Is available to destination?
* Is available?
*
* @param \IPS\GeoLocation $destination Desired destination
* @param \IPS\GeoLocation $destination Desired destination
* @param array $items Items
* @param string $currency Desired currency
* @param \IPS\nexus\Invoice|NULL $invoice The invoice
* @return bool
*/
public function isAvailable( \IPS\GeoLocation $destination )
public function isAvailable( \IPS\GeoLocation $destination, array $items, $currency, \IPS\nexus\Invoice $invoice = NULL )
{
return TRUE;
}
@@ -141,7 +144,7 @@ class _EasyPostRate implements \IPS\nexus\Shipping\Rate
*/
public static function getRates( $lengthInInches, $widthInInches, $heightInInches, $weightInOz, \IPS\nexus\Customer $toCustomer, \IPS\Geolocation $toAddress, $currency )
{
$fromAddress = \IPS\GeoLocation::buildFromJson( \IPS\Settings::i()->site_address );
$fromAddress = \IPS\GeoLocation::buildFromJson( \IPS\Settings::i()->easypost_address ?: \IPS\Settings::i()->site_address );
return \IPS\Http\Url::external( 'https://api.easypost.com/v2/shipments' )->request()->login( \IPS\Settings::i()->easypost_api_key, '' )->post( array( 'shipment' => array(
'to_address' => array(
@@ -363,35 +363,56 @@ class _FlatRate extends \IPS\Node\Model implements \IPS\nexus\Shipping\Rate
}
/**
* Is available to destination?
* Is available?
*
* @param \IPS\GeoLocation $destination Desired destination
* @param \IPS\GeoLocation $destination Desired destination
* @param array $items Items
* @param string $currency Desired currency
* @param \IPS\nexus\Invoice|NULL $invoice The invoice
* @return bool
*/
public function isAvailable( \IPS\GeoLocation $destination )
public function isAvailable( \IPS\GeoLocation $destination, array $items, $currency, \IPS\nexus\Invoice $invoice = NULL )
{
if ( $this->locations === '*' )
{
return TRUE;
}
else
/* Is available to destination? */
if ( $this->locations !== '*' )
{
$locations = json_decode( $this->locations, TRUE );
if ( isset( $locations[ $destination->country ] ) )
{
if ( $locations[ $destination->country ] === '*' )
if ( $locations[ $destination->country ] !== '*' and !in_array( $destination->region, $locations[ $destination->country ] ) )
{
return TRUE;
}
else
{
return in_array( $destination->region, $locations[ $destination->country ] );
return FALSE;
}
}
return FALSE;
else
{
return FALSE;
}
}
/* Is it available for what's being bought? */
$criteria = $this->_getCriteria( $items, $invoice );
$rates = json_decode( $this->rates, TRUE );
foreach ( $rates as $rate )
{
$min = $rate['min'];
if ( is_array( $min ) )
{
$min = $min[ $currency ];
}
$max = $rate['max'];
if ( is_array( $max ) )
{
$max = $max[ $currency ];
}
if ( ( $min === '*' or $criteria >= $min ) and ( $max === '*' or $criteria <= $max ) )
{
return TRUE;
}
}
return FALSE;
}
/**
@@ -405,14 +426,13 @@ class _FlatRate extends \IPS\Node\Model implements \IPS\nexus\Shipping\Rate
}
/**
* Price
* Get criteria
*
* @param array $items Items
* @param string $currency Desired currency
* @param \IPS\nexus\Invoice|NULL $invoice The invoice
* @return \IPS\nexus\Money
* @return The criteria the rased is based on (e.g. if the rate is based on invoice total, will return the invoice total)
*/
public function getPrice( array $items, $currency, \IPS\nexus\Invoice $invoice = NULL )
protected function _getCriteria( array $items, \IPS\nexus\Invoice $invoice = NULL )
{
switch ( $this->type )
{
@@ -450,6 +470,21 @@ class _FlatRate extends \IPS\Node\Model implements \IPS\nexus\Shipping\Rate
}
}
return $criteria;
}
/**
* Price
*
* @param array $items Items
* @param string $currency Desired currency
* @param \IPS\nexus\Invoice|NULL $invoice The invoice
* @return \IPS\nexus\Money
*/
public function getPrice( array $items, $currency, \IPS\nexus\Invoice $invoice = NULL )
{
$criteria = $this->_getCriteria( $items, $invoice );
$rates = json_decode( $this->rates, TRUE );
foreach ( $rates as $rate )
{
+6 -3
View File
@@ -25,12 +25,15 @@ if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
interface Rate
{
/**
* Is available to destination?
* Is available?
*
* @param \IPS\GeoLocation $destination Desired destination
* @param \IPS\GeoLocation $destination Desired destination
* @param array $items Items
* @param string $currency Desired currency
* @param \IPS\nexus\Invoice|NULL $invoice The invoice
* @return bool
*/
public function isAvailable( \IPS\GeoLocation $destination );
public function isAvailable( \IPS\GeoLocation $destination, array $items, $currency, \IPS\nexus\Invoice $invoice = NULL );
/**
* Name
+1 -1
View File
@@ -294,7 +294,7 @@ class _Reply extends \IPS\Content\Comment implements \IPS\Content\Hideable
if ( !in_array( $staffId, $sentTo ) and ( $this->item()->department->staff === '*' or in_array( $staffId, explode( ',', $this->item()->department->staff ) ) ) )
{
$email = \IPS\Email::buildFromTemplate( 'nexus', $this->type === static::REPLY_HIDDEN ? 'staffNotifyNote' : 'staffNotifyReply', array( $this ) );
$email->from = $this->item()->department->email;
$email->from = ( $this->item()->department->email ) ? $this->item()->department->email : \IPS\Settings::i()->email_out;
switch ( \IPS\Settings::i()->nexus_sout_from )
{
case 'staff':
@@ -256,7 +256,7 @@ class _Request extends \IPS\Content\Item implements \IPS\Content\ReadMarkers
}
else
{
return htmlentities( $row['r_email'], \IPS\HTMLENTITIES, 'UTF-8', FALSE );
return htmlspecialchars( $row['r_email'], \IPS\HTMLENTITIES, 'UTF-8', FALSE );
}
},
'r_last_reply_by' => function( $val, $row )
@@ -773,7 +773,7 @@ class _Request extends \IPS\Content\Item implements \IPS\Content\ReadMarkers
$invoice->member = \IPS\nexus\Customer::loggedIn();
$invoice->return_uri = "app=nexus&module=support&controller=home&do=create&department={$department->id}&title=" . urlencode( $values['support_title'] );
$item = new \IPS\nexus\extensions\nexus\Item\SupportCharge( $department->_title, $ppiCost );
$item = new \IPS\nexus\extensions\nexus\Item\SupportCharge( \IPS\Member::loggedIn()->language()->get( 'nexus_department_' . $department->_id ), $ppiCost );
$item->id = $department->id;
if ( $department->ppi_tax )
{
@@ -900,6 +900,8 @@ class _Request extends \IPS\Content\Item implements \IPS\Content\ReadMarkers
}
parent::processAfterCreate( $comment, $values );
$this->sendNotifications();
}
/**
@@ -1348,7 +1350,7 @@ class _Request extends \IPS\Content\Item implements \IPS\Content\ReadMarkers
if ( $this->department->staff === '*' or count( array_intersect( \IPS\nexus\Support\Department::staffDepartmentPerms( $member ), explode( ',', $this->department->staff ) ) ) )
{
$email = \IPS\Email::buildFromTemplate( 'nexus', 'staffNotifyNew', array( $this ) );
$email->from = $this->department->email;
$email->from = ( $this->department->email ) ? $this->department->email : \IPS\Settings::i()->email_out;
switch ( \IPS\Settings::i()->nexus_sout_from )
{
case 'staff':
@@ -258,4 +258,20 @@ class _Status extends \IPS\Node\Model
return $buttons;
}
/**
* [ActiveRecord] Duplicate
*
* @return void
*/
public function __clone()
{
$oldId = $this->_id;
parent::__clone();
\IPS\Lang::saveCustom( 'nexus', "nexus_status_{$this->id}_admin", iterator_to_array( \IPS\Db::i()->select( 'CONCAT(word_custom, \' ' . \IPS\Member::loggedIn()->language()->get('copy_noun') . '\') as word_custom, lang_id', 'core_sys_lang_words', array( 'word_key=?', "nexus_status_{$oldId}_admin" ) )->setKeyField( 'lang_id' )->setValueField('word_custom') ) );
\IPS\Lang::saveCustom( 'nexus', "nexus_status_{$this->id}_front", iterator_to_array( \IPS\Db::i()->select( 'word_custom, lang_id', 'core_sys_lang_words', array( 'word_key=?', "nexus_status_{$oldId}_front" ) )->setKeyField( 'lang_id' )->setValueField('word_custom') ) );
\IPS\Lang::saveCustom( 'nexus', "nexus_status_{$this->id}_set", iterator_to_array( \IPS\Db::i()->select( 'word_custom, lang_id', 'core_sys_lang_words', array( 'word_key=?', "nexus_status_{$oldId}_set" ) )->setKeyField( 'lang_id' )->setValueField('word_custom') ) );
}
}
+1 -1
View File
@@ -138,7 +138,7 @@ class _Tax extends \IPS\Node\Model
* @return array
*/
public function formatFormValues( $values )
{
{
$rates = array();
if( isset( $values['rates'] ) )