- log eintrag hinzugefuegt, beim setzen auf park...

This commit is contained in:
ma0048
2023-03-16 13:57:17 +01:00
parent 22cd1e075a
commit c365896865
3 changed files with 53 additions and 32 deletions
@@ -22,6 +22,8 @@ class Rueckstellung extends Auth_Controller
$this->load->model('crm/Rueckstellung_model', 'RueckstellungModel');
$this->load->model('crm/RueckstellungStatus_model', 'RueckstellungStatusModel');
$this->load->model('person/Person_model', 'PersonModel');
$this->load->library('PersonLogLib');
$this->_setAuthUID(); // sets property uid
$this->_ci =& get_instance(); // get code igniter instance
@@ -43,11 +45,17 @@ class Rueckstellung extends Auth_Controller
$result = array(
'von' => $fullName,
'bezeichnung' => $rueckstellung->bezeichnung,
'bis' => $rueckstellung->datum_bis
'bis' => $rueckstellung->datum_bis,
'status_kurzbz' => $rueckstellung->status_kurzbz
);
if ($rueckstellung->status_kurzbz === 'parked' && $rueckstellung->datum_bis < date('Y-m-d'))
{
$this->_ci->RueckstellungModel->delete(array('person_id' => $person_id, 'status_kurzbz' => 'parked'));
$result = null;
}
}
$this->outputJsonSuccess($result);
}
@@ -57,8 +65,19 @@ class Rueckstellung extends Auth_Controller
$datum_bis = $this->input->post('datum_bis');
$status_kurzbz = $this->input->post('status_kurzbz');
$result = $this->_ci->RueckstellungModel->set($person_id, date_format(date_create($datum_bis), 'Y-m-d'), $status_kurzbz, $this->_uid);
$result = $this->_ci->RueckstellungModel->insert(
array('person_id' => $person_id,
'status_kurzbz' => $status_kurzbz,
'datum_bis' => date_format(date_create($datum_bis), 'Y-m-d'),
'insertvon' => $this->_uid
)
);
if (isError($result))
$this->terminateWithJsonError(getError($result));
$this->_log($person_id, $status_kurzbz);
$this->outputJson($result);
}
@@ -66,23 +85,13 @@ class Rueckstellung extends Auth_Controller
{
$person_id = $this->input->post('person_id');
$status = $this->input->post('status');
$rueckstellungd = $this->_ci->RueckstellungModel->getByPersonId($person_id, $status);
if (isError($rueckstellungd))
$this->terminateWithJsonError($this->p->t('ui', 'fehlerBeimLesen'));
if (hasData($rueckstellungd))
{
$rueckstellungd = getData($rueckstellungd)[0];
$result = $this->_ci->RueckstellungModel->delete($rueckstellungd->rueckstellung_id);
if (isError($result))
$this->terminateWithJsonError($this->_ci->p->t('ui', 'fehlerBeimSpeichern'));
$this->outputJson($result);
}
$result = $this->_ci->RueckstellungModel->delete(array('person_id' => $person_id, 'status_kurzbz' => $status));
if (isError($result))
$this->terminateWithJsonError($this->_ci->p->t('ui', 'fehlerBeimSpeichern'));
$this->outputJson($result);
}
public function getStatus($aktiv = true)
@@ -124,4 +133,23 @@ class Rueckstellung extends Auth_Controller
if (!$this->_uid) show_error('User authentification failed');
}
private function _log($person_id, $status_kurzbz)
{
$message = "Person $person_id set to $status_kurzbz";
$this->_ci->personloglib->log(
$person_id,
'Action',
array(
'name' => 'Person status set',
'message' => $message,
'success' => true
),
'bewerbung',
'infocenter',
null,
$this->_uid
);
}
}
@@ -30,14 +30,4 @@ class Rueckstellung_model extends DB_Model
return $this->loadWhere($where);
}
public function set($person_id, $datum_bis, $status_kurzbz, $uid)
{
$exists = $this->getByPersonId($person_id, $status_kurzbz);
if (hasData($exists))
return error("Rueckstellung entry already exists");
return $this->insert(array('person_id' => $person_id, 'status_kurzbz' => $status_kurzbz, 'datum_bis' => $datum_bis, 'insertvon' => $uid));
}
}
+4 -1
View File
@@ -73,7 +73,10 @@ var Rueckstellung = {
{
successCallback: function(data, textStatus, jqXHR) {
if (FHC_AjaxClient.hasData(data))
{
Rueckstellung.get(personid);
InfocenterDetails._refreshLog()
}
else
{
onRueckstellungError();
@@ -152,7 +155,7 @@ var Rueckstellung = {
var callbackforundo = function ()
{
Rueckstellung.delete(personid);
Rueckstellung.delete(personid, rueckstellungobj.status_kurzbz);
}
var rueckstellunghtml = rueckstellungdtext+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'+