$errors['maxFileSize'] = ts("Maximum file size cannot exceed Upload max size ('upload_max_filesize') as defined in PHP.ini.");
}
+ // validate recent items stack size
+ if ($fields['recentItemsMaxCount'] && ($fields['recentItemsMaxCount'] < 1 || $fields['recentItemsMaxCount'] > CRM_Utils_Recent::MAX_ITEMS)) {
+ $errors['recentItemsMaxCount'] = ts("Illegal stack size. Use values between 1 and %1.", array( 1 => CRM_Utils_Recent::MAX_ITEMS));
+ }
+
if (!empty($fields['wkhtmltopdfPath'])) {
// check and ensure that thi leads to the wkhtmltopdf binary
// and it is a valid executable binary
*
* @var string
*/
- const STORE_NAME = 'CRM_Utils_Recent';
+ const MAX_ITEMS = 30, STORE_NAME = 'CRM_Utils_Recent';
/**
* The list of recently viewed items.
* Maximum stack size
* @var int
*/
- static private $_maxItems = 20;
+ static private $_maxItems = 10;
/**
* Initialize this class and set the static variables.
*/
public static function initialize() {
$maxItemsSetting = Civi::settings()->get('recentItemsMaxCount');
- if (isset($maxItemsSetting) && $maxItemsSetting > 0 && $maxItemsSetting < 100) {
+ if (isset($maxItemsSetting) && $maxItemsSetting > 0 && $maxItemsSetting < self::MAX_ITEMS) {
self::$_maxItems = $maxItemsSetting;
}
if (!self::$_recent) {
'title' => 'Size of "Recent Items" stack',
'is_domain' => 1,
'is_contact' => 0,
- 'description' => 'How many items should CiviCRM store in it\'s "Recently viewed" list.',
'help_text' => NULL,
),
'recentItemsProviders' => array(