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,44 +12,53 @@
|
||||
namespace IPS\nexus\modules\front\clients;
|
||||
|
||||
/* To prevent PHP errors (extending class does not exist) revealing path */
|
||||
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
|
||||
|
||||
use IPS\Db;
|
||||
use IPS\Dispatcher\Controller;
|
||||
use IPS\Http\Url;
|
||||
use IPS\Member;
|
||||
use IPS\nexus\Customer;
|
||||
use IPS\Output;
|
||||
use function count;
|
||||
use function defined;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Controller to redirect /clients to something sensible
|
||||
*/
|
||||
class _splash extends \IPS\Dispatcher\Controller
|
||||
class splash extends Controller
|
||||
{
|
||||
/**
|
||||
* Execute
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function execute()
|
||||
public function execute() : void
|
||||
{
|
||||
if ( \IPS\Member::loggedIn()->member_id )
|
||||
if ( Member::loggedIn()->member_id )
|
||||
{
|
||||
$where = array( array( 'ps_member=?', \IPS\Member::loggedIn()->member_id ) );
|
||||
$parentContacts = \IPS\nexus\Customer::loggedIn()->parentContacts();
|
||||
if ( \count( $parentContacts ) )
|
||||
$where = array( array( 'ps_member=?', Member::loggedIn()->member_id ) );
|
||||
$parentContacts = Customer::loggedIn()->parentContacts();
|
||||
if ( count( $parentContacts ) )
|
||||
{
|
||||
$or = array();
|
||||
foreach ( $parentContacts as $contact )
|
||||
{
|
||||
$where[0][0] .= ' OR ' . \IPS\Db::i()->in( 'ps_id', $contact->purchaseIds() );
|
||||
$where[0][0] .= ' OR ' . Db::i()->in( 'ps_id', $contact->purchaseIds() );
|
||||
}
|
||||
}
|
||||
$where[] = array( 'ps_show=1' );
|
||||
|
||||
if ( \IPS\Db::i()->select( 'COUNT(*)', 'nexus_purchases', $where )->first() )
|
||||
if ( Db::i()->select( 'COUNT(*)', 'nexus_purchases', $where )->first() )
|
||||
{
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=nexus&module=clients&controller=purchases', 'front', 'clientspurchases' ) );
|
||||
Output::i()->redirect( Url::internal( 'app=nexus&module=clients&controller=purchases', 'front', 'clientspurchases' ) );
|
||||
}
|
||||
}
|
||||
|
||||
\IPS\Output::i()->redirect( \IPS\Http\Url::internal( 'app=nexus&module=clients&controller=invoices', 'front', 'clientsinvoices' ) );
|
||||
Output::i()->redirect( Url::internal( 'app=nexus&module=clients&controller=invoices', 'front', 'clientsinvoices' ) );
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user