Cron, missed default setting to origin "cron" and some __String() to (string) replacements

This commit is contained in:
Ad Schellevis 2018-03-20 18:59:42 +01:00
parent 97156b5596
commit 71485968d2
2 changed files with 4 additions and 3 deletions

View File

@ -70,7 +70,7 @@ class SettingsController extends ApiMutableModelControllerBase
if ($node != null) {
$result = array("result" => "failed", "validations" => array());
$jobInfo = $this->request->getPost("job");
if ($node->origin->__toString() != "cron") {
if ((string)$node->origin != "cron") {
if ($jobInfo["command"] != (string)$node->command) {
$result["validations"]["job.command"] = gettext("This item has been created by " .
"another service, command and parameter may not be changed.");
@ -78,7 +78,7 @@ class SettingsController extends ApiMutableModelControllerBase
if ($jobInfo["parameters"] != (string)$node->parameters) {
$result["validations"]["job.parameters"] = sprintf(gettext("This item has been created by " .
"another service, command and parameter may not be changed. (was: %s)"),
(String)$node->parameters);
(string)$node->parameters);
}
}

View File

@ -1,12 +1,13 @@
<model>
<mount>//OPNsense/cron</mount>
<version>1.0.0</version>
<version>1.0.1</version>
<description>Cron settings</description>
<items>
<jobs>
<job type="ArrayField">
<origin type="TextField">
<Required>Y</Required>
<default>cron</default>
<mask>/^([a-z,A-Z,1-9]){0,30}$/</mask>
<ValidationMessage>Origin should be regular text of max 30 characters.</ValidationMessage>
</origin>