From efcef48f89495172093bccee2a4940b967022f58 Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 9 May 2022 11:14:01 +0200 Subject: [PATCH 01/23] Changed Sanchomail 'From' to noreply --- application/helpers/hlp_sancho_helper.php | 2 +- include/sancho.inc.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/application/helpers/hlp_sancho_helper.php b/application/helpers/hlp_sancho_helper.php index d599e40bc..e57802432 100644 --- a/application/helpers/hlp_sancho_helper.php +++ b/application/helpers/hlp_sancho_helper.php @@ -49,7 +49,7 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm if ($from == '') { - $from = 'sancho@'.DOMAIN; + $from = 'noreply@'.DOMAIN; } // Embed sancho header and footer image diff --git a/include/sancho.inc.php b/include/sancho.inc.php index 5fc6fcdab..0d5c8e8a4 100644 --- a/include/sancho.inc.php +++ b/include/sancho.inc.php @@ -40,7 +40,7 @@ const DEFAULT_SANCHO_FOOTER_IMG = 'sancho_footer_DEFAULT.jpg'; */ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerImg = DEFAULT_SANCHO_HEADER_IMG, $footerImg = DEFAULT_SANCHO_FOOTER_IMG, $replyTo = '', $cc = '') { - $from = 'sancho@'. DOMAIN; + $from = 'noreply@'. DOMAIN; $sanchoHeader_img = dirname(__FILE__). '/../skin/images/sancho/'. $headerImg; $sanchoFooter_img = dirname(__FILE__). '/../skin/images/sancho/'. $footerImg; From c39174980cd78bb6e44a273696dc886c141ac14e Mon Sep 17 00:00:00 2001 From: Cris Date: Mon, 9 May 2022 15:34:22 +0200 Subject: [PATCH 02/23] Fixed function _getSTGLMailAddress to return same array structure Different structure was causing errors in handling. --- application/controllers/jobs/AnrechnungJob.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/application/controllers/jobs/AnrechnungJob.php b/application/controllers/jobs/AnrechnungJob.php index f32a8268a..4c341af50 100644 --- a/application/controllers/jobs/AnrechnungJob.php +++ b/application/controllers/jobs/AnrechnungJob.php @@ -358,8 +358,6 @@ html; 'vorname' => $stgl->vorname ); } - - return $stglMailAdress_arr; } // If not available, get assistance mail address else @@ -368,12 +366,13 @@ html; if (hasData($result)) { - return array( - $result->retval[0]->email, - '' + $stglMailAdress_arr[]= array( + 'to' => $result->retval[0]->email, + 'vorname' => '' ); } } + return $stglMailAdress_arr; } // Build HTML table with yesterdays new Anrechnungen of the given STG From 06179ee7148e6c4830c60be654221486d7987c94 Mon Sep 17 00:00:00 2001 From: Paolo Date: Thu, 23 Mar 2023 14:38:42 +0100 Subject: [PATCH 03/23] Code quality check fixes --- application/helpers/hlp_sancho_helper.php | 25 +++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/application/helpers/hlp_sancho_helper.php b/application/helpers/hlp_sancho_helper.php index e57802432..f101ce89d 100644 --- a/application/helpers/hlp_sancho_helper.php +++ b/application/helpers/hlp_sancho_helper.php @@ -38,7 +38,17 @@ const DEFAULT_SANCHO_FOOTER_IMG = 'sancho_footer_DEFAULT.jpg'; * @param string $bcc Sets BCC of mail. * @return void */ -function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerImg = DEFAULT_SANCHO_HEADER_IMG, $footerImg = DEFAULT_SANCHO_FOOTER_IMG, $from = null, $cc = null, $bcc = null) +function sendSanchoMail( + $vorlage_kurzbz, + $vorlage_data, + $to, + $subject, + $headerImg = DEFAULT_SANCHO_HEADER_IMG, + $footerImg = DEFAULT_SANCHO_FOOTER_IMG, + $from = null, + $cc = null, + $bcc = null +) { $ci =& get_instance(); $ci->load->library('email'); @@ -74,7 +84,18 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm $body = _parseMailContent('Sancho_Mail_Template', $layout); // Send mail - return $ci->maillib->send($from, $to, $subject, $body, $alias = '', $cc, $bcc, $altMessage = '', $bulk = true, $autogenerated = true); + return $ci->maillib->send( + $from, + $to, + $subject, + $body, + '', // alias + $cc, + $bcc, + '', // altMessage + true, // bulk + true // autogenerated + ); } /** From ce2d69fc82d3c44bbf9232ca384dfb5656efd7e2 Mon Sep 17 00:00:00 2001 From: Alexei Karpenko Date: Fri, 6 Dec 2024 13:05:35 +0100 Subject: [PATCH 04/23] Vertragsbestandteil Model: check if sap sync table present before executing select for sap organisationseinheit --- .../Vertragsbestandteil_model.php | 42 ++++++++++++++++--- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/application/models/vertragsbestandteil/Vertragsbestandteil_model.php b/application/models/vertragsbestandteil/Vertragsbestandteil_model.php index 6d8c18859..cbc529d83 100644 --- a/application/models/vertragsbestandteil/Vertragsbestandteil_model.php +++ b/application/models/vertragsbestandteil/Vertragsbestandteil_model.php @@ -19,12 +19,17 @@ class Vertragsbestandteil_model extends DB_Model protected function getVertragsbestandteilSQL() { + $sapInstalled = $this->_checkIfSAPSyncTableExists(); + + $oe_kurzbz_sap = $sapInstalled ? 'sap.oe_kurzbz_sap' : 'NULL AS oe_kurzbz_sap'; + $sap_join = $sapInstalled ? 'LEFT JOIN sync.tbl_sap_organisationsstruktur sap USING(oe_kurzbz)' : ''; + $sql = <<overlappingvbs; } + + /** + * Checks if sap sync table exists. + * @return bool + */ + private function _checkIfSAPSyncTableExists() + { + $params = array( + DB_NAME, + 'sync', + 'tbl_sap_organisationsstruktur' + ); + + $sql = "SELECT + 1 AS exists + FROM + information_schema.tables + WHERE + table_catalog = ? AND + table_schema = ? AND + table_name = ?"; + + $res = $this->execReadOnlyQuery($sql, $params); + + return hasData($res); + } } From 6b169d4183a77399fd63f8f13268df1b3844fe8b Mon Sep 17 00:00:00 2001 From: Alexei Karpenko Date: Sat, 11 Jan 2025 15:43:30 +0100 Subject: [PATCH 05/23] sancho mail: configuration of header/footer and sender is possible --- cis/private/mailtest.php | 24 +++++++ config/global.config-default.inc.php | 9 +++ include/sancho.inc.php | 95 ++++++++++++++++++++++------ 3 files changed, 110 insertions(+), 18 deletions(-) create mode 100644 cis/private/mailtest.php diff --git a/cis/private/mailtest.php b/cis/private/mailtest.php new file mode 100644 index 000000000..e2de76d3b --- /dev/null +++ b/cis/private/mailtest.php @@ -0,0 +1,24 @@ + diff --git a/include/sancho.inc.php b/include/sancho.inc.php index 0d5c8e8a4..c0271196f 100644 --- a/include/sancho.inc.php +++ b/include/sancho.inc.php @@ -18,12 +18,16 @@ * * Authors: Cristina Hainberger */ + +require_once(dirname(__FILE__).'/../config/global.config.inc.php'); require_once(dirname(__FILE__).'/basis_db.class.php'); require_once(dirname(__FILE__).'/mail.class.php'); require_once(dirname(__FILE__).'/vorlage.class.php'); -const DEFAULT_SANCHO_HEADER_IMG = 'sancho_header_DEFAULT.jpg'; -const DEFAULT_SANCHO_FOOTER_IMG = 'sancho_footer_DEFAULT.jpg'; +// TODO: keep this so that an image is used in any case? +//const DEFAULT_SANCHO_HEADER_IMG = 'sancho_header_DEFAULT.jpg'; +//const DEFAULT_SANCHO_FOOTER_IMG = 'sancho_footer_DEFAULT.jpg'; +const DEFAULT_SENDER = 'noreply'; /** * Send single Mail with Sancho Design and Layout. @@ -32,22 +36,75 @@ const DEFAULT_SANCHO_FOOTER_IMG = 'sancho_footer_DEFAULT.jpg'; * to be replaced in the content template. * @param string $to Email-adress. * @param string $subject Subject of mail. - * @param string $headerImg Filename of the specific Sancho header image. - * @param string $footerImg + * @param string $headerImg Filename of the specific Sancho header image, false if no header image + * @param string $footerImg - false if no footer image * @param string $replyTo default Email-adress for reply. * @param string | array $cc * @return boolean True, if succeeded. */ -function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerImg = DEFAULT_SANCHO_HEADER_IMG, $footerImg = DEFAULT_SANCHO_FOOTER_IMG, $replyTo = '', $cc = '') -{ - $from = 'noreply@'. DOMAIN; - $sanchoHeader_img = dirname(__FILE__). '/../skin/images/sancho/'. $headerImg; - $sanchoFooter_img = dirname(__FILE__). '/../skin/images/sancho/'. $footerImg; +function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerImg = '', $footerImg = '', $replyTo = '', $cc = '') +{ + $from = defined('CUSTOM_MAIl_SENDER') && CUSTOM_MAIl_SENDER != '' ? CUSTOM_MAIl_SENDER : DEFAULT_SENDER; + $from = $from.'@'. DOMAIN; + + $image_path_prefix = dirname(__FILE__). '/../skin/images/sancho/'; + + //$sanchoHeader_img = dirname(__FILE__). '/../skin/images/sancho/'. self::DEFAULT_SANCHO_HEADER_IMG; + // hide header by default + $sanchoHeader_img = false; + $header_visibility = 'display:none'; + + if ($headerImg !== false) + { + if (isset($headerImg) && $headerImg != '') + { + // use provided header image + $sanchoHeader_img = $headerImg; + } + elseif (defined('CUSTOM_MAIl_HEADER_IMG') && CUSTOM_MAIl_HEADER_IMG != '') + { + // use default header image + $sanchoHeader_img = CUSTOM_MAIl_HEADER_IMG; + } + + if ($sanchoHeader_img !== false) + { + // set full image path and visibility + $sanchoHeader_img = $image_path_prefix.$sanchoHeader_img; + $header_visibility = ''; + } + } + + //$sanchoFooter_img = dirname(__FILE__). '/../skin/images/sancho/'. self::DEFAULT_SANCHO_FOOTER_IMG; + // hide footer by default + $sanchoFooter_img = false; + $footer_visibility = 'display:none'; + + if ($footerImg !== false) + { + if (isset($footerImg) && $footerImg != '') + { + // use provided footer image + $sanchoFooter_img = $footerImg; + } + elseif (defined('CUSTOM_MAIl_FOOTER_IMG') && CUSTOM_MAIl_FOOTER_IMG != '') + { + // use default footer image + $sanchoFooter_img = CUSTOM_MAIl_FOOTER_IMG; + } + + if ($sanchoFooter_img !== false) + { + // set full image path and visibility + $sanchoFooter_img = $image_path_prefix.$sanchoFooter_img; + $footer_visibility = ''; + } + } // Set unique content id for embedding header and footer image $cid_header = uniqid(); $cid_footer = uniqid(); - + // Set specific mail content into specific content template $content = parseMailContent($vorlage_kurzbz, $vorlage_data); @@ -55,7 +112,9 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm $layout = array( 'CID_header' => $cid_header, 'CID_footer' => $cid_footer, - 'content' => $content + 'content' => $content, + 'header_visibility' => $header_visibility, + 'footer_visibility' => $footer_visibility ); // Set the data array into overall sancho mail template @@ -63,22 +122,22 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm // Send mail $mail = new Mail($to, $from, $subject, $body); - - // * embed the images - $mail->addEmbeddedImage($sanchoHeader_img, 'image/jpg', '', $cid_header); - $mail->addEmbeddedImage($sanchoFooter_img, 'image/jpg', '', $cid_footer); + + // * embed the images if needed + if ($sanchoHeader_img !== false) $mail->addEmbeddedImage($sanchoHeader_img, 'image/jpg', '', $cid_header); + if ($sanchoFooter_img !== false) $mail->addEmbeddedImage($sanchoFooter_img, 'image/jpg', '', $cid_footer); // * Set reply-to if (isset($replyTo) && $replyTo != '') $mail->setReplyTo($replyTo); - + // * Set cc if (isset($cc) && $cc != '') $mail->setCCRecievers($cc); // * embed the html content $mail->setHTMLContent($body); - + return $mail->send(); } @@ -95,7 +154,7 @@ function parseMailContent($vorlage_kurzbz, $vorlage_data) { $vorlage = new Vorlage(); $vorlage->getAktuelleVorlage('etw', $vorlage_kurzbz); - + // If the text and the subject of the template are not empty if (!empty($vorlage->text)) { From 6c858141fdfb980c2a86558d36f795dca1d6f141 Mon Sep 17 00:00:00 2001 From: Alexei Karpenko Date: Mon, 13 Jan 2025 16:22:45 +0100 Subject: [PATCH 06/23] deleted mailtest file --- cis/private/mailtest.php | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 cis/private/mailtest.php diff --git a/cis/private/mailtest.php b/cis/private/mailtest.php deleted file mode 100644 index e2de76d3b..000000000 --- a/cis/private/mailtest.php +++ /dev/null @@ -1,24 +0,0 @@ - Date: Tue, 14 Jan 2025 11:00:26 +0100 Subject: [PATCH 07/23] - umbenennung auf internatinal credits --- system/phrasesupdate.php | 68 ++++++++++++++++++++++++++-------------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 201c231a6..746c24da3 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -18268,6 +18268,26 @@ array( ) ) ), + array( + 'app' => 'international', + 'category' => 'international', + 'phrase' => 'internationalCredits', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'International Credits', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'International Credits', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), array( 'app' => 'international', 'category' => 'international', @@ -18397,11 +18417,11 @@ array( array( 'sprache' => 'German', 'text' => 'Ab dem Studienjahr 2022/23 ist der Erwerb von internationalen und interkulturellen Kompetenzen Teil des Curriculums.
- Auf der Grundlage der vorliegenden Maßnahmen absolvieren Sie im Laufe ihres Studiums Internationalisierungsaktivitäten, die mit unterschiedlichen ECTS-Punkten hinterlegt sind.
- In Summe müssen 5 ECTS erworben werden, die im 6. Semester wirksam werden.
+ Auf der Grundlage der vorliegenden Maßnahmen absolvieren Sie im Laufe ihres Studiums Internationalisierungsaktivitäten, die mit unterschiedlichen International Credits hinterlegt sind.
+ In Summe müssen 5 International Credits erworben werden, die im 6. Semester wirksam werden.
Das Modul „International skills“ wird mit der Beurteilung „Mit Erfolg teilgenommen“ abgeschlossen.
Bitte wählen Sie die für Sie in Frage kommenden Maßnahmen aus und planen Sie das entsprechende Semester.
- Sobald die 5 ECTS erreicht wurden, überprüft der Studiengang die von Ihnen hochgeladenen Dokumente.

