Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

@@ -2,9 +2,10 @@
/**
* @brief Custom Package Field Node
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @subpackage Nexus
* @since 1 May 2013
* @version SVN_VERSION_NUMBER
*/
@@ -99,7 +100,7 @@ class _CustomField extends \IPS\CustomField
/**
* @brief [CustomField] Upload Field Storage Extension
*/
public static $uploadStorageExtension = 'nexus_PackageFields';
public static $uploadStorageExtension = 'nexus_PurchaseFields';
/**
* @brief [CustomField] Editor Options
@@ -125,23 +126,25 @@ class _CustomField extends \IPS\CustomField
}
catch ( \OutOfRangeException $e ) { }
}
$form->add( new \IPS\Helpers\Form\Node( 'cf_packages', $packages, TRUE, array( 'class' => 'IPS\nexus\Package\Group', 'noParentNodes' => 'custom_packages', 'multiple' => TRUE, 'permissionCheck' => function( $node )
$form->add( new \IPS\Helpers\Form\Node( 'cf_packages', $packages, FALSE, array( 'class' => 'IPS\nexus\Package\Group', 'noParentNodes' => 'custom_packages', 'multiple' => TRUE, 'permissionCheck' => function( $node )
{
return !( $node instanceof \IPS\nexus\Package\Group );
} ) ), 'pf_desc' );
$form->add( new \IPS\Helpers\Form\YesNo( 'cf_sticky', $this->sticky, FALSE ), 'pf_type' );
$form->addHeader( 'display_settings' );
$form->add( new \IPS\Helpers\Form\YesNo( 'cf_purchase', $this->purchase, FALSE, array( 'togglesOn' => array( 'cf_required' ) ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'cf_editable', $this->editable, FALSE, array( 'togglesOn' => array( 'cf_required' ) ) ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'cf_required', $this->required, FALSE, array(), NULL, NULL, NULL, 'cf_required' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'cf_purchase', $this->purchase, FALSE ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'cf_editable', $this->editable, FALSE ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'cf_required', $this->required ?: FALSE, FALSE, array(), NULL, NULL, NULL, 'pf_not_null' ) );
$form->add( new \IPS\Helpers\Form\YesNo( 'cf_invoice', $this->invoice ) );
unset( $form->elements[''][1] );
unset( $form->elements['']['pf_not_null'] );
unset( $form->elements['']['pf_max_input'] );
unset( $form->elements['']['pf_input_format'] );
unset( $form->elements[''][2] );
unset( $form->elements['']['pf_search_type'] );
unset( $form->elements['']['pf_search_type_on_off'] );
unset( $form->elements['']['pf_format'] );
}
@@ -153,12 +156,21 @@ class _CustomField extends \IPS\CustomField
*/
public function formatFormValues( $values )
{
if( isset( $values['cf_packages'] ) )
if( isset( $values['cf_packages'] ) AND is_array( $values['cf_packages'] ) )
{
$values['packages'] = implode( ',', array_map( function( $node ){ return $node->id; }, $values['cf_packages'] ) );
unset( $values['cf_packages'] );
}
/*
* Make sure that the multiple field is set to 0 for the Radio field, otherwise the package package_stock_adjustments will fail..
* it seems that people changed a select field often to a radio field, which caused that the field was missing in the stock adjustment
*/
if( isset( $values['pf_type'] ) and $values['pf_type'] == 'Radio' )
{
$values['pf_multiple'] = 0;
}
return parent::formatFormValues( $values );
}
@@ -190,7 +202,14 @@ class _CustomField extends \IPS\CustomField
{
if ( $this->type === 'UserPass' )
{
return \IPS\Theme::i()->getTemplate( 'forms', 'nexus', 'global' )->usernamePasswordDisplay( json_decode( \IPS\Text\Encrypt::fromTag( $value )->decrypt(), TRUE ) );
if ( is_array( $value ) )
{
return \IPS\Theme::i()->getTemplate( 'forms', 'nexus', 'global' )->usernamePasswordDisplay( $value );
}
else
{
return \IPS\Theme::i()->getTemplate( 'forms', 'nexus', 'global' )->usernamePasswordDisplay( json_decode( \IPS\Text\Encrypt::fromTag( $value )->decrypt(), TRUE ) );
}
}
return parent::displayValue( $value );