Version 4.3.0
This commit is contained in:
1 parent
96997ddd8e
commit
fe1acf984a
1349 files changed
+116159
-67711
No files matched your search
@@ -138,7 +138,8 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
$order = array();
|
||||
if ( $groupByDepartment )
|
||||
{
|
||||
$order[] = 'dpt_position';
|
||||
$order[] = 'nexus_support_staff_dpt_order.dpt_position';
|
||||
$order[] = 'nexus_support_departments.dpt_position'; // This is to prevent an issue if two departments have the same position (which may be the case if new departments have been created since the user set their preferred order)
|
||||
}
|
||||
$honorSeverities = ( !isset( \IPS\Request::i()->cookie['support_honor_severities'] ) or \IPS\Request::i()->cookie['support_honor_severities'] );
|
||||
if ( $honorSeverities )
|
||||
@@ -525,19 +526,26 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
/* Init */
|
||||
\IPS\Dispatcher::i()->checkAcpPermission( 'requests_create' );
|
||||
$steps = array();
|
||||
$url = \IPS\Http\Url::internal('app=nexus&module=support&controller=requests&do=create');
|
||||
$initialData = NULL;
|
||||
if ( isset( \IPS\Request::i()->member ) )
|
||||
{
|
||||
$initialData = array( 'member' => \IPS\Request::i()->member );
|
||||
$url = $url->setQueryString( 'member', \IPS\Request::i()->member );
|
||||
}
|
||||
|
||||
/* Owner */
|
||||
if ( !isset( \IPS\Request::i()->member ) )
|
||||
{
|
||||
$steps['request_owner'] = function( $data )
|
||||
$steps['request_owner'] = function( $data ) use ( $url )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'owner', 'continue' );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'request_owner_type', 'member', TRUE, array(
|
||||
$form = new \IPS\Helpers\Form( 'owner', 'continue', $url->setQueryString( '_step', 'request_owner' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'request_owner_type', isset( $data['email'] ) ? 'email' : 'member', TRUE, array(
|
||||
'options' => array( 'member' => 'request_owner_member', 'email' => 'request_owner_email' ),
|
||||
'toggles' => array( 'member' => array( 'request_owner_member' ), 'email' => array( 'request_owner_email' ) )
|
||||
) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Member( 'request_owner_member', isset( \IPS\Request::i()->member ) ? \IPS\Member::load( \IPS\Request::i()->member ) : NULL, FALSE, array(), NULL, NULL, NULL, 'request_owner_member' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Email( 'request_owner_email', NULL, FALSE, array(), NULL, NULL, NULL, 'request_owner_email' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Member( 'request_owner_member', isset( $data['member'] ) ? \IPS\Member::load( $data['member'] ) : ( isset( \IPS\Request::i()->member ) ? \IPS\Member::load( \IPS\Request::i()->member ) : NULL ), FALSE, array(), NULL, NULL, NULL, 'request_owner_member' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Email( 'request_owner_email', isset( $data['email'] ) ? $data['email'] : NULL, FALSE, array(), NULL, NULL, NULL, 'request_owner_email' ) );
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
if ( $values['request_owner_type'] === 'member' )
|
||||
@@ -579,7 +587,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
$stockActions = \IPS\nexus\Support\StockAction::roots();
|
||||
if ( count( $stockActions ) )
|
||||
{
|
||||
$steps['stock_action'] = function( $data ) use ( $stockActions )
|
||||
$steps['stock_action'] = function( $data ) use ( $stockActions, $url )
|
||||
{
|
||||
$options = array( 0 => 'none' );
|
||||
foreach ( $stockActions as $action )
|
||||
@@ -587,8 +595,8 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
$options[ $action->id ] = $action->_title;
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'stock_action', 'continue' );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'stock_action', 0, FALSE, array(
|
||||
$form = new \IPS\Helpers\Form( 'stock_action', 'continue', $url->setQueryString( '_step', 'stock_action' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Radio( 'stock_action', isset( $data['stock_action'] ) ? $data['stock_action'] : 0, FALSE, array(
|
||||
'options' => $options
|
||||
) ) );
|
||||
if ( $values = $form->values() )
|
||||
@@ -602,7 +610,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Request Details */
|
||||
$steps['request_details'] = function( $data ) use ( $stockActions )
|
||||
$steps['request_details'] = function( $data ) use ( $stockActions, $url )
|
||||
{
|
||||
if ( !isset( $data['member'] ) AND isset( \IPS\Request::i()->member ) )
|
||||
{
|
||||
@@ -615,16 +623,16 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
$stockAction = $stockActions[ $data['stock_action'] ];
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'request_details', 'continue' );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'support_title', NULL, TRUE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'support_department', $stockAction ? $stockAction->department : NULL, TRUE, array( 'class' => 'IPS\nexus\Support\Department' ) ) );
|
||||
$form = new \IPS\Helpers\Form( 'request_details', 'continue', $url->setQueryString( '_step', 'request_details' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'support_title', isset( $data['title'] ) ? $data['title'] : NULL, TRUE ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'support_department', isset( $data['department'] ) ? $data['department'] : ( $stockAction ? $stockAction->department : NULL ), TRUE, array( 'class' => 'IPS\nexus\Support\Department' ) ) );
|
||||
if ( isset( $data['member'] ) )
|
||||
{
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'support_purchase', 0, FALSE, array( 'class' => 'IPS\nexus\Purchase', 'forceOwner' => \IPS\Member::load( $data['member'] ), 'zeroVal' => 'none' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'support_purchase', isset( $data['purchase'] ) ? $data['purchase'] : 0, FALSE, array( 'class' => 'IPS\nexus\Purchase', 'forceOwner' => \IPS\Member::load( $data['member'] ), 'zeroVal' => 'none' ) ) );
|
||||
}
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'r_status', $stockAction ? $stockAction->status : \IPS\nexus\Support\Status::load( TRUE, 'status_default_staff' ), TRUE, array( 'class' => 'IPS\nexus\Support\Status' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'support_severity', \IPS\nexus\Support\Severity::load( TRUE, 'sev_default' ), TRUE, array( 'class' => 'IPS\nexus\Support\Severity' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'r_staff', 0, FALSE, array( 'options' => array( 0 => 'unassigned' ) + \IPS\nexus\Support\Request::staff() ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'r_status', isset( $data['status'] ) ? $data['status'] : ( $stockAction ? $stockAction->status : \IPS\nexus\Support\Status::load( TRUE, 'status_default_staff' ) ), TRUE, array( 'class' => 'IPS\nexus\Support\Status' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Node( 'support_severity', isset( $data['severity'] ) ? $data['severity'] : \IPS\nexus\Support\Severity::load( TRUE, 'sev_default' ), TRUE, array( 'class' => 'IPS\nexus\Support\Severity' ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Select( 'r_staff', isset( $data['staff'] ) ? $data['staff'] : 0, FALSE, array( 'parse' => 'normal', 'options' => array( 0 => \IPS\Member::loggedIn()->language()->addToStack('unassigned') ) + \IPS\nexus\Support\Request::staff() ) ) );
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
$data['title'] = $values['support_title'];
|
||||
@@ -645,15 +653,15 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
$customFields = \IPS\nexus\Support\CustomField::roots();
|
||||
if ( count( $customFields ) )
|
||||
{
|
||||
$steps['custom_support_fields'] = function( $data )
|
||||
$steps['custom_support_fields'] = function( $data ) use ( $url )
|
||||
{
|
||||
$customFields = \IPS\nexus\Support\CustomField::roots( NULL, NULL, array( "sf_departments='*' OR " . \IPS\Db::i()->findInSet( 'sf_departments', array( $data['department'] ) ) ) );
|
||||
if ( count( $customFields ) )
|
||||
{
|
||||
$form = new \IPS\Helpers\Form( 'custom_fields', 'continue' );
|
||||
$form = new \IPS\Helpers\Form( 'custom_fields', 'continue', $url->setQueryString( '_step', 'custom_support_fields' ) );
|
||||
foreach ( $customFields as $field )
|
||||
{
|
||||
$form->add( $field->buildHelper() );
|
||||
$form->add( $field->buildHelper( isset( $data['custom_fields']["nexus_cfield_{$field->id}"] ) ? $data['custom_fields']["nexus_cfield_{$field->id}"] : NULL ) );
|
||||
}
|
||||
if ( $values = $form->values() )
|
||||
{
|
||||
@@ -670,7 +678,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
}
|
||||
|
||||
/* Your Message */
|
||||
$steps['your_message'] = function( $data ) use ( $stockActions )
|
||||
$steps['your_message'] = function( $data ) use ( $stockActions, $url )
|
||||
{
|
||||
$stockAction = NULL;
|
||||
if ( isset( $data['stock_action'] ) and isset( $stockActions[ $data['stock_action'] ] ) )
|
||||
@@ -701,7 +709,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
$defaultContent = NULL;
|
||||
}
|
||||
|
||||
$form = new \IPS\Helpers\Form( 'your_message' );
|
||||
$form = new \IPS\Helpers\Form( 'your_message', 'save', $url->setQueryString( '_step', 'your_message' ) );
|
||||
$form->add( new \IPS\Helpers\Form\YesNo( 'support_email_customer', TRUE, TRUE, array( 'togglesOn' => array( 'support_create_to', 'support_create_cc', 'support_create_bcc' ) ) ) );
|
||||
$form->add( new \IPS\Helpers\Form\Email( 'to', isset( $data['member'] ) ? \IPS\Member::load( $data['member'] )->email : $data['email'], NULL, array(), NULL, NULL, NULL, 'support_create_to' ) );
|
||||
$form->add( new \IPS\Helpers\Form\Text( 'cc', array(), FALSE, array( 'autocomplete' => array( 'unique' => TRUE, 'forceLower' => TRUE ) ), array( 'IPS\nexus\Support\Request', '_validateEmail' ), NULL, NULL, 'support_create_cc' ) );
|
||||
@@ -845,16 +853,7 @@ class _requests extends \IPS\Dispatcher\Controller
|
||||
|
||||
return $form;
|
||||
};
|
||||
|
||||
/* Set member */
|
||||
$url = \IPS\Http\Url::internal('app=nexus&module=support&controller=requests&do=create');
|
||||
$initialData = NULL;
|
||||
if ( isset( \IPS\Request::i()->member ) )
|
||||
{
|
||||
$initialData = array( 'member' => \IPS\Request::i()->member );
|
||||
$url = $url->setQueryString( 'member', \IPS\Request::i()->member );
|
||||
}
|
||||
|
||||
|
||||
/* Display */
|
||||
\IPS\Output::i()->title = \IPS\Member::loggedIn()->language()->addToStack('create_support_request');
|
||||
\IPS\Output::i()->output = new \IPS\Helpers\Wizard( $steps, $url, TRUE, $initialData );
|
||||
|
||||
Reference in new issue
Block a user