remove Left join, add an current($data), getting orgform elsewhere || empty

This commit is contained in:
Manuela Thamer
2026-10-02 16:03:38 +02:00
parent 293bb77179
commit 511864da0c
@@ -1625,7 +1625,6 @@ class Status extends FHCAPI_Controller
$oldstatus = current($oldstatus);
$authUID = getAuthUID();
$now = date('c');
@@ -1663,7 +1662,6 @@ class Status extends FHCAPI_Controller
$this->getDataOrTerminateWithError($result);
//Send Message
$this->load->model('crm/Prestudent_model', 'PrestudentModel');
@@ -1671,18 +1669,21 @@ class Status extends FHCAPI_Controller
$this->PrestudentModel->addSelect('stg.oe_kurzbz');
$this->PrestudentModel->addSelect('stg.bezeichnung AS stg_bezeichnung');
$this->PrestudentModel->addSelect('stg.email AS stg_email');
$this->PrestudentModel->addSelect('plan.orgform_kurzbz');
// $this->PrestudentModel->addSelect('plan.orgform_kurzbz');
$this->PrestudentModel->addSelect('typ.bezeichnung AS typ_bezeichnung');
$this->PrestudentModel->addJoin('public.tbl_person p', 'person_id');
$this->PrestudentModel->addJoin('public.tbl_studiengang stg', 'studiengang_kz');
$this->PrestudentModel->addJoin('public.tbl_studiengangstyp typ', 'typ');
$this->PrestudentModel->addJoin('public.tbl_studienplan plan', 'studienplan_id', 'LEFT');
// $this->PrestudentModel->addJoin('public.tbl_studienplan plan', 'studienplan_id', 'LEFT');
$result = $this->PrestudentModel->load($prestudent_id);
$studentdata = $this->getDataOrTerminateWithError($result);
$studentdata = current($studentdata);
$orgform = $oldstatus->orgform_kurzbz || '';
//TODO(Manu) test mail and check if orgform_kurzbz is necessary
$this->load->library('MessageLib');
$result = $this->messagelib->sendMessageUserTemplate(
$studentdata->person_id, // receiversPersonId
@@ -1693,7 +1694,8 @@ class Status extends FHCAPI_Controller
'nachname' => $studentdata->nachname,
'typ' => $studentdata->typ_bezeichnung,
'studiengang' => $studentdata->stg_bezeichnung,
'orgform' => $studentdata->orgform_kurzbz ?: $oldstatus->orgform_kurzbz,
// 'orgform' => $studentdata->orgform_kurzbz ?: $oldstatus->orgform_kurzbz,
'orgform' => $orgform,
'stgMail' => $studentdata->stg_email
], // parseData
null, // orgform
@@ -1704,7 +1706,6 @@ class Status extends FHCAPI_Controller
true // multiPartMime
);
$this->terminateWithSuccess(true);
}