public function testMakeFormAndSetConfigurationFromForm()
 {
     $form = ZurmoSystemConfigurationFormAdapter::makeFormFromSystemConfiguration();
     $this->assertEquals(AutoresponderOrCampaignBatchSizeConfigUtil::CONFIG_DEFAULT_VALUE, $form->autoresponderOrCampaignBatchSize);
     $this->assertEquals(AutoresponderOrCampaignBatchSizeConfigUtil::getBatchSize(), $form->autoresponderOrCampaignBatchSize);
     $this->assertEquals(OutboundEmailBatchSizeConfigUtil::getBatchSize(), $form->outboundEmailBatchSize);
     $this->assertEquals(ZurmoSystemConfigurationUtil::getBatchSize(), $form->listPageSizeMaxLimit);
     //User is not root so he cant change batch size
     $form->autoresponderOrCampaignBatchSize = 20;
     $form->outboundEmailBatchSize = 30;
     $form->listPageSizeMaxLimit = 10;
     ZurmoSystemConfigurationFormAdapter::setConfigurationFromForm($form);
     $form = ZurmoSystemConfigurationFormAdapter::makeFormFromSystemConfiguration();
     $this->assertEquals(AutoresponderOrCampaignBatchSizeConfigUtil::CONFIG_DEFAULT_VALUE, $form->autoresponderOrCampaignBatchSize);
     $this->assertEquals(OutboundEmailBatchSizeConfigUtil::getBatchSize(), $form->outboundEmailBatchSize);
     $this->assertEquals(ZurmoSystemConfigurationUtil::getBatchSize(), $form->listPageSizeMaxLimit);
     //User is root so he can change batch size
     $super = User::getByUsername('super');
     $super->setIsRootUser();
     Yii::app()->user->userModel = $super;
     $form->autoresponderOrCampaignBatchSize = 20;
     $form->outboundEmailBatchSize = 30;
     $form->listPageSizeMaxLimit = 10;
     ZurmoSystemConfigurationFormAdapter::setConfigurationFromForm($form);
     $form = ZurmoSystemConfigurationFormAdapter::makeFormFromSystemConfiguration();
     $this->assertEquals(20, $form->autoresponderOrCampaignBatchSize);
     $this->assertEquals(30, $form->outboundEmailBatchSize);
     $this->assertEquals(10, $form->listPageSizeMaxLimit);
 }
 /**
  * Given a SystemConfigurationForm, save the system configuration global values.
  */
 public static function setConfigurationFromForm(ZurmoSystemConfigurationForm $form)
 {
     if (Yii::app()->user->userModel->isRootUser) {
         AutoresponderOrCampaignBatchSizeConfigUtil::setBatchSize((int) $form->autoresponderOrCampaignBatchSize);
         OutboundEmailBatchSizeConfigUtil::setBatchSize((int) $form->outboundEmailBatchSize);
         ZurmoSystemConfigurationUtil::setBatchSize((int) $form->listPageSizeMaxLimit);
     }
 }
 public function rules()
 {
     return array(array('applicationName', 'type', 'type' => 'string'), array('applicationName', 'length', 'max' => 64), array('timeZone', 'required'), array('listPageSize', 'required'), array('listPageSize', 'type', 'type' => 'integer'), array('listPageSize', 'numerical', 'min' => 1, 'max' => ZurmoSystemConfigurationUtil::getBatchSize()), array('subListPageSize', 'required'), array('subListPageSize', 'type', 'type' => 'integer'), array('subListPageSize', 'numerical', 'min' => 1, 'max' => ZurmoSystemConfigurationUtil::getBatchSize()), array('modalListPageSize', 'required'), array('modalListPageSize', 'type', 'type' => 'integer'), array('modalListPageSize', 'numerical', 'min' => 1, 'max' => ZurmoSystemConfigurationUtil::getBatchSize()), array('dashboardListPageSize', 'required'), array('dashboardListPageSize', 'type', 'type' => 'integer'), array('dashboardListPageSize', 'numerical', 'min' => 1, 'max' => ZurmoSystemConfigurationUtil::getBatchSize()), array('defaultFromEmailAddress', 'email'), array('defaultFromEmailAddress', 'required'), array('defaultTestToEmailAddress', 'email'), array('defaultTestToEmailAddress', 'required'), array('gamificationModalNotificationsEnabled', 'boolean'), array('gamificationModalCollectionsEnabled', 'boolean'), array('gamificationModalCoinsEnabled', 'boolean'), array('realtimeUpdatesEnabled', 'boolean'), array('subListPageSize', 'type', 'type' => 'integer'), array('reCaptchaPrivateKey', 'type', 'type' => 'string'), array('reCaptchaPublicKey', 'type', 'type' => 'string'));
 }
 public function rules()
 {
     return array(array('listPageSize', 'required'), array('listPageSize', 'type', 'type' => 'integer'), array('listPageSize', 'numerical', 'min' => 1, 'max' => ZurmoSystemConfigurationUtil::getBatchSize()), array('subListPageSize', 'required'), array('subListPageSize', 'type', 'type' => 'integer'), array('subListPageSize', 'numerical', 'min' => 1, 'max' => ZurmoSystemConfigurationUtil::getBatchSize()), array('dashboardListPageSize', 'required'), array('dashboardListPageSize', 'type', 'type' => 'integer'), array('dashboardListPageSize', 'numerical', 'min' => 1, 'max' => ZurmoSystemConfigurationUtil::getBatchSize()), array('themeColor', 'required'), array('themeColor', 'type', 'type' => 'string'), array('backgroundTexture', 'type', 'type' => 'string'), array('hideWelcomeView', 'boolean'), array('turnOffEmailNotifications', 'boolean'), array('enableDesktopNotifications', 'boolean'), array('hideFromSelecting', 'boolean'), array('hideFromLeaderboard', 'boolean'), array('defaultPermissionSetting', 'numerical', 'min' => self::DEFAULT_PERMISSIONS_SETTING_OWNER, 'max' => self::DEFAULT_PERMISSIONS_SETTING_EVERYONE), array('defaultPermissionGroupSetting', 'numerical', 'min' => 1), array('selectedVisibleAndOrderedTabMenuItems', 'type', 'type' => 'array'));
 }