if (count($directive_value[$i]['Hour']) === 24) {
$hourly = 'hourly';
}
- $minute = sprintf('%02d', $directive_value[$i]['Minute']);
+ $minute = '00';
+ /**
+ * Check if Minute key exists because of bug about missing Minute
+ * @see http://bugs.bacula.org/view.php?id=2318
+ */
+ if (array_key_exists('Minute', $directive_value[$i])) {
+ $minute = sprintf('%02d', $directive_value[$i]['Minute']);
+ }
$day = count($directive_value[$i]['Day']) === 31 ? '' : 'on ' . implode(',', $directive_value[$i]['Day']);
$month = Params::getMonthsConfig($directive_value[$i]['Month']);
$week = Params::getWeeksConfig($directive_value[$i]['WeekOfMonth']);
'WdayRangeTo',
'TimeHourAt',
'TimeMinAt',
- 'TimeHourHourly',
'TimeMinHourly'
);
$minute = null;
if ($load_values) {
$hour = $directives->Hour[0]; // @TODO: Check for many hour values;
- $minute = $directives->Minute;
+ /**
+ * Check if Minute property exists because of bug about missing Minute
+ * @see http://bugs.bacula.org/view.php?id=2318
+ */
+ $minute = property_exists($directives, 'Minute') ? $directives->Minute : 0;
}
$this->directives['time'] = array(
'hour' => $hour,
'minute' => $minute
);
- $this->TimeAt->Checked = true;
+ if ($load_values) {
+ if (count($directives->Hour) == 24) {
+ $this->TimeHourly->Checked = true;
+ $this->TimeMinHourly->setDirectiveValue($minute);
+ } elseif (count($directives->Hour) == 1) {
+ $this->TimeAt->Checked = true;
+ $this->TimeHourAt->setDirectiveValue($hour);
+ $this->TimeMinAt->setDirectiveValue($minute);
+ } else {
+ $this->TimeDisable->Checked = true;
+ }
+ } else {
+ $this->TimeDisable->Checked = true;
+ }
}
public function getDirectiveValue() {
$minute = sprintf('%02d', $this->TimeMinAt->getDirectiveValue());
$directive_values[] = "at {$hour}:{$minute}";
} elseif ($this->TimeHourly->Checked === true) {
- $hour = $this->TimeHourHourly->getDirectiveValue();
+ $hour = '00';
$minute = sprintf('%02d', $this->TimeMinHourly->getDirectiveValue());
- $directive_values[] = "at {$hour}:{$minute}";
+ $directive_values[] = "hourly at {$hour}:{$minute}";
}
$directive_value = array('Run' => implode(' ', $directive_values));
<div id="day<%=$this->TimeAt->ClientID%>" class="day<%=$this->TimeAt->ClientID%>" style="display: <%=$this->TimeAt->Checked ? 'block' : 'none'%>">
<com:Application.Web.Portlets.DirectiveText
ID="TimeHourAt"
- DirectiveValue="<%=$this->directives['time']['hour']%>"
Label="<%[ Hour ]%>"
InConfig="true"
Show="true"
/>
<com:Application.Web.Portlets.DirectiveText
ID="TimeMinAt"
- DirectiveValue="<%=$this->directives['time']['minute']%>"
Label="<%[ Minute ]%>"
InConfig="true"
Show="true"
/>
</div>
<div id="day_range<%=$this->TimeAt->ClientID%>" class="day<%=$this->TimeAt->ClientID%>" style="display: <%=$this->TimeHourly->Checked ? 'block' : 'none'%>">
- <com:Application.Web.Portlets.DirectiveText
- ID="TimeHourHourly"
- DirectiveValue="0"
- Label="<%[ Hour ]%>"
- InConfig="true"
- Show="true"
- />
<com:Application.Web.Portlets.DirectiveText
ID="TimeMinHourly"
- DirectiveValue="<%=$this->directives['time']['minute']%>"
Label="<%[ Minute ]%>"
InConfig="true"
Show="true"