Use only active Statusgruende & "--keine Auswahl--"

This commit is contained in:
cgfhtw
2024-07-16 09:59:10 +02:00
parent 043d876642
commit 7031a4d9c4
3 changed files with 22 additions and 7 deletions
@@ -54,11 +54,11 @@ class Status extends FHCAPI_Controller
{
$this->load->model('crm/Statusgrund_model', 'StatusgrundModel');
$result = $this->StatusgrundModel->load();
if (isError($result)) {
$this->terminateWithError(getError($result), self::ERROR_TYPE_GENERAL);
}
return $this->terminateWithSuccess(getData($result) ?: []);
$result = $this->StatusgrundModel->getAktiveGruende();
$data = $this->getDataOrTerminateWithError($result);
$this->terminateWithSuccess($data);
}
public function getLastBismeldestichtag()
@@ -27,4 +27,19 @@ class Statusgrund_model extends DB_Model
return success($status->retval);
}
public function getAktiveGruende()
{
$lang = '[(SELECT index FROM public.tbl_sprache WHERE sprache=' . $this->escape(getUserLanguage()) . ' LIMIT 1)]';
$this->addSelect('tbl_status_grund.*');
$this->addSelect('bezeichnung_mehrsprachig' . $lang . ' AS bezeichnung');
$this->addSelect('beschreibung' . $lang . ' AS beschreibung');
$this->addOrder('bezeichnung_mehrsprachig' . $lang);
return $this->loadWhere([
'aktiv' => true
]);
}
}