Commit 4614f4a1 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

:ambulance: fix(opsi): Disable OPSI log fetching on templates

It was triggerring errors and it makes no sense anyway

issue #5742
Showing with 21 additions and 15 deletions
+21 -15
...@@ -63,26 +63,29 @@ class opsiLogView extends simplePlugin ...@@ -63,26 +63,29 @@ class opsiLogView extends simplePlugin
if ($dn == '') { if ($dn == '') {
$dn = 'new'; $dn = 'new';
} }
parent::__construct($dn, $object, $parent, $mainTab);
/* Try to fetch logs for the given event (mac) */ parent::__construct($dn, $object, $parent, $mainTab);
$this->o_queue = new supportDaemon();
/* Get correct macAddress. Check if an event is given or a ldap object. */ if (!$this->is_template) {
if (isset($this->attrs['macAddress'][0])) { /* Try to fetch logs for the given event (mac) */
$this->mac = $this->attrs['macAddress'][0]; $this->o_queue = new supportDaemon();
}
if (isset($this->parent->by_object['opsiClient']) && $this->parent->by_object['opsiClient']->is_account && ($this->mac != '')) { /* Get correct macAddress. Check if an event is given or a ldap object. */
/* Query for log files */ if (isset($this->attrs['macAddress'][0])) {
$res = $this->o_queue->append_call('System.list_logs', $this->mac, array('args' => array())); $this->mac = $this->attrs['macAddress'][0];
if ($this->o_queue->is_error()) {
msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
} }
/* Check if there is at least one log file */ if (isset($this->parent->by_object['opsiClient']) && $this->parent->by_object['opsiClient']->is_account && ($this->mac != '')) {
if (is_array($res)) { /* Query for log files */
$this->attributesAccess['available_logs']->setChoices($res); $res = $this->o_queue->append_call('System.list_logs', $this->mac, array('args' => array()));
if ($this->o_queue->is_error()) {
msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
}
/* Check if there is at least one log file */
if (is_array($res)) {
$this->attributesAccess['available_logs']->setChoices($res);
}
} }
} }
...@@ -102,6 +105,9 @@ class opsiLogView extends simplePlugin ...@@ -102,6 +105,9 @@ class opsiLogView extends simplePlugin
function loadLog() function loadLog()
{ {
if ($this->is_template) {
return;
}
$res = $this->o_queue->append_call('System.get_log', $this->mac, array('args' => array($this->available_logs))); $res = $this->o_queue->append_call('System.get_log', $this->mac, array('args' => array($this->available_logs)));
if ($this->o_queue->is_error()) { if ($this->o_queue->is_error()) {
msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG); msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment