Merge branch 'rc1_FHC4_C4' into demo-cis40

This commit is contained in:
Andreas Österreicher
2025-08-05 09:31:18 +02:00
2 changed files with 22 additions and 17 deletions
@@ -152,7 +152,7 @@ class Documents extends FHCAPI_Controller
* @param string $xml * @param string $xml
* @param string $xsl * @param string $xsl
* @param string $sign_user (optional) * @param string $sign_user (optional)
* *
* @return array with Akte data and export data * @return array with Akte data and export data
*/ */
private function _getAkteExportData($xml, $xsl, $sign_user = null) private function _getAkteExportData($xml, $xsl, $sign_user = null)
@@ -235,7 +235,7 @@ class Documents extends FHCAPI_Controller
$student = current($this->getDataOrTerminateWithError($result)); $student = current($this->getDataOrTerminateWithError($result));
$ss = $this->input->post_get('ss'); $ss = $this->input->post_get('ss');
if ($ss !== null) { if ($ss !== null) {
$this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel'); $this->load->model('crm/prestudentstatus_model', 'PrestudentstatusModel');
$result = $this->PrestudentstatusModel->getLastStatus($student->prestudent_id, $ss); $result = $this->PrestudentstatusModel->getLastStatus($student->prestudent_id, $ss);
@@ -334,7 +334,7 @@ class Documents extends FHCAPI_Controller
$this->PrestudentModel->addJoin('public.tbl_studiengang', 'studiengang_kz', 'LEFT'); $this->PrestudentModel->addJoin('public.tbl_studiengang', 'studiengang_kz', 'LEFT');
$result = $this->PrestudentModel->load($prestudent_id); $result = $this->PrestudentModel->load($prestudent_id);
$prestudent = current($this->getDataOrTerminateWithError($result)); $prestudent = current($this->getDataOrTerminateWithError($result));
$studiengang_kz = $prestudent->studiengang_kz; $studiengang_kz = $prestudent->studiengang_kz;
$akteData['person_id'] = $prestudent->person_id; $akteData['person_id'] = $prestudent->person_id;
$akteData['titel'] = mb_substr($xsl . "_" . $prestudent->kuerzel, 0, 64); $akteData['titel'] = mb_substr($xsl . "_" . $prestudent->kuerzel, 0, 64);
@@ -380,7 +380,7 @@ class Documents extends FHCAPI_Controller
// TODO: was bedeutet wenn keine berechtigung? // TODO: was bedeutet wenn keine berechtigung?
if (!$access_rights || !$access_rights->berechtigung) if (!$access_rights || !$access_rights->berechtigung)
return show_404(); return show_404();
$allowed = false; $allowed = false;
foreach ($access_rights->berechtigung as $access_right) { foreach ($access_rights->berechtigung as $access_right) {
if ($this->permissionlib->isBerechtigt($access_right)) { if ($this->permissionlib->isBerechtigt($access_right)) {
@@ -454,11 +454,11 @@ class Documents extends FHCAPI_Controller
if (!$vorlage->archivierbar) if (!$vorlage->archivierbar)
$this->terminateWithError($this->p->t("stv", "grades_error_archive")); $this->terminateWithError($this->p->t("stv", "grades_error_archive"));
if ($sign_user && !$vorlage->signierbar) if ($sign_user && !$vorlage->signierbar)
$this->terminateWithError($this->p->t("stv", "grades_error_sign")); $this->terminateWithError($this->p->t("stv", "grades_error_sign"));
$this->load->library('DocumentExportLib'); $this->load->library('DocumentExportLib');
// XML Data // XML Data
+16 -11
View File
@@ -55,7 +55,7 @@ use SimpleXMLElement as SimpleXMLElement;
* $doc->create($outputformat); * $doc->create($outputformat);
* $doc->output(true); * $doc->output(true);
* $doc->close(); * $doc->close();
* *
* New: * New:
* $xml_data = $this->documentexportlib->getDataXML($data); * $xml_data = $this->documentexportlib->getDataXML($data);
* $images = [[ * $images = [[
@@ -397,20 +397,24 @@ class DocumentExportLib
$vorlage_stg = current(getData($result)); $vorlage_stg = current(getData($result));
foreach ($vorlage_stg as $k => $v) foreach ($vorlage_stg as $k => $v)
$vorlage->$k = $v; $vorlage->$k = $v;
if ($sign_user)
{
$this->addSignToData($xml_data);
}
$result = $this->create($temp_folder, $outputformat, $vorlage, $xml_data, $images); $result = $this->create($temp_folder, $outputformat, $vorlage, $xml_data, $images);
if (isError($result)) if (isError($result))
return $result; return $result;
$temp_filename = getData($result); $temp_filename = getData($result);
if ($sign_user) { if ($sign_user)
$this->addSignToData($xml_data); {
$result = $this->sign($temp_folder, $temp_filename, $outputformat, $sign_user, $sign_profile); $result = $this->sign($temp_folder, $temp_filename, $outputformat, $sign_user, $sign_profile);
if (isError($result)) if (isError($result))
return $result; return $result;
$temp_filename = getData($result); $temp_filename = getData($result);
} }
@@ -445,6 +449,7 @@ class DocumentExportLib
if ($xml_data->firstChild->tagName == 'error') if ($xml_data->firstChild->tagName == 'error')
return error($xml_data->firstChild->textContent); return error($xml_data->firstChild->textContent);
$styles_xsl = null;
// styles.xml erstellen // styles.xml erstellen
if ($vorlage->style) { if ($vorlage->style) {
$styles_xsl = new DOMDocument(); $styles_xsl = new DOMDocument();
@@ -461,7 +466,7 @@ class DocumentExportLib
// Template holen // Template holen
$vorlage_found = false; $vorlage_found = false;
$vorlage_filename = $vorlage->vorlage_kurzbz . ($vorlage->mimetype == 'application/vnd.oasis.opendocument.spreadsheet' ? '.ods' : '.odt'); $vorlage_filename = $vorlage->vorlage_kurzbz . ($vorlage->mimetype == 'application/vnd.oasis.opendocument.spreadsheet' ? '.ods' : '.odt');
$aktive_addons = array_filter(array_map('trim', explode(";", ACTIVE_ADDONS))); $aktive_addons = array_filter(array_map('trim', explode(";", ACTIVE_ADDONS)));
foreach($aktive_addons as $addon) { foreach($aktive_addons as $addon) {
$zipfile = DOC_ROOT . 'addons/' . $addon . '/system/vorlage_zip/' . $vorlage_filename; $zipfile = DOC_ROOT . 'addons/' . $addon . '/system/vorlage_zip/' . $vorlage_filename;
@@ -652,7 +657,7 @@ class DocumentExportLib
foreach ($files as $file) foreach ($files as $file)
if (is_file($file)) if (is_file($file))
unlink($file); unlink($file);
chdir($source_folder); chdir($source_folder);
rmdir($temp_folder); rmdir($temp_folder);
} }
@@ -703,12 +708,12 @@ class DocumentExportLib
{ {
if ($outputformat) if ($outputformat)
return $outputformat; return $outputformat;
if ($mimetype == 'application/vnd.oasis.opendocument.spreadsheet') if ($mimetype == 'application/vnd.oasis.opendocument.spreadsheet')
return 'ods'; return 'ods';
if ($mimetype == 'application/vnd.oasis.opendocument.text') if ($mimetype == 'application/vnd.oasis.opendocument.text')
return 'odt'; return 'odt';
return 'pdf'; return 'pdf';
} }
} }