+ Sobald die 5 International Credits erreicht wurden, überprüft der Studiengang die von Ihnen hochgeladenen Dokumente.

Fragen zum Status Ihrer Maßnahme u.ä. richten Sie bitte an den Studiengang.
Bei allen weiteren Fragen zum Thema Organisation und Finanzierung des Auslandsaufenthalts und/oder Sprachkurs gibt Ihnen das International Office der FH Technikum Wien unter international.office@technikum-wien.at gerne Auskunft.', 'description' => '', @@ -18410,11 +18430,11 @@ array( array( 'sprache' => 'English', 'text' => 'Starting with the study year 2022/23, the acquisition of international and intercultural competencies is part of the curriculum.
- On the basis of the measures at-hand, you will complete internationalization activities during the course of your studies, which are assigned different ECTS credits.
- In total, 5 ECTS must be acquired, which become effective in the 6th semester.
+ On the basis of the measures at-hand, you will complete internationalization activities during the course of your studies, which are assigned different International Credits.
+ In total, 5 International Credits must be acquired, which become effective in the 6th semester.
The module “International skills” is completed with the assessment "Successfully participated".
Please select the measures that apply to you and schedule the appropriate semester.
- Once the 5 ECTS have been achieved, the degree program will review the documents you have uploaded.

+ Once the 5 International Credits have been achieved, the degree program will review the documents you have uploaded.

