settings = array( 'publicationFee' => 'float', 'purchaseArticleFeeEnabled' => 'bool', 'purchaseArticleFee' => 'float', 'purchaseIssueFeeEnabled' => 'bool', 'purchaseIssueFee' => 'float', 'membershipFee' => 'float', 'restrictOnlyPdf' => 'bool', ); $this->addCheck(new FormValidatorCustom($this, 'publicationFee', 'optional', 'manager.payment.form.numeric', function($publicationFee) { return is_numeric($publicationFee) && $publicationFee >= 0; })); $this->addCheck(new FormValidatorCustom($this, 'purchaseArticleFee', 'optional', 'manager.payment.form.numeric', function($purchaseArticleFee) { return is_numeric($purchaseArticleFee) && $purchaseArticleFee >= 0; })); $this->addCheck(new FormValidatorCustom($this, 'purchaseIssueFee', 'optional', 'manager.payment.form.numeric', function($purchaseIssueFee) { return is_numeric($purchaseIssueFee) && $purchaseIssueFee >= 0; })); $this->addCheck(new FormValidatorCustom($this, 'membershipFee', 'optional', 'manager.payment.form.numeric', function($membershipFee) { return is_numeric($membershipFee) && $membershipFee >= 0; })); } /** * Initialize form data from current group group. */ function initData($journal) { foreach (array_keys($this->settings) as $settingName) { $this->setData($settingName, $journal->getSetting($settingName)); } } /** * Assign form data to user-submitted data. */ function readInputData() { $this->readUserVars(array_keys($this->settings)); } /** * Save settings * @param $request PKPRequest */ function execute($request) { $journal = $request->getJournal(); foreach (array_keys($this->settings) as $settingName) { $journal->updateSetting($settingName, $this->getData($settingName)); } } } ?>