Merge branch 'ticket-13814-mailAlertUpdate' into develop

This commit is contained in:
Marion Muszynski 2017-08-22 11:44:08 +02:00
commit 4befac4029
2 changed files with 10 additions and 10 deletions

View File

@ -42,7 +42,7 @@ class AdminAntAlert extends AdminTab {
if ($res) {
$this->_html .= HelperFormBootstrap::displaySuccess($this->l('Alert deleted : #') . (int)Tools::getValue('id'));
} else {
$this->_html .= HelperFormBootstrap::displayError($this->l('Alert cannot be deleted : #') . (int)Tools::getValue('id'));
$this->_html .= HelperFormBootstrap::displayErrors($this->l('Alert cannot be deleted : #') . (int)Tools::getValue('id'));
}
return $res;
}
@ -54,12 +54,12 @@ class AdminAntAlert extends AdminTab {
$alert = new AntAlert((int)Tools::getValue('id_alert'));
} else {
$alert = new AntAlert();
$alert->date_last_send = date("Y-m-d H:i:s");
$alert->date_last_sent = date("Y-m-d H:i:s");
}
$alert->id_contact = Tools::getValue('id_contact');
$alert->limit = Tools::getValue('limit');
$alert->hours = Tools::getValue('hours');
$alert->id_contact = (int)Tools::getValue('id_contact');
$alert->limit = (int)Tools::getValue('limit');
$alert->hours = (int)Tools::getValue('hours');
$alert->enabled = (int)Tools::getValue('enabled');
if ($alert->save()) {
@ -69,7 +69,7 @@ class AdminAntAlert extends AdminTab {
$this->_html .= HelperFormBootstrap::displaySuccess($this->l('Alert has been created'));
}
} else {
$this->_html .= HelperFormBootstrap::displayError($this->l('Error occured while updating alert'));
$this->_html .= HelperFormBootstrap::displayErrors($this->l('Error occured while updating alert'));
}
}
@ -200,7 +200,7 @@ class AdminAntAlert extends AdminTab {
'label' => $contact['name'],
'value' => (int) $contact['id_contact']
);
if($alert!==NULL && $alert->id_contact==$contact['id_contact']) {
if(isset($alert) && $alert->id_contact==$contact['id_contact']) {
$id_contacts[(int)$contact['id_contact']]['selected'] = true;
}elseif(in_array($contact['id_contact'], $alreadyUsedContacts)){
$id_contacts[(int)$contact['id_contact']]['disabled'] = true;

View File

@ -10,7 +10,7 @@ class AntAlert extends ObjectModel
public $hours;
public $date_add;
public $date_upd;
public $date_last_send;
public $date_last_sent;
protected $fieldsRequired = array('id_contact','limit','hours');
protected $fieldsValidate = array(
@ -21,7 +21,7 @@ class AntAlert extends ObjectModel
'hours' => 'isInt',
'date_add' => 'isDate',
'date_upd' => 'isDate',
'date_last_send' => 'isDate',
'date_last_sent' => 'isDate',
);
protected $table = 'ant_alert';
@ -39,7 +39,7 @@ class AntAlert extends ObjectModel
$fields['hours'] = (int)$this->hours;
$fields['date_add'] = pSQL($this->date_add);
$fields['date_upd'] = pSQL($this->date_upd);
$fields['date_last_send'] = pSQL($this->date_last_send);
$fields['date_last_sent'] = pSQL($this->date_last_sent);
return $fields;
}