Please direct questions regarding the status of your measure and the like should be directed to the study program.
For all further questions regarding the organization and financing of your stay abroad and/or language course, please contact the International Office of the UAS Technikum Wien at international.office@technikum-wien.at. ', @@ -18771,13 +18791,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => 'ECTS bestätigt', + 'text' => 'International Credits bestätigt', 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => 'ECTS confirmed', + 'text' => 'International Credits confirmed', 'description' => '', 'insertvon' => 'system' ) @@ -18791,13 +18811,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => 'ECTS - Maßnahme', + 'text' => 'International Credits - Maßnahme', 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => 'ECTS - Measures', + 'text' => 'International Credits - Measures', 'description' => '', 'insertvon' => 'system' ) @@ -19071,13 +19091,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => 'Nur bestätigte Maßnahmen vorhanden, aber weniger als 5 ECTs.', + 'text' => 'Nur bestätigte Maßnahmen vorhanden, aber weniger als 5 International Credits.', 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => 'Only confirmed measures, but fewer than 5 ECTs.', + 'text' => 'Only confirmed measures, but fewer than 5 International Credits.', 'description' => '', 'insertvon' => 'system' ) @@ -19091,13 +19111,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => 'Es wurden 5 ECTs erreicht.', + 'text' => 'Es wurden 5 International Credits erreicht.', 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => '5 ECTs points have been achieved.', + 'text' => '5 International Credits have been achieved.', 'description' => '', 'insertvon' => 'system' ) @@ -19251,13 +19271,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => 'ECTS - bestätigt', + 'text' => 'International Credits - bestätigt', 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => 'ECTS - confirmed', + 'text' => 'International Credits - confirmed', 'description' => '', 'insertvon' => 'system' ) @@ -19391,13 +19411,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => '>=5 ECTS verplant', + 'text' => '>=5 International Credits verplant', 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => '>=5 ECTS planned', + 'text' => '>=5 international credits planned', 'description' => '', 'insertvon' => 'system' ) @@ -19411,13 +19431,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => '<5 ECTS verplant', + 'text' => '<5 International Credits verplant', 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => '<5 ECTS planned', + 'text' => '<5 International Credits planned', 'description' => '', 'insertvon' => 'system' ) @@ -19431,13 +19451,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => '>=5 ECTS bestätigt', + 'text' => '>=5 International Credits bestätigt', 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => '>=5 ECTS confirmed', + 'text' => '>=5 International Credits confirmed', 'description' => '', 'insertvon' => 'system' ) @@ -19451,13 +19471,13 @@ array( 'phrases' => array( array( 'sprache' => 'German', - 'text' => '<5 ECTS bestätigt', + 'text' => '<5 International Credits bestätigt', 'description' => '', 'insertvon' => 'system' ), array( 'sprache' => 'English', - 'text' => '<5 ECTS confirmed', + 'text' => '<5 International Credits confirmed', 'description' => '', 'insertvon' => 'system' ) From 13d86edcfc4b4c5a37f99d99e1c654038cc29bf2 Mon Sep 17 00:00:00 2001 From: Alexei Karpenko Date: Tue, 14 Jan 2025 17:24:40 +0100 Subject: [PATCH 08/23] sancho mails: added CUSTOM_MAIL_USE_IMAGES config for sending mails without header/footer, removed option to hide mail html --- config/global.config-default.inc.php | 12 +++--- include/sancho.inc.php | 56 ++++++++++------------------ 2 files changed, 25 insertions(+), 43 deletions(-) diff --git a/config/global.config-default.inc.php b/config/global.config-default.inc.php index d62df361d..82efcb11e 100644 --- a/config/global.config-default.inc.php +++ b/config/global.config-default.inc.php @@ -314,12 +314,12 @@ define ('ZAHLUNGSBESTAETIGUNG_ANZEIGEN_FUER_LEHRGAENGE', true); // Gibt an, ob im CIS die Zahlungsreferenz angezeigt wird define ('ZAHLUNGSBESTAETIGUNG_ZAHLUNGSREFERENZ_ANZEIGEN', false); -// sender for custom mails -define('CUSTOM_MAIl_SENDER', 'noreply'); +// header und footer Bilder für eigene Mails verwenden +define('CUSTOM_MAIL_USE_IMAGES', true); -// header image for custom mails -define('CUSTOM_MAIl_HEADER_IMG', 'sancho_header_DEFAULT.jpg'); +// header Bild für eigene Mails +define('CUSTOM_MAIL_HEADER_IMG', 'sancho_header_DEFAULT.jpg'); -// footer image for custom mails -define('CUSTOM_MAIl_FOOTER_IMG', 'sancho_footer_DEFAULT.jpg'); +// footer image for eigene Mails +define('CUSTOM_MAIL_FOOTER_IMG', 'sancho_footer_DEFAULT.jpg'); ?> diff --git a/include/sancho.inc.php b/include/sancho.inc.php index c0271196f..120315eac 100644 --- a/include/sancho.inc.php +++ b/include/sancho.inc.php @@ -24,9 +24,6 @@ require_once(dirname(__FILE__).'/basis_db.class.php'); require_once(dirname(__FILE__).'/mail.class.php'); require_once(dirname(__FILE__).'/vorlage.class.php'); -// TODO: keep this so that an image is used in any case? -//const DEFAULT_SANCHO_HEADER_IMG = 'sancho_header_DEFAULT.jpg'; -//const DEFAULT_SANCHO_FOOTER_IMG = 'sancho_footer_DEFAULT.jpg'; const DEFAULT_SENDER = 'noreply'; /** @@ -44,60 +41,47 @@ const DEFAULT_SENDER = 'noreply'; */ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerImg = '', $footerImg = '', $replyTo = '', $cc = '') { - $from = defined('CUSTOM_MAIl_SENDER') && CUSTOM_MAIl_SENDER != '' ? CUSTOM_MAIl_SENDER : DEFAULT_SENDER; - $from = $from.'@'. DOMAIN; + $from = DEFAULT_SENDER.'@'. DOMAIN; - $image_path_prefix = dirname(__FILE__). '/../skin/images/sancho/'; + $header_image_path_prefix = dirname(__FILE__). '/../skin/images/sancho/'; + $footer_image_path_prefix = dirname(__FILE__). '/../skin/images/sancho/'; + $sanchoHeader_img = ''; + $sanchoFooter_img = ''; - //$sanchoHeader_img = dirname(__FILE__). '/../skin/images/sancho/'. self::DEFAULT_SANCHO_HEADER_IMG; - // hide header by default - $sanchoHeader_img = false; - $header_visibility = 'display:none'; - - if ($headerImg !== false) + if (!defined('CUSTOM_MAIL_USE_IMAGES') || CUSTOM_MAIL_USE_IMAGES) { if (isset($headerImg) && $headerImg != '') { // use provided header image $sanchoHeader_img = $headerImg; } - elseif (defined('CUSTOM_MAIl_HEADER_IMG') && CUSTOM_MAIl_HEADER_IMG != '') + elseif (defined('CUSTOM_MAIL_HEADER_IMG') && CUSTOM_MAIL_HEADER_IMG != '') { // use default header image - $sanchoHeader_img = CUSTOM_MAIl_HEADER_IMG; + $sanchoHeader_img = CUSTOM_MAIL_HEADER_IMG; } - if ($sanchoHeader_img !== false) + if ($sanchoHeader_img != '') { - // set full image path and visibility - $sanchoHeader_img = $image_path_prefix.$sanchoHeader_img; - $header_visibility = ''; + // set full image path + $sanchoHeader_img = $header_image_path_prefix.$sanchoHeader_img; } - } - //$sanchoFooter_img = dirname(__FILE__). '/../skin/images/sancho/'. self::DEFAULT_SANCHO_FOOTER_IMG; - // hide footer by default - $sanchoFooter_img = false; - $footer_visibility = 'display:none'; - - if ($footerImg !== false) - { if (isset($footerImg) && $footerImg != '') { // use provided footer image $sanchoFooter_img = $footerImg; } - elseif (defined('CUSTOM_MAIl_FOOTER_IMG') && CUSTOM_MAIl_FOOTER_IMG != '') + elseif (defined('CUSTOM_MAIL_FOOTER_IMG') && CUSTOM_MAIL_FOOTER_IMG != '') { // use default footer image - $sanchoFooter_img = CUSTOM_MAIl_FOOTER_IMG; + $sanchoFooter_img = CUSTOM_MAIL_FOOTER_IMG; } - if ($sanchoFooter_img !== false) + if ($sanchoFooter_img !== '') { - // set full image path and visibility - $sanchoFooter_img = $image_path_prefix.$sanchoFooter_img; - $footer_visibility = ''; + // set full image path + $sanchoFooter_img = $footer_image_path_prefix.$sanchoFooter_img; } } @@ -112,9 +96,7 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm $layout = array( 'CID_header' => $cid_header, 'CID_footer' => $cid_footer, - 'content' => $content, - 'header_visibility' => $header_visibility, - 'footer_visibility' => $footer_visibility + 'content' => $content ); // Set the data array into overall sancho mail template @@ -124,8 +106,8 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm $mail = new Mail($to, $from, $subject, $body); // * embed the images if needed - if ($sanchoHeader_img !== false) $mail->addEmbeddedImage($sanchoHeader_img, 'image/jpg', '', $cid_header); - if ($sanchoFooter_img !== false) $mail->addEmbeddedImage($sanchoFooter_img, 'image/jpg', '', $cid_footer); + if ($sanchoHeader_img != '') $mail->addEmbeddedImage($sanchoHeader_img, 'image/jpg', '', $cid_header); + if ($sanchoFooter_img != '') $mail->addEmbeddedImage($sanchoFooter_img, 'image/jpg', '', $cid_footer); // * Set reply-to if (isset($replyTo) && $replyTo != '') From a1a9e96bc0db04db1b3328953af9a32ea19cc9e4 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Wed, 15 Jan 2025 13:34:16 +0100 Subject: [PATCH 09/23] permission basis/gehaelter --- system/dbupdate_3.4.php | 2 +- system/dbupdate_3.4/41950_perm_gehaelter.php | 41 ++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 system/dbupdate_3.4/41950_perm_gehaelter.php diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index 0af314c46..171fdafed 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -67,7 +67,7 @@ require_once('dbupdate_3.4/25999_C4_permission.php'); require_once('dbupdate_3.4/33683_digitale_anwesenheitsliste_und_entschuldigungsmanagement_fuer_studierende_prototyp.php'); require_once('dbupdate_3.4/40717_lv_faktor.php'); require_once('dbupdate_3.4/48526_pep_tagging.php'); - +require_once('dbupdate_3.4/41950_perm_gehaelter.php); // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; diff --git a/system/dbupdate_3.4/41950_perm_gehaelter.php b/system/dbupdate_3.4/41950_perm_gehaelter.php new file mode 100644 index 000000000..cad736916 --- /dev/null +++ b/system/dbupdate_3.4/41950_perm_gehaelter.php @@ -0,0 +1,41 @@ +, + * + * Beschreibung: + * Permissions f. Gehaelter + */ +if (! defined('DB_NAME')) exit('No direct script access allowed'); + +// Add permission: basis/gehaelter +if($result = @$db->db_query("SELECT 1 FROM system.tbl_berechtigung WHERE berechtigung_kurzbz = 'basis/gehaelter';")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "INSERT INTO system.tbl_berechtigung(berechtigung_kurzbz, beschreibung) VALUES('basis/gehaelter', 'Zugriff auf Gehaelter');"; + + if(!$db->db_query($qry)) + { + echo 'system.tbl_berechtigung '.$db->db_last_error().'
'; + } + else + { + echo 'system.tbl_berechtigung: Added permission "basis/gehaelter"
'; + } + } +} From fd67974d55068ca9e5fffdd1ad7bfe8196932d96 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Wed, 15 Jan 2025 13:35:58 +0100 Subject: [PATCH 10/23] fix typo --- system/dbupdate_3.4.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index 171fdafed..57eee605c 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -67,7 +67,7 @@ require_once('dbupdate_3.4/25999_C4_permission.php'); require_once('dbupdate_3.4/33683_digitale_anwesenheitsliste_und_entschuldigungsmanagement_fuer_studierende_prototyp.php'); require_once('dbupdate_3.4/40717_lv_faktor.php'); require_once('dbupdate_3.4/48526_pep_tagging.php'); -require_once('dbupdate_3.4/41950_perm_gehaelter.php); +require_once('dbupdate_3.4/41950_perm_gehaelter.php'); // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; From f1234c0b99865e580c6fe5b79e7f65045c4dce28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szabo=20M=C3=B3nika?= Date: Wed, 15 Jan 2025 14:37:06 +0100 Subject: [PATCH 11/23] Update studentenexportextended.xls.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Zusätzliche Spalte Person_id hinzufügen --- content/statistik/studentenexportextended.xls.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/content/statistik/studentenexportextended.xls.php b/content/statistik/studentenexportextended.xls.php index 81e51b53a..89acbe18f 100644 --- a/content/statistik/studentenexportextended.xls.php +++ b/content/statistik/studentenexportextended.xls.php @@ -127,6 +127,8 @@ $worksheet->write($zeile, ++$i, "STAATSBÜRGERSCHAFT", $format_bold); $maxlength[$i] = 16; $worksheet->write($zeile, ++$i, "SVNR", $format_bold); $maxlength[$i] = 4; +$worksheet->write($zeile, ++$i, "PERSON_ID", $format_bold); +$maxlength[$i] = 6; $worksheet->write($zeile, ++$i, "ERSATZKENNZEICHEN", $format_bold); $maxlength[$i] = 17; $worksheet->write($zeile, ++$i, "GESCHLECHT", $format_bold); @@ -399,6 +401,12 @@ function draw_content($row) $maxlength[$i] = mb_strlen($row->svnr); $worksheet->write($zeile, $i, $row->svnr); $i++; + + //Person_id + if (mb_strlen($row->person_id) > $maxlength[$i]) + $maxlength[$i] = mb_strlen($row->person_id); + $worksheet->write($zeile, $i, $row->person_id); + $i++; //Ersatzkennzeichen if (mb_strlen($row->ersatzkennzeichen) > $maxlength[$i]) From ece4f4a8b520261b5a7647838c5574e6dbcfaac5 Mon Sep 17 00:00:00 2001 From: Alexei Karpenko Date: Wed, 15 Jan 2025 16:52:11 +0100 Subject: [PATCH 12/23] sancho mails: enabled removing of header/footer and custom header/footer images in code igniter code, legacy code: global ids for images are created only if config is set --- application/config/mail.php | 9 ++++ application/helpers/hlp_sancho_helper.php | 51 ++++++++++++++++++----- include/sancho.inc.php | 10 +++-- 3 files changed, 55 insertions(+), 15 deletions(-) diff --git a/application/config/mail.php b/application/config/mail.php index 9d577720d..c89400ed1 100644 --- a/application/config/mail.php +++ b/application/config/mail.php @@ -32,3 +32,12 @@ $config['validate'] = false; // If true then the email address will be validated // If enabled will be logged info about emails in Codeigniter error logs $config['enable_debug'] = false; + +// If to use images for custom mails +$config['custom_mail_use_images'] = CUSTOM_MAIL_USE_IMAGES; + +// header image for custom mails +$config['custom_mail_header_img'] = CUSTOM_MAIL_HEADER_IMG; + +// footer image for custom mails +$config['custom_mail_footer_img'] = CUSTOM_MAIL_FOOTER_IMG; diff --git a/application/helpers/hlp_sancho_helper.php b/application/helpers/hlp_sancho_helper.php index f101ce89d..d11b6522e 100644 --- a/application/helpers/hlp_sancho_helper.php +++ b/application/helpers/hlp_sancho_helper.php @@ -23,9 +23,6 @@ if (! defined('BASEPATH')) exit('No direct script access allowed'); // Functions needed in the view FHC-Header // ------------------------------------------------------------------------ -const DEFAULT_SANCHO_HEADER_IMG = 'sancho_header_DEFAULT.jpg'; -const DEFAULT_SANCHO_FOOTER_IMG = 'sancho_footer_DEFAULT.jpg'; - /** * Send single Mail with Sancho Design and Layout. * @param string $vorlage_kurzbz Name of the template for specific mail content. @@ -43,8 +40,8 @@ function sendSanchoMail( $vorlage_data, $to, $subject, - $headerImg = DEFAULT_SANCHO_HEADER_IMG, - $footerImg = DEFAULT_SANCHO_FOOTER_IMG, + $headerImg = '', + $footerImg = '', $from = null, $cc = null, $bcc = null @@ -54,8 +51,8 @@ function sendSanchoMail( $ci->load->library('email'); $ci->load->library('MailLib'); - $sanchoHeader_img = 'skin/images/sancho/'. $headerImg; - $sanchoFooter_img = 'skin/images/sancho/'. $footerImg; + $custom_mail_use_images = $ci->config->item('mail'); + if ($from == '') { @@ -65,10 +62,42 @@ function sendSanchoMail( // Embed sancho header and footer image // reset important to ensure embedding of images when called in a loop $ci->email->clear(true); // clear vars and attachments - $ci->email->attach($sanchoHeader_img); - $ci->email->attach($sanchoFooter_img); - $cid_header = $ci->email->attachment_cid($sanchoHeader_img); // sets unique content id for embedding - $cid_footer = $ci->email->attachment_cid($sanchoFooter_img); // sets unique content id for embedding + + $cid_header = ''; + $cid_footer = ''; + + if (isset($custom_mail_use_images['custom_mail_use_images']) && $custom_mail_use_images['custom_mail_use_images']) + { + $sanchoHeader_img = ''; + $sanchoFooter_img = ''; + + if (isset($headerImg) && $headerImg != '') + { + // use provided header image + $sanchoHeader_img = $headerImg; + } + elseif (isset($custom_mail_use_images['custom_mail_header_img']) && $custom_mail_use_images['custom_mail_header_img']) + { + // use default header image + $sanchoHeader_img = 'skin/images/sancho/'. $custom_mail_use_images['custom_mail_header_img']; + } + + if (isset($footerImg) && $footerImg != '') + { + // use provided footer image + $sanchoFooter_img = $footerImg; + } + elseif (isset($custom_mail_use_images['custom_mail_footer_img']) && $custom_mail_use_images['custom_mail_footer_img']) + { + // use default footer image + $sanchoFooter_img = 'skin/images/sancho/'. $custom_mail_use_images['custom_mail_footer_img']; + } + + $ci->email->attach($sanchoHeader_img); + $ci->email->attach($sanchoFooter_img); + $cid_header = $ci->email->attachment_cid($sanchoHeader_img); // sets unique content id for embedding + $cid_footer = $ci->email->attachment_cid($sanchoFooter_img); // sets unique content id for embedding + } // Set specific mail content into specific content template $content = _parseMailContent($vorlage_kurzbz, $vorlage_data); diff --git a/include/sancho.inc.php b/include/sancho.inc.php index 120315eac..4fdf467e0 100644 --- a/include/sancho.inc.php +++ b/include/sancho.inc.php @@ -47,6 +47,8 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm $footer_image_path_prefix = dirname(__FILE__). '/../skin/images/sancho/'; $sanchoHeader_img = ''; $sanchoFooter_img = ''; + $cid_header = ''; + $cid_footer = ''; if (!defined('CUSTOM_MAIL_USE_IMAGES') || CUSTOM_MAIL_USE_IMAGES) { @@ -83,11 +85,11 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm // set full image path $sanchoFooter_img = $footer_image_path_prefix.$sanchoFooter_img; } - } - // Set unique content id for embedding header and footer image - $cid_header = uniqid(); - $cid_footer = uniqid(); + // Set unique content id for embedding header and footer image + $cid_header = uniqid(); + $cid_footer = uniqid(); + } // Set specific mail content into specific content template $content = parseMailContent($vorlage_kurzbz, $vorlage_data); From f381ef229ef9ad57fc9d75a1be706c7e3523dd91 Mon Sep 17 00:00:00 2001 From: ma0048 Date: Thu, 16 Jan 2025 10:38:01 +0100 Subject: [PATCH 13/23] - index tbl_lehrveranstaltung_faktor_lvid hinzugefuegt - sortierung gleichgezogen --- system/dbupdate_3.4/40717_lv_faktor.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/system/dbupdate_3.4/40717_lv_faktor.php b/system/dbupdate_3.4/40717_lv_faktor.php index 932d6fd40..c304e292d 100644 --- a/system/dbupdate_3.4/40717_lv_faktor.php +++ b/system/dbupdate_3.4/40717_lv_faktor.php @@ -63,3 +63,18 @@ if (!$result = @$db->db_query("SELECT 1 FROM lehre.tbl_lehrveranstaltung_faktor else echo 'Tabelle: lehre.tbl_lehrveranstaltung_faktor befüllt!'; } + +// Add index to lehre.tbl_lehrveranstaltung_faktor +if ($result = $db->db_query("SELECT * FROM pg_class WHERE relname='idx_tbl_lehrveranstaltung_faktor_lvid'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = "CREATE INDEX idx_tbl_lehrveranstaltung_faktor_lvid ON lehre.tbl_lehrveranstaltung_faktor USING btree (lehrveranstaltung_id);"; + + if (! $db->db_query($qry)) + echo 'Indizes: ' . $db->db_last_error() . '
'; + else + echo 'Index fuer lehre.tbl_lehrveranstaltung_faktor.lehrveranstaltung_id hinzugefuegt'; + } +} + From 899c36c52c0bef1d283a6a4ecfc2bb1cbd57dada Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Mon, 20 Jan 2025 15:10:52 +0100 Subject: [PATCH 14/23] default sancho image comes from global config now --- application/controllers/jobs/AntragJob.php | 4 ++-- application/controllers/jobs/ReihungstestJob.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/application/controllers/jobs/AntragJob.php b/application/controllers/jobs/AntragJob.php index 46a31f3d6..11b950174 100644 --- a/application/controllers/jobs/AntragJob.php +++ b/application/controllers/jobs/AntragJob.php @@ -183,8 +183,8 @@ class AntragJob extends JOB_Controller $data, $to, 'Anträge - Aktion(en) erforderlich', - DEFAULT_SANCHO_HEADER_IMG, - DEFAULT_SANCHO_FOOTER_IMG, + '', + '', '', $cc )) diff --git a/application/controllers/jobs/ReihungstestJob.php b/application/controllers/jobs/ReihungstestJob.php index b55287439..996354bb5 100644 --- a/application/controllers/jobs/ReihungstestJob.php +++ b/application/controllers/jobs/ReihungstestJob.php @@ -431,8 +431,8 @@ class ReihungstestJob extends JOB_Controller $mailcontent_data_arr, $applicant->email, 'Ihre Anmeldung zum Reihungstest - Reminder / Your registration for the placement test - Reminder', - DEFAULT_SANCHO_HEADER_IMG, - DEFAULT_SANCHO_FOOTER_IMG, + '', + '', $from, '', $bcc); From e65322965fd750fe38b1438eb10632106e103d7a Mon Sep 17 00:00:00 2001 From: Alexei Karpenko Date: Mon, 20 Jan 2025 16:24:56 +0100 Subject: [PATCH 15/23] sancho mail: added config for haeder/footer image path, renamed custom mail config entries to sancho mail config entries, images are always attached inline (when using Code Igniter) --- application/config/mail.php | 9 ++++--- application/helpers/hlp_sancho_helper.php | 31 +++++++++++++++++------ config/global.config-default.inc.php | 9 ++++--- include/sancho.inc.php | 17 ++++++------- 4 files changed, 43 insertions(+), 23 deletions(-) diff --git a/application/config/mail.php b/application/config/mail.php index c89400ed1..2ac9a53c3 100644 --- a/application/config/mail.php +++ b/application/config/mail.php @@ -34,10 +34,13 @@ $config['validate'] = false; // If true then the email address will be validated $config['enable_debug'] = false; // If to use images for custom mails -$config['custom_mail_use_images'] = CUSTOM_MAIL_USE_IMAGES; +$config['sancho_mail_use_images'] = SANCHO_MAIL_USE_IMAGES; + +// image path for sancho mail, relativ to document root +$config['sancho_mail_img_path'] = SANCHO_MAIL_IMG_PATH; // header image for custom mails -$config['custom_mail_header_img'] = CUSTOM_MAIL_HEADER_IMG; +$config['sancho_mail_header_img'] = SANCHO_MAIL_HEADER_IMG; // footer image for custom mails -$config['custom_mail_footer_img'] = CUSTOM_MAIL_FOOTER_IMG; +$config['sancho_mail_footer_img'] = SANCHO_MAIL_FOOTER_IMG; diff --git a/application/helpers/hlp_sancho_helper.php b/application/helpers/hlp_sancho_helper.php index d11b6522e..768447eb2 100644 --- a/application/helpers/hlp_sancho_helper.php +++ b/application/helpers/hlp_sancho_helper.php @@ -51,7 +51,7 @@ function sendSanchoMail( $ci->load->library('email'); $ci->load->library('MailLib'); - $custom_mail_use_images = $ci->config->item('mail'); + $sancho_mail_use_images = $ci->config->item('mail'); if ($from == '') @@ -66,7 +66,7 @@ function sendSanchoMail( $cid_header = ''; $cid_footer = ''; - if (isset($custom_mail_use_images['custom_mail_use_images']) && $custom_mail_use_images['custom_mail_use_images']) + if (isset($sancho_mail_use_images['sancho_mail_use_images']) && $sancho_mail_use_images['sancho_mail_use_images']) { $sanchoHeader_img = ''; $sanchoFooter_img = ''; @@ -76,10 +76,10 @@ function sendSanchoMail( // use provided header image $sanchoHeader_img = $headerImg; } - elseif (isset($custom_mail_use_images['custom_mail_header_img']) && $custom_mail_use_images['custom_mail_header_img']) + elseif (isset($sancho_mail_use_images['sancho_mail_header_img']) && $sancho_mail_use_images['sancho_mail_header_img']) { // use default header image - $sanchoHeader_img = 'skin/images/sancho/'. $custom_mail_use_images['custom_mail_header_img']; + $sanchoHeader_img = $sancho_mail_use_images['sancho_mail_header_img']; } if (isset($footerImg) && $footerImg != '') @@ -87,14 +87,29 @@ function sendSanchoMail( // use provided footer image $sanchoFooter_img = $footerImg; } - elseif (isset($custom_mail_use_images['custom_mail_footer_img']) && $custom_mail_use_images['custom_mail_footer_img']) + elseif (isset($sancho_mail_use_images['sancho_mail_footer_img']) && $sancho_mail_use_images['sancho_mail_footer_img']) { // use default footer image - $sanchoFooter_img = 'skin/images/sancho/'. $custom_mail_use_images['custom_mail_footer_img']; + $sanchoFooter_img = $sancho_mail_use_images['sancho_mail_footer_img']; } - $ci->email->attach($sanchoHeader_img); - $ci->email->attach($sanchoFooter_img); + // add image file paths + if (isset($sancho_mail_use_images['sancho_mail_img_path'])) + { + if ($sanchoHeader_img != '') + { + $sanchoHeader_img = $sancho_mail_use_images['sancho_mail_img_path'].$sanchoHeader_img; + } + + if ($sanchoFooter_img != '') + { + $sanchoFooter_img = $sancho_mail_use_images['sancho_mail_img_path'].$sanchoFooter_img; + } + } + + // attach header and footer + $ci->email->attach($sanchoHeader_img, 'inline'); + $ci->email->attach($sanchoFooter_img, 'inline'); $cid_header = $ci->email->attachment_cid($sanchoHeader_img); // sets unique content id for embedding $cid_footer = $ci->email->attachment_cid($sanchoFooter_img); // sets unique content id for embedding } diff --git a/config/global.config-default.inc.php b/config/global.config-default.inc.php index 9446bf5ba..bb9ec0069 100644 --- a/config/global.config-default.inc.php +++ b/config/global.config-default.inc.php @@ -340,11 +340,14 @@ define('DIENSTVERHAELTNIS_SUPPORT', false); define('FAS_STUDSTATUS_SHOW_KOMM_PRFG_HINT', false); // header und footer Bilder für eigene Mails verwenden -define('CUSTOM_MAIL_USE_IMAGES', true); +define('SANCHO_MAIL_USE_IMAGES', true); + +// Pfad für Bilder für eigene Mails, relativ zu document root +define('SANCHO_MAIL_IMG_PATH', 'skin/images/sancho/'); // header Bild für eigene Mails -define('CUSTOM_MAIL_HEADER_IMG', 'sancho_header_DEFAULT.jpg'); +define('SANCHO_MAIL_HEADER_IMG', 'sancho_header_DEFAULT.jpg'); // footer image for eigene Mails -define('CUSTOM_MAIL_FOOTER_IMG', 'sancho_footer_DEFAULT.jpg'); +define('SANCHO_MAIL_FOOTER_IMG', 'sancho_footer_DEFAULT.jpg'); ?> diff --git a/include/sancho.inc.php b/include/sancho.inc.php index 4fdf467e0..e5a9d172f 100644 --- a/include/sancho.inc.php +++ b/include/sancho.inc.php @@ -43,30 +43,29 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm { $from = DEFAULT_SENDER.'@'. DOMAIN; - $header_image_path_prefix = dirname(__FILE__). '/../skin/images/sancho/'; - $footer_image_path_prefix = dirname(__FILE__). '/../skin/images/sancho/'; + $image_path_prefix = dirname(__DIR__).'/'.(defined('SANCHO_MAIL_IMG_PATH') ? SANCHO_MAIL_IMG_PATH : ''); $sanchoHeader_img = ''; $sanchoFooter_img = ''; $cid_header = ''; $cid_footer = ''; - if (!defined('CUSTOM_MAIL_USE_IMAGES') || CUSTOM_MAIL_USE_IMAGES) + if (!defined('SANCHO_MAIL_USE_IMAGES') || SANCHO_MAIL_USE_IMAGES) { if (isset($headerImg) && $headerImg != '') { // use provided header image $sanchoHeader_img = $headerImg; } - elseif (defined('CUSTOM_MAIL_HEADER_IMG') && CUSTOM_MAIL_HEADER_IMG != '') + elseif (defined('SANCHO_MAIL_HEADER_IMG') && SANCHO_MAIL_HEADER_IMG != '') { // use default header image - $sanchoHeader_img = CUSTOM_MAIL_HEADER_IMG; + $sanchoHeader_img = SANCHO_MAIL_HEADER_IMG; } if ($sanchoHeader_img != '') { // set full image path - $sanchoHeader_img = $header_image_path_prefix.$sanchoHeader_img; + $sanchoHeader_img = $image_path_prefix.$sanchoHeader_img; } if (isset($footerImg) && $footerImg != '') @@ -74,16 +73,16 @@ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerIm // use provided footer image $sanchoFooter_img = $footerImg; } - elseif (defined('CUSTOM_MAIL_FOOTER_IMG') && CUSTOM_MAIL_FOOTER_IMG != '') + elseif (defined('SANCHO_MAIL_FOOTER_IMG') && SANCHO_MAIL_FOOTER_IMG != '') { // use default footer image - $sanchoFooter_img = CUSTOM_MAIL_FOOTER_IMG; + $sanchoFooter_img = SANCHO_MAIL_FOOTER_IMG; } if ($sanchoFooter_img !== '') { // set full image path - $sanchoFooter_img = $footer_image_path_prefix.$sanchoFooter_img; + $sanchoFooter_img = $image_path_prefix.$sanchoFooter_img; } // Set unique content id for embedding header and footer image From 4c46a5f5c7130bf89c66b4900fd993422063897b Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Wed, 22 Jan 2025 15:09:20 +0100 Subject: [PATCH 16/23] modify regex to match optional table alias and ignore column alias equal to column name --- application/core/DB_Model.php | 38 ++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/application/core/DB_Model.php b/application/core/DB_Model.php index c3a609f3d..4346b933d 100644 --- a/application/core/DB_Model.php +++ b/application/core/DB_Model.php @@ -991,14 +991,17 @@ class DB_Model extends CI_Model // Find and replace all the occurrences of the provided encrypted columns // with the postgresql decryption function - $query = preg_replace( - '/\b' . $encryptedColumn . '\b/', - sprintf( - self::CRYPT_WHERE_TEMPLATE, - $encryptedColumn, - $decryptionPassword, - $definition[self::CRYPT_CAST] - ), + $query = preg_replace_callback( + '/(? Date: Wed, 22 Jan 2025 17:16:47 +0100 Subject: [PATCH 17/23] use encryption parameters in lamda function and return replacement string --- application/core/DB_Model.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/application/core/DB_Model.php b/application/core/DB_Model.php index 4346b933d..2f33bc82e 100644 --- a/application/core/DB_Model.php +++ b/application/core/DB_Model.php @@ -993,9 +993,9 @@ class DB_Model extends CI_Model // with the postgresql decryption function $query = preg_replace_callback( '/(? Date: Wed, 22 Jan 2025 17:18:22 +0100 Subject: [PATCH 18/23] modify to consider valorisation history, TODO cleanup valorisation tables dependency on FHC-Core-Personalverwaltung Extension --- .../Gehaltsbestandteil_model.php | 205 ++++++++++++++---- 1 file changed, 158 insertions(+), 47 deletions(-) diff --git a/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php b/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php index e9006dfc0..f327df78b 100644 --- a/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php +++ b/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php @@ -33,41 +33,84 @@ class Gehaltsbestandteil_model extends DB_Model implements IEncryption $datestring = $date->format("Y-m-d"); $qry = " - SELECT - gehaltsbestandteil_id, - gbt.von, - gbt.bis, - gbt.anmerkung, - gbt.dienstverhaeltnis_id, - gehaltstyp_kurzbz, - valorisierungssperre, - gbt.valorisierung, - grundbetrag as grund_betrag_decrypted, - betrag_valorisiert as betrag_val_decrypted, - gt.bezeichnung as gehaltstyp_bezeichnung, - vb.vertragsbestandteiltyp_kurzbz, - bf.funktion_kurzbz, - bf.oe_kurzbz, - fkt.beschreibung as fkt_beschreibung, - fb.bezeichnung as fb_bezeichnung, - org.bezeichnung as org_bezeichnung, - freitext.freitexttyp_kurzbz, - freitext.titel as freitext_titel - FROM hr.tbl_gehaltsbestandteil gbt LEFT JOIN hr.tbl_gehaltstyp gt using(gehaltstyp_kurzbz) - LEFT JOIN hr.tbl_vertragsbestandteil vb using(vertragsbestandteil_id) - LEFT JOIN hr.tbl_vertragsbestandteil_funktion vbf using(vertragsbestandteil_id) - LEFT JOIN public.tbl_benutzerfunktion bf using(benutzerfunktion_id) - LEFT JOIN public.tbl_funktion fkt using(funktion_kurzbz) - LEFT JOIN public.tbl_fachbereich fb using(fachbereich_kurzbz) - LEFT JOIN public.tbl_organisationseinheit org on (bf.oe_kurzbz=org.oe_kurzbz) - LEFT JOIN hr.tbl_vertragsbestandteil_freitext freitext on(vb.vertragsbestandteil_id=freitext.vertragsbestandteil_id) - WHERE gbt.dienstverhaeltnis_id=? AND - (gbt.von<=? and (gbt.bis is null OR gbt.bis>=?)) - ORDER BY gt.sort +with gbt as ( + select + gb.gehaltsbestandteil_id, + gb.von, + gb.bis, + gb.anmerkung, + gb.dienstverhaeltnis_id, + gb.gehaltstyp_kurzbz, + gb.valorisierungssperre, + gb.valorisierung, + gb.grundbetrag as grund_betrag_decrypted, + coalesce(vh.betrag_valorisiert, gb.grundbetrag) as betrag_val_decrypted, + gb.vertragsbestandteil_id + from + hr.tbl_gehaltsbestandteil gb + LEFT JOIN + hr.tbl_valorisierung_historie vh ON vh.gehaltsbestandteil_id = gb.gehaltsbestandteil_id AND vh.valorisierungsdatum = ( + SELECT + vi.valorisierungsdatum + FROM + hr.tbl_valorisierung_instanz vi + JOIN + hr.tbl_dienstverhaeltnis d ON d.dienstverhaeltnis_id = ? + AND d.oe_kurzbz = vi.oe_kurzbz + WHERE + ? >= valorisierungsdatum + ORDER BY + valorisierungsdatum DESC + LIMIT 1 + ) + where + dienstverhaeltnis_id = ? + and ( + ? BETWEEN COALESCE(von, '1970-01-01'::date) AND COALESCE(bis, '2170-01-01'::date) + ) +) +select + gbt.gehaltsbestandteil_id, + gbt.von, + gbt.bis, + gbt.anmerkung, + gbt.dienstverhaeltnis_id, + gbt.gehaltstyp_kurzbz, + gbt.valorisierungssperre, + gbt.valorisierung, + gbt.grund_betrag_decrypted, + gbt.betrag_val_decrypted, + gt.bezeichnung as gehaltstyp_bezeichnung, + vb.vertragsbestandteiltyp_kurzbz, + bf.funktion_kurzbz, + bf.oe_kurzbz, + fkt.beschreibung as fkt_beschreibung, + fb.bezeichnung as fb_bezeichnung, + org.bezeichnung as org_bezeichnung, + freitext.freitexttyp_kurzbz, + freitext.titel as freitext_titel +from + gbt +LEFT JOIN + hr.tbl_gehaltstyp gt using(gehaltstyp_kurzbz) +LEFT JOIN + hr.tbl_vertragsbestandteil vb using(vertragsbestandteil_id) +LEFT JOIN + hr.tbl_vertragsbestandteil_funktion vbf using(vertragsbestandteil_id) +LEFT JOIN + public.tbl_benutzerfunktion bf using(benutzerfunktion_id) +LEFT JOIN + public.tbl_funktion fkt using(funktion_kurzbz) +LEFT JOIN + public.tbl_fachbereich fb using(fachbereich_kurzbz) +LEFT JOIN + public.tbl_organisationseinheit org on (bf.oe_kurzbz=org.oe_kurzbz) +LEFT JOIN + hr.tbl_vertragsbestandteil_freitext freitext on(vb.vertragsbestandteil_id=freitext.vertragsbestandteil_id) "; return $this->execQuery($qry, - array($dienstverhaeltnis_id, $datestring, $datestring), + array($dienstverhaeltnis_id, $datestring, $dienstverhaeltnis_id, $datestring), $this->getEncryptedColumns()); } @@ -86,9 +129,36 @@ class Gehaltsbestandteil_model extends DB_Model implements IEncryption array($dienstverhaeltnis_id), $this->getEncryptedColumns()); } - public function getGehaltsbestandteile($dienstverhaeltnis_id, $stichtag=null, $includefuture=false) + { + if( !is_null($stichtag) && (time() > strtotime($stichtag)) ) + { + $query = $this->getGehaltsbestandteileMitValorisierungsHistorie( + $dienstverhaeltnis_id, $stichtag, $includefuture + ); + } + else + { + $query = $this->getGehaltsbestandteileOhneValorisierungsHistorie( + $dienstverhaeltnis_id, $stichtag, $includefuture + ); + } + + $gehaltsbestandteile = array(); + if( null !== ($rows = getData($query)) ) + { + foreach( $rows as $row ) { + $tmpgb = new Gehaltsbestandteil(); + $tmpgb->hydrateByStdClass($row, true); + $gehaltsbestandteile[] = $tmpgb; + } + } + + return $gehaltsbestandteile; + } + + protected function getGehaltsbestandteileOhneValorisierungsHistorie($dienstverhaeltnis_id, $stichtag=null, $includefuture=false) { $stichtagclause = ''; if( !is_null($stichtag) ) @@ -111,24 +181,65 @@ class Gehaltsbestandteil_model extends DB_Model implements IEncryption {$stichtagclause} EOSQL; - $query = $this->loadWhere( + $result = $this->loadWhere( $where, $this->getEncryptedColumns() ); - - $gehaltsbestandteile = array(); - if( null !== ($rows = getData($query)) ) - { - foreach( $rows as $row ) { - $tmpgb = new Gehaltsbestandteil(); - $tmpgb->hydrateByStdClass($row, true); - $gehaltsbestandteile[] = $tmpgb; - } - } - - return $gehaltsbestandteile; + return $result; + } + + protected function getGehaltsbestandteileMitValorisierungsHistorie($dienstverhaeltnis_id, $stichtag, $includefuture=false) + { + $date = strftime('%Y-%m-%d', strtotime($stichtag)); + $includefuture_clause = ($includefuture) + ? ' OR COALESCE(von, \'1970-01-01\'::date) > ' . $this->escape($date) + : ''; + $sql = <<escape($dienstverhaeltnis_id)} + AND d.oe_kurzbz = vi.oe_kurzbz + WHERE + {$this->escape($date)} >= valorisierungsdatum + ORDER BY + valorisierungsdatum DESC + LIMIT 1 + ) +WHERE + g.dienstverhaeltnis_id = {$this->escape($dienstverhaeltnis_id)} + AND ( + {$this->escape($date)} BETWEEN COALESCE(von, '1970-01-01'::date) AND COALESCE(bis, '2170-01-01'::date) + {$includefuture_clause} + ) +EOSQL; + + $result = $this->execReadOnlyQuery($sql, array(), $this->getEncryptedColumns()); + return $result; } - public function getGehaltsbestandteil($id) { From c5d79f750e74abf18f4099a22c311184323e9bd2 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Thu, 23 Jan 2025 15:31:17 +0100 Subject: [PATCH 19/23] add parameter withvalorisationhistory to use valorisation history or not --- .../vertragsbestandteil/GehaltsbestandteilLib.php | 7 +++++-- .../vertragsbestandteil/VertragsbestandteilLib.php | 13 ++++++++++--- .../Gehaltsbestandteil_model.php | 6 ++++-- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/application/libraries/vertragsbestandteil/GehaltsbestandteilLib.php b/application/libraries/vertragsbestandteil/GehaltsbestandteilLib.php index b75bdd722..930f84a64 100644 --- a/application/libraries/vertragsbestandteil/GehaltsbestandteilLib.php +++ b/application/libraries/vertragsbestandteil/GehaltsbestandteilLib.php @@ -28,9 +28,12 @@ class GehaltsbestandteilLib $this->GehaltsbestandteilModel = $this->CI->GehaltsbestandteilModel; } - public function fetchGehaltsbestandteile($dienstverhaeltnis_id, $stichtag=null, $includefuture=false) + public function fetchGehaltsbestandteile($dienstverhaeltnis_id, $stichtag=null, + $includefuture=false, $withvalorisationhistory=true) { - return $this->GehaltsbestandteilModel->getGehaltsbestandteile($dienstverhaeltnis_id, $stichtag, $includefuture); + return $this->GehaltsbestandteilModel->getGehaltsbestandteile( + $dienstverhaeltnis_id, $stichtag, $includefuture, $withvalorisationhistory + ); } public function fetchGehaltsbestandteil($gehaltsbestandteil_id) diff --git a/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php b/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php index b58c514e1..2e6182957 100644 --- a/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php +++ b/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php @@ -26,6 +26,8 @@ class VertragsbestandteilLib { const INCLUDE_FUTURE = true; const DO_NOT_INCLUDE_FUTURE = false; + const WITH_VALORISATION_HISTORY = true; + const NOT_WITH_VALORISATION_HISTORY = false; protected $CI; /** @var Dienstverhaeltnis_model */ @@ -90,10 +92,15 @@ class VertragsbestandteilLib return $dv; } - public function fetchVertragsbestandteile($dienstverhaeltnis_id, $stichtag=null, $includefuture=false) + public function fetchVertragsbestandteile($dienstverhaeltnis_id, $stichtag=null, + $includefuture=false, $withvalorisationhistory=true) { - $vbs = $this->VertragsbestandteilModel->getVertragsbestandteile($dienstverhaeltnis_id, $stichtag, $includefuture); - $gbs = $this->GehaltsbestandteilLib->fetchGehaltsbestandteile($dienstverhaeltnis_id, $stichtag, $includefuture); + $vbs = $this->VertragsbestandteilModel->getVertragsbestandteile( + $dienstverhaeltnis_id, $stichtag, $includefuture + ); + $gbs = $this->GehaltsbestandteilLib->fetchGehaltsbestandteile( + $dienstverhaeltnis_id, $stichtag, $includefuture, $withvalorisationhistory + ); $gbsByVBid = array(); foreach( $gbs as $gb ) diff --git a/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php b/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php index f327df78b..c3d8cb174 100644 --- a/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php +++ b/application/models/vertragsbestandteil/Gehaltsbestandteil_model.php @@ -130,9 +130,11 @@ LEFT JOIN $this->getEncryptedColumns()); } - public function getGehaltsbestandteile($dienstverhaeltnis_id, $stichtag=null, $includefuture=false) + public function getGehaltsbestandteile($dienstverhaeltnis_id, $stichtag=null, + $includefuture=false, $withvalorisationhistory=true) { - if( !is_null($stichtag) && (time() > strtotime($stichtag)) ) + if( !is_null($stichtag) && (time() > strtotime($stichtag)) + && $withvalorisationhistory !== false ) { $query = $this->getGehaltsbestandteileMitValorisierungsHistorie( $dienstverhaeltnis_id, $stichtag, $includefuture From 87220e17894b15cc586cf99ce3bb95f3405fd531 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Thu, 23 Jan 2025 16:13:47 +0100 Subject: [PATCH 20/23] move tbl_valorisierung_* to core since they are used in vertragsbestandteillib and gehaltsbestandteillib --- system/dbupdate_3.4.php | 11 +- system/dbupdate_3.4/53903_valorisierung.php | 113 ++++++++++++++++++++ 2 files changed, 121 insertions(+), 3 deletions(-) create mode 100644 system/dbupdate_3.4/53903_valorisierung.php diff --git a/system/dbupdate_3.4.php b/system/dbupdate_3.4.php index 57eee605c..c6e64edb3 100644 --- a/system/dbupdate_3.4.php +++ b/system/dbupdate_3.4.php @@ -68,6 +68,7 @@ require_once('dbupdate_3.4/33683_digitale_anwesenheitsliste_und_entschuldigungsm require_once('dbupdate_3.4/40717_lv_faktor.php'); require_once('dbupdate_3.4/48526_pep_tagging.php'); require_once('dbupdate_3.4/41950_perm_gehaelter.php'); +require_once('dbupdate_3.4/53903_valorisierung.php'); // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; @@ -206,11 +207,15 @@ $tabellen=array( "hr.tbl_karenztyp" => array("karenztyp_kurzbz","bezeichnung"), "hr.tbl_teilzeittyp" => array("teilzeittyp_kurzbz","bezeichnung","aktiv"), "hr.tbl_gehaltsbestandteil" => array("gehaltsbestandteil_id","dienstverhaeltnis_id","vertragsbestandteil_id","gehaltstyp_kurzbz","von","bis","anmerkung","grundbetrag","betrag_valorisiert","valorisierungssperre","insertamum", "insertvon","updateamum","updatevon","valorisierung","auszahlungen"), - "hr.tbl_gehaltshistorie" => array("gehaltshistorie_id", "datum","betrag","gehaltsbestandteil_id","mitarbeiter_uid"), + "hr.tbl_gehaltshistorie" => array("gehaltshistorie_id", "datum","betrag","gehaltsbestandteil_id","mitarbeiter_uid","gehaltsbestandteil_von","gehaltsbestandteil_bis"), "hr.tbl_gehaltstyp" => array("gehaltstyp_kurzbz","bezeichnung","valorisierung","sort","aktiv"), "hr.tbl_frist" => array("frist_id","mitarbeiter_uid","ereignis_kurzbz","bezeichnung","datum","status_kurzbz","parameter","insertvon","insertamum","updatevon","updateamum"), - "hr.tbl_frist_ereignis" => array("ereignis_kurzbz","bezeichnung","manuell"), - "hr.tbl_frist_status" => array("status_kurzbz", "bezeichnung"), + "hr.tbl_frist_ereignis" => array("ereignis_kurzbz","bezeichnung","manuell","sort"), + "hr.tbl_frist_status" => array("status_kurzbz", "bezeichnung","sort"), + "hr.tbl_valorisierung_historie" => array("valorisierung_historie_id", "gehaltsbestandteil_id", "valorisierungsdatum", "betrag_valorisiert", "insertvon", "insertamum"), + "hr.tbl_valorisierung_instanz" => array("updateamum", "oe_kurzbz", "valorisierungsdatum", "valorisierung_kurzbz", "beschreibung", "ausgewaehlt", "updatevon", "valorisierung_instanz_id"), + "hr.tbl_valorisierung_instanz_methode" => array("valorisierung_instanz_id", "valorisierung_methode_kurzbz", "beschreibung", "valorisierung_methode_parameter"), + "hr.tbl_valorisierung_methode" => array("beschreibung", "valorisierung_methode_kurzbz"), "lehre.tbl_abschlussbeurteilung" => array("abschlussbeurteilung_kurzbz","bezeichnung","bezeichnung_english","sort"), "lehre.tbl_abschlusspruefung" => array("abschlusspruefung_id","student_uid","vorsitz","pruefer1","pruefer2","pruefer3","abschlussbeurteilung_kurzbz","akadgrad_id","pruefungstyp_kurzbz","datum","uhrzeit","sponsion","anmerkung","updateamum","updatevon","insertamum","insertvon","ext_id","note","protokoll","endezeit","pruefungsantritt_kurzbz","freigabedatum"), "lehre.tbl_abschlusspruefung_antritt" => array("pruefungsantritt_kurzbz","bezeichnung","bezeichnung_english","sort"), diff --git a/system/dbupdate_3.4/53903_valorisierung.php b/system/dbupdate_3.4/53903_valorisierung.php new file mode 100644 index 000000000..0aa443de0 --- /dev/null +++ b/system/dbupdate_3.4/53903_valorisierung.php @@ -0,0 +1,113 @@ +db_query("SELECT * FROM information_schema.tables WHERE table_name='tbl_valorisierung_methode' AND table_schema='hr'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = " +CREATE TABLE IF NOT EXISTS hr.tbl_valorisierung_methode ( + valorisierung_methode_kurzbz character varying(32) NOT NULL, + beschreibung character varying NOT NULL, + CONSTRAINT tbl_valorisierung_methode_pkey PRIMARY KEY (valorisierung_methode_kurzbz) +); + +GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE hr.tbl_valorisierung_methode TO vilesci; + +INSERT INTO hr.tbl_valorisierung_methode (valorisierung_methode_kurzbz, beschreibung) VALUES + ('ValorisierungProzent', 'Valorisierung um einen Prozentsatz'), + ('ValorisierungFixBetrag', 'Valorisierung um einen fixen Betrag'), + ('ValorisierungGestaffelt', 'mehrere Stufen mit unterschiedlichen Prozentwerten') +ON CONFLICT(valorisierung_methode_kurzbz) DO NOTHING; + "; + + if (! $db->db_query($qry)) + echo 'Valorisierung: ' . $db->db_last_error() . '
'; + else + echo 'hr.tbl_valorisierung_methode wurden neu erstellt
'; + } +} + +if ($result = $db->db_query("SELECT * FROM information_schema.tables WHERE table_name='tbl_valorisierung_instanz' AND table_schema='hr'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = " +CREATE TABLE IF NOT EXISTS hr.tbl_valorisierung_instanz ( + valorisierung_instanz_id serial NOT NULL, + oe_kurzbz character varying(32), + valorisierungsdatum date NOT NULL, + valorisierung_kurzbz character varying(128) NOT NULL, + beschreibung text, + ausgewaehlt boolean DEFAULT false NOT NULL, + updatevon character varying(32), + updateamum timestamp without time zone, + CONSTRAINT tbl_valorisierung_instanz_pkey PRIMARY KEY (valorisierung_instanz_id), + CONSTRAINT tbl_valorisierung_instanz_fk1 FOREIGN KEY (oe_kurzbz) REFERENCES public.tbl_organisationseinheit(oe_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT, + UNIQUE(valorisierung_kurzbz) +); + +CREATE UNIQUE INDEX IF NOT EXISTS tbl_valorisierung_instanz_unique_idx ON hr.tbl_valorisierung_instanz (ausgewaehlt, valorisierungsdatum, oe_kurzbz) WHERE (ausgewaehlt = TRUE); + +GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE hr.tbl_valorisierung_instanz TO vilesci; +GRANT SELECT,UPDATE ON SEQUENCE hr.tbl_valorisierung_instanz_valorisierung_instanz_id_seq TO vilesci; + "; + + if (! $db->db_query($qry)) + echo 'Valorisierung: ' . $db->db_last_error() . '
'; + else + echo 'hr.tbl_valorisierung_instanz wurden neu erstellt
'; + } +} + +if ($result = $db->db_query("SELECT * FROM information_schema.tables WHERE table_name='tbl_valorisierung_instanz_methode' AND table_schema='hr'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = " +CREATE TABLE IF NOT EXISTS hr.tbl_valorisierung_instanz_methode ( + valorisierung_instanz_id integer NOT NULL, + valorisierung_methode_kurzbz character varying(32) NOT NULL, + beschreibung text, + valorisierung_methode_parameter jsonb NOT NULL, + CONSTRAINT tbl_valorisierung_instanz_methode_pkey PRIMARY KEY (valorisierung_instanz_id, valorisierung_methode_kurzbz), + CONSTRAINT tbl_valorisierung_instanz_methode_fk1 FOREIGN KEY (valorisierung_instanz_id) REFERENCES hr.tbl_valorisierung_instanz(valorisierung_instanz_id) ON UPDATE CASCADE ON DELETE RESTRICT, + CONSTRAINT tbl_valorisierung_instanz_methode_fk2 FOREIGN KEY (valorisierung_methode_kurzbz) REFERENCES hr.tbl_valorisierung_methode(valorisierung_methode_kurzbz) ON UPDATE CASCADE ON DELETE RESTRICT +); + +GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE hr.tbl_valorisierung_instanz_methode TO vilesci; + "; + + if (! $db->db_query($qry)) + echo 'Valorisierung: ' . $db->db_last_error() . '
'; + else + echo 'hr.tbl_valorisierung_instanz_methode wurde neu erstellt
'; + } +} + +if ($result = $db->db_query("SELECT * FROM information_schema.tables WHERE table_name='tbl_valorisierung_historie' AND table_schema='hr'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = " +CREATE TABLE IF NOT EXISTS hr.tbl_valorisierung_historie ( + valorisierung_historie_id serial NOT NULL, + gehaltsbestandteil_id integer NOT NULL, + valorisierungsdatum date NOT NULL, + betrag_valorisiert bytea NOT NULL, + insertvon character varying(32), + insertamum timestamp without time zone DEFAULT now(), + CONSTRAINT tbl_valorisierung_historie_pkey PRIMARY KEY (valorisierung_historie_id) +); + +GRANT SELECT,INSERT,DELETE,UPDATE ON TABLE hr.tbl_valorisierung_historie TO vilesci; +GRANT SELECT,UPDATE ON SEQUENCE hr.tbl_valorisierung_historie_valorisierung_historie_id_seq TO vilesci; + "; + + if (! $db->db_query($qry)) + echo 'Valorisierung: ' . $db->db_last_error() . '
'; + else + echo 'hr.tbl_valorisierung_historie wurde neu erstellt
'; + } +} + \ No newline at end of file From d6abfbbc232d986abf799784c11e69e5f257a065 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Thu, 23 Jan 2025 16:33:03 +0100 Subject: [PATCH 21/23] fix typo --- system/dbupdate_3.4/53903_valorisierung.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/system/dbupdate_3.4/53903_valorisierung.php b/system/dbupdate_3.4/53903_valorisierung.php index 0aa443de0..c6f01afb4 100644 --- a/system/dbupdate_3.4/53903_valorisierung.php +++ b/system/dbupdate_3.4/53903_valorisierung.php @@ -24,7 +24,7 @@ ON CONFLICT(valorisierung_methode_kurzbz) DO NOTHING; if (! $db->db_query($qry)) echo 'Valorisierung: ' . $db->db_last_error() . '
'; else - echo 'hr.tbl_valorisierung_methode wurden neu erstellt
'; + echo 'hr.tbl_valorisierung_methode wurde neu erstellt
'; } } @@ -56,7 +56,7 @@ GRANT SELECT,UPDATE ON SEQUENCE hr.tbl_valorisierung_instanz_valorisierung_insta if (! $db->db_query($qry)) echo 'Valorisierung: ' . $db->db_last_error() . '
'; else - echo 'hr.tbl_valorisierung_instanz wurden neu erstellt
'; + echo 'hr.tbl_valorisierung_instanz wurde neu erstellt
'; } } From 39c2e447198849460a36eac85938896534e1f0f1 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 28 Jan 2025 10:22:30 +0100 Subject: [PATCH 22/23] sancho default sender konfigurierbar machen --- application/config/mail.php | 3 +++ application/helpers/hlp_sancho_helper.php | 24 +++++++++++++---------- config/global.config-default.inc.php | 3 +++ include/sancho.inc.php | 7 +++++-- 4 files changed, 25 insertions(+), 12 deletions(-) diff --git a/application/config/mail.php b/application/config/mail.php index 2ac9a53c3..e7fd53c3a 100644 --- a/application/config/mail.php +++ b/application/config/mail.php @@ -33,6 +33,9 @@ $config['validate'] = false; // If true then the email address will be validated // If enabled will be logged info about emails in Codeigniter error logs $config['enable_debug'] = false; +// default sender +$config['sancho_mail_default_sender'] = SANCHO_MAIL_DEFAULT_SENDER; + // If to use images for custom mails $config['sancho_mail_use_images'] = SANCHO_MAIL_USE_IMAGES; diff --git a/application/helpers/hlp_sancho_helper.php b/application/helpers/hlp_sancho_helper.php index 768447eb2..9a32f5e1a 100644 --- a/application/helpers/hlp_sancho_helper.php +++ b/application/helpers/hlp_sancho_helper.php @@ -51,12 +51,16 @@ function sendSanchoMail( $ci->load->library('email'); $ci->load->library('MailLib'); - $sancho_mail_use_images = $ci->config->item('mail'); + $sancho_mail_config = $ci->config->item('mail'); if ($from == '') { - $from = 'noreply@'.DOMAIN; + $from = ((isset($sancho_mail_config['sancho_mail_default_sender']) + && $sancho_mail_config['sancho_mail_default_sender']) + ? $sancho_mail_config['sancho_mail_default_sender'] + : 'noreply') + . '@' . DOMAIN; } // Embed sancho header and footer image @@ -66,7 +70,7 @@ function sendSanchoMail( $cid_header = ''; $cid_footer = ''; - if (isset($sancho_mail_use_images['sancho_mail_use_images']) && $sancho_mail_use_images['sancho_mail_use_images']) + if (isset($sancho_mail_config['sancho_mail_use_images']) && $sancho_mail_config['sancho_mail_use_images']) { $sanchoHeader_img = ''; $sanchoFooter_img = ''; @@ -76,10 +80,10 @@ function sendSanchoMail( // use provided header image $sanchoHeader_img = $headerImg; } - elseif (isset($sancho_mail_use_images['sancho_mail_header_img']) && $sancho_mail_use_images['sancho_mail_header_img']) + elseif (isset($sancho_mail_config['sancho_mail_header_img']) && $sancho_mail_config['sancho_mail_header_img']) { // use default header image - $sanchoHeader_img = $sancho_mail_use_images['sancho_mail_header_img']; + $sanchoHeader_img = $sancho_mail_config['sancho_mail_header_img']; } if (isset($footerImg) && $footerImg != '') @@ -87,23 +91,23 @@ function sendSanchoMail( // use provided footer image $sanchoFooter_img = $footerImg; } - elseif (isset($sancho_mail_use_images['sancho_mail_footer_img']) && $sancho_mail_use_images['sancho_mail_footer_img']) + elseif (isset($sancho_mail_config['sancho_mail_footer_img']) && $sancho_mail_config['sancho_mail_footer_img']) { // use default footer image - $sanchoFooter_img = $sancho_mail_use_images['sancho_mail_footer_img']; + $sanchoFooter_img = $sancho_mail_config['sancho_mail_footer_img']; } // add image file paths - if (isset($sancho_mail_use_images['sancho_mail_img_path'])) + if (isset($sancho_mail_config['sancho_mail_img_path'])) { if ($sanchoHeader_img != '') { - $sanchoHeader_img = $sancho_mail_use_images['sancho_mail_img_path'].$sanchoHeader_img; + $sanchoHeader_img = $sancho_mail_config['sancho_mail_img_path'].$sanchoHeader_img; } if ($sanchoFooter_img != '') { - $sanchoFooter_img = $sancho_mail_use_images['sancho_mail_img_path'].$sanchoFooter_img; + $sanchoFooter_img = $sancho_mail_config['sancho_mail_img_path'].$sanchoFooter_img; } } diff --git a/config/global.config-default.inc.php b/config/global.config-default.inc.php index bb9ec0069..0d4158b48 100644 --- a/config/global.config-default.inc.php +++ b/config/global.config-default.inc.php @@ -339,6 +339,9 @@ define('DIENSTVERHAELTNIS_SUPPORT', false); // Falls Studstatus (Abmeldung, AbmeldungStg, Unterbrechung, Wiederholung) verwendet wird zeige Hinweistext bei Eingabe einer kommissionellen oder zusaetzlichen kommissionellen Pruefung define('FAS_STUDSTATUS_SHOW_KOMM_PRFG_HINT', false); +// default absender (@DOMAIN wird hinzugefuegt daher ohne angeben) +define('SANCHO_MAIL_DEFAULT_SENDER', 'noreply'); + // header und footer Bilder für eigene Mails verwenden define('SANCHO_MAIL_USE_IMAGES', true); diff --git a/include/sancho.inc.php b/include/sancho.inc.php index e5a9d172f..4da3768b5 100644 --- a/include/sancho.inc.php +++ b/include/sancho.inc.php @@ -24,7 +24,7 @@ require_once(dirname(__FILE__).'/basis_db.class.php'); require_once(dirname(__FILE__).'/mail.class.php'); require_once(dirname(__FILE__).'/vorlage.class.php'); -const DEFAULT_SENDER = 'noreply'; +const FALLBACK_SENDER = 'noreply'; /** * Send single Mail with Sancho Design and Layout. @@ -41,7 +41,10 @@ const DEFAULT_SENDER = 'noreply'; */ function sendSanchoMail($vorlage_kurzbz, $vorlage_data, $to, $subject, $headerImg = '', $footerImg = '', $replyTo = '', $cc = '') { - $from = DEFAULT_SENDER.'@'. DOMAIN; + $from = ((defined('SANCHO_MAIL_DEFAULT_SENDER') && SANCHO_MAIL_DEFAULT_SENDER != '') + ? SANCHO_MAIL_DEFAULT_SENDER + : FALLBACK_SENDER) + . '@' . DOMAIN; $image_path_prefix = dirname(__DIR__).'/'.(defined('SANCHO_MAIL_IMG_PATH') ? SANCHO_MAIL_IMG_PATH : ''); $sanchoHeader_img = ''; From 7f6744047f18ee07b3065d8a89d94e28e123d917 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 28 Jan 2025 11:26:01 +0100 Subject: [PATCH 23/23] check in ci mail config if constants in global config are defined --- application/config/mail.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/config/mail.php b/application/config/mail.php index e7fd53c3a..4f1baa85d 100644 --- a/application/config/mail.php +++ b/application/config/mail.php @@ -34,16 +34,16 @@ $config['validate'] = false; // If true then the email address will be validated $config['enable_debug'] = false; // default sender -$config['sancho_mail_default_sender'] = SANCHO_MAIL_DEFAULT_SENDER; +$config['sancho_mail_default_sender'] = defined('SANCHO_MAIL_DEFAULT_SENDER') ? SANCHO_MAIL_DEFAULT_SENDER : ''; // If to use images for custom mails -$config['sancho_mail_use_images'] = SANCHO_MAIL_USE_IMAGES; +$config['sancho_mail_use_images'] = defined('SANCHO_MAIL_USE_IMAGES') ? SANCHO_MAIL_USE_IMAGES : false; // image path for sancho mail, relativ to document root -$config['sancho_mail_img_path'] = SANCHO_MAIL_IMG_PATH; +$config['sancho_mail_img_path'] = defined('SANCHO_MAIL_IMG_PATH') ? SANCHO_MAIL_IMG_PATH : ''; // header image for custom mails -$config['sancho_mail_header_img'] = SANCHO_MAIL_HEADER_IMG; +$config['sancho_mail_header_img'] = defined('SANCHO_MAIL_HEADER_IMG') ? SANCHO_MAIL_HEADER_IMG : ''; // footer image for custom mails -$config['sancho_mail_footer_img'] = SANCHO_MAIL_FOOTER_IMG; +$config['sancho_mail_footer_img'] = defined('SANCHO_MAIL_FOOTER_IMG') ? SANCHO_MAIL_FOOTER_IMG : '';