Version 4.7.6
This commit is contained in:
1 parent
8ba7d43898
commit
7b7404e741
1085 files changed
+30590
-7837
No files matched your search
@@ -151,6 +151,22 @@ class _Rule extends \IPS\Node\Model
|
||||
|
||||
$conditions[] = \IPS\Member::loggedIn()->language()->addToStack( 'f_blurb_products', FALSE, array( 'sprintf' => array( implode( ' ' . \IPS\Member::loggedIn()->language()->addToStack('or') . ' ', $packages ) ) ) );
|
||||
}
|
||||
|
||||
/* Subscriptions */
|
||||
if ( $this->subscriptions and $this->subscriptions != '*' )
|
||||
{
|
||||
$subscriptions = array();
|
||||
foreach ( explode( ',', $this->subscriptions ) as $id )
|
||||
{
|
||||
try
|
||||
{
|
||||
$subscriptions[] = \IPS\nexus\Subscription\Package::load( $id )->_title;
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) { }
|
||||
}
|
||||
|
||||
$conditions[] = \IPS\Member::loggedIn()->language()->addToStack( 'f_blurb_subscriptions', FALSE, array( 'sprintf' => array( implode( ' ' . \IPS\Member::loggedIn()->language()->addToStack('or') . ' ', $subscriptions ) ) ) );
|
||||
}
|
||||
|
||||
/* Coupon */
|
||||
if ( $this->coupon )
|
||||
@@ -444,6 +460,7 @@ class _Rule extends \IPS\Node\Model
|
||||
$form->addTab( 'fraud_rule_transaction' );
|
||||
$form->add( $this->_combine( 'f_amount', 'IPS\nexus\Form\Money' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'f_products', ( !$this->products or $this->products === '*' ) ? 0 : explode( ',', $this->products ), FALSE, array( 'class' => 'IPS\nexus\Package', 'multiple' => TRUE, 'zeroVal' => 'any' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'f_subscriptions', ( !$this->subscriptions or $this->subscriptions === '*' ) ? 0 : explode( ',', $this->subscriptions ), FALSE, array( 'class' => 'IPS\nexus\Subscription\Package', 'multiple' => TRUE, 'zeroVal' => 'any' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'f_methods', ( !$this->methods or $this->methods === '*' ) ? 0 : explode( ',', $this->methods ), FALSE, array( 'class' => 'IPS\nexus\Gateway', 'multiple' => TRUE, 'zeroVal' => 'any' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'f_coupon', $this->coupon, FALSE, array( 'options' => $yesNoEither ) ) );
|
||||
|
||||
@@ -645,7 +662,7 @@ class _Rule extends \IPS\Node\Model
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( array( 'f_methods', 'f_products' ) as $k )
|
||||
foreach ( array( 'f_methods', 'f_products', 'f_subscriptions' ) as $k )
|
||||
{
|
||||
if( isset( $values[ $k ] ) )
|
||||
{
|
||||
@@ -735,6 +752,25 @@ class _Rule extends \IPS\Node\Model
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Subscriptions */
|
||||
if ( $this->subscriptions and $this->subscriptions != '*' )
|
||||
{
|
||||
$match = FALSE;
|
||||
foreach ( $transaction->invoice->items as $item )
|
||||
{
|
||||
if ( $item instanceof \IPS\nexus\extensions\nexus\Item\Subscription and \in_array( $item->id, explode( ',', $this->subscriptions ) ) )
|
||||
{
|
||||
$match = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$match )
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Coupon */
|
||||
if ( $this->coupon )
|
||||
@@ -1185,6 +1221,7 @@ class _Rule extends \IPS\Node\Model
|
||||
foreach ( array(
|
||||
'methods' => array_keys( \IPS\nexus\Gateway::roots() ),
|
||||
'products' => iterator_to_array( \IPS\Db::i()->select( 'p_id', 'nexus_packages' ) ),
|
||||
'subscriptions' => iterator_to_array( \IPS\Db::i()->select( 'sp_id', 'nexus_member_subscription_packages' ) ),
|
||||
'country' => array_values( \IPS\GeoLocation::$countries ),
|
||||
'customer_groups' => array_keys( \IPS\Member\Group::groups() )
|
||||
) as $k => $allValues )
|
||||
|
||||
@@ -988,10 +988,10 @@ class _Braintree extends \IPS\nexus\Gateway
|
||||
/**
|
||||
* Get short code for PayPal State
|
||||
*
|
||||
* @param \IPS\GeoLocation $address
|
||||
* @return string
|
||||
* @param \IPS\GeoLocation $address
|
||||
* @return NULL|string
|
||||
*/
|
||||
protected function _payPalState( \IPS\GeoLocation $address ): string
|
||||
protected function _payPalState( \IPS\GeoLocation $address ): ?string
|
||||
{
|
||||
/* PayPal requires short codes for states */
|
||||
$state = $address->region;
|
||||
|
||||
@@ -210,7 +210,10 @@ class _Gateway extends \IPS\Node\Model
|
||||
$values['countries'] = \is_array( $values['paymethod_countries'] ) ? implode( ',', $values['paymethod_countries'] ) : $values['paymethod_countries'];
|
||||
}
|
||||
|
||||
$values['validationfile'] = (string) $values['m_validationfile'];
|
||||
if( isset( $values['m_validationfile'] ) )
|
||||
{
|
||||
$values['validationfile'] = (string) $values['m_validationfile'];
|
||||
}
|
||||
|
||||
$settings = array();
|
||||
foreach ( $values as $k => $v )
|
||||
|
||||
@@ -63,13 +63,7 @@ class _Payout extends \IPS\nexus\Payout
|
||||
{
|
||||
$settings = json_decode( \IPS\Settings::i()->nexus_payout, TRUE );
|
||||
|
||||
$field = new \IPS\Helpers\Form\TextArea( 'manual_details', NULL, NULL, array(), function( $val )
|
||||
{
|
||||
if ( !$val and \IPS\Request::i()->withdraw_method === 'Manual' )
|
||||
{
|
||||
throw new \DomainException('form_required');
|
||||
}
|
||||
} );
|
||||
$field = new \IPS\Helpers\Form\TextArea( 'manual_details', NULL, TRUE, array() );
|
||||
$field->label = $settings['Manual']['title'];
|
||||
return array( $field );
|
||||
}
|
||||
|
||||
@@ -1606,9 +1606,21 @@ class _Invoice extends \IPS\Patterns\ActiveRecord
|
||||
}
|
||||
$this->member = $memberToSave;
|
||||
$postBeforeRegister = isset( $this->guest_data['pbr'] ) ? $this->guest_data['pbr'] : NULL;
|
||||
$referredBy = isset( $this->guest_data['referred_by'] ) ? $this->guest_data['referred_by'] : NULL;
|
||||
|
||||
$this->guest_data = isset( $this->guest_data['guestTransactionKey'] ) ? array( 'guestTransactionKey' => $this->guest_data['guestTransactionKey'] ) : NULL;
|
||||
$this->save();
|
||||
|
||||
|
||||
/* Referrals */
|
||||
if( $referredBy )
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\Member::load( $referredBy )->addReferral( $this->member );
|
||||
}
|
||||
catch ( \OutOfRangeException $e ) {}
|
||||
}
|
||||
|
||||
/* If we provided answers to security questions in check out, save those */
|
||||
if ( \IPS\Settings::i()->security_questions_enabled and \in_array( \IPS\Settings::i()->security_questions_prompt, array( 'register', 'optional' ) ) )
|
||||
{
|
||||
|
||||
@@ -178,9 +178,10 @@ class _Item extends \IPS\Content\Item implements \IPS\Content\Featurable, \IPS\C
|
||||
* @param bool $joinAuthor If true, will join the members table for the author
|
||||
* @param bool $joinLastCommenter If true, will join the members table for the last commenter
|
||||
* @param bool $showMovedLinks If true, moved item links are included in the results
|
||||
* @param array|null $location Array of item lat and long
|
||||
* @return \IPS\Patterns\ActiveRecordIterator|int
|
||||
*/
|
||||
public static function getItemsWithPermission( $where=array(), $order=NULL, $limit=10, $permissionKey='read', $includeHiddenItems=\IPS\Content\Hideable::FILTER_AUTOMATIC, $queryFlags=0, \IPS\Member $member=NULL, $joinContainer=FALSE, $joinComments=FALSE, $joinReviews=FALSE, $countOnly=FALSE, $joins=NULL, $skipPermission=FALSE, $joinTags=TRUE, $joinAuthor=TRUE, $joinLastCommenter=TRUE, $showMovedLinks=FALSE )
|
||||
public static function getItemsWithPermission( $where=array(), $order=NULL, $limit=10, $permissionKey='read', $includeHiddenItems=\IPS\Content\Hideable::FILTER_AUTOMATIC, $queryFlags=0, \IPS\Member $member=NULL, $joinContainer=FALSE, $joinComments=FALSE, $joinReviews=FALSE, $countOnly=FALSE, $joins=NULL, $skipPermission=FALSE, $joinTags=TRUE, $joinAuthor=TRUE, $joinLastCommenter=TRUE, $showMovedLinks=FALSE, $location=NULL )
|
||||
{
|
||||
$member = $member ?: \IPS\Member::loggedIn();
|
||||
|
||||
|
||||
@@ -2341,14 +2341,14 @@ class _Package extends \IPS\Node\Model
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Turn off guest page caching */
|
||||
if ( \IPS\CACHE_PAGE_TIMEOUT and !\IPS\Member::loggedIn()->member_id )
|
||||
{
|
||||
/* Set the cookie for 20 minutes - if the guest hasn't checked out by then they may no longer see their cart on every page but as long as their session is still valid they will still be able to check out. */
|
||||
\IPS\Request::i()->setCookie( 'noCache', 1, \IPS\DateTime::ts( time() + 1200 ) );
|
||||
}
|
||||
|
||||
|
||||
/* Return */
|
||||
return $cartId;
|
||||
}
|
||||
@@ -2682,7 +2682,7 @@ class _Package extends \IPS\Node\Model
|
||||
{
|
||||
\IPS\Output::i()->redirect( $invoice->acpUrl() );
|
||||
}
|
||||
$purchase->member->log( 'purchase', array( 'type' => 'change', 'id' => $purchase->id, 'old' => $purchase->name, 'name' => $newPackage->_title, 'system' => FALSE ) );
|
||||
$purchase->member->log( 'purchase', array( 'type' => 'change', 'id' => $purchase->id, 'old' => $purchase->name, 'name' => $newPackage->titleForLog(), 'system' => FALSE ) );
|
||||
\IPS\Output::i()->redirect( $purchase->acpUrl() );
|
||||
}
|
||||
return (string) $form;
|
||||
|
||||
@@ -140,4 +140,35 @@ class _Review extends \IPS\Content\Review implements \IPS\Content\EditHistory, \
|
||||
\IPS\Output::i()->cssFiles = array_merge( \IPS\Output::i()->cssFiles, \IPS\Theme::i()->css( 'embed.css', 'nexus', 'front' ) );
|
||||
return \IPS\Theme::i()->getTemplate( 'global', 'nexus' )->embedProductReview( $this, $this->item(), $renewalTerm, $this->url()->setQueryString( $params ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Do stuff after creating (abstracted as comments and reviews need to do different things)
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function postCreate()
|
||||
{
|
||||
parent::postCreate();
|
||||
|
||||
/* If this review is moderated, then let the parent class do it's thing and if it didn't find a reason, see if this specific product requires reviews to be approved */
|
||||
if ( $this->hidden() === 1 )
|
||||
{
|
||||
try
|
||||
{
|
||||
\IPS\core\Approval::loadFromContent( \get_called_class(), $this->id );
|
||||
}
|
||||
catch( \OutOfRangeException $e )
|
||||
{
|
||||
/* No reason found - see if product requires approval of reviews */
|
||||
if ( $this->item()->review_moderate )
|
||||
{
|
||||
$log = new \IPS\core\Approval;
|
||||
$log->content_class = \get_called_class();
|
||||
$log->content_id = $this->id;
|
||||
$log->held_reason = 'item';
|
||||
$log->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,7 +67,12 @@ class _Package extends \IPS\Node\Model
|
||||
public static $descriptionLangSuffix = '_desc';
|
||||
|
||||
/* !Node */
|
||||
|
||||
|
||||
/**
|
||||
* @brief [Node] App for permission index
|
||||
*/
|
||||
public static $permApp = 'nexus';
|
||||
|
||||
/**
|
||||
* @brief [Node] Node Title
|
||||
*/
|
||||
@@ -153,8 +158,10 @@ class _Package extends \IPS\Node\Model
|
||||
\IPS\File::get( 'nexus_Products', $this->image )->delete();
|
||||
}
|
||||
}
|
||||
catch( \Exception $e ){
|
||||
}
|
||||
catch( \Exception $e ){}
|
||||
|
||||
\IPS\Task::queue( 'nexus', 'DeleteSubscriptions', [ 'id' => $this->id ] );
|
||||
|
||||
parent::delete();
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,8 @@ class _Reply extends \IPS\Content\Comment implements \IPS\Content\Hideable
|
||||
'content' => 'post',
|
||||
'date' => 'date',
|
||||
'ip_address' => 'ip_address',
|
||||
'hidden' => 'hidden'
|
||||
'hidden' => 'hidden',
|
||||
'first' => 'is_first'
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1239,9 +1239,10 @@ class _Request extends \IPS\Content\Item implements \IPS\Content\ReadMarkers
|
||||
* @param bool $joinAuthor If true, will join the members table for the author
|
||||
* @param bool $joinLastCommenter If true, will join the members table for the last commenter
|
||||
* @param bool $showMovedLinks If true, moved item links are included in the results
|
||||
* @param array|null $location Array of item lat and long
|
||||
* @return \IPS\Patterns\ActiveRecordIterator|int
|
||||
*/
|
||||
public static function getItemsWithPermission( $where=array(), $order=NULL, $limit=10, $permissionKey='read', $includeHiddenItems=\IPS\Content\Hideable::FILTER_AUTOMATIC, $queryFlags=0, \IPS\Member $member=NULL, $joinContainer=FALSE, $joinComments=FALSE, $joinReviews=FALSE, $countOnly=FALSE, $joins=NULL, $skipPermission=FALSE, $joinTags=TRUE, $joinAuthor=TRUE, $joinLastCommenter=TRUE, $showMovedLinks=FALSE )
|
||||
public static function getItemsWithPermission( $where=array(), $order=NULL, $limit=10, $permissionKey='read', $includeHiddenItems=\IPS\Content\Hideable::FILTER_AUTOMATIC, $queryFlags=0, \IPS\Member $member=NULL, $joinContainer=FALSE, $joinComments=FALSE, $joinReviews=FALSE, $countOnly=FALSE, $joins=NULL, $skipPermission=FALSE, $joinTags=TRUE, $joinAuthor=TRUE, $joinLastCommenter=TRUE, $showMovedLinks=FALSE, $location = null )
|
||||
{
|
||||
/* Get customer object */
|
||||
if ( !$member )
|
||||
|
||||
@@ -372,9 +372,14 @@ class _Tax extends \IPS\Node\Model
|
||||
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types" xmlns:impl="urn:ec.europa.eu:taxud:vies:services:checkVat"><soap:Header></soap:Header><soap:Body><tns1:checkVat xmlns:tns1="urn:ec.europa.eu:taxud:vies:services:checkVat:types" xmlns="urn:ec.europa.eu:taxud:vies:services:checkVat:types"><tns1:countryCode>{$countryCode}</tns1:countryCode><tns1:vatNumber>{$vatNumberWithoutCountryCode}</tns1:vatNumber></tns1:checkVat></soap:Body></soap:Envelope>
|
||||
XML;
|
||||
/* Send the request */
|
||||
$request = \IPS\Http\Url::external('http://ec.europa.eu/taxation_customs/vies/services/checkVatService')->request();
|
||||
$request = \IPS\Http\Url::external('https://ec.europa.eu/taxation_customs/vies/services/checkVatService')->request()->setHeaders( [ 'Content-Type' => 'text/xml' ] );
|
||||
$response = $request->post( $xml );
|
||||
|
||||
|
||||
if( $response->httpResponseCode != 200 )
|
||||
{
|
||||
throw new \IPS\Http\Request\Exception;
|
||||
}
|
||||
|
||||
/* Interpret */
|
||||
$responseArray = array();
|
||||
$xml = new \IPS\Xml\XMLReader;
|
||||
|
||||
@@ -157,7 +157,7 @@ class _Transaction extends \IPS\Patterns\ActiveRecord
|
||||
'view' => array(
|
||||
'icon' => 'search',
|
||||
'title' => 'transaction_view',
|
||||
'link' => \IPS\Http\Url::internal( "app=nexus&module=payments&controller=transactions&do=view&id={$row['t_id']}" )
|
||||
'link' => \IPS\Http\Url::internal( "app=nexus&module=payments&controller=transactions&do=view&id={$row['t_id']}" )->getSafeUrlFromFilters()
|
||||
),
|
||||
), \IPS\nexus\Transaction::constructFromData( $row )->buttons( $ref ) );
|
||||
};
|
||||
@@ -966,12 +966,12 @@ class _Transaction extends \IPS\Patterns\ActiveRecord
|
||||
$return = array();
|
||||
|
||||
/* Approve button */
|
||||
if ( \in_array( $this->status, array( static::STATUS_WAITING, static::STATUS_HELD, static::STATUS_REVIEW ) ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'payments', 'transactions_edit' ) )
|
||||
if ( $this->method and \in_array( $this->status, array( static::STATUS_WAITING, static::STATUS_HELD, static::STATUS_REVIEW ) ) and \IPS\Member::loggedIn()->hasAcpRestriction( 'nexus', 'payments', 'transactions_edit' ) )
|
||||
{
|
||||
$return['approve'] = array(
|
||||
'title' => $this->auth ? 'transaction_capture' : 'transaction_approve',
|
||||
'icon' => 'check',
|
||||
'link' => $url->setQueryString( array( 'do' => 'approve' ) )->csrf(),
|
||||
'link' => $url->setQueryString( array( 'do' => 'approve' ) )->csrf()->getSafeUrlFromFilters(),
|
||||
'data' => array( 'confirm' => '' )
|
||||
);
|
||||
}
|
||||
@@ -982,7 +982,7 @@ class _Transaction extends \IPS\Patterns\ActiveRecord
|
||||
$return['review'] = array(
|
||||
'title' => 'transaction_flag_review',
|
||||
'icon' => 'flag',
|
||||
'link' => $url->setQueryString( array( 'do' => 'review' ) )->csrf(),
|
||||
'link' => $url->setQueryString( array( 'do' => 'review' ) )->csrf()->getSafeUrlFromFilters(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -992,7 +992,7 @@ class _Transaction extends \IPS\Patterns\ActiveRecord
|
||||
$return['void'] = array(
|
||||
'title' => 'transaction_void',
|
||||
'icon' => 'times',
|
||||
'link' => $url->setQueryString( array( 'do' => 'void' ) )->csrf(),
|
||||
'link' => $url->setQueryString( array( 'do' => 'void' ) )->csrf()->getSafeUrlFromFilters(),
|
||||
'data' => array( 'confirm' => '' )
|
||||
);
|
||||
}
|
||||
@@ -1025,11 +1025,10 @@ class _Transaction extends \IPS\Patterns\ActiveRecord
|
||||
$return['delete'] = array(
|
||||
'title' => 'delete',
|
||||
'icon' => 'times-circle',
|
||||
'link' => $url->setQueryString( 'do', 'delete' )->csrf(),
|
||||
'link' => $url->setQueryString( 'do', 'delete' )->csrf()->getSafeUrlFromFilters(),
|
||||
'data' => array( 'confirm' => '', 'confirmSubMessage' => \IPS\Member::loggedIn()->language()->addToStack('trans_delete_warning') )
|
||||
);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -1094,4 +1093,4 @@ class _Transaction extends \IPS\Patterns\ActiveRecord
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user