From 21e43d7a0894ec036591cfc1e6d088a77a6ceb73 Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 27 May 2020 11:37:49 +0200 Subject: [PATCH 001/313] Created DB view public.vw.msg_vars_user (data of logged in user) This data will be used by the messaging system to provide data of the logged in user. --- system/dbupdate_3.3.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 64f4f490a..3112bacbb 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -196,6 +196,43 @@ if(!$result = @$db->db_query("SELECT 1 FROM public.vw_msg_vars_person LIMIT 1")) echo '
Granted privileges to vilesci on public.vw_msg_vars_person'; } +// CREATE OR REPLACE VIEW public.vw_msg_vars_user and grants privileges +if(!$result = @$db->db_query("SELECT 1 FROM public.vw_msg_vars_user LIMIT 1")) +{ + $qry = ' + CREATE OR REPLACE VIEW public.vw_msg_vars_user AS ( + SELECT DISTINCT ON + (b.uid) b.uid, + p.vorname, + p.nachname, + b.alias, + ma.telefonklappe AS "durchwahl" + FROM public.tbl_person p + JOIN public.tbl_benutzer b USING (person_id) + JOIN public.tbl_mitarbeiter ma ON ma.mitarbeiter_uid = b.uid + WHERE ma.personalnummer > 0 + );'; + + if(!$db->db_query($qry)) + echo 'public.vw_msg_vars_user: '.$db->db_last_error().'
'; + else + echo '
public.vw_msg_vars_user view created'; + + $qry = 'GRANT SELECT ON TABLE public.vw_msg_vars_user TO web;'; + + if(!$db->db_query($qry)) + echo 'public.vw_msg_vars_user: '.$db->db_last_error().'
'; + else + echo '
Granted privileges to web on public.vw_msg_vars_user'; + + $qry = 'GRANT SELECT ON TABLE public.vw_msg_vars_user TO vilesci;'; + + if(!$db->db_query($qry)) + echo 'public.vw_msg_vars_user: '.$db->db_last_error().'
'; + else + echo '
Granted privileges to vilesci on public.vw_msg_vars_user'; +} + //Spalte anmerkung und rechnungsadresse in tbl_adresse if(!$result = @$db->db_query("SELECT rechnungsadresse FROM public.tbl_adresse LIMIT 1")) { From 1be1d1c8e9b32b8bb47798901fd58f139b0b81eb Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 27 May 2020 11:48:05 +0200 Subject: [PATCH 002/313] Added GUI for 'Eigene Felder' + layout adaptations . GUI: added multidropdown 'Eigene Felder', which contains fields of the logged in user . Layout: Message text area has now min and max height; sending button now aligned correctly; multidropdowns now aligned to text area Signed-off-by: Cris --- .../system/messages/htmlWriteTemplate.php | 31 ++++++++++++++++--- public/js/messaging/messageWrite.js | 7 ++++- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/application/views/system/messages/htmlWriteTemplate.php b/application/views/system/messages/htmlWriteTemplate.php index 199a88cfa..95ab12630 100644 --- a/application/views/system/messages/htmlWriteTemplate.php +++ b/application/views/system/messages/htmlWriteTemplate.php @@ -83,19 +83,41 @@ 19 ? 19 : count($variables); echo $this->widgetlib->widget( 'MultipleDropdown_widget', array('elements' => success($variables)), array( 'name' => 'variables[]', 'id' => 'variables', - 'size' => count($variables), + 'size' => $size, 'multiple' => true ) ); ?> - +
+
+ + + 5 ? 5 : count($user_fields); + echo $this->widgetlib->widget( + 'MultipleDropdown_widget', + array('elements' => success($user_fields)), + array( + 'name' => 'user_fields[]', + 'id' => 'user_fields', + 'size' => $size, + 'multiple' => true + ) + ); + ?> +

@@ -111,14 +133,15 @@ ?> -
-
+

diff --git a/public/js/messaging/messageWrite.js b/public/js/messaging/messageWrite.js index 3a3a23792..1978fc08c 100644 --- a/public/js/messaging/messageWrite.js +++ b/public/js/messaging/messageWrite.js @@ -46,7 +46,12 @@ $(document).ready(function () { tinymce.init({ selector: "#bodyTextArea", - plugins: "autoresize" + plugins: "autoresize", + autoresize_on_init: false, + autoresize_min_height: 400, + autoresize_max_height: 400, + autoresize_bottom_margin: 10, + auto_focus: "bodyTextArea" }); tinymce.init({ From 7ab2155d6a0098b3127e353ad4ed29a85170f63c Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 27 May 2020 11:49:35 +0200 Subject: [PATCH 003/313] Added method to retrieve data of logged in user in Message model Signed-off-by: Cris --- application/models/system/Message_model.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 764c3ae14..5ebcc5ee9 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -191,4 +191,23 @@ class Message_model extends DB_Model return $this->execQuery(sprintf($query, is_array($person_id) ? 'IN' : '='), array($person_id)); } + + /** + * Get message vars for logged in user + * @param string $uid + * @return array|null + */ + public function getMsgVarsDataLoggedInUser() + { + $result = $this->db->query('SELECT * FROM public.vw_msg_vars_user WHERE uid = \''. getAuthUID(). '\''); + + if ($result) + { + return success($result->list_fields()); + } + else + { + return error($this->db->error(), FHC_DB_ERROR); + } + } } From a5e0c9ca5a89020cf0796f00bba657400a147a34 Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 27 May 2020 11:52:12 +0200 Subject: [PATCH 004/313] Added logic to provide fields of logged in user in Messaging system Signed-off-by: Cris --- application/libraries/MessageLib.php | 25 ++++++++++++++++++++++++ application/models/CL/Messages_model.php | 21 ++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index fd2051f48..31d33eda4 100644 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -215,6 +215,31 @@ class MessageLib return $messageVars; // otherwise returns the error } + + /** + * Retrieves message vars of the logged in user from view vw_msg_vars_user + */ + public function getMessageVarsLoggedInUser() + { + // Retrieves message vars from view vw_msg_vars + $messageVars = $this->_ci->MessageModel->getMsgVarsDataLoggedInUser(); + if (isSuccess($messageVars)) // if everything is ok + { + $variablesArray = array(); + $tmpVariablesArray = getData($messageVars); + + // Starts from 1 to skip the first element which is uid + for ($i = 1; $i < count($tmpVariablesArray); $i++) + { + $variablesArray['{my_'.str_replace(' ', '_', strtolower($tmpVariablesArray[$i])).'}'] + = 'my_'. strtoupper($tmpVariablesArray[$i]); + } + + return success($variablesArray); + } + + return $messageVars; // otherwise returns the error + } /** * Retrieves organisation units for each role that a user plays inside that organisation unit diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index 67e7ff969..2bec3dd9c 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -833,6 +833,26 @@ class Messages_model extends CI_Model $variables[] = $tmpVar; } + + // --------------------------------------------------------------------------------------- + // Retrieves message vars of logged in user from database view vw_msg_vars_person + $result = null; + + // If data contains a prestudent id + $result = $this->messagelib->getMessageVarsLoggedInUser(); + + if (isError($result)) show_error(getError($result)); + + // Then builds an array that contains objects with field name and field description of logged in user data + $user_fields = array(); + foreach (getData($result) as $id => $description) + { + $obj = new stdClass(); + $obj->id = $id; + $obj->description = $description; + + $user_fields[] = $obj; + } // --------------------------------------------------------------------------------------- // Retrieves the sender id @@ -853,6 +873,7 @@ class Messages_model extends CI_Model 'subject' => $replySubject, 'body' => $replyBody, 'variables' => $variables, + 'user_fields' => $user_fields, 'organisationUnits' => getData($organisationUnits), 'senderIsAdmin' => getData($senderIsAdmin), 'recipientsArray' => $recipientsArray, From 046994f14b667effcd07e120eaf153b3b508954e Mon Sep 17 00:00:00 2001 From: Cris Date: Wed, 27 May 2020 11:53:56 +0200 Subject: [PATCH 005/313] Added phrase 'meineFelder' Signed-off-by: Cris --- system/phrasesupdate.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/system/phrasesupdate.php b/system/phrasesupdate.php index 14af8e733..2672d5b91 100644 --- a/system/phrasesupdate.php +++ b/system/phrasesupdate.php @@ -6766,6 +6766,26 @@ When on hold, the date is only a reminder.', ) ) ), + array( + 'app' => 'core', + 'category' => 'ui', + 'phrase' => 'meineFelder', + 'insertvon' => 'system', + 'phrases' => array( + array( + 'sprache' => 'German', + 'text' => 'Meine Felder', + 'description' => '', + 'insertvon' => 'system' + ), + array( + 'sprache' => 'English', + 'text' => 'My fields', + 'description' => '', + 'insertvon' => 'system' + ) + ) + ), ); From 634401485a5f857842e8a08a6431e7a7f1191526 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 28 May 2020 09:42:51 +0200 Subject: [PATCH 006/313] Renamed 'Meine Felder'-msg names and small method adaptation to retrieve fields Signed-off-by: Cris --- application/libraries/MessageLib.php | 6 +++--- application/models/system/Message_model.php | 17 +++++++++++++++++ system/dbupdate_3.3.php | 10 +++++----- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index 31d33eda4..e0622e664 100644 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -222,7 +222,7 @@ class MessageLib public function getMessageVarsLoggedInUser() { // Retrieves message vars from view vw_msg_vars - $messageVars = $this->_ci->MessageModel->getMsgVarsDataLoggedInUser(); + $messageVars = $this->_ci->MessageModel->getMsgVarsLoggedInUser(); if (isSuccess($messageVars)) // if everything is ok { $variablesArray = array(); @@ -231,8 +231,8 @@ class MessageLib // Starts from 1 to skip the first element which is uid for ($i = 1; $i < count($tmpVariablesArray); $i++) { - $variablesArray['{my_'.str_replace(' ', '_', strtolower($tmpVariablesArray[$i])).'}'] - = 'my_'. strtoupper($tmpVariablesArray[$i]); + $variablesArray['{'.str_replace(' ', '_', strtolower($tmpVariablesArray[$i])).'}'] + = strtoupper($tmpVariablesArray[$i]); } return success($variablesArray); diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 5ebcc5ee9..0972f127f 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -171,6 +171,23 @@ class Message_model extends DB_Model return error($this->db->error(), FHC_DB_ERROR); } } + + /** + * Get message variables for logged in user + */ + public function getMsgVarsLoggedInUser() + { + $result = $this->db->query('SELECT * FROM public.vw_msg_vars_user WHERE 0 = 1'); + + if ($result) + { + return success($result->list_fields()); + } + else + { + return error($this->db->error(), FHC_DB_ERROR); + } + } /** * getMsgVarsDataByPrestudentId diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 3112bacbb..f0da8fab6 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -202,11 +202,11 @@ if(!$result = @$db->db_query("SELECT 1 FROM public.vw_msg_vars_user LIMIT 1")) $qry = ' CREATE OR REPLACE VIEW public.vw_msg_vars_user AS ( SELECT DISTINCT ON - (b.uid) b.uid, - p.vorname, - p.nachname, - b.alias, - ma.telefonklappe AS "durchwahl" + (b.uid) b.uid AS "my_uid", + p.vorname AS "my_vorname", + p.nachname AS "my_nachname", + b.alias AS "my_alias", + ma.telefonklappe AS "my_durchwahl" FROM public.tbl_person p JOIN public.tbl_benutzer b USING (person_id) JOIN public.tbl_mitarbeiter ma ON ma.mitarbeiter_uid = b.uid From ebd9c2c0ba8fc1efe22f3e0933c20d165e5a8b6e Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 28 May 2020 09:46:15 +0200 Subject: [PATCH 007/313] Added method to retrieve message vars data of the logged in user This method retrieves the specific data of the logged in user to be used in 'Meine Felder' Signed-off-by: Cris --- application/models/system/Message_model.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 0972f127f..6f2a3c7ed 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -210,21 +210,13 @@ class Message_model extends DB_Model } /** - * Get message vars for logged in user - * @param string $uid + * Get message vars data for logged in user * @return array|null */ - public function getMsgVarsDataLoggedInUser() + public function getMsgVarsDataByLoggedInUser() { - $result = $this->db->query('SELECT * FROM public.vw_msg_vars_user WHERE uid = \''. getAuthUID(). '\''); + $query = 'SELECT * FROM public.vw_msg_vars_user WHERE my_uid = ?'; - if ($result) - { - return success($result->list_fields()); - } - else - { - return error($this->db->error(), FHC_DB_ERROR); - } + return $this->execQuery($query, array(getAuthUID())); } } From 4f1796ee9d969812273f1e637d9ad5ad3c657a39 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 28 May 2020 09:48:31 +0200 Subject: [PATCH 008/313] Added logic to add message vars data of logged in user into message body Signed-off-by: Cris --- application/models/CL/Messages_model.php | 39 ++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index 2bec3dd9c..d0676c5dd 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -393,7 +393,10 @@ class Messages_model extends CI_Model // Looping on receivers data foreach (getData($msgVarsData) as $receiver) { - $msgVarsDataArray = $this->_lowerReplaceSpaceArrayKeys((array)$receiver); // replaces array keys + // Merge receivers data with logged in user data + $msgVarsDataArray = $this->_addMsgVarsDataOfLoggedInUser($receiver); + + $msgVarsDataArray = $this->_lowerReplaceSpaceArrayKeys((array)getData($msgVarsDataArray)[0]); // replaces array keys $parsedSubject = parseText($subject, $msgVarsDataArray); $parsedBody = parseText($body, $msgVarsDataArray); @@ -600,6 +603,9 @@ class Messages_model extends CI_Model $parseMessageText = error('The given person_id is not a valid number'); if (is_numeric($person_id)) $parseMessageText = $this->MessageModel->getMsgVarsDataByPersonId($person_id); + + // Add message vars data of the logged in user + $parseMessageText = $this->_addMsgVarsDataOfLoggedInUser($parseMessageText); if (hasData($parseMessageText)) { @@ -623,7 +629,10 @@ class Messages_model extends CI_Model $parseMessageText = error('The given prestudent_id is not a valid number'); if (is_numeric($prestudent_id)) $parseMessageText = $this->MessageModel->getMsgVarsDataByPrestudentId($prestudent_id); - + + // Add message vars data of the logged in user + $parseMessageText = $this->_addMsgVarsDataOfLoggedInUser($parseMessageText); + if (hasData($parseMessageText)) { $parseMessageText = success( @@ -882,4 +891,30 @@ class Messages_model extends CI_Model 'type' => $type ); } + + /** + * Adds message vars data of the logged in user to the given object (that should also have message vars data) + * @param object $otherMsgVarsDataObj Can be success object or simple object. + * @return object Returns success object. + */ + public function _addMsgVarsDataOfLoggedInUser($otherMsgVarsDataObj) + { + // First check if param type is object + if (!is_object($otherMsgVarsDataObj)) show_error('Must pass an object to merge with data of logged in user'); + + // If it is a return object, extract the simple data object + if (isSuccess($otherMsgVarsDataObj)) + { + $otherMsgVarsDataObj = getData($otherMsgVarsDataObj)[0]; + } + + // Retrieve message vars data of the logged in user + if (!$msgVarsDataLoggedInUser = getData($this->MessageModel->getMsgVarsDataByLoggedInUser())[0]) + { + return success($otherMsgVarsDataObj); // If failed, return at least given object as expected success object + } + + return success(array((object)(array_merge((array) $otherMsgVarsDataObj, (array) $msgVarsDataLoggedInUser)))); + + } } From 8b80f2226e63c3b3471082946cdd91113a7540e5 Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 2 Jun 2020 15:03:31 +0200 Subject: [PATCH 009/313] Added logic for cronjob to add senders fields into message body Signed-off-by: Cris --- application/models/CL/Messages_model.php | 25 +++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index d0676c5dd..ac3a16e3e 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -48,6 +48,9 @@ class Messages_model extends CI_Model $this->load->model('system/Benutzerrolle_model', 'BenutzerrolleModel'); // Loads model Prestudent_model $this->load->model('crm/Prestudent_model', 'PrestudentModel'); + // Loads model Benutzer_model + $this->load->model('person/Benutzer_model', 'BenutzerModel'); + } //------------------------------------------------------------------------------------------------------------------ @@ -463,6 +466,14 @@ class Messages_model extends CI_Model if (!hasData($msgVarsData)) show_error('No recipients were given'); $prestudentsData = $this->PrestudentModel->getOrganisationunits($prestudents); + + // Get the senders uid + $this->BenutzerModel->addSelect('uid'); + if (!$result = getData($this->BenutzerModel->getFromPersonId($sender_id))) + { + show_error('No sender_uid found'); + } + $sender_uid = $result[0]->uid; // Adds the organisation unit to each prestudent if (isEmptyString($oe_kurzbz) && hasData($msgVarsData) && hasData($prestudentsData)) @@ -472,7 +483,15 @@ class Messages_model extends CI_Model foreach (getData($msgVarsData) as $receiver) { - $msgVarsDataArray = $this->_lowerReplaceSpaceArrayKeys((array)$receiver); // replaces array keys + /** + * Merge receivers data with senders data + * NOTE: _addMsgVarsDataOfLoggedInUser usually retrieves data of the logged in user that is set in the + * templates user fields. As sendExplicitTemplateSenderId is run by a job, a sender uid is passed to be used + * instead the logged in user. + */ + $msgVarsDataArray = $this->_addMsgVarsDataOfLoggedInUser($receiver, $sender_uid); + + $msgVarsDataArray = $this->_lowerReplaceSpaceArrayKeys((array)getData($msgVarsDataArray)[0]); // replaces array keys // Additional message variables if (is_array($msgVars)) $msgVarsDataArray = array_merge($msgVarsDataArray, $msgVars); @@ -897,7 +916,7 @@ class Messages_model extends CI_Model * @param object $otherMsgVarsDataObj Can be success object or simple object. * @return object Returns success object. */ - public function _addMsgVarsDataOfLoggedInUser($otherMsgVarsDataObj) + public function _addMsgVarsDataOfLoggedInUser($otherMsgVarsDataObj, $uid = null) { // First check if param type is object if (!is_object($otherMsgVarsDataObj)) show_error('Must pass an object to merge with data of logged in user'); @@ -909,7 +928,7 @@ class Messages_model extends CI_Model } // Retrieve message vars data of the logged in user - if (!$msgVarsDataLoggedInUser = getData($this->MessageModel->getMsgVarsDataByLoggedInUser())[0]) + if (!$msgVarsDataLoggedInUser = getData($this->MessageModel->getMsgVarsDataByLoggedInUser($uid))[0]) { return success($otherMsgVarsDataObj); // If failed, return at least given object as expected success object } From d35ee0c834becab5700ba448284864d4b49f749e Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 2 Jun 2020 15:06:22 +0200 Subject: [PATCH 010/313] Adapted method to retrieve user fields when method is called by a cronjob Signed-off-by: Cris --- application/models/system/Message_model.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/application/models/system/Message_model.php b/application/models/system/Message_model.php index 6f2a3c7ed..d9f8585ed 100644 --- a/application/models/system/Message_model.php +++ b/application/models/system/Message_model.php @@ -211,12 +211,23 @@ class Message_model extends DB_Model /** * Get message vars data for logged in user + * @param string uid The UID should ONLY be passed if this method is called by a cronjob. + * This is to enable jobs to use templates which use logged-in-user fields ('Eigene Felder'). * @return array|null */ - public function getMsgVarsDataByLoggedInUser() + public function getMsgVarsDataByLoggedInUser($uid = null) { + if (is_string($uid)) + { + $params = array($uid); + } + else + { + $params = array(getAuthUID()); + } + $query = 'SELECT * FROM public.vw_msg_vars_user WHERE my_uid = ?'; - return $this->execQuery($query, array(getAuthUID())); + return $this->execQuery($query, $params); } } From 2906c1803e9d0caf5cac630730eb1de18ce2cdac Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 2 Jun 2020 16:29:51 +0200 Subject: [PATCH 011/313] Changed 'Eigene Felder'-Alias: if alias is NULL, uid is used as alias This is to ensure the email is built correctly. Signed-off-by: Cris --- system/dbupdate_3.3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index f0da8fab6..f03718116 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -205,7 +205,7 @@ if(!$result = @$db->db_query("SELECT 1 FROM public.vw_msg_vars_user LIMIT 1")) (b.uid) b.uid AS "my_uid", p.vorname AS "my_vorname", p.nachname AS "my_nachname", - b.alias AS "my_alias", + COALESCE(b.alias, b.uid) AS "my_alias", ma.telefonklappe AS "my_durchwahl" FROM public.tbl_person p JOIN public.tbl_benutzer b USING (person_id) From 8304b4a1ae50668156b127e17bda2948a70057aa Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 2 Jun 2020 16:31:52 +0200 Subject: [PATCH 012/313] Adapted GUI: display user fields in tinymce-editor on doubleclick Signed-off-by: Cris --- public/js/messaging/messageWrite.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/public/js/messaging/messageWrite.js b/public/js/messaging/messageWrite.js index 1978fc08c..8b1d73bdf 100644 --- a/public/js/messaging/messageWrite.js +++ b/public/js/messaging/messageWrite.js @@ -78,6 +78,21 @@ $(document).ready(function () }); } + if ($("#user_fields")) + { + $("#user_fields").dblclick(function () + { + if ($("#bodyTextArea")) + { + //if editor active add at cursor position, otherwise at end + if (tinymce.activeEditor.id === "bodyTextArea") + tinymce.activeEditor.execCommand('mceInsertContent', false, $(this).children(":selected").val()); + else + tinyMCE.get("bodyTextArea").setContent(tinyMCE.get("bodyTextArea").getContent() + $(this).children(":selected").val()); + } + }); + } + if ($("#recipients")) { $("#recipients").change(tinymcePreviewSetContent); From 742c9fa8572745b9f7c4a570bf6bb4550eac30df Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 4 Jun 2020 11:33:58 +0200 Subject: [PATCH 013/313] Check that user is an active employee in message-cronjob Signed-off-by: Cris --- application/models/CL/Messages_model.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/models/CL/Messages_model.php b/application/models/CL/Messages_model.php index ac3a16e3e..f24e16086 100644 --- a/application/models/CL/Messages_model.php +++ b/application/models/CL/Messages_model.php @@ -467,8 +467,9 @@ class Messages_model extends CI_Model $prestudentsData = $this->PrestudentModel->getOrganisationunits($prestudents); - // Get the senders uid + // Get the senders uid (if user is an active employee) $this->BenutzerModel->addSelect('uid'); + $this->BenutzerModel->addJoin('public.tbl_mitarbeiter ma', 'ma.mitarbeiter_uid = uid'); if (!$result = getData($this->BenutzerModel->getFromPersonId($sender_id))) { show_error('No sender_uid found'); From 9250485cb37b77eb81ad776c9e133ef3f60ea414 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Thu, 3 Sep 2020 15:22:46 +0200 Subject: [PATCH 014/313] check for time in csv import --- cis/private/tools/zeitaufzeichnung.php | 182 +++++++----- include/projekt.class.php | 391 ++++++++++++++++--------- 2 files changed, 347 insertions(+), 226 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 71fdda2bb..ed146e728 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -689,108 +689,128 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $anzahl = 0; $importtage_array = array(); $ende_vorher = date('Y-m-d H:i:s'); + $projects_of_user = new projekt(); + $projects= $projects_of_user->getProjekteListForMitarbeiter($user); + $project_kurzbz_array = array(); + + foreach($projects as $prjct) + { + array_push($project_kurzbz_array, (string) $prjct->projekt_kurzbz); + } + while(($data = fgetcsv($handle, 1000, ';', '"')) !== FALSE) { - if($data[0] == $user) - { - if (!isset($data[5])) - $data[5] = NULL; - if (!isset($data[6])) - $data[6] = NULL; - if (!isset($data[7])) - $data[7] = NULL; - if (!isset($data[8])) - $data[8] = NULL; - if ($datum->formatDatum($data[2], $format='Y-m-d H:i:s') < $sperrdatum) - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum ('.$data[2].')
'; - //elseif (isset($data[8]) && ( filter_var($data[8], FILTER_VALIDATE_INT) === false )) - //{ - // echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Service ID ist keine Zahl ('.$data[8].')
'; - //} - elseif (checkVals($data[5],$data[6],$data[7],$data[8])) + if($data[0] == $user){ + if(!empty($data[6]) && !in_array($data[6], $project_kurzbz_array)) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Werte ('.$data[2].')
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt nicht zugewiesen sind: ('.$data[6].')
'; } else { - if ($data[1] == 'LehreIntern') - $data[1] = 'Lehre'; - $zeit->new = true; - $zeit->beschreibung = NULL; - $zeit->oe_kurzbz_1 = NULL; - $zeit->projekt_kurzbz = NULL; - $zeit->projektphase_id = NULL; - $zeit->service_id = NULL; - $zeit->insertamum = date('Y-m-d H:i:s'); - $zeit->updateamum = date('Y-m-d H:i:s'); - $zeit->updatevon = $user; - $zeit->insertvon = $user; - $zeit->uid = $data[0]; - $zeit->aktivitaet_kurzbz = $data[1]; - $zeit->start = $datum->formatDatum($data[2], $format='Y-m-d H:i:s'); - $zeit->ende = $datum->formatDatum($data[3], $format='Y-m-d H:i:s'); - if (isset($data[4])) - $zeit->beschreibung = $data[4]; - if (isset($data[5])) - $zeit->oe_kurzbz_1 = $data[5]; - if (isset($data[6])) - $zeit->projekt_kurzbz = $data[6]; - if (isset($data[7])) - $zeit->projektphase_id = $data[7]; - if (isset($data[8])) - $zeit->service_id = $data[8]; - $tag = $datum->formatDatum($data[2], $format='Y-m-d'); - - if(!in_array($tag, $importtage_array)) + if (!isset($data[5])) + $data[5] = NULL; + if (!isset($data[6])) + $data[6] = NULL; + if (!isset($data[7])) + $data[7] = NULL; + if (!isset($data[8])) + $data[8] = NULL; + if ($datum->formatDatum($data[2], $format='Y-m-d H:i:s') < $sperrdatum) + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum ('.$data[2].')
'; + //elseif (isset($data[8]) && ( filter_var($data[8], FILTER_VALIDATE_INT) === false )) + //{ + // echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Service ID ist keine Zahl ('.$data[8].')
'; + //} + elseif (!empty($data[6]) && !$projects_of_user->checkProjectInCorrectTime($data[6], $data[2], $data[3])) { - $importtage_array[] = $tag; - $zeit->deleteEntriesForUser($user, $tag); - $tag_aktuell = $tag; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; + } + elseif (checkVals($data[5],$data[6],$data[7],$data[8])) + { + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Werte ('.$data[2].')
'; } else { - if ($ende_vorher < $zeit->start) + if ($data[1] == 'LehreIntern') + $data[1] = 'Lehre'; + $zeit->new = true; + $zeit->beschreibung = NULL; + $zeit->oe_kurzbz_1 = NULL; + $zeit->projekt_kurzbz = NULL; + $zeit->projektphase_id = NULL; + $zeit->service_id = NULL; + + $zeit->insertamum = date('Y-m-d H:i:s'); + $zeit->updateamum = date('Y-m-d H:i:s'); + $zeit->updatevon = $user; + $zeit->insertvon = $user; + $zeit->uid = $data[0]; + $zeit->aktivitaet_kurzbz = $data[1]; + $zeit->start = $datum->formatDatum($data[2], $format='Y-m-d H:i:s'); + $zeit->ende = $datum->formatDatum($data[3], $format='Y-m-d H:i:s'); + if (isset($data[4])) + $zeit->beschreibung = $data[4]; + if (isset($data[5])) + $zeit->oe_kurzbz_1 = $data[5]; + if (isset($data[6])) + $zeit->projekt_kurzbz = $data[6]; + if (isset($data[7])) + $zeit->projektphase_id = $data[7]; + if (isset($data[8])) + $zeit->service_id = $data[8]; + $tag = $datum->formatDatum($data[2], $format='Y-m-d'); + + if(!in_array($tag, $importtage_array)) { - $pause = new zeitaufzeichnung(); - $pause->new = true; - $pause->insertamum = date('Y-m-d H:i:s'); - $pause->updateamum = date('Y-m-d H:i:s'); - $pause->updatevon = $user; - $pause->insertvon = $user; - $pause->uid = $user; - $pause->aktivitaet_kurzbz = 'Pause'; - $pause->start = $ende_vorher; - $pause->ende = $zeit->start; - $pause->beschreibung = ''; - if(!$pause->save()) + $importtage_array[] = $tag; + $zeit->deleteEntriesForUser($user, $tag); + $tag_aktuell = $tag; + } + else + { + if ($ende_vorher < $zeit->start) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg.'
'; + $pause = new zeitaufzeichnung(); + $pause->new = true; + $pause->insertamum = date('Y-m-d H:i:s'); + $pause->updateamum = date('Y-m-d H:i:s'); + $pause->updatevon = $user; + $pause->insertvon = $user; + $pause->uid = $user; + $pause->aktivitaet_kurzbz = 'Pause'; + $pause->start = $ende_vorher; + $pause->ende = $zeit->start; + $pause->beschreibung = ''; + if(!$pause->save()) + { + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$pause->errormsg.'
'; + } } } - } - $ende_vorher = $zeit->ende; - if($data[2] != $data[3]) - { - /* - if ($data[1] == 'LehreExtern') + $ende_vorher = $zeit->ende; + if($data[2] != $data[3]) { - $zeit->start = date('Y-m-d H:i:s', strtotime('+2 seconds', strtotime($data[2]))); - $zeit->ende = date('Y-m-d H:i:s', strtotime('-2 seconds', strtotime($data[3]))); - } - */ - if(!$zeit->save()) - { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'('.$zeit->start.')
'; + /* + if ($data[1] == 'LehreExtern') + { + $zeit->start = date('Y-m-d H:i:s', strtotime('+2 seconds', strtotime($data[2]))); + $zeit->ende = date('Y-m-d H:i:s', strtotime('-2 seconds', strtotime($data[3]))); + } + */ + if(!$zeit->save()) + { + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': '.$zeit->errormsg.'('.$zeit->start.')
'; + } + else + $anzahl++; } else $anzahl++; - } - else - $anzahl++; - } + } + } } else if (strpos($data[0],'#') === false) { diff --git a/include/projekt.class.php b/include/projekt.class.php index 92a3129ec..d1cd49661 100644 --- a/include/projekt.class.php +++ b/include/projekt.class.php @@ -28,26 +28,25 @@ require_once(dirname(__FILE__).'/basis_db.class.php'); class projekt extends basis_db { - public $new; // boolean - public $result = array(); // projekt Objekt + public $new; // boolean + public $result = array(); // projekt Objekt //Tabellenspalten - public $projekt_kurzbz; // string - public $nummer; // string - public $titel; // string - public $beschreibung; // string - public $beginn; // date - public $ende; // date - public $oe_kurzbz; // string - public $insertamum; // timestamp - public $insertvon; // string - public $updateamum; // timestamp - public $updatevon; // string + public $projekt_kurzbz; // string + public $nummer; // string + public $titel; // string + public $beschreibung; // string + public $beginn; // date + public $ende; // date + public $oe_kurzbz; // string + public $insertamum; // timestamp + public $insertvon; // string + public $updateamum; // timestamp + public $updatevon; // string public $budget; public $farbe; - public $anzahl_ma; // integer - public $aufwand_pt; // integer - + public $anzahl_ma; // integer + public $aufwand_pt; // integer /** @@ -58,23 +57,21 @@ class projekt extends basis_db { parent::__construct(); - if($projekt_kurzbz != null) + if ($projekt_kurzbz != null) $this->load($projekt_kurzbz); } /** * Laedt die Projek mit der Kurzbezeichnung $projekt_kurzbz - * @param string $projekt_kurzbz Kurzbz des Projekts. + * @param string $projekt_kurzbz Kurzbz des Projekts. * @return true wenn ok, false im Fehlerfall */ public function load($projekt_kurzbz) { - $qry = "SELECT * FROM fue.tbl_projekt WHERE projekt_kurzbz=".$this->db_add_param($projekt_kurzbz); + $qry = "SELECT * FROM fue.tbl_projekt WHERE projekt_kurzbz=" . $this->db_add_param($projekt_kurzbz); - if ($this->db_query($qry)) - { - if ($row = $this->db_fetch_object()) - { + if ($this->db_query($qry)) { + if ($row = $this->db_fetch_object()) { $this->projekt_kurzbz = $row->projekt_kurzbz; $this->nummer = $row->nummer; $this->titel = $row->titel; @@ -89,43 +86,39 @@ class projekt extends basis_db return true; } - else - { + else { $this->errormsg = 'Datensatz wurde nicht gefunden'; return false; } } - else - { + else { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } } - /** - * Laedt alle aktuellen Projekte - * @param bool $filter_kommende Lädt auch alle zukünftigen. + /** + * Laedt alle aktuellen Projekte + * @param bool $filter_kommende Lädt auch alle zukünftigen. * @param string $oe Organisationseinheit. - * @return bool - */ - public function getProjekteAktuell($filter_kommende = false, $oe = null) - { - $qry = 'SELECT * FROM fue.tbl_projekt WHERE '; + * @return bool + */ + public function getProjekteAktuell($filter_kommende = false, $oe = null) + { + $qry = 'SELECT * FROM fue.tbl_projekt WHERE '; - if($filter_kommende) - $qry .= " ((beginn < CURRENT_TIMESTAMP AND ende > CURRENT_TIMESTAMP) OR beginn > CURRENT_TIMESTAMP)"; - else - $qry .= " (beginn < CURRENT_TIMESTAMP AND ende > CURRENT_TIMESTAMP)"; + if ($filter_kommende) + $qry .= " ((beginn < CURRENT_TIMESTAMP AND ende > CURRENT_TIMESTAMP) OR beginn > CURRENT_TIMESTAMP)"; + else + $qry .= " (beginn < CURRENT_TIMESTAMP AND ende > CURRENT_TIMESTAMP)"; - if (!is_null($oe)) - $qry .= ' AND oe_kurzbz='.$this->db_add_param($oe); + if (!is_null($oe)) + $qry .= ' AND oe_kurzbz=' . $this->db_add_param($oe); - $qry .= ' ORDER BY oe_kurzbz;'; - if ($this->db_query($qry)) - { - while ($row = $this->db_fetch_object()) - { + $qry .= ' ORDER BY oe_kurzbz;'; + if ($this->db_query($qry)) { + while ($row = $this->db_fetch_object()) { $obj = new projekt(); $obj->projekt_kurzbz = $row->projekt_kurzbz; @@ -145,31 +138,28 @@ class projekt extends basis_db } return true; } - else - { + else { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } - } + } - /** - * Laedt alle Projekte die zwischen beginn und ende liegen - * @param date $beginn Anfang. - * @param date $ende Ende. - * @param string $oe Organisationseinheit. - * @return bool - */ - public function getProjekteInZeitraum($beginn, $ende, $oe = null) - { - $qry = 'select * from fue.tbl_projekt where beginn <= '.$this->db_add_param($ende).' and ende >= '.$this->db_add_param($beginn); + /** + * Laedt alle Projekte die zwischen beginn und ende liegen + * @param date $beginn Anfang. + * @param date $ende Ende. + * @param string $oe Organisationseinheit. + * @return bool + */ + public function getProjekteInZeitraum($beginn, $ende, $oe = null) + { + $qry = 'select * from fue.tbl_projekt where beginn <= ' . $this->db_add_param($ende) . ' and ende >= ' . $this->db_add_param($beginn); if (!is_null($oe)) - $qry .= " AND oe_kurzbz=".$this->db_add_param($oe); + $qry .= " AND oe_kurzbz=" . $this->db_add_param($oe); $qry .= ' ORDER BY oe_kurzbz;'; //echo $qry; - if ($this->db_query($qry)) - { - while ($row = $this->db_fetch_object()) - { + if ($this->db_query($qry)) { + while ($row = $this->db_fetch_object()) { $obj = new projekt(); $obj->projekt_kurzbz = $row->projekt_kurzbz; @@ -188,12 +178,11 @@ class projekt extends basis_db } return true; } - else - { + else { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } - } + } /** @@ -205,13 +194,11 @@ class projekt extends basis_db { $qry = 'SELECT * FROM fue.tbl_projekt'; if (!is_null($oe)) - $qry .= " WHERE oe_kurzbz=".$this->db_add_param($oe); + $qry .= " WHERE oe_kurzbz=" . $this->db_add_param($oe); $qry .= ' ORDER BY oe_kurzbz;'; //echo $qry; - if ($this->db_query($qry)) - { - while ($row = $this->db_fetch_object()) - { + if ($this->db_query($qry)) { + while ($row = $this->db_fetch_object()) { $obj = new projekt(); $obj->projekt_kurzbz = $row->projekt_kurzbz; @@ -231,8 +218,7 @@ class projekt extends basis_db } return true; } - else - { + else { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } @@ -245,26 +231,21 @@ class projekt extends basis_db protected function validate() { //Gesamtlaenge pruefen - if ($this->projekt_kurzbz == null) - { + if ($this->projekt_kurzbz == null) { $this->errormsg = 'Projekt kurzbz darf nicht NULL sein!'; } - if ($this->oe_kurzbz == null) - { + if ($this->oe_kurzbz == null) { $this->errormsg = 'OE kurbz darf nicht NULL sein!'; } - if (mb_strlen($this->projekt_kurzbz) > 16) - { + if (mb_strlen($this->projekt_kurzbz) > 16) { $this->errormsg = 'Projektyp_kurzbz darf nicht länger als 16 Zeichen sein'; return false; } - if (mb_strlen($this->nummer) > 8) - { + if (mb_strlen($this->nummer) > 8) { $this->errormsg = 'Nummer darf nicht länger als 8 Zeichen sein'; return false; } - if (mb_strlen($this->titel) > 256) - { + if (mb_strlen($this->titel) > 256) { $this->errormsg = 'Titel darf nicht länger als 256 Zeichen sein'; return false; } @@ -283,56 +264,52 @@ class projekt extends basis_db public function save($new = null) { //Variablen pruefen - if(!$this->validate()) + if (!$this->validate()) return false; if ($new == null) $new = $this->new; - if ($new) - { + if ($new) { //Neuen Datensatz einfuegen - $qry = 'INSERT INTO fue.tbl_projekt (projekt_kurzbz, nummer, titel,beschreibung, beginn, ende, budget, farbe, oe_kurzbz, aufwand_pt, anzahl_ma, aufwandstyp_kurzbz) VALUES('. - $this->db_add_param($this->projekt_kurzbz).', '. - $this->db_add_param($this->nummer).', '. - $this->db_add_param($this->titel).', '. - $this->db_add_param($this->beschreibung).', '. - $this->db_add_param($this->beginn).', '. - $this->db_add_param($this->ende).', '. - $this->db_add_param($this->budget).', '. - $this->db_add_param($this->farbe).', '. - $this->db_add_param($this->oe_kurzbz).','. - $this->db_add_param($this->aufwand_pt).','. - $this->db_add_param($this->anzahl_ma).','. - $this->db_add_param($this->aufwandstyp_kurzbz).');'; + $qry = 'INSERT INTO fue.tbl_projekt (projekt_kurzbz, nummer, titel,beschreibung, beginn, ende, budget, farbe, oe_kurzbz, aufwand_pt, anzahl_ma, aufwandstyp_kurzbz) VALUES(' . + $this->db_add_param($this->projekt_kurzbz) . ', ' . + $this->db_add_param($this->nummer) . ', ' . + $this->db_add_param($this->titel) . ', ' . + $this->db_add_param($this->beschreibung) . ', ' . + $this->db_add_param($this->beginn) . ', ' . + $this->db_add_param($this->ende) . ', ' . + $this->db_add_param($this->budget) . ', ' . + $this->db_add_param($this->farbe) . ', ' . + $this->db_add_param($this->oe_kurzbz) . ',' . + $this->db_add_param($this->aufwand_pt) . ',' . + $this->db_add_param($this->anzahl_ma) . ',' . + $this->db_add_param($this->aufwandstyp_kurzbz) . ');'; } - else - { + else { //Updaten des bestehenden Datensatzes - $qry = 'UPDATE fue.tbl_projekt SET '. - 'projekt_kurzbz='.$this->db_add_param($this->projekt_kurzbz).', '. - 'nummer='.$this->db_add_param($this->nummer).', '. - 'titel='.$this->db_add_param($this->titel).', '. - 'beschreibung='.$this->db_add_param($this->beschreibung).', '. - 'beginn='.$this->db_add_param($this->beginn).', '. - 'ende='.$this->db_add_param($this->ende).', '. - 'budget='.$this->db_add_param($this->budget).', '. - 'farbe='.$this->db_add_param($this->farbe).', '. - 'oe_kurzbz='.$this->db_add_param($this->oe_kurzbz).', '. - 'anzahl_ma='.$this->db_add_param($this->anzahl_ma).', '. - 'aufwand_pt='.$this->db_add_param($this->aufwand_pt).', '. - 'aufwandstyp_kurzbz='.$this->db_add_param($this->aufwandstyp_kurzbz).' '. - 'WHERE projekt_kurzbz='.$this->db_add_param($this->projekt_kurzbz).';'; + $qry = 'UPDATE fue.tbl_projekt SET ' . + 'projekt_kurzbz=' . $this->db_add_param($this->projekt_kurzbz) . ', ' . + 'nummer=' . $this->db_add_param($this->nummer) . ', ' . + 'titel=' . $this->db_add_param($this->titel) . ', ' . + 'beschreibung=' . $this->db_add_param($this->beschreibung) . ', ' . + 'beginn=' . $this->db_add_param($this->beginn) . ', ' . + 'ende=' . $this->db_add_param($this->ende) . ', ' . + 'budget=' . $this->db_add_param($this->budget) . ', ' . + 'farbe=' . $this->db_add_param($this->farbe) . ', ' . + 'oe_kurzbz=' . $this->db_add_param($this->oe_kurzbz) . ', ' . + 'anzahl_ma=' . $this->db_add_param($this->anzahl_ma) . ', ' . + 'aufwand_pt=' . $this->db_add_param($this->aufwand_pt) . ', ' . + 'aufwandstyp_kurzbz=' . $this->db_add_param($this->aufwandstyp_kurzbz) . ' ' . + 'WHERE projekt_kurzbz=' . $this->db_add_param($this->projekt_kurzbz) . ';'; } - if ($this->db_query($qry)) - { + if ($this->db_query($qry)) { return true; } - else - { + else { $this->errormsg = 'Fehler beim Speichern der Daten'; return false; } @@ -345,14 +322,12 @@ class projekt extends basis_db */ public function delete($projekt_kurzbz) { - $qry = "DELETE FROM lehre.tbl_projek WHERE projekt_kurzbz=".$this->db_add_param($projekt_kurzbz); + $qry = "DELETE FROM lehre.tbl_projek WHERE projekt_kurzbz=" . $this->db_add_param($projekt_kurzbz); - if ($this->db_query($qry)) - { + if ($this->db_query($qry)) { return true; } - else - { + else { $this->errormsg = 'Fehler beim Loeschen des Datensatzes'; return false; } @@ -367,7 +342,7 @@ class projekt extends basis_db */ function getProjekteMitarbeiter($mitarbeiter_uid, $projektphasen = false) { - $qry = "SELECT DISTINCT + $qry = "SELECT DISTINCT tbl_projekt.* FROM fue.tbl_ressource @@ -377,12 +352,12 @@ class projekt extends basis_db AND (ende + interval '1 month 1 day' >=now() OR ende is null) AND ( - mitarbeiter_uid=".$this->db_add_param($mitarbeiter_uid)." OR - student_uid=".$this->db_add_param($mitarbeiter_uid)." + mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid) . " OR + student_uid=" . $this->db_add_param($mitarbeiter_uid) . " )"; - if ($projektphasen == true) - $qry .= "UNION + if ($projektphasen == true) + $qry .= "UNION SELECT DISTINCT tbl_projekt.* @@ -401,12 +376,10 @@ class projekt extends basis_db AND (tbl_projektphase.ende + interval '1 month 1 day' >=now() OR tbl_projektphase.ende is null) ) ) - AND mitarbeiter_uid=".$this->db_add_param($mitarbeiter_uid); + AND mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid); - if ($result = $this->db_query($qry)) - { - while ($row = $this->db_fetch_object($result)) - { + if ($result = $this->db_query($qry)) { + while ($row = $this->db_fetch_object($result)) { $obj = new projekt(); $obj->projekt_kurzbz = $row->projekt_kurzbz; @@ -421,22 +394,90 @@ class projekt extends basis_db } return true; } - else - { + else { $this->erromsg = 'Fehler beim Laden der Daten'; return false; } } + + /** + * Liefert Ein Array mit Porjekten von allen Projekten des Mitarbeiters mit UID. + * Optional auch mit den Zuteilungen zu Projektphasen. + * @param string $mitarbeiter_uid MitarbeiterUID. + * @param bool $projektphasen Default false. Wenn true, werden auch Zuteilungen zu Projektphasen geliefert. + * @return array wenn ok, false im Fehlerfall + */ + function getProjekteListForMitarbeiter($mitarbeiter_uid, $projektphasen = false) + { + $projectList = array(); + $qry = "SELECT DISTINCT + tbl_projekt.* + FROM + fue.tbl_ressource + JOIN fue.tbl_projekt_ressource USING(ressource_id) + JOIN fue.tbl_projekt USING(projekt_kurzbz) + WHERE (beginn<=now() or beginn is null) + AND (ende + interval '1 month 1 day' >=now() OR ende is null) + AND + ( + mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid) . " OR + student_uid=" . $this->db_add_param($mitarbeiter_uid) . " + )"; + + if ($projektphasen == true) + $qry .= "UNION + + SELECT DISTINCT + tbl_projekt.* + FROM + fue.tbl_projektphase + JOIN fue.tbl_projekt USING (projekt_kurzbz) + JOIN fue.tbl_projekt_ressource USING (projektphase_id) + JOIN fue.tbl_ressource ON (tbl_ressource.ressource_id=tbl_projekt_ressource.ressource_id) + WHERE + ( + ( + (tbl_projekt.beginn<=now() or tbl_projekt.beginn is null) + AND (tbl_projekt.ende + interval '1 month 1 day' >=now() OR tbl_projekt.ende is null) + ) OR ( + (tbl_projektphase.start<=now() or tbl_projektphase.start is null) + AND (tbl_projektphase.ende + interval '1 month 1 day' >=now() OR tbl_projektphase.ende is null) + ) + ) + AND mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid); + + if ($result = $this->db_query($qry)) { + while ($row = $this->db_fetch_object($result)) { + $obj = new projekt(); + + $obj->projekt_kurzbz = $row->projekt_kurzbz; + $obj->nummer = $row->nummer; + $obj->titel = $row->titel; + $obj->beschreibung = $row->beschreibung; + $obj->beginn = $row->beginn; + $obj->ende = $row->ende; + $obj->oe_kurzbz = $row->oe_kurzbz; + + $this->result[] = $obj; + + array_push($projectList, $obj); + } + return $projectList; + } + else { + $this->erromsg = 'Fehler beim Laden der Daten'; + return false; + } + } + public function getProjektFromBestellung($bestellung_id) { $qry = "select * from fue.tbl_projekt join wawi.tbl_projekt_bestellung USING (projekt_kurzbz) - where bestellung_id= ".$this->db_add_param($bestellung_id); + where bestellung_id= " . $this->db_add_param($bestellung_id); - if ($this->db_query($qry)) - { - if ($row = $this->db_fetch_object()) - { + if ($this->db_query($qry)) { + if ($row = $this->db_fetch_object()) { $this->projekt_kurzbz = $row->projekt_kurzbz; $this->nummer = $row->nummer; $this->titel = $row->titel; @@ -451,17 +492,77 @@ class projekt extends basis_db return true; } - else - { + else { $this->errormsg = 'Datensatz wurde nicht gefunden'; return false; } } - else + else { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } + + /** + * Liefert True zurück wenn die angegebenen Start und Endzeitpunkt der Arbeitsdauer in die Projektdauer fallen + * @param string $mitarbeiter_uid MitarbeiterUID. + * @param bool $projektphasen Default false. Wenn true, werden auch Zuteilungen zu Projektphasen geliefert. + * @return array wenn ok, false im Fehlerfall + */ + public function checkProjectInCorrectTime($projekt_kurzbz, $give_project_start, $give_projekt_ende) + { + try { + $projekt = $this->getProjectByKurzbz($projekt_kurzbz); + if(strtotime($projekt->beginn)) + $projekt_start = date('Y-m-d', strtotime($projekt->beginn)); + else + $projekt_start = NULL; + if(strtotime($projekt->ende)) + $projekt_ende = date('Y-m-d', strtotime($projekt->ende)); + else + $projekt_ende = NULL; + + $given_start = date('Y-m-d', strtotime($give_project_start)); + $given_ende = date('Y-m-d', strtotime($give_projekt_ende)); + + var_dump($projekt_start,$given_start); + var_dump($projekt_ende,$given_ende); + if ((empty($projekt_start) || $given_start >= $projekt_start) && (empty($projekt_ende) || $given_ende <= $projekt_ende)) + return true; + else + return false; + + } + catch (Exception $e) + { + echo 'Exception abgefangen: ', $e->getMessage(), "\n"; + } + } + + public function getProjectByKurzbz($projekt_kurzbz) + { + $qry = "SELECT * FROM fue.tbl_projekt + WHERE projekt_kurzbz=".$this->db_add_param($projekt_kurzbz); + if ($result = $this->db_query($qry)) { + $row = $this->db_fetch_object($result); + $obj = new projekt(); + + $obj->projekt_kurzbz = $row->projekt_kurzbz; + $obj->nummer = $row->nummer; + $obj->titel = $row->titel; + $obj->beschreibung = $row->beschreibung; + $obj->beginn = $row->beginn; + $obj->ende = $row->ende; + $obj->oe_kurzbz = $row->oe_kurzbz; + + return $obj; + } + else { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } } } + ?> From 6c857b7c24717d224d265317c9c132b0397aa751 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Thu, 3 Sep 2020 15:25:33 +0200 Subject: [PATCH 015/313] cleanup var_dump --- include/projekt.class.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/projekt.class.php b/include/projekt.class.php index d1cd49661..036a90bf0 100644 --- a/include/projekt.class.php +++ b/include/projekt.class.php @@ -526,8 +526,6 @@ class projekt extends basis_db $given_start = date('Y-m-d', strtotime($give_project_start)); $given_ende = date('Y-m-d', strtotime($give_projekt_ende)); - var_dump($projekt_start,$given_start); - var_dump($projekt_ende,$given_ende); if ((empty($projekt_start) || $given_start >= $projekt_start) && (empty($projekt_ende) || $given_ende <= $projekt_ende)) return true; else From 2e44f58df9cc8d0f03a313c08620f28b35e79200 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Mon, 7 Sep 2020 16:11:17 +0200 Subject: [PATCH 016/313] check time in project for user input --- cis/private/tools/zeitaufzeichnung.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index ed146e728..ba554f5e7 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -672,6 +672,14 @@ function checkVals ($oe_val, $project_val, $phase_val, $service_val) if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) { $zeit = new zeitaufzeichnung(); + $projects_of_user = new projekt(); + $projects= $projects_of_user->getProjekteListForMitarbeiter($user); + $project_kurzbz_array = array(); + + foreach($projects as $prjct) + { + array_push($project_kurzbz_array, (string) $prjct->projekt_kurzbz); + } if ($_FILES['csv']['error'] == 0 && isset($_POST['import'])) { @@ -689,14 +697,14 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $anzahl = 0; $importtage_array = array(); $ende_vorher = date('Y-m-d H:i:s'); - $projects_of_user = new projekt(); + /*$projects_of_user = new projekt(); $projects= $projects_of_user->getProjekteListForMitarbeiter($user); $project_kurzbz_array = array(); foreach($projects as $prjct) { array_push($project_kurzbz_array, (string) $prjct->projekt_kurzbz); - } + }*/ while(($data = fgetcsv($handle, 1000, ';', '"')) !== FALSE) { @@ -832,7 +840,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) } } else if ($datum->formatDatum($von, $format='Y-m-d H:i:s') < $sperrdatum) - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum'; + echo '' .$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum'; else if (isset($_POST['save']) || isset($_POST['edit'])) { @@ -864,7 +872,12 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $zeit->service_id = $service_id; $zeit->kunde_uid = $kunde_uid; $saveerror = 0; - if (isset($_POST['genPause']) && (isset($_POST['save']) || isset($_POST['edit']))) + if (!$projects_of_user->checkProjectInCorrectTime($projekt_kurzbz, $datum->formatDatum($von, $format='Y-m-d'), $datum->formatDatum($bis, $format='Y-m-d'))) + { + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; + $saveerror = 1; + } + elseif (isset($_POST['genPause']) && (isset($_POST['save']) || isset($_POST['edit']))) { $p_start = $datum->formatDatum($von_pause, $format='Y-m-d H:i:s'); From 37884b1f7e96b1f713f0866ba20e0b5a8906e189 Mon Sep 17 00:00:00 2001 From: Oliiver Date: Tue, 8 Sep 2020 09:49:57 +0200 Subject: [PATCH 017/313] cleanup code --- cis/private/tools/zeitaufzeichnung.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index ba554f5e7..d5ace925a 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1,5 +1,5 @@ getProjekteListForMitarbeiter($user); - $project_kurzbz_array = array(); - - foreach($projects as $prjct) - { - array_push($project_kurzbz_array, (string) $prjct->projekt_kurzbz); - }*/ while(($data = fgetcsv($handle, 1000, ';', '"')) !== FALSE) { From e4f3139205a89f6ed969a51dd7696e9be97b57a7 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Wed, 9 Sep 2020 10:50:42 +0200 Subject: [PATCH 018/313] impliment zeitaufzeichnungs checks --- cis/private/tools/zeitaufzeichnung.php | 10 +-- include/projekt.class.php | 2 +- include/projektphase.class.php | 86 +++++++++++++++++++++++++- 3 files changed, 92 insertions(+), 6 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index ba554f5e7..a114eef40 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -680,6 +680,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) { array_push($project_kurzbz_array, (string) $prjct->projekt_kurzbz); } + $projectphase = new projektphase(); if ($_FILES['csv']['error'] == 0 && isset($_POST['import'])) { @@ -726,10 +727,6 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $data[8] = NULL; if ($datum->formatDatum($data[2], $format='Y-m-d H:i:s') < $sperrdatum) echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum ('.$data[2].')
'; - //elseif (isset($data[8]) && ( filter_var($data[8], FILTER_VALIDATE_INT) === false )) - //{ - // echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Service ID ist keine Zahl ('.$data[8].')
'; - //} elseif (!empty($data[6]) && !$projects_of_user->checkProjectInCorrectTime($data[6], $data[2], $data[3])) { echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; @@ -877,6 +874,11 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; $saveerror = 1; } + elseif (!$projectphase->checkProjectphaseInCorrectTime($projektphase_id, $datum->formatDatum($von, $format='Y-m-d'), $datum->formatDatum($bis, $format='Y-m-d'))) + { + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt.
'; + $saveerror = 1; + } elseif (isset($_POST['genPause']) && (isset($_POST['save']) || isset($_POST['edit']))) { diff --git a/include/projekt.class.php b/include/projekt.class.php index 036a90bf0..304d6d4ab 100644 --- a/include/projekt.class.php +++ b/include/projekt.class.php @@ -25,7 +25,7 @@ * @param string $projekt_kurzbz primary key Projektname. */ require_once(dirname(__FILE__).'/basis_db.class.php'); - +error_reporting(E_ALL ^ E_NOTICE); class projekt extends basis_db { public $new; // boolean diff --git a/include/projektphase.class.php b/include/projektphase.class.php index 81de4e095..8d96c92af 100644 --- a/include/projektphase.class.php +++ b/include/projektphase.class.php @@ -24,7 +24,7 @@ */ require_once(dirname(__FILE__).'/basis_db.class.php'); require_once(dirname(__FILE__).'/projekttask.class.php'); - +error_reporting(E_ALL ^ E_NOTICE); class projektphase extends basis_db { public $new; // boolean @@ -572,6 +572,90 @@ class projektphase extends basis_db else return false; } + + public function checkProjectphaseInCorrectTime($projektphase_id, $given_projectphase_start, $given_projektphase_ende) + { + try + { + $projektphase = $this->getProjectphaseById($projektphase_id); + if(strtotime($projektphase->beginn)) + $projektphase_start = date('Y-m-d', strtotime($projektphase->beginn)); + else + $projektphase_start = NULL; + if(strtotime($projektphase->ende)) + $projektphase_ende = date('Y-m-d', strtotime($projektphase->ende)); + else + $projektphase_ende = NULL; + + $given_start = date('Y-m-d', strtotime($given_projectphase_start)); + $given_ende = date('Y-m-d', strtotime($given_projektphase_ende)); + + if ((empty($projektphase_start) || $given_start >= $projektphase_start) && (empty($projektphase_ende) || $given_ende <= $projektphase_ende)) + return true; + else + return false; + + } + catch (Exception $e) + { + echo 'Exception abgefangen: ', $e->getMessage(), "\n"; + } + } + + /** + * Laedt die Projektphase mit der ID $projektphase_id + * @param $projektphase_id ID der zu ladenden Projektphase + * @return true wenn ok, false im Fehlerfall + */ + public function getProjectphaseById($projektphase_id) + { + if(!is_numeric($projektphase_id)) + { + $this->errormsg = 'Projektarbeit_id muss eine gueltige Zahl sein'; + return false; + } + + $qry = "SELECT tbl_projektphase.*, tbl_ressource.bezeichnung AS ressource_bezeichnung + FROM fue.tbl_projektphase LEFT OUTER JOIN fue.tbl_ressource USING (ressource_id) + WHERE projektphase_id=".$this->db_add_param($projektphase_id, FHC_INTEGER); + + if($this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + { + $obj = new projektphase(); + $obj->projekt_kurzbz = $row->projekt_kurzbz; + $obj->projektphase_id = $row->projektphase_id; + $obj->projektphase_fk = $row->projektphase_fk; + $obj->bezeichnung = $row->bezeichnung; + $obj->typ = $row->typ; + $obj->beschreibung = $row->beschreibung; + $obj->start = $row->start; + $obj->ende = $row->ende; + $obj->personentage = $row->personentage; + $obj->farbe = $row->farbe; + $obj->budget = $row->budget; + $obj->ressource_id = $row->ressource_id; + $obj->ressource_bezeichnung = $row->ressource_bezeichnung; + $obj->insertamum = $row->insertamum; + $obj->insertvon = $row->insertvon; + $obj->updateamum = $row->updateamum; + $obj->updatevon = $row->updatevon; + + return $obj; + } + else + { + $this->errormsg = 'Datensatz wurde nicht gefunden'; + return false; + } + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } } ?> From 2e8ed786f456cd4392300bdf83bfc37518adc455 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Wed, 9 Sep 2020 13:05:28 +0200 Subject: [PATCH 019/313] impliment export --- cis/private/tools/zeitaufzeichnung.php | 87 +++++++++++++++++++++++++- 1 file changed, 86 insertions(+), 1 deletion(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 8c4588893..5831ebecf 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -166,6 +166,12 @@ if(isset($_POST['export'])) } } +//CSV export für Übersicht zugeteilter Projekte - Konflikt mit normalen HTML headern deshalb weiter vorne +if(isset($_POST['projektübersichtexport'])) +{ + exportProjectOverviewAsCSV($user, ','); +} + echo ' @@ -1048,7 +1054,9 @@ if($projekt->getProjekteMitarbeiter($user, true)) CSV Import | - CSV Export"; + CSV Export | + + Projektübersichtexport"; if($anzprojekte > 0) echo " | ".$p->t("zeitaufzeichnung/projektexport").""; echo " @@ -1134,6 +1142,17 @@ if($projekt->getProjekteMitarbeiter($user, true)) echo ''; } + if (isset($_GET['projektübersichtexport'])) + { + echo '
'; + echo '
'; + echo 'CSV-Export'; + echo ''; + echo ''; + echo '
'; + echo '
'; + } + //Aktivitaet echo ''; echo ''.$p->t("zeitaufzeichnung/aktivitaet").''; @@ -1886,4 +1905,70 @@ function getZeitaufzeichnung($user, $von, $bis) return $za; } +/** + * Exportiert Zeitaufzeichnungsdaten als CSV + * @param $data Zeitaufzeichnungsdaten + * @param string $delimiter CSV-Trennzeichen + * @param $fieldheadings Namen der Spaltenüberschriften + * @param bool $za_simple Zeitaufzeichnung lang (für Infrastrukturmitarbeiter) oder kurz (simple) + * @param $uid Id des Users für CSV-Filenamen "zeitaufzeichnung_uid" + */ +function exportProjectOverviewAsCSV($user, $delimiter = ',') +{ + + $filename = "projektUebersicht_".$user.".csv"; + header('Content-type: text/csv; charset=utf-8'); + header('Content-Disposition: attachment; filename='.$filename); + + $file = fopen('php://output', 'w'); + $towrite = getDataForProjectOverviewCSV($user); + foreach ($towrite as $row) + { + fputcsv($file, $row, $delimiter); + } + fclose($file); + //Abbruch damit HTML markup danach nicht mit exportiert wird + exit(); +} + +function getDataForProjectOverviewCSV($user) +{ + $projects_of_user = new projekt(); + $projects= $projects_of_user->getProjekteListForMitarbeiter($user); + + $csvData = array(); + //headers schreiben + $csvData[] = array('PROJEKT', 'PROJEKT KURZBEZEICHNUNG', 'PROJEKTPHASE', 'START', 'PROJEKT ENDE'); + foreach ($projects as $project) + { + //Newline characters bei Beschreibung ersetzen + $titel = $project->titel; + $projekt_kurzbz = $project->projekt_kurzbz; + $projekt_phase = ''; + $beginn = $project->beginn; + $ende = $project->ende; + + $csvData[] = array($titel, $projekt_kurzbz,$projekt_phase, $beginn, $ende); + + $projektphasen = new projektphase($projekt_kurzbz); + + if($projektphasen->getProjektphasen($projekt_kurzbz)) + { + foreach($projektphasen->result as $projektphase) + { + $projekt_phase = $projektphase->bezeichnung; + if(!empty($projektphase->beginn)) + $beginn = $projektphase->beginn; + else + $beginn = $project->beginn; + if(!empty($projektphase->ende)) + $ende = $projektphase->ende; + else + $ende = $project->ende; + $csvData[] = array($titel, $projekt_kurzbz,$projekt_phase, $beginn, $ende); + } + } + } + return $csvData; +} ?> From e933cce0e890bfe610c6b7164e071a37a38a6039 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Thu, 10 Sep 2020 09:29:39 +0200 Subject: [PATCH 020/313] add project ID to csv export --- cis/private/tools/zeitaufzeichnung.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 5831ebecf..6ee3e35cd 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1938,17 +1938,18 @@ function getDataForProjectOverviewCSV($user) $csvData = array(); //headers schreiben - $csvData[] = array('PROJEKT', 'PROJEKT KURZBEZEICHNUNG', 'PROJEKTPHASE', 'START', 'PROJEKT ENDE'); + $csvData[] = array('PROJEKT', 'PROJEKT KURZBEZEICHNUNG', 'PROJEKTPHASE', 'PROJEKTPHASEN ID', 'START', 'PROJEKT ENDE'); foreach ($projects as $project) { //Newline characters bei Beschreibung ersetzen $titel = $project->titel; $projekt_kurzbz = $project->projekt_kurzbz; $projekt_phase = ''; + $projekt_phase_id = ''; $beginn = $project->beginn; $ende = $project->ende; - $csvData[] = array($titel, $projekt_kurzbz,$projekt_phase, $beginn, $ende); + $csvData[] = array($titel, $projekt_kurzbz,$projekt_phase,$projekt_phase_id, $beginn, $ende); $projektphasen = new projektphase($projekt_kurzbz); @@ -1957,6 +1958,7 @@ function getDataForProjectOverviewCSV($user) foreach($projektphasen->result as $projektphase) { $projekt_phase = $projektphase->bezeichnung; + $projekt_phase_id = $projektphase->projektphase_id; if(!empty($projektphase->beginn)) $beginn = $projektphase->beginn; else @@ -1965,7 +1967,7 @@ function getDataForProjectOverviewCSV($user) $ende = $projektphase->ende; else $ende = $project->ende; - $csvData[] = array($titel, $projekt_kurzbz,$projekt_phase, $beginn, $ende); + $csvData[] = array($titel, $projekt_kurzbz,$projekt_phase, $projekt_phase_id, $beginn, $ende); } } } From 612c339305dc5316608802131da9e795e019b555 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Thu, 10 Sep 2020 10:39:33 +0200 Subject: [PATCH 021/313] only get project phases that user is assigned to in CSV Export --- cis/private/tools/zeitaufzeichnung.php | 4 +- include/projektphase.class.php | 79 ++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 2 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 6ee3e35cd..1056ebc87 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1951,9 +1951,9 @@ function getDataForProjectOverviewCSV($user) $csvData[] = array($titel, $projekt_kurzbz,$projekt_phase,$projekt_phase_id, $beginn, $ende); - $projektphasen = new projektphase($projekt_kurzbz); + $projektphasen = new projektphase(); - if($projektphasen->getProjektphasen($projekt_kurzbz)) + if($projektphasen->getProjectphaseForMitarbeiter($user)) { foreach($projektphasen->result as $projektphase) { diff --git a/include/projektphase.class.php b/include/projektphase.class.php index 8d96c92af..fbf41682c 100644 --- a/include/projektphase.class.php +++ b/include/projektphase.class.php @@ -656,6 +656,85 @@ class projektphase extends basis_db return false; } } + + public function getProjectphaseForMitarbeiter($mitarbeiter_uid) + { + + /*$qry = "SELECT DISTINCT + tbl_projekt.* + FROM + fue.tbl_ressource + JOIN fue.tbl_projekt_ressource USING(ressource_id) + JOIN fue.tbl_projekt USING(projekt_kurzbz) + WHERE (beginn<=now() or beginn is null) + AND (ende + interval '1 month 1 day' >=now() OR ende is null) + AND + ( + mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid) . " OR + student_uid=" . $this->db_add_param($mitarbeiter_uid) . " + )";*/ + + $qry = " + + SELECT DISTINCT + tbl_projektphase.* + FROM + fue.tbl_projektphase + JOIN fue.tbl_projekt USING (projekt_kurzbz) + JOIN fue.tbl_projekt_ressource USING (projektphase_id) + JOIN fue.tbl_ressource ON (tbl_ressource.ressource_id=tbl_projekt_ressource.ressource_id) + WHERE + ( + ( + (tbl_projekt.beginn<=now() or tbl_projekt.beginn is null) + AND (tbl_projekt.ende + interval '1 month 1 day' >=now() OR tbl_projekt.ende is null) + ) OR ( + (tbl_projektphase.start<=now() or tbl_projektphase.start is null) + AND (tbl_projektphase.ende + interval '1 month 1 day' >=now() OR tbl_projektphase.ende is null) + ) + ) + AND mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid); + + if($result = $this->db_query($qry)) + { + if($row = $this->db_fetch_object()) + { + while ($row = $this->db_fetch_object($result)) { + $obj = new projektphase(); + $obj->projekt_kurzbz = $row->projekt_kurzbz; + $obj->projektphase_id = $row->projektphase_id; + $obj->projektphase_fk = $row->projektphase_fk; + $obj->bezeichnung = $row->bezeichnung; + $obj->typ = $row->typ; + $obj->beschreibung = $row->beschreibung; + $obj->start = $row->start; + $obj->ende = $row->ende; + $obj->personentage = $row->personentage; + $obj->farbe = $row->farbe; + $obj->budget = $row->budget; + $obj->ressource_id = $row->ressource_id; + $obj->ressource_bezeichnung = $row->ressource_bezeichnung; + $obj->insertamum = $row->insertamum; + $obj->insertvon = $row->insertvon; + $obj->updateamum = $row->updateamum; + $obj->updatevon = $row->updatevon; + + $this->result[] = $obj; + } + return true; + } + else + { + $this->errormsg = 'Datensatz wurde nicht gefunden'; + return false; + } + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } } ?> From a565b667519dd109cd74b7b8eeb078d029ad932f Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Thu, 10 Sep 2020 13:07:51 +0200 Subject: [PATCH 022/313] display only projektphasen of the user --- cis/private/tools/zeitaufzeichnung.php | 37 ++++--- .../tools/zeitaufzeichnung_projektphasen.php | 20 +++- include/projektphase.class.php | 104 ++++++++++++++++-- 3 files changed, 128 insertions(+), 33 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 1056ebc87..6263972ed 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1936,6 +1936,9 @@ function getDataForProjectOverviewCSV($user) $projects_of_user = new projekt(); $projects= $projects_of_user->getProjekteListForMitarbeiter($user); + $projektphase = new projektphase(); + $projektphasen = $projektphase->getProjectphaseForMitarbeiter($user); + $csvData = array(); //headers schreiben $csvData[] = array('PROJEKT', 'PROJEKT KURZBEZEICHNUNG', 'PROJEKTPHASE', 'PROJEKTPHASEN ID', 'START', 'PROJEKT ENDE'); @@ -1951,25 +1954,27 @@ function getDataForProjectOverviewCSV($user) $csvData[] = array($titel, $projekt_kurzbz,$projekt_phase,$projekt_phase_id, $beginn, $ende); - $projektphasen = new projektphase(); + //$projektphasen = new projektphase(); - if($projektphasen->getProjectphaseForMitarbeiter($user)) - { - foreach($projektphasen->result as $projektphase) + + foreach($projektphasen as $prjp) { - $projekt_phase = $projektphase->bezeichnung; - $projekt_phase_id = $projektphase->projektphase_id; - if(!empty($projektphase->beginn)) - $beginn = $projektphase->beginn; - else - $beginn = $project->beginn; - if(!empty($projektphase->ende)) - $ende = $projektphase->ende; - else - $ende = $project->ende; - $csvData[] = array($titel, $projekt_kurzbz,$projekt_phase, $projekt_phase_id, $beginn, $ende); + if($prjp->projekt_kurzbz===$projekt_kurzbz) + { + $projekt_phase = $prjp->bezeichnung; + $projekt_phase_id = $prjp->projektphase_id; + if (!empty($prjp->beginn)) + $beginn = $prjp->beginn; + else + $beginn = $project->beginn; + if (!empty($prjp->ende)) + $ende = $prjp->ende; + else + $ende = $project->ende; + $csvData[] = array($titel, $projekt_kurzbz, $projekt_phase, $projekt_phase_id, $beginn, $ende); + } } - } + } return $csvData; } diff --git a/cis/private/tools/zeitaufzeichnung_projektphasen.php b/cis/private/tools/zeitaufzeichnung_projektphasen.php index 8ec421395..c6fe99363 100644 --- a/cis/private/tools/zeitaufzeichnung_projektphasen.php +++ b/cis/private/tools/zeitaufzeichnung_projektphasen.php @@ -1,26 +1,36 @@ getProjectphaseForMitarbeiterByKurzBz($user, $projekt_kurzbz); + $pp_user_ids = array(); + foreach ($projektphasen_user as $pp_user) + { + array_push($pp_user_ids, $pp_user->projektphase_id); + } + if($projektphase->getProjektphasen($projekt_kurzbz)) { $result_obj = array(); foreach($projektphase->result as $row) { - $item['projektphase_id']=$row->projektphase_id; - $item['bezeichnung']=$row->bezeichnung; - $result_obj[]=$item; + if(in_array($row->projektphase_id, $pp_user_ids)) + { + $item['projektphase_id'] = $row->projektphase_id; + $item['bezeichnung'] = $row->bezeichnung; + $result_obj[] = $item; + } } echo json_encode($result_obj); } diff --git a/include/projektphase.class.php b/include/projektphase.class.php index fbf41682c..5744382e9 100644 --- a/include/projektphase.class.php +++ b/include/projektphase.class.php @@ -657,9 +657,14 @@ class projektphase extends basis_db } } + /** + * Laedt die Projektphase mit der ID des mitarbeiters + * @param $mitarbeiter_uid der zu ladenden Projektphase des users + * @return array wenn ok, false im Fehlerfall + */ public function getProjectphaseForMitarbeiter($mitarbeiter_uid) { - + $projecphasetList = array(); /*$qry = "SELECT DISTINCT tbl_projekt.* FROM @@ -697,10 +702,10 @@ class projektphase extends basis_db if($result = $this->db_query($qry)) { - if($row = $this->db_fetch_object()) + while($row = $this->db_fetch_object($result)) { - while ($row = $this->db_fetch_object($result)) { $obj = new projektphase(); + $obj->projekt_kurzbz = $row->projekt_kurzbz; $obj->projektphase_id = $row->projektphase_id; $obj->projektphase_fk = $row->projektphase_fk; @@ -713,21 +718,97 @@ class projektphase extends basis_db $obj->farbe = $row->farbe; $obj->budget = $row->budget; $obj->ressource_id = $row->ressource_id; - $obj->ressource_bezeichnung = $row->ressource_bezeichnung; $obj->insertamum = $row->insertamum; $obj->insertvon = $row->insertvon; $obj->updateamum = $row->updateamum; $obj->updatevon = $row->updatevon; $this->result[] = $obj; - } - return true; - } - else - { - $this->errormsg = 'Datensatz wurde nicht gefunden'; - return false; + + array_push($projecphasetList, $obj); } + return $projecphasetList; + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } + + /** + * Laedt die Projektphase mit der ID des mitarbeiters für das jeweilige Projekt + * @param $mitarbeiter_uid der zu ladenden Projektphase des users + * @param $prjkzbz des zu landenen Projekts + * @return array wenn ok, false im Fehlerfall + */ + public function getProjectphaseForMitarbeiterByKurzBz($mitarbeiter_uid, $prjkzbz) + { + $projecphasetList = array(); + /*$qry = "SELECT DISTINCT + tbl_projekt.* + FROM + fue.tbl_ressource + JOIN fue.tbl_projekt_ressource USING(ressource_id) + JOIN fue.tbl_projekt USING(projekt_kurzbz) + WHERE (beginn<=now() or beginn is null) + AND (ende + interval '1 month 1 day' >=now() OR ende is null) + AND + ( + mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid) . " OR + student_uid=" . $this->db_add_param($mitarbeiter_uid) . " + )";*/ + + $qry = " + + SELECT DISTINCT + tbl_projektphase.* + FROM + fue.tbl_projektphase + JOIN fue.tbl_projekt USING (projekt_kurzbz) + JOIN fue.tbl_projekt_ressource USING (projektphase_id) + JOIN fue.tbl_ressource ON (tbl_ressource.ressource_id=tbl_projekt_ressource.ressource_id) + WHERE + ( + ( + (tbl_projekt.beginn<=now() or tbl_projekt.beginn is null) + AND (tbl_projekt.ende + interval '1 month 1 day' >=now() OR tbl_projekt.ende is null) + ) OR ( + (tbl_projektphase.start<=now() or tbl_projektphase.start is null) + AND (tbl_projektphase.ende + interval '1 month 1 day' >=now() OR tbl_projektphase.ende is null) + ) + ) + AND mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid); + + if($result = $this->db_query($qry)) + { + while($row = $this->db_fetch_object($result)) + { + $obj = new projektphase(); + + $obj->projekt_kurzbz = $row->projekt_kurzbz; + $obj->projektphase_id = $row->projektphase_id; + $obj->projektphase_fk = $row->projektphase_fk; + $obj->bezeichnung = $row->bezeichnung; + $obj->typ = $row->typ; + $obj->beschreibung = $row->beschreibung; + $obj->start = $row->start; + $obj->ende = $row->ende; + $obj->personentage = $row->personentage; + $obj->farbe = $row->farbe; + $obj->budget = $row->budget; + $obj->ressource_id = $row->ressource_id; + $obj->insertamum = $row->insertamum; + $obj->insertvon = $row->insertvon; + $obj->updateamum = $row->updateamum; + $obj->updatevon = $row->updatevon; + + $this->result[] = $obj; + + if($prjkzbz === $row->projekt_kurzbz ) + array_push($projecphasetList, $obj); + } + return $projecphasetList; } else { @@ -735,6 +816,5 @@ class projektphase extends basis_db return false; } } - } ?> From 0153364885a481ec9e25875c18fde53ce9282eac Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 15 Sep 2020 18:11:37 +0200 Subject: [PATCH 023/313] =?UTF-8?q?Pr=C3=BCfungsprotokoll=20Freigabe:=20pa?= =?UTF-8?q?ssed=20data=20to=20controller=20in=20better=20way=20(password?= =?UTF-8?q?=20and=20freigegeben=20bool=20in=20a=20separate=20object)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/lehre/Pruefungsprotokoll.php | 20 ++++++++++-------- public/js/lehre/pruefungsprotokoll.js | 21 ++++++++++++------- 2 files changed, 25 insertions(+), 16 deletions(-) diff --git a/application/controllers/lehre/Pruefungsprotokoll.php b/application/controllers/lehre/Pruefungsprotokoll.php index d9793ef06..467a7dc71 100644 --- a/application/controllers/lehre/Pruefungsprotokoll.php +++ b/application/controllers/lehre/Pruefungsprotokoll.php @@ -115,9 +115,11 @@ class Pruefungsprotokoll extends Auth_Controller public function saveProtokoll() { $abschlusspruefung_id = $this->input->post('abschlusspruefung_id'); - $data = $this->input->post('protocoldata'); + $freigebendata = $this->input->post('freigebendata'); + $protocoldata = $this->input->post('protocoldata'); - if (isset($abschlusspruefung_id) && is_numeric($abschlusspruefung_id) && isset($data)) + if (isset($abschlusspruefung_id) && is_numeric($abschlusspruefung_id) + && isset($freigebendata['freigeben']) && isset($protocoldata)) { // check permission $berechtigt = $this->_getAbschlusspruefungBerechtigt($abschlusspruefung_id); @@ -125,15 +127,14 @@ class Pruefungsprotokoll extends Auth_Controller $this->outputJsonError(getError($berechtigt)); else { - $freigabe = isset($data['freigabedatum']) && $data['freigabedatum']; + $freigabe = $freigebendata['freigeben'] === 'true'; if ($freigabe) { // Verify password - $password = $data['password']; - unset($data['password']); - if (!isEmptyString($password)) + if (isset($freigebendata['password']) && !isEmptyString($freigebendata['password'])) { + $password = $freigebendata['password']; $result = $this->authlib->checkUserAuthByUsernamePassword($this->_uid, $password); if (isError($result)) { @@ -146,7 +147,8 @@ class Pruefungsprotokoll extends Auth_Controller } } - $data = $this->_prepareAbschlusspruefungDataForSave($data); + $data = $this->_prepareAbschlusspruefungDataForSave($protocoldata, $freigabe); + $result = $this->AbschlusspruefungModel->update($abschlusspruefung_id, $data); if (hasData($result)) @@ -213,7 +215,7 @@ class Pruefungsprotokoll extends Auth_Controller * @param $data * @return array */ - private function _prepareAbschlusspruefungDataForSave($data) + private function _prepareAbschlusspruefungDataForSave($data, $freigabe) { $nullfields = array('uhrzeit', 'endezeit', 'abschlussbeurteilung_kurzbz', 'protokoll'); foreach ($data as $idx => $item) @@ -222,7 +224,7 @@ class Pruefungsprotokoll extends Auth_Controller $data[$idx] = null; } - if (isset($data['freigabedatum']) && $data['freigabedatum']) + if ($freigabe === true) $data['freigabedatum'] = date('Y-m-d'); return $data; diff --git a/public/js/lehre/pruefungsprotokoll.js b/public/js/lehre/pruefungsprotokoll.js index 8cb72cbf6..8af7d6f21 100644 --- a/public/js/lehre/pruefungsprotokoll.js +++ b/public/js/lehre/pruefungsprotokoll.js @@ -10,6 +10,12 @@ $("document").ready(function() { $("#saveProtocolBtn, #freigebenProtocolBtn").click( function() { + + var freigebendata = { + freigeben: false, + password: null + } + var data = { abschlussbeurteilung_kurzbz: $("#abschlussbeurteilung_kurzbz").val(), protokoll: $("#protokoll").val(), @@ -19,11 +25,11 @@ $("document").ready(function() { if ($(this).prop("id") === 'freigebenProtocolBtn') { - data.freigabedatum = true; - data.password = $("#password").val(); + freigebendata.freigeben = true; + freigebendata.password = $("#password").val(); } - var checkFields = Pruefungsprotokoll.checkFields(data, $("#verfCheck").prop('checked')); + var checkFields = Pruefungsprotokoll.checkFields(data, freigebendata, $("#verfCheck").prop('checked')); $("#protocolform td").removeClass('has-error'); if (checkFields.length > 0) { @@ -44,7 +50,7 @@ $("document").ready(function() { return; } - Pruefungsprotokoll.saveProtokoll($("#abschlusspruefung_id").val(),data); + Pruefungsprotokoll.saveProtokoll($("#abschlusspruefung_id").val(), freigebendata, data); } ) @@ -79,11 +85,11 @@ var Pruefungsprotokoll = { $("#verfNotice").html(FHC_PhrasesLib.t("abschlusspruefung", "verfNotice")); } }, - checkFields: function(data, verfChecked) + checkFields: function(data, freigebendata, verfChecked) { var errors = []; - if (data.abschlussbeurteilung_kurzbz == "" && data.freigabedatum === true && verfChecked) + if (data.abschlussbeurteilung_kurzbz == "" && freigebendata.freigeben === true && verfChecked) errors.push({"abschlussbeurteilung_kurzbz": FHC_PhrasesLib.t("abschlusspruefung", "abschlussbeurteilungLeer")}); var zeitregex = /^[0-2][0-9]:[0-5][0-9]$/; @@ -111,12 +117,13 @@ var Pruefungsprotokoll = { }, // ajax calls // ----------------------------------------------------------------------------------------------------------------- - saveProtokoll: function(abschlusspruefung_id, data) + saveProtokoll: function(abschlusspruefung_id, freigeben, data) { FHC_AjaxClient.ajaxCallPost( CALLED_PATH + '/saveProtokoll', { abschlusspruefung_id: abschlusspruefung_id, + freigebendata: freigeben, protocoldata: data }, { From 82d7f4edd200cc0b8434928c6413852b7913cffb Mon Sep 17 00:00:00 2001 From: Oliiver Date: Wed, 16 Sep 2020 09:37:31 +0200 Subject: [PATCH 024/313] fix brackets; remove error_reporting --- include/projekt.class.php | 43 +++--- include/projektphase.class.php | 230 +++++++++++++++++---------------- 2 files changed, 150 insertions(+), 123 deletions(-) diff --git a/include/projekt.class.php b/include/projekt.class.php index 304d6d4ab..dc5144fb8 100644 --- a/include/projekt.class.php +++ b/include/projekt.class.php @@ -25,7 +25,7 @@ * @param string $projekt_kurzbz primary key Projektname. */ require_once(dirname(__FILE__).'/basis_db.class.php'); -error_reporting(E_ALL ^ E_NOTICE); + class projekt extends basis_db { public $new; // boolean @@ -86,12 +86,14 @@ class projekt extends basis_db return true; } - else { + else + { $this->errormsg = 'Datensatz wurde nicht gefunden'; return false; } } - else { + else + { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } @@ -138,7 +140,8 @@ class projekt extends basis_db } return true; } - else { + else + { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } @@ -178,7 +181,8 @@ class projekt extends basis_db } return true; } - else { + else + { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } @@ -218,7 +222,8 @@ class projekt extends basis_db } return true; } - else { + else + { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } @@ -287,7 +292,8 @@ class projekt extends basis_db $this->db_add_param($this->anzahl_ma) . ',' . $this->db_add_param($this->aufwandstyp_kurzbz) . ');'; } - else { + else + { //Updaten des bestehenden Datensatzes $qry = 'UPDATE fue.tbl_projekt SET ' . @@ -309,7 +315,8 @@ class projekt extends basis_db if ($this->db_query($qry)) { return true; } - else { + else + { $this->errormsg = 'Fehler beim Speichern der Daten'; return false; } @@ -327,7 +334,8 @@ class projekt extends basis_db if ($this->db_query($qry)) { return true; } - else { + else + { $this->errormsg = 'Fehler beim Loeschen des Datensatzes'; return false; } @@ -394,7 +402,8 @@ class projekt extends basis_db } return true; } - else { + else + { $this->erromsg = 'Fehler beim Laden der Daten'; return false; } @@ -464,7 +473,8 @@ class projekt extends basis_db } return $projectList; } - else { + else + { $this->erromsg = 'Fehler beim Laden der Daten'; return false; } @@ -492,12 +502,14 @@ class projekt extends basis_db return true; } - else { + else + { $this->errormsg = 'Datensatz wurde nicht gefunden'; return false; } } - else { + else + { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } @@ -534,7 +546,7 @@ class projekt extends basis_db } catch (Exception $e) { - echo 'Exception abgefangen: ', $e->getMessage(), "\n"; + error_log('Exception abgefangen: ', $e->getMessage(), "\n"); } } @@ -556,7 +568,8 @@ class projekt extends basis_db return $obj; } - else { + else + { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } diff --git a/include/projektphase.class.php b/include/projektphase.class.php index 5744382e9..e12f2c458 100644 --- a/include/projektphase.class.php +++ b/include/projektphase.class.php @@ -24,7 +24,7 @@ */ require_once(dirname(__FILE__).'/basis_db.class.php'); require_once(dirname(__FILE__).'/projekttask.class.php'); -error_reporting(E_ALL ^ E_NOTICE); + class projektphase extends basis_db { public $new; // boolean @@ -37,10 +37,10 @@ class projektphase extends basis_db public $bezeichnung; //string public $typ='Projektphase'; //string public $beschreibung; //string - public $start; //date - public $ende; //date + public $start; //date + public $ende; //date public $personentage; //integer - public $farbe; + public $farbe; public $budget; // numeric public $ressource_id; // bigint public $ressource_bezeichnung; // string @@ -58,7 +58,7 @@ class projektphase extends basis_db { parent::__construct(); - if($projektphase_id != null) + if($projektphase_id != null) $this->load($projektphase_id); } @@ -74,11 +74,11 @@ class projektphase extends basis_db $this->errormsg = 'Projektarbeit_id muss eine gueltige Zahl sein'; return false; } - - $qry = "SELECT tbl_projektphase.*, tbl_ressource.bezeichnung AS ressource_bezeichnung + + $qry = "SELECT tbl_projektphase.*, tbl_ressource.bezeichnung AS ressource_bezeichnung FROM fue.tbl_projektphase LEFT OUTER JOIN fue.tbl_ressource USING (ressource_id) WHERE projektphase_id=".$this->db_add_param($projektphase_id, FHC_INTEGER); - + if($this->db_query($qry)) { if($row = $this->db_fetch_object()) @@ -102,20 +102,20 @@ class projektphase extends basis_db $this->updatevon = $row->updatevon; return true; } - else + else { $this->errormsg = 'Datensatz wurde nicht gefunden'; return false; } } - else + else { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } } - + /** * Laedt die Projektphasen mit zu einem Projekt * @param $projekt_kurzbz Projekt der zu ladenden Projektphasen @@ -125,23 +125,23 @@ class projektphase extends basis_db { $this->result=array(); $qry = "Select * from fue.tbl_projektphase where projekt_kurzbz = ".$this->db_add_param($projekt_kurzbz)." and projektphase_id not in ( - WITH RECURSIVE tasks(projektphase_fk) as + WITH RECURSIVE tasks(projektphase_fk) as ( SELECT projektphase_id FROM fue.tbl_projektphase WHERE projektphase_fk=".$this->db_add_param($projektphase_id, FHC_INTEGER)." UNION ALL - SELECT p.projektphase_id FROM fue.tbl_projektphase p, tasks + SELECT p.projektphase_id FROM fue.tbl_projektphase p, tasks WHERE p.projektphase_fk=tasks.projektphase_fk ) SELECT * FROM tasks) and projektphase_id not in (".$this->db_add_param($projektphase_id, FHC_INTEGER).")"; //echo "\n".$qry."\n"; - + if($this->db_query($qry)) { while($row = $this->db_fetch_object()) { $obj = new projektphase(); - + $obj->projekt_kurzbz = $row->projekt_kurzbz; $obj->projektphase_id = $row->projektphase_id; $obj->projektphase_fk = $row->projektphase_fk; @@ -158,25 +158,25 @@ class projektphase extends basis_db $obj->insertvon = $row->insertvon; $obj->updateamum = $row->updateamum; $obj->updatevon = $row->updatevon; - + $this->result[] = $obj; } //var_dump($this->result); return true; } - else + else { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } } - + /** * Laedt die Projektphasen zu einem Projekt * @param $projekt_kurzbz Projekt der zu ladenden Projektphasen * @param $foreignkey wenn ! gib nur die Erste Ebene der Projektphasen zurück * @return true wenn ok, false im Fehlerfall - */ + */ public function getProjektphasen($projekt_kurzbz, $foreignkey = null) { $this->result=array(); @@ -184,18 +184,18 @@ class projektphase extends basis_db FROM fue.tbl_projektphase LEFT OUTER JOIN fue.tbl_ressource USING (ressource_id) WHERE projekt_kurzbz=".$this->db_add_param($projekt_kurzbz); //echo "\n".$qry."\n"; - + if(!is_null($foreignkey)) $qry .= " and projektphase_fk is NULL"; - - $qry .= " ORDER BY start, projektphase_fk DESC;"; - + + $qry .= " ORDER BY start, projektphase_fk DESC;"; + if($this->db_query($qry)) { while($row = $this->db_fetch_object()) { $obj = new projektphase(); - + $obj->projekt_kurzbz = $row->projekt_kurzbz; $obj->projektphase_id = $row->projektphase_id; $obj->projektphase_fk = $row->projektphase_fk; @@ -213,36 +213,36 @@ class projektphase extends basis_db $obj->insertvon = $row->insertvon; $obj->updateamum = $row->updateamum; $obj->updatevon = $row->updatevon; - + $this->result[] = $obj; } //var_dump($this->result); return true; } - else + else { $this->errormsg = 'Fehler beim Laden der Daten'; return false; } } - + /** * Lädt alle Unterphasen zu einem Projekt * @param type $phase_id - * @return boolean + * @return boolean */ public function getAllUnterphasen($phase_id) { $qry = "SELECT tbl_projektphase.*, tbl_ressource.bezeichnung AS ressource_bezeichung FROM fue.tbl_projektphase LEFT OUTER JOIN fue.tbl_ressource USING (ressource_id) - WHERE projektphase_fk =".$this->db_add_param($phase_id, FHC_INTEGER); - + WHERE projektphase_fk =".$this->db_add_param($phase_id, FHC_INTEGER); + if($result = $this->db_query($qry)) { while($row = $this->db_fetch_object()) { - $obj = new projektphase(); - + $obj = new projektphase(); + $obj->projekt_kurzbz = $row->projekt_kurzbz; $obj->projektphase_id = $row->projektphase_id; $obj->projektphase_fk = $row->projektphase_fk; @@ -260,15 +260,15 @@ class projektphase extends basis_db $obj->insertvon = $row->insertvon; $obj->updateamum = $row->updateamum; $obj->updatevon = $row->updatevon; - + $this->result[] = $obj; } - return true; + return true; } else { - $this->errormsg = "Fehler beim laden der Daten"; - return false; + $this->errormsg = "Fehler beim laden der Daten"; + return false; } } @@ -296,11 +296,11 @@ class projektphase extends basis_db $this->errormsg.='Projekt Kurzbz darf nicht länger als 16 Zeichen sein'; return false; } - + $this->errormsg = ''; return true; } - + /** * Speichert den aktuellen Datensatz in die Datenbank * Wenn $neu auf true gesetzt ist wird ein neuer Datensatz angelegt @@ -315,12 +315,12 @@ class projektphase extends basis_db if($new==null) $new = $this->new; - + if($new) { //Neuen Datensatz einfuegen - $qry='BEGIN; INSERT INTO fue.tbl_projektphase (projekt_kurzbz, projektphase_fk, bezeichnung, typ, + $qry='BEGIN; INSERT INTO fue.tbl_projektphase (projekt_kurzbz, projektphase_fk, bezeichnung, typ, beschreibung, start, ende, budget, ressource_id, insertvon, insertamum, updatevon, updateamum, farbe, personentage) VALUES ('. $this->db_add_param($this->projekt_kurzbz).', '. $this->db_add_param($this->projektphase_fk).', '. @@ -356,7 +356,7 @@ class projektphase extends basis_db 'updatevon='.$this->db_add_param($this->updatevon).' '. 'WHERE projektphase_id='.$this->db_add_param($this->projektphase_id, FHC_INTEGER).';'; } - + if($this->db_query($qry)) { if($new) @@ -371,21 +371,21 @@ class projektphase extends basis_db $this->db_query('COMMIT'); return true; } - else + else { $this->errormsg = 'Fehler beim Auslesen der Sequence'; $this->db_query('ROLLBACK;'); return false; } } - else + else { $this->errormsg = 'Fehler beim Auslesen der Sequence'; $this->db_query('ROLLBACK;'); return false; } } - + return true; } else @@ -394,7 +394,7 @@ class projektphase extends basis_db return false; } } - + /** * Loescht den Datenensatz mit der ID die uebergeben wird * @param $projekt_kurzbz ID die geloescht werden soll @@ -407,77 +407,81 @@ class projektphase extends basis_db $this->errormsg = 'Projektphase_ID ist ungueltig'; return true; } - + // an projektphase hängt noch eine phase if($this->existPhaseFk($projektphase_id)) { $this->errormsg ="Phase kann nicht gelöscht werden, da noch eine andere Phase daran hängt. Bitte zuerst Phase abhängen. "; - return false; + return false; } - + // Beginne Transaktion und lösche alle Tasks der Phase - $qry1 ="Begin; DELETE FROM fue.tbl_projekttask + $qry1 ="Begin; DELETE FROM fue.tbl_projekttask WHERE projektphase_id =".$this->db_add_param($projektphase_id, FHC_INTEGER).";"; - + if($this->db_query($qry1)) { // Lösche alle zugewiesenen Ressourcen - $qry2 = "DELETE FROM fue.tbl_projekt_ressource + $qry2 = "DELETE FROM fue.tbl_projekt_ressource WHERE projektphase_id =".$this->db_add_param($projektphase_id, FHC_INTEGER).";"; - + if($this->db_query($qry2)) { // Lösche den Phaseneintrag - $qry3 = "DELETE FROM fue.tbl_projektphase + $qry3 = "DELETE FROM fue.tbl_projektphase WHERE projektphase_id = ".$this->db_add_param($projektphase_id, FHC_INTEGER).";"; - + if($this->db_query($qry3)) { $this->db_query('COMMIT'); - return true; - }else + return true; + } + else { $this->errormsg ="Fehler beim löschen der Projektphase aufgetreten"; $this->db_query('ROLLBACK'); - return false; + return false; } - }else + } + else { $this->errormsg ="Fehler beim löschen der Ressourcen aufgetreten"; $this->db_query('ROLLBACK'); - return false; + return false; } - }else + } + else { $this->errormsg ="Fehler beim löschen der Tasks aufgetreten"; - $this->db_query('ROLLBACK'); - return false; + $this->db_query('ROLLBACK'); + return false; } } - + /** - * + * * Überprüft ob an übergebenr Phase noch eine andere Phase hängt. true wenn noch eine daran hängt * @param $projektphase_id */ public function existPhaseFk($projektphase_id) { $qry = "SELECT * FROM fue.tbl_projektphase WHERE projektphase_fk =".$this->db_add_param($projektphase_id, FHC_INTEGER).";"; - + if($this->db_query($qry)) { if($row = $this->db_fetch_object()) - return true; - }else + return true; + } + else { $this->errormsg ="Fehler bei der Abfrage aufgetreten"; - return false; + return false; } } - + /** - * + * * Löscht Ressourcen einer Phase * @param $projektphase_id * @param $ressource_id -> wenn != null wird nur die eine ressource gelöscht @@ -492,58 +496,60 @@ class projektphase extends basis_db $this->errormsg = "Keine gültige ID übergeben"; return false; } - $qry ="DELETE from fue.tbl_projekt_ressource - WHERE projektphase_id =".$this->db_add_param($projektphase_id, FHC_INTEGER)." and + $qry ="DELETE from fue.tbl_projekt_ressource + WHERE projektphase_id =".$this->db_add_param($projektphase_id, FHC_INTEGER)." and ressource_id=".$this->db_add_param($ressource_id, FHC_INTEGER).";"; - }else + } + else { // gesamte Ressourcen von Phase werden gelöscht if(!is_numeric($projektphase_id)) { $this->errormsg ="Keine gültige ID übergeben"; } - $qry ="DELETE from fue.tbl_projekt_ressource + $qry ="DELETE from fue.tbl_projekt_ressource WHERE projektphase_id =".$this->db_add_param($projektphase_id, FHC_INTEGER).";"; } if($this->db_query($qry)) { - return true; - }else + return true; + } + else { $this->errormsg = "Fehler bei der Abfrage aufgetreten"; - return false; + return false; } - + } - + /** - * + * * gibt den Fortschritt der Phase in Prozent zurück --> Phasen die auf die übergebene Phase zeigen werden berücksichtigt * @param $projektphase_id */ - public function getFortschritt($projektphase_id) +public function getFortschritt($projektphase_id) { - $qry = "Select * from fue.tbl_projektphase phase - join fue.tbl_projekttask task using(projektphase_id) + $qry = "Select * from fue.tbl_projektphase phase + join fue.tbl_projekttask task using(projektphase_id) where task.projektphase_id = ".$this->db_add_param($projektphase_id, FHC_INTEGER)." OR task.projektphase_id IN ( - - WITH RECURSIVE tasks(projektphase_fk) as + + WITH RECURSIVE tasks(projektphase_fk) as ( SELECT projektphase_id FROM fue.tbl_projektphase WHERE projektphase_fk=".$this->db_add_param($projektphase_id, FHC_INTEGER)." UNION ALL - SELECT p.projektphase_id FROM fue.tbl_projektphase p, tasks + SELECT p.projektphase_id FROM fue.tbl_projektphase p, tasks WHERE p.projektphase_fk=tasks.projektphase_fk )SELECT * FROM tasks)"; - - $taskAnzahl = 0; + + $taskAnzahl = 0; // erledige tasks - $i = 0; - $ergebnis = 0; - + $i = 0; + $ergebnis = 0; + if($this->db_query($qry)) { while($row = $this->db_fetch_object()) @@ -553,24 +559,24 @@ class projektphase extends basis_db $i++; } } - $taskAnzahl = ($taskAnzahl == 0)? 1 : $taskAnzahl; - $ergebnis = ($i*100)/$taskAnzahl; - - return sprintf("%01.2f", $ergebnis); + $taskAnzahl = ($taskAnzahl == 0)? 1 : $taskAnzahl; + $ergebnis = ($i*100)/$taskAnzahl; + + return sprintf("%01.2f", $ergebnis); } - + /** * Überprüft ob alle Tasks einer Phase erledigt sind */ public function isPhaseErledigt($phase_id) { - $task = new projekttask(); - - $task->getProjekttasks($phase_id,null,'offen'); + $task = new projekttask(); + + $task->getProjekttasks($phase_id,null,'offen'); if(count($task->result)==0) - return true; + return true; else - return false; + return false; } public function checkProjectphaseInCorrectTime($projektphase_id, $given_projectphase_start, $given_projektphase_ende) @@ -578,14 +584,22 @@ class projektphase extends basis_db try { $projektphase = $this->getProjectphaseById($projektphase_id); - if(strtotime($projektphase->beginn)) - $projektphase_start = date('Y-m-d', strtotime($projektphase->beginn)); + if(strtotime($projektphase->start)) + { + $projektphase_start = date('Y-m-d', strtotime($projektphase->start)); + } else - $projektphase_start = NULL; + { + $projektphase_start = NULL; + } if(strtotime($projektphase->ende)) - $projektphase_ende = date('Y-m-d', strtotime($projektphase->ende)); + { + $projektphase_ende = date('Y-m-d', strtotime($projektphase->ende)); + } else - $projektphase_ende = NULL; + { + $projektphase_ende = NULL; + } $given_start = date('Y-m-d', strtotime($given_projectphase_start)); $given_ende = date('Y-m-d', strtotime($given_projektphase_ende)); @@ -598,7 +612,7 @@ class projektphase extends basis_db } catch (Exception $e) { - echo 'Exception abgefangen: ', $e->getMessage(), "\n"; + error_log('Exception abgefangen: ', $e->getMessage(), "\n"); } } @@ -615,7 +629,7 @@ class projektphase extends basis_db return false; } - $qry = "SELECT tbl_projektphase.*, tbl_ressource.bezeichnung AS ressource_bezeichnung + $qry = "SELECT tbl_projektphase.*, tbl_ressource.bezeichnung AS ressource_bezeichnung FROM fue.tbl_projektphase LEFT OUTER JOIN fue.tbl_ressource USING (ressource_id) WHERE projektphase_id=".$this->db_add_param($projektphase_id, FHC_INTEGER); From ad98fed84b555fe54fb365d2ddec3a6c314f53e8 Mon Sep 17 00:00:00 2001 From: Oliiver Date: Wed, 16 Sep 2020 12:34:26 +0200 Subject: [PATCH 025/313] additionally export projectphasen without project --- cis/private/tools/zeitaufzeichnung.php | 38 ++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 6263972ed..4802b08ab 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1055,7 +1055,7 @@ if($projekt->getProjekteMitarbeiter($user, true)) CSV Import | CSV Export | - + Projektübersichtexport"; if($anzprojekte > 0) echo " | ".$p->t("zeitaufzeichnung/projektexport").""; @@ -1944,6 +1944,7 @@ function getDataForProjectOverviewCSV($user) $csvData[] = array('PROJEKT', 'PROJEKT KURZBEZEICHNUNG', 'PROJEKTPHASE', 'PROJEKTPHASEN ID', 'START', 'PROJEKT ENDE'); foreach ($projects as $project) { + $index=0; //Newline characters bei Beschreibung ersetzen $titel = $project->titel; $projekt_kurzbz = $project->projekt_kurzbz; @@ -1963,19 +1964,44 @@ function getDataForProjectOverviewCSV($user) { $projekt_phase = $prjp->bezeichnung; $projekt_phase_id = $prjp->projektphase_id; - if (!empty($prjp->beginn)) - $beginn = $prjp->beginn; + if (!empty($prjp->start)) + { + $beginn = $prjp->start; + } else - $beginn = $project->beginn; + { + $beginn = $project->beginn; + } if (!empty($prjp->ende)) - $ende = $prjp->ende; + { + $ende = $prjp->ende; + } else - $ende = $project->ende; + { + $ende = $project->ende; + } $csvData[] = array($titel, $projekt_kurzbz, $projekt_phase, $projekt_phase_id, $beginn, $ende); + //$index = array_search($prjp, array_values($projektphasen)); + unset($projektphasen[$index]); } + $index++; } } + foreach($projektphasen as $prjp) + { + if(empty($prjp->projektphase_fk)) + { + $titel=$prjp->projekt_kurzbz; + $projekt_kurzbz = $prjp->projekt_kurzbz; + $projekt_phase = $prjp->bezeichnung; + $projekt_phase_id = $prjp->projektphase_id; + $beginn = $prjp->start; + $ende = $prjp->ende; + + $csvData[] = array($titel, $projekt_kurzbz, $projekt_phase, $projekt_phase_id, $beginn, $ende); + } + } return $csvData; } ?> From 85c6aa08fc0ce9bd97efa29f59f619773179683a Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Wed, 23 Sep 2020 12:45:00 +0200 Subject: [PATCH 026/313] fix bug for empty projekt and projektphasen --- cis/private/tools/zeitaufzeichnung.php | 6 +++--- include/projekt.class.php | 7 +++++-- include/projektphase.class.php | 26 ++++++++++++++------------ 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 4802b08ab..c5aff4ef6 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -727,7 +727,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum ('.$data[2].')
'; elseif (!empty($data[6]) && !$projects_of_user->checkProjectInCorrectTime($data[6], $data[2], $data[3])) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; } elseif (checkVals($data[5],$data[6],$data[7],$data[8])) { @@ -869,12 +869,12 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $saveerror = 0; if (!$projects_of_user->checkProjectInCorrectTime($projekt_kurzbz, $datum->formatDatum($von, $format='Y-m-d'), $datum->formatDatum($bis, $format='Y-m-d'))) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; $saveerror = 1; } elseif (!$projectphase->checkProjectphaseInCorrectTime($projektphase_id, $datum->formatDatum($von, $format='Y-m-d'), $datum->formatDatum($bis, $format='Y-m-d'))) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt.
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt.
'; $saveerror = 1; } elseif (isset($_POST['genPause']) && (isset($_POST['save']) || isset($_POST['edit']))) diff --git a/include/projekt.class.php b/include/projekt.class.php index dc5144fb8..5cfa0ed9c 100644 --- a/include/projekt.class.php +++ b/include/projekt.class.php @@ -523,6 +523,8 @@ class projekt extends basis_db */ public function checkProjectInCorrectTime($projekt_kurzbz, $give_project_start, $give_projekt_ende) { + if(empty($projekt_kurzbz)) + return true; try { $projekt = $this->getProjectByKurzbz($projekt_kurzbz); @@ -546,7 +548,7 @@ class projekt extends basis_db } catch (Exception $e) { - error_log('Exception abgefangen: ', $e->getMessage(), "\n"); + error_log('Exception abgefangen: ', $e->getMessage(), "\n"); } } @@ -554,7 +556,8 @@ class projekt extends basis_db { $qry = "SELECT * FROM fue.tbl_projekt WHERE projekt_kurzbz=".$this->db_add_param($projekt_kurzbz); - if ($result = $this->db_query($qry)) { + if ($result = $this->db_query($qry)) + { $row = $this->db_fetch_object($result); $obj = new projekt(); diff --git a/include/projektphase.class.php b/include/projektphase.class.php index e12f2c458..a0e2b5c6b 100644 --- a/include/projektphase.class.php +++ b/include/projektphase.class.php @@ -581,25 +581,27 @@ public function getFortschritt($projektphase_id) public function checkProjectphaseInCorrectTime($projektphase_id, $given_projectphase_start, $given_projektphase_ende) { + if(empty($projektphase_id)) + return true; try { $projektphase = $this->getProjectphaseById($projektphase_id); if(strtotime($projektphase->start)) - { - $projektphase_start = date('Y-m-d', strtotime($projektphase->start)); - } + { + $projektphase_start = date('Y-m-d', strtotime($projektphase->start)); + } else - { - $projektphase_start = NULL; - } + { + $projektphase_start = NULL; + } if(strtotime($projektphase->ende)) - { - $projektphase_ende = date('Y-m-d', strtotime($projektphase->ende)); - } + { + $projektphase_ende = date('Y-m-d', strtotime($projektphase->ende)); + } else - { - $projektphase_ende = NULL; - } + { + $projektphase_ende = NULL; + } $given_start = date('Y-m-d', strtotime($given_projectphase_start)); $given_ende = date('Y-m-d', strtotime($given_projektphase_ende)); From 49fb4d8afaec65a6927e0d715b8d8360bcbd14be Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Wed, 23 Sep 2020 13:16:07 +0200 Subject: [PATCH 027/313] sort csvExport --- cis/private/tools/zeitaufzeichnung.php | 88 +++++++++++++------------- 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index c5aff4ef6..e30605700 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1934,17 +1934,16 @@ function exportProjectOverviewAsCSV($user, $delimiter = ',') function getDataForProjectOverviewCSV($user) { $projects_of_user = new projekt(); - $projects= $projects_of_user->getProjekteListForMitarbeiter($user); + $projects = $projects_of_user->getProjekteListForMitarbeiter($user); $projektphase = new projektphase(); $projektphasen = $projektphase->getProjectphaseForMitarbeiter($user); $csvData = array(); - //headers schreiben - $csvData[] = array('PROJEKT', 'PROJEKT KURZBEZEICHNUNG', 'PROJEKTPHASE', 'PROJEKTPHASEN ID', 'START', 'PROJEKT ENDE'); + foreach ($projects as $project) { - $index=0; + $index = 0; //Newline characters bei Beschreibung ersetzen $titel = $project->titel; $projekt_kurzbz = $project->projekt_kurzbz; @@ -1953,55 +1952,54 @@ function getDataForProjectOverviewCSV($user) $beginn = $project->beginn; $ende = $project->ende; - $csvData[] = array($titel, $projekt_kurzbz,$projekt_phase,$projekt_phase_id, $beginn, $ende); + $csvData[] = array($titel, $projekt_kurzbz, $projekt_phase, $projekt_phase_id, $beginn, $ende); - //$projektphasen = new projektphase(); - - - foreach($projektphasen as $prjp) + foreach ($projektphasen as $prjp) + { + if ($prjp->projekt_kurzbz === $projekt_kurzbz) { - if($prjp->projekt_kurzbz===$projekt_kurzbz) + $projekt_phase = $prjp->bezeichnung; + $projekt_phase_id = $prjp->projektphase_id; + if (!empty($prjp->start)) { - $projekt_phase = $prjp->bezeichnung; - $projekt_phase_id = $prjp->projektphase_id; - if (!empty($prjp->start)) - { - $beginn = $prjp->start; - } - else - { - $beginn = $project->beginn; - } - if (!empty($prjp->ende)) - { - $ende = $prjp->ende; - } - else - { - $ende = $project->ende; - } - $csvData[] = array($titel, $projekt_kurzbz, $projekt_phase, $projekt_phase_id, $beginn, $ende); - //$index = array_search($prjp, array_values($projektphasen)); - unset($projektphasen[$index]); + $beginn = $prjp->start; + } else + { + $beginn = $project->beginn; } - $index++; + if (!empty($prjp->ende)) + { + $ende = $prjp->ende; + } else + { + $ende = $project->ende; + } + $csvData[] = array($titel, $projekt_kurzbz, $projekt_phase, $projekt_phase_id, $beginn, $ende); + //$index = array_search($prjp, array_values($projektphasen)); + unset($projektphasen[$index]); } + $index++; + } } - foreach($projektphasen as $prjp) - { - if(empty($prjp->projektphase_fk)) - { - $titel=$prjp->projekt_kurzbz; - $projekt_kurzbz = $prjp->projekt_kurzbz; - $projekt_phase = $prjp->bezeichnung; - $projekt_phase_id = $prjp->projektphase_id; - $beginn = $prjp->start; - $ende = $prjp->ende; + foreach ($projektphasen as $prjp) + { + if (empty($prjp->projektphase_fk)) + { + $titel = $prjp->projekt_kurzbz; + $projekt_kurzbz = $prjp->projekt_kurzbz; + $projekt_phase = $prjp->bezeichnung; + $projekt_phase_id = $prjp->projektphase_id; + $beginn = $prjp->start; + $ende = $prjp->ende; - $csvData[] = array($titel, $projekt_kurzbz, $projekt_phase, $projekt_phase_id, $beginn, $ende); - } - } + $csvData[] = array($titel, $projekt_kurzbz, $projekt_phase, $projekt_phase_id, $beginn, $ende); + } + } + + sort($csvData); + //headers schreiben + $csvData[0] = array('PROJEKT', 'PROJEKT KURZBEZEICHNUNG', 'PROJEKTPHASE', 'PROJEKTPHASEN ID', 'START', 'PROJEKT ENDE'); return $csvData; } ?> From 4183e7f4f702e04727f04d575745bc5f54adbe7f Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Wed, 23 Sep 2020 13:44:46 +0200 Subject: [PATCH 028/313] changed errormessage for projects that are already complited --- cis/private/tools/zeitaufzeichnung.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index e30605700..143863345 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -710,7 +710,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) if($data[0] == $user){ if(!empty($data[6]) && !in_array($data[6], $project_kurzbz_array)) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt nicht zugewiesen sind: ('.$data[6].')
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt entweder nicht zugewiesen sind oder das Projekt schon abgeschlossen wurde: ('.$data[6].')
'; } else { From 16fb610b3fc32176e1248c2b1cf34e2dea92900a Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Wed, 23 Sep 2020 14:24:17 +0200 Subject: [PATCH 029/313] impliment checks for ProjektPhase --- cis/private/tools/zeitaufzeichnung.php | 35 +++++++++++++++----------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 143863345..99b8739b9 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -678,14 +678,24 @@ function checkVals ($oe_val, $project_val, $phase_val, $service_val) if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) { $zeit = new zeitaufzeichnung(); + $projects_of_user = new projekt(); $projects= $projects_of_user->getProjekteListForMitarbeiter($user); $project_kurzbz_array = array(); + $projektph_of_user = new projektphase(); + $projektphasen = $projektph_of_user->getProjectphaseForMitarbeiter($user); + $projectphasen_kurzbz_array = array(); + foreach($projects as $prjct) { array_push($project_kurzbz_array, (string) $prjct->projekt_kurzbz); } + foreach ($projektphasen as $pp) + { + array_push($projectphasen_kurzbz_array, (string) $pp->projektphase_id); + } + $projectphase = new projektphase(); if ($_FILES['csv']['error'] == 0 && isset($_POST['import'])) @@ -712,6 +722,10 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) { echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt entweder nicht zugewiesen sind oder das Projekt schon abgeschlossen wurde: ('.$data[6].')
'; } + elseif(!empty($data[7]) && !in_array($data[7], $projectphasen_kurzbz_array)) + { + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgender Projektphase entweder nicht zugewiesen sind oder die Projektphase schon abgeschlossen wurde: ('.$data[7].')
'; + } else { @@ -729,6 +743,10 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) { echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; } + elseif (!empty($data[7]) && !$projektph_of_user ->checkProjectphaseInCorrectTime($data[7], $data[2], $data[3])) + { + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt.
'; + } elseif (checkVals($data[5],$data[6],$data[7],$data[8])) { echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Fehlerhafte Werte ('.$data[2].')
'; @@ -1960,20 +1978,9 @@ function getDataForProjectOverviewCSV($user) { $projekt_phase = $prjp->bezeichnung; $projekt_phase_id = $prjp->projektphase_id; - if (!empty($prjp->start)) - { - $beginn = $prjp->start; - } else - { - $beginn = $project->beginn; - } - if (!empty($prjp->ende)) - { - $ende = $prjp->ende; - } else - { - $ende = $project->ende; - } + $beginn = $prjp->start; + $ende = $prjp->ende; + $csvData[] = array($titel, $projekt_kurzbz, $projekt_phase, $projekt_phase_id, $beginn, $ende); //$index = array_search($prjp, array_values($projektphasen)); unset($projektphasen[$index]); From 14fbfc78604c2142b6b1b801382f4e07a994900d Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Thu, 24 Sep 2020 08:48:59 +0200 Subject: [PATCH 030/313] diplay date in error message --- cis/private/tools/zeitaufzeichnung.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 99b8739b9..518d397a5 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -169,7 +169,7 @@ if(isset($_POST['export'])) //CSV export für Übersicht zugeteilter Projekte - Konflikt mit normalen HTML headern deshalb weiter vorne if(isset($_POST['projektübersichtexport'])) { - exportProjectOverviewAsCSV($user, ','); + exportProjectOverviewAsCSV('oesi', ','); } echo ' @@ -741,11 +741,11 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum ('.$data[2].')
'; elseif (!empty($data[6]) && !$projects_of_user->checkProjectInCorrectTime($data[6], $data[2], $data[3])) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt.
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt: ('.$data[2].') ('.$data[3].')
'; } elseif (!empty($data[7]) && !$projektph_of_user ->checkProjectphaseInCorrectTime($data[7], $data[2], $data[3])) { - echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt.
'; + echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektphasenzeitrahmen fällt: ('.$data[2].') ('.$data[3].')
'; } elseif (checkVals($data[5],$data[6],$data[7],$data[8])) { From 3d274645ac34023b0ca544020620a512da6a8312 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Thu, 24 Sep 2020 08:52:33 +0200 Subject: [PATCH 031/313] correct user --- cis/private/tools/zeitaufzeichnung.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 518d397a5..2ed8005b1 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -169,7 +169,7 @@ if(isset($_POST['export'])) //CSV export für Übersicht zugeteilter Projekte - Konflikt mit normalen HTML headern deshalb weiter vorne if(isset($_POST['projektübersichtexport'])) { - exportProjectOverviewAsCSV('oesi', ','); + exportProjectOverviewAsCSV($user, ','); } echo ' From f672cd2d53901d7692929cc664f25897bd7aee84 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Thu, 24 Sep 2020 11:14:32 +0200 Subject: [PATCH 032/313] user can enter project with projectphase even if not assigend to project --- cis/private/tools/zeitaufzeichnung.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 2ed8005b1..a5e277e76 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -718,7 +718,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) while(($data = fgetcsv($handle, 1000, ';', '"')) !== FALSE) { if($data[0] == $user){ - if(!empty($data[6]) && !in_array($data[6], $project_kurzbz_array)) + if(!empty($data[6]) && !in_array($data[6], $project_kurzbz_array) && empty($data[7])) { echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da Sie folgendem Projekt entweder nicht zugewiesen sind oder das Projekt schon abgeschlossen wurde: ('.$data[6].')
'; } @@ -739,7 +739,7 @@ if(isset($_POST['save']) || isset($_POST['edit']) || isset($_POST['import'])) $data[8] = NULL; if ($datum->formatDatum($data[2], $format='Y-m-d H:i:s') < $sperrdatum) echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich da vor dem Sperrdatum ('.$data[2].')
'; - elseif (!empty($data[6]) && !$projects_of_user->checkProjectInCorrectTime($data[6], $data[2], $data[3])) + elseif (empty($data[7]) && !empty($data[6]) && !$projects_of_user->checkProjectInCorrectTime($data[6], $data[2], $data[3])) { echo ''.$p->t("global/fehlerBeimSpeichernDerDaten").': Eingabe nicht möglich, da angegebenes Anfangs und Enddatum nicht in den Projektzeitrahmen fällt: ('.$data[2].') ('.$data[3].')
'; } From 08536d63df9e8f1d14e2f7eeae8307d2bf736e61 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Fri, 25 Sep 2020 12:19:18 +0200 Subject: [PATCH 033/313] display Full Name of Supervisors for vacation reqeust --- cis/private/profile/urlaubstool.php | 9 +++++- cis/private/profile/zeitsperre_resturlaub.php | 12 ++++++-- include/person.class.php | 29 +++++++++++++++++++ 3 files changed, 47 insertions(+), 3 deletions(-) diff --git a/cis/private/profile/urlaubstool.php b/cis/private/profile/urlaubstool.php index 9d33b25ae..08e9eb766 100644 --- a/cis/private/profile/urlaubstool.php +++ b/cis/private/profile/urlaubstool.php @@ -257,19 +257,26 @@ if(isset($_GET['speichern']) && isset($_GET['wtag'])) if(!$error) { //Mail an Vorgesetzten + $prsn = new person(); + $vorgesetzter = $ma->getVorgesetzte($uid); if($vorgesetzter) { $to=''; + $fullName =''; foreach($ma->vorgesetzte as $vg) { if($to!='') { $to.=', '.$vg.'@'.DOMAIN; + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName = ', '.$name; } else { $to.=$vg.'@'.DOMAIN; + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName = $name; } } @@ -295,7 +302,7 @@ if(isset($_GET['speichern']) && isset($_GET['wtag'])) $mail = new mail($to, 'vilesci@'.DOMAIN,$p->t('urlaubstool/freigabeansuchenUrlaub'), $message); if($mail->send()) { - $vgmail="".$p->t('urlaubstool/freigabemailWurdeVersandt',array($to)).""; + $vgmail="".$p->t('urlaubstool/freigabemailWurdeVersandt',array($fullName)).""; } else { diff --git a/cis/private/profile/zeitsperre_resturlaub.php b/cis/private/profile/zeitsperre_resturlaub.php index b7654310e..2f7840108 100644 --- a/cis/private/profile/zeitsperre_resturlaub.php +++ b/cis/private/profile/zeitsperre_resturlaub.php @@ -413,15 +413,23 @@ if(isset($_GET['type']) && ($_GET['type']=='edit_sperre' || $_GET['type']=='new_ if($zeitsperre->new && $zeitsperre->zeitsperretyp_kurzbz=='Urlaub') { //Beim Anlegen von neuen Urlauben wird ein Mail an den Vorgesetzten versendet um diesen Freizugeben - $vorgesetzter = $ma->getVorgesetzte($uid); + $prsn = new person(); + + $vorgesetzter = $ma->getVorgesetzte($uid); if($vorgesetzter) { $to=''; + $fullName =''; foreach($ma->vorgesetzte as $vg) { if (!empty($to)) + { $to.=','; + $fullName =','; + } $to.=trim($vg.'@'.DOMAIN); + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName = $name; } $benutzer = new benutzer(); @@ -440,7 +448,7 @@ if(isset($_GET['type']) && ($_GET['type']=='edit_sperre' || $_GET['type']=='new_ $mail = new mail($to, $from, 'Freigabeansuchen', $message); if($mail->send()) { - echo "
".$p->t('urlaubstool/freigabemailWurdeVersandt',array($to)).""; + echo "
".$p->t('urlaubstool/freigabemailWurdeVersandt',array($fullName)).""; } else { diff --git a/include/person.class.php b/include/person.class.php index edfa0ec7f..b220bb55b 100644 --- a/include/person.class.php +++ b/include/person.class.php @@ -1018,4 +1018,33 @@ class person extends basis_db return false; } } + + public function getFullNameFromBenutzer($uid) + { + $qry = "SELECT + * + FROM + public.tbl_person + JOIN public.tbl_benutzer USING(person_id) + WHERE + uid=".$this->db_add_param($uid, FHC_STRING); + + if ($this->db_query($qry)) + { + if ($row = $this->db_fetch_object()) + { + return (string)$row->vorname.' '.$row->nachname; + } + else + { + $this->errormsg = 'Keine Personendaten zu dieser UID gefunden'; + return false; + } + } + else + { + $this->errormsg = "Fehler beim Laden der Personendaten"; + return false; + } + } } From c48540014297631a430c31b90fe976f616c892c8 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Tue, 29 Sep 2020 14:56:15 +0200 Subject: [PATCH 034/313] user is able to delete approved vacation if in the future --- cis/private/profile/urlaubstool.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/cis/private/profile/urlaubstool.php b/cis/private/profile/urlaubstool.php index 9d33b25ae..4b1805080 100644 --- a/cis/private/profile/urlaubstool.php +++ b/cis/private/profile/urlaubstool.php @@ -373,10 +373,14 @@ if ((isset($wmonat) || isset($wmonat))&&(isset($wjahr) || isset($wjahr))) if(date("Y-m-d",mktime(0, 0, 0, ($wmonat+1) , $i-$wotag+1, $jahre[$wjahr]))>=$row->vondatum && date("Y-m-d",mktime(0, 0, 0, ($wmonat+1) , $i-$wotag+1, $jahre[$wjahr]))<=$row->bisdatum) { - if($row->freigabevon!='' || $row->bisdatumfreigabevon!='' && $row->vondatum<=date("Y-m-d",time())) { $hgfarbe[$i]='#bbb'; } + elseif ($row->freigabevon!='' && $row->vondatum>date("Y-m-d",time())) + { + $hgfarbe[$i]='#C1FF80'; + } else { $hgfarbe[$i]='#FFFC7F'; @@ -389,7 +393,7 @@ if ((isset($wmonat) || isset($wmonat))&&(isset($wjahr) || isset($wjahr))) } else { - if($hgfarbe[$i]!='#FFFC7F' && $hgfarbe[$i]!='#bbb') + if($hgfarbe[$i]!='#FFFC7F' && $hgfarbe[$i]!='#bbb' && $hgfarbe[$i]!='#C1FF80') { $hgfarbe[$i]='#E9ECEE'; @@ -696,7 +700,7 @@ for ($i=0;$i<6;$i++) } if($tage[$j+7*$i]!='') { - if($hgfarbe[$j+7*$i]=='#FFFC7F') + if($hgfarbe[$j+7*$i]=='#FFFC7F' )//|| $hgfarbe[$j+7*$i]=='#C1FF80') { echo 't('urlaubstool/erreichbar').': '.$erreichbarkeit_kurzbz[$j+7*$i].'">'.$tage[$j+7*$i].'
';; $k=$j+7*$i; @@ -724,6 +728,11 @@ for ($i=0;$i<6;$i++) } elseif(isset($freigabeamum[$j+7*$i])) { + if($hgfarbe[$j+7*$i]=='#C1FF80') + { + $k=$j+7*$i; + echo ""; + } echo 'freigegeben'; } else From 6128a7ae6ec5e2e0814db7a27d7b0f693057bb22 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Mon, 12 Oct 2020 15:31:37 +0200 Subject: [PATCH 035/313] add X to delete approved vacation --- cis/private/profile/urlaubstool.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cis/private/profile/urlaubstool.php b/cis/private/profile/urlaubstool.php index 4b1805080..5d64cacb7 100644 --- a/cis/private/profile/urlaubstool.php +++ b/cis/private/profile/urlaubstool.php @@ -379,7 +379,7 @@ if ((isset($wmonat) || isset($wmonat))&&(isset($wjahr) || isset($wjahr))) } elseif ($row->freigabevon!='' && $row->vondatum>date("Y-m-d",time())) { - $hgfarbe[$i]='#C1FF80'; + $hgfarbe[$i]='#CDDDEE'; } else { @@ -393,7 +393,7 @@ if ((isset($wmonat) || isset($wmonat))&&(isset($wjahr) || isset($wjahr))) } else { - if($hgfarbe[$i]!='#FFFC7F' && $hgfarbe[$i]!='#bbb' && $hgfarbe[$i]!='#C1FF80') + if($hgfarbe[$i]!='#FFFC7F' && $hgfarbe[$i]!='#bbb' && $hgfarbe[$i]!='#CDDDEE') { $hgfarbe[$i]='#E9ECEE'; @@ -700,7 +700,7 @@ for ($i=0;$i<6;$i++) } if($tage[$j+7*$i]!='') { - if($hgfarbe[$j+7*$i]=='#FFFC7F' )//|| $hgfarbe[$j+7*$i]=='#C1FF80') + if($hgfarbe[$j+7*$i]=='#FFFC7F' )//|| $hgfarbe[$j+7*$i]=='#CDDDEE') { echo 't('urlaubstool/erreichbar').': '.$erreichbarkeit_kurzbz[$j+7*$i].'">'.$tage[$j+7*$i].'
';; $k=$j+7*$i; @@ -728,12 +728,13 @@ for ($i=0;$i<6;$i++) } elseif(isset($freigabeamum[$j+7*$i])) { - if($hgfarbe[$j+7*$i]=='#C1FF80') + echo 'freigegeben '; + if($hgfarbe[$j+7*$i]=='#CDDDEE') { $k=$j+7*$i; echo "
"; + echo 'loeschen'; } - echo 'freigegeben'; } else { From 5802ca8ea20c0687f5eccb95a94a91d1957affdb Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Tue, 13 Oct 2020 09:26:06 +0200 Subject: [PATCH 036/313] =?UTF-8?q?versende=20Email=20an=20Vorgesetzten=20?= =?UTF-8?q?wenn=20freigegebener=20Urlaub=20gel=C3=B6scht=20=20wird?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/profile/urlaubstool.php | 60 ++++++++++++++++++++++++++++- include/zeitsperre.class.php | 9 +++++ locale/de-AT/urlaubstool.php | 4 ++ 3 files changed, 72 insertions(+), 1 deletion(-) diff --git a/cis/private/profile/urlaubstool.php b/cis/private/profile/urlaubstool.php index 5d64cacb7..720935c46 100644 --- a/cis/private/profile/urlaubstool.php +++ b/cis/private/profile/urlaubstool.php @@ -163,6 +163,64 @@ if (isset($_GET['rechts_x']) || isset($_POST['rechts_x'])) $wjahr=$wjahr; } } + +//Bereits freigegebenen Eintrag löschen +//Eintragung löschen +if((isset($_GET['delete']) && isset($_GET['informSupervisor'])) || (isset($_POST['delete']) && isset($_POST['informSupervisor']))) +{ + $zeitsperre = new zeitsperre(); + $zeitsperre->load($_GET['delete']); + + $vondatum = $zeitsperre->getVonDatum(); + $bisdatum = $zeitsperre->getBisDatum(); + + if(!$zeitsperre->delete($_GET['delete'])) + echo $zeitsperre->errormsg; + + //Mail an Vorgesetzten + $vorgesetzter = $ma->getVorgesetzte($uid); + if($vorgesetzter) + { + $to=''; + foreach($ma->vorgesetzte as $vg) + { + if($to!='') + { + $to.=', '.$vg.'@'.DOMAIN; + } + else + { + $to.=$vg.'@'.DOMAIN; + } + } + + $benutzer = new benutzer(); + $benutzer->load($uid); + $message = $p->t('urlaubstool/diesIstEineAutomatischeMail')."\n". + $p->t('urlaubstool/xHatUrlaubGeloescht',array($benutzer->nachname,$benutzer->vorname)).":\n"; + + for($i=0;$it('urlaubstool/von')." ".date("d.m.Y", strtotime($vondatum))." ".$p->t('urlaubstool/bis')." ".date("d.m.Y", strtotime($bisdatum))."\n"; + } + + $mail = new mail($to, 'vilesci@'.DOMAIN,$p->t('urlaubstool/freigegebenerUrlaubGeloescht'), $message); + if($mail->send()) + { + $vgmail="".$p->t('urlaubstool/VorgesetzteInformiert',array($to)).""; + } + else + { + $vgmail="
".$p->t('urlaubstool/fehlerBeimSendenAufgetreten',array($to))."!"; + } + } + else + { + $vgmail="
".$p->t('urlaubstool/konnteKeinFreigabemailVersendetWerden').""; + } +} + + //Eintragung löschen if((isset($_GET['delete']) || isset($_POST['delete']))) { @@ -732,7 +790,7 @@ for ($i=0;$i<6;$i++) if($hgfarbe[$j+7*$i]=='#CDDDEE') { $k=$j+7*$i; - echo ""; + echo ""; echo 'loeschen'; } } diff --git a/include/zeitsperre.class.php b/include/zeitsperre.class.php index ce310451a..936a8d32f 100644 --- a/include/zeitsperre.class.php +++ b/include/zeitsperre.class.php @@ -510,6 +510,15 @@ class zeitsperre extends basis_db } } + public function getVonDatum() + { + return $this->vondatum; + } + + public function getBisDatum() + { + return $this->bisdatum; + } } ?> diff --git a/locale/de-AT/urlaubstool.php b/locale/de-AT/urlaubstool.php index 9ab612826..cd34be0da 100644 --- a/locale/de-AT/urlaubstool.php +++ b/locale/de-AT/urlaubstool.php @@ -36,4 +36,8 @@ $this->phrasen['urlaubstool/meineZeitsperren']='Meine Zeitsperren'; $this->phrasen['urlaubstool/sieKoennenDiesenUnterFolgenderAdresseFreigeben']='Sie können diesen unter folgender Adresse freigeben'; $this->phrasen['urlaubstool/freigabeansuchenUrlaub']='Freigabeansuchen Urlaub'; $this->phrasen['urlaubstool/freigabeFehlt']='Urlaub wurde noch nicht freigegeben'; +$this->phrasen['urlaubstool/freigegebenerUrlaubGeloescht']='Bereits Freigegebener Urlaub wurde gelöscht'; +$this->phrasen['urlaubstool/VorgesetzteInformiert']='Email wurde an %s versandt'; +$this->phrasen['urlaubstool/konnteKeinInformationsemailVersendetWerden']='Es konnte kein Email versendet werden, da kein Vorgesetzter eingetragen ist!'; +$this->phrasen['urlaubstool/xHatUrlaubGeloescht']='%s %s hat bereits freigegebenen Urlaub gelöscht'; ?> From 4ced199e88a2ef1c2412b7a18baf9ee605e9b611 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Tue, 13 Oct 2020 12:26:06 +0200 Subject: [PATCH 037/313] =?UTF-8?q?Freigegebenen=20Urlaub=20l=C3=B6schen?= =?UTF-8?q?=20auch=20in=20Zeitsperren?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/profile/urlaubstool.php | 5 +- cis/private/profile/zeitsperre_resturlaub.php | 64 ++++++++++++++++++- 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/cis/private/profile/urlaubstool.php b/cis/private/profile/urlaubstool.php index 720935c46..efba62e99 100644 --- a/cis/private/profile/urlaubstool.php +++ b/cis/private/profile/urlaubstool.php @@ -198,11 +198,8 @@ if((isset($_GET['delete']) && isset($_GET['informSupervisor'])) || (isset($_POS $benutzer->load($uid); $message = $p->t('urlaubstool/diesIstEineAutomatischeMail')."\n". $p->t('urlaubstool/xHatUrlaubGeloescht',array($benutzer->nachname,$benutzer->vorname)).":\n"; + $message.= $p->t('urlaubstool/von')." ".date("d.m.Y", strtotime($vondatum))." ".$p->t('urlaubstool/bis')." ".date("d.m.Y", strtotime($bisdatum))."\n"; - for($i=0;$it('urlaubstool/von')." ".date("d.m.Y", strtotime($vondatum))." ".$p->t('urlaubstool/bis')." ".date("d.m.Y", strtotime($bisdatum))."\n"; - } $mail = new mail($to, 'vilesci@'.DOMAIN,$p->t('urlaubstool/freigegebenerUrlaubGeloescht'), $message); if($mail->send()) diff --git a/cis/private/profile/zeitsperre_resturlaub.php b/cis/private/profile/zeitsperre_resturlaub.php index b7654310e..348a4418e 100644 --- a/cis/private/profile/zeitsperre_resturlaub.php +++ b/cis/private/profile/zeitsperre_resturlaub.php @@ -461,8 +461,62 @@ if(isset($_GET['type']) && ($_GET['type']=='edit_sperre' || $_GET['type']=='new_ echo "$error_msg"; } +//loeschen eines bereits freigegebenen Urlaubs +if((isset($_GET['type']) && $_GET['type']=='delete_sperre' && isset($_GET['informSupervisor']))) +{ + $zeitsperre = new zeitsperre(); + $zeitsperre->load($_GET['id']); + + $vondatum = $zeitsperre->getVonDatum(); + $bisdatum = $zeitsperre->getBisDatum(); + + if(!$zeitsperre->delete($_GET['id'])) + echo $zeitsperre->errormsg; + + //Mail an Vorgesetzten + $vorgesetzter = $ma->getVorgesetzte($uid); + if($vorgesetzter) + { + $to=''; + foreach($ma->vorgesetzte as $vg) + { + if($to!='') + { + $to.=', '.$vg.'@'.DOMAIN; + } + else + { + $to.=$vg.'@'.DOMAIN; + } + } + + $benutzer = new benutzer(); + $benutzer->load($uid); + $message = $p->t('urlaubstool/diesIstEineAutomatischeMail')."\n". + $p->t('urlaubstool/xHatUrlaubGeloescht',array($benutzer->nachname,$benutzer->vorname)).":\n"; + + + $message.= $p->t('urlaubstool/von')." ".date("d.m.Y", strtotime($vondatum))." ".$p->t('urlaubstool/bis')." ".date("d.m.Y", strtotime($bisdatum))."\n"; + + + $mail = new mail($to, 'vilesci@'.DOMAIN,$p->t('urlaubstool/freigegebenerUrlaubGeloescht'), $message); + if($mail->send()) + { + echo "
".$p->t('urlaubstool/VorgesetzteInformiert',array($to)).""; + } + else + { + echo "
".$p->t('urlaubstool/fehlerBeimSendenAufgetreten',array($to))."!"; + } + } + else + { + $vgmail="
".$p->t('urlaubstool/konnteKeinFreigabemailVersendetWerden').""; + } +} + //loeschen einer zeitsperre -if(isset($_GET['type']) && $_GET['type']=='delete_sperre') +if(isset($_GET['type']) && $_GET['type']=='delete_sperre' && !isset($_GET['informSupervisor']) ) { $zeit = new zeitsperre(); $zeit->load($_GET['id']); @@ -532,10 +586,14 @@ if(count($zeit->result)>0) $content_table.="".$p->t('zeitsperre/edit').""; if ($row->vondatum < $gesperrt_bis AND in_array($row->zeitsperretyp_kurzbz,$typen_arr)) $content_table .= ' '; - else if($row->freigabeamum=='' || $row->zeitsperretyp_kurzbz!='Urlaub') + else if($row->vondatum>=date("Y-m-d",time()) && $row->zeitsperretyp_kurzbz=='Urlaub') { - $content_table.="\n".$p->t('zeitsperre/loeschen').""; + $content_table.="\n".$p->t('zeitsperre/loeschen').""; } + elseif($row->zeitsperretyp_kurzbz!='Urlaub') + { + $content_table.="\n".$p->t('zeitsperre/loeschen').""; + } else $content_table .= ' '; $content_table.=""; From c1e4278e71fac1f9b86503d5a93e7db34ef359a7 Mon Sep 17 00:00:00 2001 From: Cris Date: Tue, 13 Oct 2020 15:45:37 +0200 Subject: [PATCH 038/313] Changed permission denying - text in 'Lehrauftrag bestellen' If a permission is correctly set, but the permission is restricted on organisational units Department or Kompetenzfeld, the error-text gives now meaningful information about the abort. Signed-off-by: Cris --- application/controllers/lehre/lehrauftrag/Lehrauftrag.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/controllers/lehre/lehrauftrag/Lehrauftrag.php b/application/controllers/lehre/lehrauftrag/Lehrauftrag.php index b7140c7c3..8a096338e 100644 --- a/application/controllers/lehre/lehrauftrag/Lehrauftrag.php +++ b/application/controllers/lehre/lehrauftrag/Lehrauftrag.php @@ -92,7 +92,8 @@ class Lehrauftrag extends Auth_Controller // Retrieve studiengaenge the user is entitled for to populate studiengang dropdown if (!$studiengang_kz_arr = $this->permissionlib->getSTG_isEntitledFor(self::BERECHTIGUNG_LEHRAUFTRAG_BESTELLEN)) { - show_error('Fehler bei Berechtigungsprüfung'); + show_error('Keine Studiengänge gefunden.
+ Es muss eine passende Organisationseinheit hinterlegt werden.
'); } // If studiengang_kz get param was set, check against entitled stg From 14fa1b24ad91826031ca70a0b8773aded43a7de5 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Wed, 14 Oct 2020 13:23:19 +0200 Subject: [PATCH 039/313] Display Full Name instead of Email Adress of Supervisor --- cis/private/profile/urlaubstool.php | 41 +++++++++++-------- cis/private/profile/zeitsperre_resturlaub.php | 19 ++++++--- 2 files changed, 37 insertions(+), 23 deletions(-) diff --git a/cis/private/profile/urlaubstool.php b/cis/private/profile/urlaubstool.php index 9fc8ec22d..11620a99a 100644 --- a/cis/private/profile/urlaubstool.php +++ b/cis/private/profile/urlaubstool.php @@ -177,22 +177,29 @@ if((isset($_GET['delete']) && isset($_GET['informSupervisor'])) || (isset($_POS if(!$zeitsperre->delete($_GET['delete'])) echo $zeitsperre->errormsg; - //Mail an Vorgesetzten - $vorgesetzter = $ma->getVorgesetzte($uid); - if($vorgesetzter) - { - $to=''; - foreach($ma->vorgesetzte as $vg) + //Mail an Vorgesetzten + $prsn = new person(); + + $vorgesetzter = $ma->getVorgesetzte($uid); + if($vorgesetzter) { - if($to!='') + $to=''; + $fullName =''; + foreach($ma->vorgesetzte as $vg) { - $to.=', '.$vg.'@'.DOMAIN; + if($to!='') + { + $to.=', '.$vg.'@'.DOMAIN; + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName.=', '.$name; + } + else + { + $to.=$vg.'@'.DOMAIN; + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName.=$name; + } } - else - { - $to.=$vg.'@'.DOMAIN; - } - } $benutzer = new benutzer(); $benutzer->load($uid); @@ -204,11 +211,11 @@ if((isset($_GET['delete']) && isset($_GET['informSupervisor'])) || (isset($_POS $mail = new mail($to, 'vilesci@'.DOMAIN,$p->t('urlaubstool/freigegebenerUrlaubGeloescht'), $message); if($mail->send()) { - $vgmail="".$p->t('urlaubstool/VorgesetzteInformiert',array($to)).""; + $vgmail="".$p->t('urlaubstool/VorgesetzteInformiert',array($fullName)).""; } else { - $vgmail="
".$p->t('urlaubstool/fehlerBeimSendenAufgetreten',array($to))."!"; + $vgmail="
".$p->t('urlaubstool/fehlerBeimSendenAufgetreten',array($fullName))."!"; } } else @@ -325,13 +332,13 @@ if(isset($_GET['speichern']) && isset($_GET['wtag'])) { $to.=', '.$vg.'@'.DOMAIN; $name = $prsn->getFullNameFromBenutzer($vg); - $fullName = ', '.$name; + $fullName.=', '.$name; } else { $to.=$vg.'@'.DOMAIN; $name = $prsn->getFullNameFromBenutzer($vg); - $fullName = $name; + $fullName.=$name; } } diff --git a/cis/private/profile/zeitsperre_resturlaub.php b/cis/private/profile/zeitsperre_resturlaub.php index 087b2ce80..efe6ed98d 100644 --- a/cis/private/profile/zeitsperre_resturlaub.php +++ b/cis/private/profile/zeitsperre_resturlaub.php @@ -419,17 +419,17 @@ if(isset($_GET['type']) && ($_GET['type']=='edit_sperre' || $_GET['type']=='new_ if($vorgesetzter) { $to=''; - $fullName =''; + $fullName=''; foreach($ma->vorgesetzte as $vg) { if (!empty($to)) { $to.=','; - $fullName =','; + $fullName.=','; } $to.=trim($vg.'@'.DOMAIN); $name = $prsn->getFullNameFromBenutzer($vg); - $fullName = $name; + $fullName.=$name; } $benutzer = new benutzer(); @@ -452,7 +452,7 @@ if(isset($_GET['type']) && ($_GET['type']=='edit_sperre' || $_GET['type']=='new_ } else { - echo "
".$p->t('urlaubstool/fehlerBeimSendenAufgetreten',array($to)).""; + echo "
".$p->t('urlaubstool/fehlerBeimSendenAufgetreten',array($fullName)).""; } } else @@ -482,19 +482,26 @@ if((isset($_GET['type']) && $_GET['type']=='delete_sperre' && isset($_GET['infor echo $zeitsperre->errormsg; //Mail an Vorgesetzten + $prsn = new person(); + $vorgesetzter = $ma->getVorgesetzte($uid); if($vorgesetzter) { $to=''; + $fullName =''; foreach($ma->vorgesetzte as $vg) { if($to!='') { $to.=', '.$vg.'@'.DOMAIN; + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName.=', '.$name; } else { $to.=$vg.'@'.DOMAIN; + $name = $prsn->getFullNameFromBenutzer($vg); + $fullName.=$name; } } @@ -510,11 +517,11 @@ if((isset($_GET['type']) && $_GET['type']=='delete_sperre' && isset($_GET['infor $mail = new mail($to, 'vilesci@'.DOMAIN,$p->t('urlaubstool/freigegebenerUrlaubGeloescht'), $message); if($mail->send()) { - echo "
".$p->t('urlaubstool/VorgesetzteInformiert',array($to)).""; + echo "
".$p->t('urlaubstool/VorgesetzteInformiert',array($fullName)).""; } else { - echo "
".$p->t('urlaubstool/fehlerBeimSendenAufgetreten',array($to))."!"; + echo "
".$p->t('urlaubstool/fehlerBeimSendenAufgetreten',array($fullName))."!"; } } else From 7fe2f3ef396f7b4bd869e86b3c229dfa7446c192 Mon Sep 17 00:00:00 2001 From: Cris Date: Thu, 15 Oct 2020 11:03:16 +0200 Subject: [PATCH 040/313] Adapted span-width of date in each tablerow Allows nice align of error messages. Signed-off-by: Cris --- cis/private/tools/zeitaufzeichnung.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index 71fdda2bb..054cf32e2 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1532,7 +1532,7 @@ if($projekt->getProjekteMitarbeiter($user, true)) $langindex = 1; else $langindex = 2; - echo ''.$tagbez[$langindex][$datum->formatDatum($tag,'N')].' '.$datum->formatDatum($tag,'d.m.Y').' '.$zeitsperre_text.''.$pausefehlt_str; + echo ''.$tagbez[$langindex][$datum->formatDatum($tag,'N')].' '.$datum->formatDatum($tag,'d.m.Y').''.$zeitsperre_text.''.$pausefehlt_str; if ($ersumme != '00:00') $erstr = ' (+ '.$ersumme.' ER)'; else From 4b81727b73e84d48e6977ddb430c4f26edb3c70b Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 20 Oct 2020 00:37:49 +0200 Subject: [PATCH 041/313] Diplomasupplement: added auslandssemesterdata to sonstige angaben --- rdf/diplomasupplement.xml.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/rdf/diplomasupplement.xml.php b/rdf/diplomasupplement.xml.php index a88df9533..7efefb9fd 100644 --- a/rdf/diplomasupplement.xml.php +++ b/rdf/diplomasupplement.xml.php @@ -360,15 +360,32 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") } } - $qry = "SELECT von, bis, lehreinheit_id FROM bis.tbl_bisio WHERE student_uid=".$db->db_add_param($uid_arr[$i]); + $qry = "SELECT tbl_bisio.bisio_id, von, bis, lehreinheit_id, + (SELECT STRING_AGG ( + tbl_zweck.bezeichnung, + ', ' + ORDER BY tbl_zweck.zweck_code + ) FROM bis.tbl_bisio_zweck + JOIN bis.tbl_zweck USING(zweck_code) + WHERE tbl_bisio_zweck.bisio_id = tbl_bisio.bisio_id + ) zweck, ort, universitaet + FROM bis.tbl_bisio + WHERE student_uid=".$db->db_add_param($uid_arr[$i]); + if($db->db_query($qry)) { if($db->db_num_rows()>0) { - echo " "; + echo ""; while($row1 = $db->db_fetch_object()) { - echo "Auslandssemester/International semester ".$datum->convertISODate($row1->von)." - ".$datum->convertISODate($row1->bis); + echo ""; + echo "".$datum->convertISODate($row1->von).""; + echo "".$datum->convertISODate($row1->bis).""; + echo "$row1->zweck"; + echo "$row1->ort"; + echo "$row1->universitaet"; + echo ""; } echo ""; $auslandssemester=true; From a26f1701ec21105b315c233b54f7f8a8606ad58c Mon Sep 17 00:00:00 2001 From: alex Date: Tue, 20 Oct 2020 23:08:01 +0200 Subject: [PATCH 042/313] Diplomasupplement: andere Formulierung bei dualem Studium, orgform kommt vom Status --- rdf/diplomasupplement.xml.php | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/rdf/diplomasupplement.xml.php b/rdf/diplomasupplement.xml.php index 7efefb9fd..0052c75be 100644 --- a/rdf/diplomasupplement.xml.php +++ b/rdf/diplomasupplement.xml.php @@ -228,14 +228,13 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") else echo ' '; - if($row->mischform=='t' || $row->orgform_kurzbz=='VBB') - { - //Bei Mischformen, die OrgForm aus dem Status nehmen - $prestudent = new prestudent(); - $prestudent->getLastStatus($row->prestudent_id); - if($prestudent->orgform_kurzbz!='') - $row->orgform_kurzbz=$prestudent->orgform_kurzbz; - } + //OrgForm aus dem Status nehmen + $prestudent = new prestudent(); + $prestudent->getLastStatus($row->prestudent_id); + if($prestudent->orgform_kurzbz!='') + $row->orgform_kurzbz=$prestudent->orgform_kurzbz; + + $anforderungen_praxis = 'Das Studium beinhaltet ein facheinschlägiges Berufspraktikum.'; switch($row->orgform_kurzbz) { @@ -245,6 +244,10 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") break; case 'DL': echo ' Fernstudium / Distance Learning'; break; + case 'DUA': // andere praxisanforderungen bei dualem Studium + echo ' Duales Studium / Integrated work/study degree program'; + $anforderungen_praxis = 'Das Studium ist als duales Studium konzipiert und weist einen hohen Anteil an Praxisphasen in Partnerunternehmen auf, die inhaltlich und organisatorisch im Studienplan verankert sind und die systematische Verschränkung von Wissen und Anwendung fördern.'; + break; default: echo ' '; break; } @@ -254,7 +257,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") echo ' UNESCO ISCED 7'; echo ' '; echo ' '; - echo ' '; + echo ' '; echo ' '; echo ' '; echo ' '; @@ -278,7 +281,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") echo ' UNESCO ISCED 6'; echo ' '; echo ' '; - echo ' '; + echo ' '; echo ' '; echo ' '; echo ' '; From 3ec0aabfee85c93c94a011631ac030de7928e4c0 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 22 Oct 2020 00:30:37 +0200 Subject: [PATCH 043/313] person/Kontakt_model: added getZustellKontakt for getting latest Zustellkontakt --- application/models/person/Kontakt_model.php | 29 +++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/application/models/person/Kontakt_model.php b/application/models/person/Kontakt_model.php index 50ef18e15..c35794fc8 100644 --- a/application/models/person/Kontakt_model.php +++ b/application/models/person/Kontakt_model.php @@ -169,4 +169,33 @@ class Kontakt_model extends DB_Model return $this->execQuery($qry, array($person_id)); } + + /** + * Loads main contact, i.e. most recent Zustellkontakt with the given kontakttypes. + * @param $person_id + * @param $kontakttypen array of kontakttypen, one chronologically last Zustellkontakt for all given types + * @return object + */ + public function getZustellKontakt($person_id, $kontakttypen) + { + if (is_string($kontakttypen)) + $kontakttypen = array($kontakttypen); + + if (!isEmptyArray($kontakttypen)) + { + $qry = " + SELECT + kontakt + FROM + public.tbl_kontakt + WHERE person_id = ? + AND kontakttyp IN ? + ORDER BY zustellung DESC NULLS LAST, updateamum DESC, insertamum DESC + LIMIT 1"; + + return $this->execQuery($qry, array($person_id, $kontakttypen)); + } + else + return success(array()); + } } From d78308d43fc5c9be8fd030e8f2485aaf2f236ed5 Mon Sep 17 00:00:00 2001 From: alex Date: Thu, 29 Oct 2020 23:40:02 +0100 Subject: [PATCH 044/313] DVUH Meldung: added ERNP Meldung for retrieving bpk for e.g. foreign residents --- include/dvb.class.php | 163 +++++++++++++++++++++++++++++++++++ soap/datenverbund_client.php | 73 ++++++++++++++-- 2 files changed, 229 insertions(+), 7 deletions(-) diff --git a/include/dvb.class.php b/include/dvb.class.php index 0131f1e4d..2f163d5e7 100644 --- a/include/dvb.class.php +++ b/include/dvb.class.php @@ -1013,6 +1013,134 @@ class dvb extends basis_db } } + public function setMatrikelnummerErnp($bildungseinrichtung, $person, $reisepass) + { + $this->debug('ernpMeldung'); + $uuid = $this->getUUID(); + + if ($this->tokenIsExpired()) + { + $result = $this->authenticate(); + if (ErrorHandler::isError($result)) + return ErrorHandler::error(); + } + + $data = ''; + $data .= ' + '.$uuid.''; + + $data .= $this->getPersonmeldungXml($bildungseinrichtung, $person); + + $data .= ' + + '.$reisepass->ausgabedatum.' + '.$reisepass->ausstellBehoerde.' + '.$reisepass->ausstellland.' + '.$reisepass->dokumentnr.' + REISEP + + '; + $data .= ''; + + $curl = curl_init(); + $url = self::DVB_URL_WEBSERVICE_MELDUNG; + + curl_setopt($curl, CURLOPT_URL, $url); + curl_setopt($curl, CURLOPT_POST, true); + curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($curl, CURLOPT_POSTFIELDS, $data); + + $headers = array( + 'Accept: application/xml', + 'Content-Type: application/xml', + 'Authorization: Bearer '.$this->authentication->access_token, + 'User-Agent: FHComplete', + 'Connection: Keep-Alive', + 'Expect:' + ); + curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); + + $this->debug('Request URL:'.$url); + $this->debug('Request Data:'.$data); + $response = curl_exec($curl); + $curl_info = curl_getinfo($curl); + curl_close($curl); + + $this->debug('Response: '.$curl_info['http_code']); + + $this->debug('Response: '.print_r($response, true)); + + if ($curl_info['http_code'] == '200') + { + $dom = new DOMDocument(); + $dom->loadXML($response); + $domnodes_fehlerliste = $dom->getElementsByTagName('fehlerliste'); + + $fehleranzahl = $domnodes_fehlerliste->item(0)->getAttribute('fehleranzahl'); + if ($fehleranzahl === '0') + { + // Keine Fehler -> Meldung erfolgreich + $retval = new stdClass(); + $retval->matrikelnummer = $person->matrikelnummer; + return ErrorHandler::success($retval); + } + else + { + $this->errormsg = 'Es gab '.$fehleranzahl.' Fehler:'; + $domnodes_fehler = $dom->getElementsByTagName('fehler'); + foreach ($domnodes_fehler as $row) + { + $fehlernummer = $row->getElementsByTagName('fehlernummer'); + + /** + * Bei Fehlernummer ED10065 wurde die Matrikelnummer korrekt gesetzt. + * Das BPK wurde vom Datenverbund versucht zu ermitteln und wird in der Fehlermeldung + * zurückgeliefert. Dieses sollte dann gespeichert werden. + * Es muss eine erneute Vergabemeldung mit korrigierten Daten vorgenommen werden um die Daten im + * DVB zu aktualisieren + * Dies gilt nur, wenn ED10065 alleine geliefert wird und keine sonstigen Fehler auftreten + */ + if ($fehlernummer->length == 1 && $fehlernummer->item(0)->textContent == 'ED10065') + { + $this->debug('ED10065 Response'); + $domnodes_feldinhalt = $row->getElementsByTagName('feldinhalt'); + if ($domnodes_feldinhalt->length > 0 && $domnodes_feldinhalt->item(0)->textContent!='') + { + $bpk = $domnodes_feldinhalt->item(0)->textContent; + $retval = new stdClass(); + $retval->matrikelnummer = $person->matrikelnummer; + if ($bpk != 'keine bPK gefunden') + $retval->bpk = $bpk; + + $this->errormsg .= 'ED10065 Response'; + $this->errormsg .= 'Eine Personendatenprüfung ist erforderlich'; + $this->errormsg .= 'Danach muss eine erneute Vergabemeldung mit dieser Matrikelnummer erfolgen.'; + $this->debug('BPK:'.$bpk); + $this->debug('MatrNr:'.$person->matrikelnummer); + + return ErrorHandler::success($retval); + } + } + else + { + $datenfeld = $row->getElementsByTagName('datenfeld'); + $fehlertext = $row->getElementsByTagName('fehlertext'); + $this->errormsg .= ' Datenfeld:'.$datenfeld->item(0)->textContent; + $this->errormsg .= ' Fehlertext:'.$fehlertext->item(0)->textContent; + } + } + return ErrorHandler::error(); + } + } + else + { + $errormsg = 'Request Failed with HTTP Code:'.$curl_info['http_code'].' and Response:'.$response; + return ErrorHandler::error($errormsg); + } + } + /** * Get BPK from Person * @param string $person_id ID of the Person. @@ -1737,6 +1865,41 @@ class dvb extends basis_db $this->debug_output .= "\n".date('Y-m-d H:i:s').': '.$msg; } + private function getPersonmeldungXml($bildungseinrichtung, $person) + { + $gebdat = str_replace("-", "", $person->geburtsdatum); + + $data = ' + '.$bildungseinrichtung.' + '.$gebdat.' + '.$person->geschlecht.' + '.$person->matrikelnummer.''; + if (isset($person->matura) && $person->matura != '') + $data .= ''.$person->matura.''; + else + $data .= '00000000'; + + $data .= ''.$person->nachname.''; + + if (isset($person->plz) && $person->plz != '') + $data .= ''.$person->plz.''; + + $data .= ''.$person->staat.''; + + if (isset($person->svnr) && $person->svnr != '') + $data .= ''.$person->svnr.''; + + $data .= ''.$person->vorname.''; + + if (isset($person->writeonerror) && $person->writeonerror === true) + $data .= 'J'; + + $data .= ' + '; + + return $data; + } + /** * Erstellt einen Logeintrag * @param object $person Personen objekt. diff --git a/soap/datenverbund_client.php b/soap/datenverbund_client.php index 36f0fb9e0..954eea2e6 100644 --- a/soap/datenverbund_client.php +++ b/soap/datenverbund_client.php @@ -57,6 +57,11 @@ $ersatzkennzeichen = filter_input(INPUT_POST, 'ersatzkennzeichen'); $person_id = filter_input(INPUT_POST, 'person_id'); $strasse = filter_input(INPUT_POST, 'strasse'); +$ausgabedatum = filter_input(INPUT_POST, 'ausgabedatum'); +$ausstellbehoerde = filter_input(INPUT_POST, 'ausstellbehoerde'); +$ausstellland = filter_input(INPUT_POST, 'ausstellland'); +$dokumentnr = filter_input(INPUT_POST, 'dokumentnr'); + ?> @@ -79,6 +84,7 @@ $strasse = filter_input(INPUT_POST, 'strasse');
  • Matrikelnummer Reservierungen anzeigen
  • Matrikelnummer Kontingent anfordern
  • Matrikelnummer Vergabe melden
  • +
  • ERNP-Eintragung anfordern
  • Gesamtprozess (Abfrage, ggf Vergabemeldung, Speichern bei Person)
  • BPK ermitteln
  • BPK ermitteln manuell
  • @@ -114,6 +120,18 @@ $strasse = filter_input(INPUT_POST, 'strasse'); '; } + function printSetMatrikelnrRows() + { + global $matrikelnr, $nachname, $vorname, $geburtsdatum, $geschlecht, $postleitzahl, $staat, $svnr, $matura; + printrow('matrikelnummer', 'Matrikelnummer', $matrikelnr); + printrow('nachname', 'Nachname', $nachname, '', 255); + printrow('vorname', 'Vorname', $vorname, '', 30); + printrow('geburtsdatum', 'Geburtsdatum', $geburtsdatum, 'Format: YYYYMMDD', 10); + printrow('geschlecht', 'Geschlecht', $geschlecht, 'Format: M | W', 1); + printrow('postleitzahl', 'Postleitzahl', $postleitzahl, '', 10); + printrow('staat', 'Staat', $staat, '1-3 Stellen Codex (zb A für Österreich)', 3); + } + switch($action) { case 'getOAuth': @@ -144,17 +162,32 @@ $strasse = filter_input(INPUT_POST, 'strasse'); break; case 'setMatrikelnummer': - printrow('matrikelnummer', 'Matrikelnummer', $matrikelnr); - printrow('nachname', 'Nachname', $nachname, '', 255); - printrow('vorname', 'Vorname', $vorname, '', 30); - printrow('geburtsdatum', 'Geburtsdatum', $geburtsdatum, 'Format: YYYYMMDD', 10); - printrow('geschlecht', 'Geschlecht', $geschlecht, 'Format: M | W', 1); - printrow('postleitzahl', 'Postleitzahl', $postleitzahl, '', 10); - printrow('staat', 'Staat', $staat, '1-3 Stellen Codex (zb A für Österreich)', 3); + printSetMatrikelnrRows(); printrow('svnr', 'SVNR', $svnr); printrow('matura', 'Maturadatum', $matura, 'Format: YYYYMMDD (optional)', 10); break; + case 'setMatrikelnummerErnp': + echo ' + + Personmeldung + '; + + printSetMatrikelnrRows(); + printrow('svnr', 'Ersatzkennzeichen', $svnr); + printrow('matura', 'Maturadatum', $matura, 'Format: YYYYMMDD (optional)', 10); + + echo ' + + Ernpmeldung + '; + + printrow('dokumentnr', 'Dokumentnummer', $dokumentnr, '', 60); + printrow('ausgabedatum', 'Ausgabedatum', $ausgabedatum, 'Format: YYYYMMDD', 10); + printrow('ausstellbehoerde', 'Ausstellbehörde', $ausstellbehoerde, '', 40); + printrow('ausstellland', 'Ausstellland', $ausstellland, '1-3 Stellen Codex (zb D für Deutschland)', 60); + break; + case 'assignMatrikelnummer': printrow('person_id', 'PersonID', $person_id); break; @@ -337,6 +370,32 @@ if (isset($_REQUEST['submit'])) echo '
    Fehlgeschlagen:'.$result->errormsg; break; + case 'setMatrikelnummerErnp': + $person = new stdClass(); + $person->matrikelnummer = $matrikelnr; + $person->vorname = $vorname; + $person->nachname = $nachname; + $person->geburtsdatum = $geburtsdatum; + $person->geschlecht = $geschlecht; + $person->staat = $staat; + $person->plz = $postleitzahl; + $person->matura = $matura; // Optional + $person->svnr = $svnr; // Optional + + $reisepass = new stdClass(); + $reisepass->ausgabedatum = $ausgabedatum; + $reisepass->ausstellBehoerde = $ausstellbehoerde; + $reisepass->ausstellland = $ausstellland; + $reisepass->dokumentnr = $dokumentnr; + + $result = $dvb->setMatrikelnummerErnp(DVB_BILDUNGSEINRICHTUNG_CODE, $person, $reisepass); + + if (ErrorHandler::isSuccess($result)) + echo '
    Erfolgreich gemeldet'; + else + echo '
    Fehlgeschlagen:'.$result->errormsg; + break; + case 'assignMatrikelnummer': $result = $dvb->assignMatrikelnummer($person_id); if(ErrorHandler::isSuccess($result)) From 6e37edd30b9ff705c779e4a028854036a32a9681 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 30 Oct 2020 13:27:34 +0100 Subject: [PATCH 045/313] DVUH ERNP Meldung: added noticetext as warning, different country example (D instead of A) --- soap/datenverbund_client.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/soap/datenverbund_client.php b/soap/datenverbund_client.php index 954eea2e6..9e5defeec 100644 --- a/soap/datenverbund_client.php +++ b/soap/datenverbund_client.php @@ -129,7 +129,6 @@ $dokumentnr = filter_input(INPUT_POST, 'dokumentnr'); printrow('geburtsdatum', 'Geburtsdatum', $geburtsdatum, 'Format: YYYYMMDD', 10); printrow('geschlecht', 'Geschlecht', $geschlecht, 'Format: M | W', 1); printrow('postleitzahl', 'Postleitzahl', $postleitzahl, '', 10); - printrow('staat', 'Staat', $staat, '1-3 Stellen Codex (zb A für Österreich)', 3); } switch($action) @@ -163,17 +162,21 @@ $dokumentnr = filter_input(INPUT_POST, 'dokumentnr'); case 'setMatrikelnummer': printSetMatrikelnrRows(); + printrow('staat', 'Staat', $staat, '1-3 Stellen Codex (zb A für Österreich)', 3); printrow('svnr', 'SVNR', $svnr); printrow('matura', 'Maturadatum', $matura, 'Format: YYYYMMDD (optional)', 10); break; case 'setMatrikelnummerErnp': + echo 'HINWEIS: Die Eintragung ins ERnP (Ergänzungsregister für natürliche Personen) sollte nur dann durchgeführt werden, wenn für die Person bei "Matrikelnummer Vergabe melden" keine BPK ermittelt werden kann. +
    Beim Punkt "BPK ermitteln" sollte dementsprechend keine BPK zurückgegeben werden.


    '; echo ' Personmeldung '; printSetMatrikelnrRows(); + printrow('staat', 'Staat', $staat, '1-3 Stellen Codex (zb D für Deutschland)', 3); printrow('svnr', 'Ersatzkennzeichen', $svnr); printrow('matura', 'Maturadatum', $matura, 'Format: YYYYMMDD (optional)', 10); From 2ceefabec9cc5efd01a37fbe19839588f725df93 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 30 Oct 2020 15:47:15 +0100 Subject: [PATCH 046/313] DVUH Meldung: Dokumenttyp can be entered for ERNP Meldung (Dropdown) --- include/dvb.class.php | 2 +- soap/datenverbund_client.php | 42 +++++++++++++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/include/dvb.class.php b/include/dvb.class.php index 2f163d5e7..c264ca4a7 100644 --- a/include/dvb.class.php +++ b/include/dvb.class.php @@ -1037,7 +1037,7 @@ class dvb extends basis_db '.$reisepass->ausstellBehoerde.' '.$reisepass->ausstellland.' '.$reisepass->dokumentnr.' - REISEP + '.$reisepass->dokumenttyp.' '; $data .= ''; diff --git a/soap/datenverbund_client.php b/soap/datenverbund_client.php index 9e5defeec..3dbb8ff5d 100644 --- a/soap/datenverbund_client.php +++ b/soap/datenverbund_client.php @@ -57,6 +57,7 @@ $ersatzkennzeichen = filter_input(INPUT_POST, 'ersatzkennzeichen'); $person_id = filter_input(INPUT_POST, 'person_id'); $strasse = filter_input(INPUT_POST, 'strasse'); +$dokumenttyp = filter_input(INPUT_POST, 'dokumenttyp'); $ausgabedatum = filter_input(INPUT_POST, 'ausgabedatum'); $ausstellbehoerde = filter_input(INPUT_POST, 'ausstellbehoerde'); $ausstellland = filter_input(INPUT_POST, 'ausstellland'); @@ -120,9 +121,42 @@ $dokumentnr = filter_input(INPUT_POST, 'dokumentnr'); '; } + /** + * Erstellt eine Tabllezeile mit Input-Feld + * @param string $name Name des Inputs. + * @param string $title Titel der Zeile. + * @param string $value Value des Inputs. + * @param string $hint Hinweistext zu Inputfeld. + * @param int $maxlength Maximallaenge des Eingabefeldes. + * @return void + */ + function printDropdownRow($name, $title, $values, $selectedValue = '', $hint = '') + { + global $db; + + echo ' + + '.$title.': + + '.$hint.' + + '; + } + + /** + * Prints Stammdaten inputfields for setMatrikelnummer form + */ function printSetMatrikelnrRows() { - global $matrikelnr, $nachname, $vorname, $geburtsdatum, $geschlecht, $postleitzahl, $staat, $svnr, $matura; + global $matrikelnr, $nachname, $vorname, $geburtsdatum, $geschlecht, $postleitzahl; printrow('matrikelnummer', 'Matrikelnummer', $matrikelnr); printrow('nachname', 'Nachname', $nachname, '', 255); printrow('vorname', 'Vorname', $vorname, '', 30); @@ -168,8 +202,8 @@ $dokumentnr = filter_input(INPUT_POST, 'dokumentnr'); break; case 'setMatrikelnummerErnp': - echo 'HINWEIS: Die Eintragung ins ERnP (Ergänzungsregister für natürliche Personen) sollte nur dann durchgeführt werden, wenn für die Person bei "Matrikelnummer Vergabe melden" keine BPK ermittelt werden kann. -
    Beim Punkt "BPK ermitteln" sollte dementsprechend keine BPK zurückgegeben werden.


    '; + echo 'HINWEIS: Die Eintragung ins ERnP (Ergänzungsregister für natürliche Personen) sollte nur dann durchgeführt werden,
    wenn für die Person bei "Matrikelnummer Vergabe melden" keine BPK ermittelt werden kann. +
    Beim Punkt "BPK ermitteln" sollte dementsprechend keine BPK zurückgegeben werden.


    '; echo ' Personmeldung @@ -185,6 +219,7 @@ $dokumentnr = filter_input(INPUT_POST, 'dokumentnr'); Ernpmeldung '; + printDropdownRow('dokumenttyp', 'Dokumenttyp', array('Reisepass' => 'REISEP', 'Personalausweis' => 'PERSAUSW'), $dokumenttyp,''); printrow('dokumentnr', 'Dokumentnummer', $dokumentnr, '', 60); printrow('ausgabedatum', 'Ausgabedatum', $ausgabedatum, 'Format: YYYYMMDD', 10); printrow('ausstellbehoerde', 'Ausstellbehörde', $ausstellbehoerde, '', 40); @@ -386,6 +421,7 @@ if (isset($_REQUEST['submit'])) $person->svnr = $svnr; // Optional $reisepass = new stdClass(); + $reisepass->dokumenttyp = $dokumenttyp; $reisepass->ausgabedatum = $ausgabedatum; $reisepass->ausstellBehoerde = $ausstellbehoerde; $reisepass->ausstellland = $ausstellland; From 4465fbc87739ae9573a2e7216ed5f8047f6309a8 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 4 Nov 2020 22:43:45 +0100 Subject: [PATCH 047/313] DVUH Meldung: Renamed Ersatzkennzeichen input field text to SVNR/Ersatzkennzeichen --- soap/datenverbund_client.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soap/datenverbund_client.php b/soap/datenverbund_client.php index 3dbb8ff5d..f751e2498 100644 --- a/soap/datenverbund_client.php +++ b/soap/datenverbund_client.php @@ -211,7 +211,7 @@ $dokumentnr = filter_input(INPUT_POST, 'dokumentnr'); printSetMatrikelnrRows(); printrow('staat', 'Staat', $staat, '1-3 Stellen Codex (zb D für Deutschland)', 3); - printrow('svnr', 'Ersatzkennzeichen', $svnr); + printrow('svnr', 'SVNR/Ersatzkennzeichen', $svnr); printrow('matura', 'Maturadatum', $matura, 'Format: YYYYMMDD (optional)', 10); echo ' From 17affaa57d117d7319219ce7c22cedebd7df016d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 6 Nov 2020 09:42:05 +0100 Subject: [PATCH 048/313] =?UTF-8?q?BIS-Meldung=20Kennzahlen=20f=C3=BCr=20E?= =?UTF-8?q?isenstadt=20und=20Pinkafeld=20angepasst?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vilesci/bis/studentenmeldung.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vilesci/bis/studentenmeldung.php b/vilesci/bis/studentenmeldung.php index f27d3602f..7f6d97a47 100644 --- a/vilesci/bis/studentenmeldung.php +++ b/vilesci/bis/studentenmeldung.php @@ -144,9 +144,9 @@ derzeit fuer alle Studierende der gleiche Standort ToDo: Standort sollte pro Student konfigurierbar sein. */ $standortcode='22'; -if(in_array($stg_kz,array('265','268','761','760','266','267','764','269','400'))) +if(in_array($stg_kz,array('265','268','761','760','266','267','764','269','400','794','795','786','859'))) $standortcode='14'; // Pinkafeld -elseif(in_array($stg_kz,array('639','640','263','743','364','635','402','401','725','264','271'))) +elseif(in_array($stg_kz,array('639','640','263','743','364','635','402','401','725','264','271','781'))) $standortcode='3'; // Eisenstadt $datumobj=new datum(); From df8e7a9006d4c0421c75d6103e5319b1ea389896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 6 Nov 2020 12:39:37 +0100 Subject: [PATCH 049/313] =?UTF-8?q?BIS=20Check=20f=C3=BCr=20Aufenthaltszwe?= =?UTF-8?q?ckcode=20korrigiert=20wenn=201,2=20und=203=20gleichzeitig=20erf?= =?UTF-8?q?asst=20wurde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vilesci/bis/studentenmeldung.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vilesci/bis/studentenmeldung.php b/vilesci/bis/studentenmeldung.php index 7f6d97a47..df10214fa 100644 --- a/vilesci/bis/studentenmeldung.php +++ b/vilesci/bis/studentenmeldung.php @@ -1368,7 +1368,7 @@ function GenerateXMLStudentBlock($row) if (!in_array($row_zweck->zweck_code, $zweck_code_arr)) { // Aufenthaltszweck 1, 2, 3 nicht gemeinsam melden - if (!empty(array_intersect(array(1, 2, 3), $zweck_code_arr))) + if (in_array(1,$zweck_code_arr) && in_array(2,$zweck_code_arr) && in_array(3,$zweck_code_arr)) { $error_log_io .= (!empty($error_log_io) ? ', ' : ''). "Aufenthaltzweckcode 1, 2, 3 dürfen nicht gemeinsam gemeldet werden"; From 575e097e7fa667a64601cc812a6d5506c139ed6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Mon, 9 Nov 2020 08:20:30 +0100 Subject: [PATCH 050/313] =?UTF-8?q?Diplomasupplement=20-=20Englische=20Ver?= =?UTF-8?q?sion=20f=C3=BCr=20duales=20Studium=20hinzugef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rdf/diplomasupplement.xml.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rdf/diplomasupplement.xml.php b/rdf/diplomasupplement.xml.php index 0052c75be..14352a3c3 100644 --- a/rdf/diplomasupplement.xml.php +++ b/rdf/diplomasupplement.xml.php @@ -235,6 +235,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") $row->orgform_kurzbz=$prestudent->orgform_kurzbz; $anforderungen_praxis = 'Das Studium beinhaltet ein facheinschlägiges Berufspraktikum.'; + $anforderungen_praxiseng = 'Included in the program is a relevant work placement.'; switch($row->orgform_kurzbz) { @@ -247,6 +248,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") case 'DUA': // andere praxisanforderungen bei dualem Studium echo ' Duales Studium / Integrated work/study degree program'; $anforderungen_praxis = 'Das Studium ist als duales Studium konzipiert und weist einen hohen Anteil an Praxisphasen in Partnerunternehmen auf, die inhaltlich und organisatorisch im Studienplan verankert sind und die systematische Verschränkung von Wissen und Anwendung fördern.'; + $anforderungen_praxiseng = 'The program is designed as integrated work study program and has a high proportion of practical phases in partner companies, which are embedded in the curriculum in terms of content and organisation and promote the systematic interconnection of knowledge and utilisation.'; break; default: echo ' '; break; @@ -258,7 +260,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") echo ' '; echo ' '; echo ' '; - echo ' '; + echo ' '; echo ' '; echo ' '; echo ' Diplomstudium (UNESCO ISCED 7)'; @@ -282,7 +284,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") echo ' '; echo ' '; echo ' '; - echo ' '; + echo ' '; echo ' '; echo ' '; echo ' Bachelorstudium (UNESCO ISCED 6)'; @@ -363,7 +365,7 @@ if (isset($_REQUEST["xmlformat"]) && $_REQUEST["xmlformat"] == "xml") } } - $qry = "SELECT tbl_bisio.bisio_id, von, bis, lehreinheit_id, + $qry = "SELECT tbl_bisio.bisio_id, von, bis, lehreinheit_id, (SELECT STRING_AGG ( tbl_zweck.bezeichnung, ', ' From 443caa91f27c6ce55a60930b0405e14f71d888d2 Mon Sep 17 00:00:00 2001 From: Paolo Date: Mon, 9 Nov 2020 10:45:25 +0100 Subject: [PATCH 051/313] Messaging sysntem: the internal email account is used only if the user account is older then 24 hours --- application/libraries/MessageLib.php | 42 +++++++++++++++++--- application/models/person/Benutzer_model.php | 4 +- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index fd2051f48..1180de9fd 100644 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -595,11 +595,20 @@ class MessageLib $this->_ci->load->model('person/Benutzer_model', 'BenutzerModel'); // And the receiver has an active account for the given organisation unit - $benutzerResult = $this->_ci->BenutzerModel->getActiveUserByPersonIdAndOrganisationUnit($message->receiver_id, $message->sender_ou); + $benutzerResult = $this->_ci->BenutzerModel->getActiveUserByPersonIdAndOrganisationUnit( + $message->receiver_id, + $message->sender_ou + ); + if (isError($benutzerResult)) return $benutzerResult; // if an error occured then return it - // Use the uid + domain email - if (hasData($benutzerResult)) $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; + // Checks if the user was NOT created in the last 24 hours + if (getData($benutzerResult)[0]->insertamum > date('Y-m-d H:i:s', strtotime('+1 day'))) + { + // Use the uid + domain email + if (hasData($benutzerResult)) $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; + } + // otherwise do NOT use the internal email account } // Otherwise try with the private email @@ -676,10 +685,33 @@ class MessageLib $this->_ci->BenutzerModel->addOrder('updateamum', 'DESC'); $this->_ci->BenutzerModel->addOrder('insertamum', 'DESC'); - $benutzerResult = $this->_ci->BenutzerModel->loadWhere(array('person_id' => $message->receiver_id)); + $benutzerResult = $this->_ci->BenutzerModel->loadWhere( + array( + 'person_id' => $message->receiver_id + ) + ); if (isError($benutzerResult)) return $benutzerResult; // if an error occured then return it - $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; // Use the uid + domain email + // For each benutzer found for this person + foreach (getData($benutzerResult) as $benutzer) + { + // Checks if the user was NOT created in the last 24 hours + if (getData($benutzerResult)[0]->insertamum > date('Y-m-d H:i:s', strtotime('+1 day'))) + { + // Use the uid + domain as email address + $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; + } + } + + // Otherwise try with the private email + if (isEmptyString($message->receiverContact)) + { + // Then use the private email + $privateEmailResult = $this->_getPrivateEmail($message->receiver_id); + if (isError($privateEmailResult)) return $privateEmailResult; // if an error occured then return it + + if (hasData($privateEmailResult)) $message->receiverContact = getData($privateEmailResult); + } } } } diff --git a/application/models/person/Benutzer_model.php b/application/models/person/Benutzer_model.php index 45edf5122..3c5a6d08a 100644 --- a/application/models/person/Benutzer_model.php +++ b/application/models/person/Benutzer_model.php @@ -23,7 +23,8 @@ class Benutzer_model extends DB_Model */ public function getActiveUserByPersonIdAndOrganisationUnit($person_id, $oe_kurzbz) { - $sql = 'SELECT b.uid + $sql = 'SELECT b.uid, + b.insertamum FROM public.tbl_benutzer b JOIN public.tbl_prestudent ps USING (person_id) JOIN public.tbl_studiengang sg USING (studiengang_kz) @@ -97,3 +98,4 @@ class Benutzer_model extends DB_Model return mb_strtolower(str_replace(' ','_', $str)); } } + From e499a07d7e93903948e52a641c20e0a30d253230 Mon Sep 17 00:00:00 2001 From: Unknown Date: Mon, 9 Nov 2020 15:16:54 +0100 Subject: [PATCH 052/313] =?UTF-8?q?bpk-Pr=C3=BCfung=20auskommentiert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vilesci/bis/studentenmeldung.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vilesci/bis/studentenmeldung.php b/vilesci/bis/studentenmeldung.php index df10214fa..388942595 100644 --- a/vilesci/bis/studentenmeldung.php +++ b/vilesci/bis/studentenmeldung.php @@ -751,7 +751,7 @@ function GenerateXMLStudentBlock($row) { $error_log.=(!empty($error_log)?', ':'')."Heimat-Nation ('".$nation."')"; } - if($row->bpk == '' || $row->bpk == null) + /*if($row->bpk == '' || $row->bpk == null) { $error_log .= (!empty($error_log) ? ', ' : '') . "bPK fehlt"; } @@ -766,7 +766,7 @@ function GenerateXMLStudentBlock($row) { $error_log.=(!empty($error_log) ? ', ' : ''). "bPK ist nicht 28 Zeichen lang"; } - } + }*/ if (!$ausserordentlich && !$incoming) { if ($zustell_plz == '' || $zustell_plz == null) @@ -1198,9 +1198,9 @@ function GenerateXMLStudentBlock($row) " . $row->ersatzkennzeichen . ""; } - $datei .= " + /*$datei .= " " . $row->bpk . " - "; + ";*/ $datei .= " " . $row->staatsbuergerschaft . " From 56c958319ddb124fea5945256c6d4c80fbcc83c0 Mon Sep 17 00:00:00 2001 From: OliiverHacker Date: Thu, 12 Nov 2020 15:49:45 +0100 Subject: [PATCH 053/313] fix bug in export --- cis/private/tools/zeitaufzeichnung.php | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/cis/private/tools/zeitaufzeichnung.php b/cis/private/tools/zeitaufzeichnung.php index a5e277e76..3d64092e4 100644 --- a/cis/private/tools/zeitaufzeichnung.php +++ b/cis/private/tools/zeitaufzeichnung.php @@ -1961,8 +1961,6 @@ function getDataForProjectOverviewCSV($user) foreach ($projects as $project) { - $index = 0; - //Newline characters bei Beschreibung ersetzen $titel = $project->titel; $projekt_kurzbz = $project->projekt_kurzbz; $projekt_phase = ''; @@ -1972,26 +1970,11 @@ function getDataForProjectOverviewCSV($user) $csvData[] = array($titel, $projekt_kurzbz, $projekt_phase, $projekt_phase_id, $beginn, $ende); - foreach ($projektphasen as $prjp) - { - if ($prjp->projekt_kurzbz === $projekt_kurzbz) - { - $projekt_phase = $prjp->bezeichnung; - $projekt_phase_id = $prjp->projektphase_id; - $beginn = $prjp->start; - $ende = $prjp->ende; - - $csvData[] = array($titel, $projekt_kurzbz, $projekt_phase, $projekt_phase_id, $beginn, $ende); - //$index = array_search($prjp, array_values($projektphasen)); - unset($projektphasen[$index]); - } - $index++; - } } foreach ($projektphasen as $prjp) { - if (empty($prjp->projektphase_fk)) + if (true) { $titel = $prjp->projekt_kurzbz; $projekt_kurzbz = $prjp->projekt_kurzbz; @@ -2000,13 +1983,13 @@ function getDataForProjectOverviewCSV($user) $beginn = $prjp->start; $ende = $prjp->ende; - $csvData[] = array($titel, $projekt_kurzbz, $projekt_phase, $projekt_phase_id, $beginn, $ende); + array_push($csvData, array($projekt_kurzbz, $projekt_phase, $projekt_phase_id, $beginn, $ende) ); } } sort($csvData); //headers schreiben - $csvData[0] = array('PROJEKT', 'PROJEKT KURZBEZEICHNUNG', 'PROJEKTPHASE', 'PROJEKTPHASEN ID', 'START', 'PROJEKT ENDE'); + array_unshift($csvData, array('PROJEKT', 'PROJEKT KURZBEZEICHNUNG', 'PROJEKTPHASE', 'PROJEKTPHASEN ID', 'START', 'PROJEKT ENDE')); return $csvData; } ?> From 4feabb25e0f69fb5ad70f1ada65d237a775569d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Fri, 13 Nov 2020 14:55:51 +0100 Subject: [PATCH 054/313] =?UTF-8?q?Firmenhandys=20sind=20nur=20f=C3=BCr=20?= =?UTF-8?q?Mitarbeiter=20sichtbar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cis/private/profile/index.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cis/private/profile/index.php b/cis/private/profile/index.php index 5b3a645da..dd39cf301 100644 --- a/cis/private/profile/index.php +++ b/cis/private/profile/index.php @@ -56,6 +56,12 @@ $uid = get_uid(); $rechte = new benutzerberechtigung(); $rechte->getBerechtigungen($uid); +$is_employee = false; +if (check_lektor($uid)) +{ + $is_employee = true; +} + $datum_obj = new datum(); // Wenn ein anderer User sich das Profil ansieht (Bei Personensuche) sollen bestimmte persönliche Daten nicht angezeigt werden @@ -346,7 +352,7 @@ if ($type == 'mitarbeiter') $kontakt->load_pers($user->person_id); foreach($kontakt->result as $k) { - if ($k->kontakttyp == 'firmenhandy') + if ($k->kontakttyp == 'firmenhandy' && $is_employee) echo 'Firmenhandy: '.$k->kontakt.'
    '; } From a1d2eb51a7106b7efad3f5f5ac3e15c315ced8c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Tue, 17 Nov 2020 17:49:32 +0100 Subject: [PATCH 055/313] Loading Name of a Person doesnt load all person Data --- include/person.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/person.class.php b/include/person.class.php index b220bb55b..328cc413c 100644 --- a/include/person.class.php +++ b/include/person.class.php @@ -374,7 +374,7 @@ class person extends basis_db $this->errormsg = 'Staatsbuergerschaft darf nicht laenger als 3 Zeichen sein'; return false; } - + //Pruefen ob das Geburtsdatum mit der SVNR uebereinstimmt. if ($this->svnr != '' && $this->gebdatum != '') { @@ -1022,7 +1022,7 @@ class person extends basis_db public function getFullNameFromBenutzer($uid) { $qry = "SELECT - * + vorname, nachname FROM public.tbl_person JOIN public.tbl_benutzer USING(person_id) From 9d2c004c6d5915b13164e1fc22832218de68f499 Mon Sep 17 00:00:00 2001 From: Paolo Date: Wed, 18 Nov 2020 08:51:48 +0100 Subject: [PATCH 056/313] Checks if the benutzer exists MessageLib->_sendNoticeEmails --- application/libraries/MessageLib.php | 30 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index 1180de9fd..8c58d1a90 100644 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -602,13 +602,17 @@ class MessageLib if (isError($benutzerResult)) return $benutzerResult; // if an error occured then return it - // Checks if the user was NOT created in the last 24 hours - if (getData($benutzerResult)[0]->insertamum > date('Y-m-d H:i:s', strtotime('+1 day'))) + // If an active user for the given organization unit was found + if (hasData($benutzerResult)) { - // Use the uid + domain email - if (hasData($benutzerResult)) $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; + // Checks if the user was NOT created in the last 24 hours + if (getData($benutzerResult)[0]->insertamum > date('Y-m-d H:i:s', strtotime('+1 day'))) + { + // Use the uid + domain email + $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; + } + // otherwise do NOT use the internal email account } - // otherwise do NOT use the internal email account } // Otherwise try with the private email @@ -692,14 +696,18 @@ class MessageLib ); if (isError($benutzerResult)) return $benutzerResult; // if an error occured then return it - // For each benutzer found for this person - foreach (getData($benutzerResult) as $benutzer) + // If an active user for the given organization unit was found + if (hasData($benutzerResult)) { - // Checks if the user was NOT created in the last 24 hours - if (getData($benutzerResult)[0]->insertamum > date('Y-m-d H:i:s', strtotime('+1 day'))) + // For each benutzer found for this person + foreach (getData($benutzerResult) as $benutzer) { - // Use the uid + domain as email address - $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; + // Checks if the user was NOT created in the last 24 hours + if (getData($benutzerResult)[0]->insertamum > date('Y-m-d H:i:s', strtotime('+1 day'))) + { + // Use the uid + domain as email address + $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; + } } } From b31585af985675be6127070f681b826af0e3d1cd Mon Sep 17 00:00:00 2001 From: Manfred Kindl Date: Wed, 18 Nov 2020 17:40:35 +0100 Subject: [PATCH 057/313] Bugfix ical_coodle Leeres VEVENT entfernt, wenn kein Termin vorhanden --- cis/public/ical_coodle.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cis/public/ical_coodle.php b/cis/public/ical_coodle.php index a4be8b52f..fd9d408b5 100644 --- a/cis/public/ical_coodle.php +++ b/cis/public/ical_coodle.php @@ -62,11 +62,15 @@ TZOFFSETTO:+0100 END:STANDARD END:VTIMEZONE\n"; //echo 'URL:',APP_ROOT,'cis/public/ical_coodle.php/',$uid,"\n"; -echo "BEGIN:VEVENT"; + // Alle Umfragen holen an denen der User beteiligt ist $umfragen = new coodle(); $umfragen->getCoodleFromUser($uid); $i = 0; +if (count($umfragen->result) > 0) +{ + //echo "BEGIN:VEVENT"; +} foreach($umfragen->result as $umfrage) { if($umfrage->coodle_status_kurzbz=='laufend') @@ -88,10 +92,7 @@ foreach($umfragen->result as $umfrage) $uhrzeit_ende = $date->format('H:i:s'); $dtende = $date->format('Ymd\THis'); - if ($i > 0) - { - echo "\nBEGIN:VEVENT"; - } + echo "\nBEGIN:VEVENT"; echo "\nUID:Coodle_Terminoption".$dtstart."_".$dtende.""; echo "\nSUMMARY:Coodle Terminoption"; echo "\nDTSTART;TZID=Europe/Vienna:$dtstart"; From 73a38a08356726990224f98c3d974acd1e0c4652 Mon Sep 17 00:00:00 2001 From: Manfred Kindl Date: Wed, 18 Nov 2020 17:41:30 +0100 Subject: [PATCH 058/313] Formatierung XML-Output --- soap/datenverbund_client.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/soap/datenverbund_client.php b/soap/datenverbund_client.php index f751e2498..a3b0982f8 100644 --- a/soap/datenverbund_client.php +++ b/soap/datenverbund_client.php @@ -469,7 +469,14 @@ if (isset($_REQUEST['submit'])) break; } if (isset($_POST['debug'])) - echo '
    '.nl2br(htmlentities($dvb->debug_output)).'
    '; + { + $output = nl2br(htmlentities($dvb->debug_output)); + $output = str_replace('><','>
    <',$output); + $output = preg_replace('/(<uni:.*?>)/','$1',$output); + $output = preg_replace('/(<\/uni:.*?>)/','$1',$output); + + echo '
    '.$output.'
    '; + } } ?> From 798ff3db24c4f6293c30d0fa0d64459cb7fdfe57 Mon Sep 17 00:00:00 2001 From: Manfred Kindl Date: Wed, 18 Nov 2020 17:44:15 +0100 Subject: [PATCH 059/313] Bugfix Abfrage Rechte --- .../lvplan/stpl_week_anzahl_studenten.php | 902 +++++++++--------- 1 file changed, 451 insertions(+), 451 deletions(-) diff --git a/cis/private/lvplan/stpl_week_anzahl_studenten.php b/cis/private/lvplan/stpl_week_anzahl_studenten.php index afd24773e..eeec45145 100644 --- a/cis/private/lvplan/stpl_week_anzahl_studenten.php +++ b/cis/private/lvplan/stpl_week_anzahl_studenten.php @@ -1,456 +1,456 @@ -, - * Andreas Oesterreicher , - * Rudolf Hangl and - * Gerald Simane-Sequens . - */ - require_once('../../../config/cis.config.inc.php'); - require_once('../../../include/functions.inc.php'); - require_once('../../../include/datum.class.php'); - require_once('../../../include/benutzer.class.php'); - require_once('../../../include/student.class.php'); - require_once('../../../include/studiengang.class.php'); - require_once('../../../include/benutzerberechtigung.class.php'); - require_once('../../../include/studiensemester.class.php'); - - if (!$db = new basis_db()) - die('Fehler beim Oeffnen der Datenbankverbindung'); - $uid=isset($_GET['uid'])?$_GET['uid']:(isset($_POST['uid'])?$_POST['uid']:get_uid()); - $uid=trim($uid); - - $rechte = new benutzerberechtigung(); - $rechte->getBerechtigungen($uid); - - if(!$rechte->isBerechtigt('lehre/reservierung:begrenzt', null, 's') || !$rechte->isBerechtigt('admin')) - die($rechte->errormsg); - unset($rechte); - - header('Content-Type: text/html;charset=UTF-8'); -?> - - - - - Anzahl Studenten Lehrveranstaltungsplan FH Technikum-Wien - +, + * Andreas Oesterreicher , + * Rudolf Hangl and + * Gerald Simane-Sequens . + */ + require_once('../../../config/cis.config.inc.php'); + require_once('../../../include/functions.inc.php'); + require_once('../../../include/datum.class.php'); + require_once('../../../include/benutzer.class.php'); + require_once('../../../include/student.class.php'); + require_once('../../../include/studiengang.class.php'); + require_once('../../../include/benutzerberechtigung.class.php'); + require_once('../../../include/studiensemester.class.php'); + + if (!$db = new basis_db()) + die('Fehler beim Oeffnen der Datenbankverbindung'); + $uid=isset($_GET['uid'])?$_GET['uid']:(isset($_POST['uid'])?$_POST['uid']:get_uid()); + $uid=trim($uid); + + $rechte = new benutzerberechtigung(); + $rechte->getBerechtigungen($uid); + + if(!$rechte->isBerechtigt('lehre/reservierung:begrenzt', null, 's') && !$rechte->isBerechtigt('admin')) + die($rechte->errormsg); + unset($rechte); + + header('Content-Type: text/html;charset=UTF-8'); +?> + + + + + Anzahl Studenten Lehrveranstaltungsplan FH Technikum-Wien + - - - - - - - -
    -
    -
    -
    -
    -
    - - - -
    -
    drucken
    - -
    -
    schliessen  
    - -
    -
    -
    -
    -
    -
    -getaktorNext(); - $objSS->load($ss); - $datum_obj = new datum(); - $ss_begin=$datum_obj->mktime_fromdate($objSS->start); - $ss_ende=$datum_obj->mktime_fromdate($objSS->ende); - - - $sql_query=' select tbl_adresse.plz,tbl_adresse.name, sum(tbl_ort.max_person) as summe '; - $sql_query.=' from public.tbl_ort,public.tbl_standort, public.tbl_adresse '; - $sql_query.=" where tbl_standort.standort_id=tbl_ort.standort_id "; - $sql_query.=" and tbl_adresse.adresse_id=tbl_standort.adresse_id "; - $sql_query.=" and tbl_adresse.adresse_id=".$db->db_add_param($adresse_id, FHC_INTEGER)." "; - $sql_query.=" and tbl_ort.aktiv and tbl_ort.lehre "; - $sql_query.=" group by tbl_adresse.plz,tbl_adresse.name "; - // Gibt es fuer das Datum und Stunde einen Stundenplaneintrag - if(!$results_anzahl=$db->db_query($sql_query)) - die($db->db_last_error()); - $raum_max_anz=0; - $fh_name='FH lese fehler'; - if ($num_rows_anzahl=$db->db_num_rows($results_anzahl)) - { - $fh_name = $db->db_result($results_anzahl,0,"name").', '.$db->db_result($results_anzahl,0,"plz"); - $raum_max_anz = $db->db_result($results_anzahl,0,"summe"); - } - - $stg=array(); - echo '

    -  Lehrveranstaltungsplan >> Wochenplan - Anzahl Studenten -    << - Wochenplan  Kw '.$kw.' -  >> -    Heute -

    '; - - // Stundentafel abfragen - $sql_query="SELECT stunde, beginn, ende FROM lehre.tbl_stunde ORDER BY stunde"; - if(!$results=$db->db_query($sql_query)) - die($db->db_last_error()); - - - echo ''; - echo ''; - echo ''; - echo ''; - for ($i=0; $i'.strftime('%a',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).' '.date('d M',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).''; - } - echo ''; - - $max_person_array=array(); - $num_rows_stunde=$db->db_num_rows($results); - echo ''; - for ($k=0; $k<$num_rows_stunde; $k++) - { - $row = $db->db_fetch_object($results, $k); - $row->show_beginn=substr($row->beginn,0,5); - $row->show_ende=substr($row->ende,0,5); - $row->check_beginn=str_replace(':','',substr($row->beginn,0,5)); - $row->check_ende=str_replace(':','',substr($row->ende,0,5)); - - echo ''; - $lehreinheiten=array(); - - for ($i=0; $i= $row->check_beginn && date('Hi')<=$row->check_ende ) - $aktiv=true; - - echo ''; - else - $tooltip.=''; - $tooltip.=''; - $gefunden_anz+=$row_anz->anz; - } - - if (!empty($gefunden_anz)) - { - $tooltip.=''; - - echo '
    Gesamt: '.$gefunden_anz; - echo ''; - } - echo ''; - - - if (!isset($max_person_array[$i]['tag'])) - $max_person_array[$i]['tag']=0; - $max_person_array[$i]['tag']=$max_person_array[$i]['tag']+$gefunden_anz; - if (!isset($max_person_array[$i]['tag_max'])) - $max_person_array[$i]['tag_max']=0; - $max_person_array[$i]['tag_max']=$max_person_array[$i]['tag_max']+$max_person; - - if (!isset($max_person_array[$k]['stunde'])) - $max_person_array[$k]['stunde']=0; - $max_person_array[$k]['stunde']=$max_person_array[$k]['stunde']+$gefunden_anz; - if (!isset($max_person_array[$k]['stunde_max'])) - $max_person_array[$k]['stunde_max']=0; - $max_person_array[$k]['stunde_max']=$max_person_array[$k]['stunde_max']+$max_person; - - if (!isset($max_person_array[$i][$k]['tag_stunde'])) - $max_person_array[$i][$k]['tag_stunde']=0; - $max_person_array[$i][$k]['tag_stunde']=$max_person_array[$i][$k]['tag_stunde']+$gefunden_anz; - if (!isset($max_person_array[$i][$k]['tag_stunde_max'])) - $max_person_array[$i][$k]['tag_stunde_max']=0; - $max_person_array[$i][$k]['tag_stunde_max']=$max_person_array[$i][$k]['tag_stunde_max']+$max_person; - - } - echo ''; - - } - echo '
    '. $fh_name .'      '. (date('Ym',$montag)==date('Ym',$letzterTagAnzeige)?$tag:(date('Y',$montag)==date('Y',$letzterTagAnzeige)?$tag_monat:$tag_monat_jahr)) .' - '. $letzter_tag_monat_jahr.'
    Stunde
    '.$row->show_beginn.'
    '.$row->show_ende.'
    '; - - $sql_query=' select distinct vw_'.$stpl_table.'.stg_bezeichnung as bezeichnung,vw_'.$stpl_table.'.stg_kurzbzlang as kurzbzlang,vw_'.$stpl_table.'.stg_kurzbz as kurzbz, vw_'.$stpl_table.'.'.$stpl_table.'_id,vw_'.$stpl_table.'.lehrform, vw_'.$stpl_table.'.gruppe, vw_'.$stpl_table.'.gruppe_kurzbz, vw_'.$stpl_table.'.unr,vw_'.$stpl_table.'.verband,vw_'.$stpl_table.'.ort_kurzbz,vw_'.$stpl_table.'.lehreinheit_id,vw_'.$stpl_table.'.studiengang_kz,vw_'.$stpl_table.'.semester,tbl_ort.max_person,tbl_standort.adresse_id,tbl_adresse.plz,tbl_adresse.name '; - $sql_query.=' from lehre.vw_'.$stpl_table.', public.tbl_ort,public.tbl_standort, public.tbl_adresse '; - $sql_query.=" where vw_".$stpl_table.".datum=".$db->db_add_param(date('Y-m-d',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))))." "; - $sql_query.=" and vw_".$stpl_table.".stunde=".$db->db_add_param($row->stunde, FHC_INTEGER)." "; - $sql_query.=" and tbl_ort.ort_kurzbz=vw_".$stpl_table.".ort_kurzbz "; - $sql_query.=" and tbl_standort.standort_id=tbl_ort.standort_id "; - $sql_query.=" and tbl_adresse.adresse_id=tbl_standort.adresse_id "; - $sql_query.=" and tbl_adresse.adresse_id=".$db->db_add_param($adresse_id, FHC_INTEGER)." "; - $sql_query.=" order by tbl_adresse.plz,vw_".$stpl_table.".ort_kurzbz "; - - // Gibt es fuer das Datum und Stunde einen Stundenplaneintrag - if(!$results_anzahl=$db->db_query($sql_query)) - die($db->db_last_error()); - $num_rows_anzahl=$db->db_num_rows($results_anzahl); - - $gefunden_anz=0; - $tooltip=''; - for ($k_anz=0; $k_anz<$num_rows_anzahl; $k_anz++) - { - $row_anz = $db->db_fetch_object($results_anzahl, $k_anz); - // Lehreinheit wird aufgeteilt in zwei Raeume - nicht verarbeiten , das sind die selben Personen - if (isset($lehreinheiten[trim($row_anz->lehreinheit_id).trim($row_anz->gruppe_kurzbz)])) - continue; - $lehreinheiten[$row_anz->lehreinheit_id]=trim($row_anz->lehreinheit_id).trim($row_anz->gruppe_kurzbz); - - $max_person=$row_anz->max_person+$max_person; - $row_anz->verband=trim($row_anz->verband); - $row_anz->gruppe=trim($row_anz->gruppe); - $row_anz->gruppe_kurzbz=trim($row_anz->gruppe_kurzbz); - - $stsem=$ss; - - $gruppe=($row_anz->gruppe_kurzbz?$row_anz->gruppe_kurzbz:null); - $student=new student(); - - $row_anz->anz=0; - if ($result=$student->getStudents($row_anz->studiengang_kz,$row_anz->semester,$row_anz->verband,$row_anz->gruppe,$gruppe, $stsem)) - $row_anz->anz=count($result); - - - if (empty($row_anz->anz)) - $fehler=true; - - $lvb=$row_anz->kurzbzlang.'-'.$row_anz->semester; - if (!is_null($row_anz->verband) && !empty($row_anz->verband)) - { - $lvb.=$row_anz->verband; - if (!is_null($row_anz->gruppe) && !empty($row_anz->gruppe) ) - $lvb.=$row_anz->gruppe; - } - if (!empty($k_anz)) - $tooltip.='
    '. date('d M Y',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).' '.$row->show_beginn.' - '.$row->show_ende.'Anzahl
    stundenplan_id:$row_anz->stundenplandev_id).'\'>'.trim($row_anz->ort_kurzbz).' ort_kurzbz).'\' target=\'_blank\' titel=\'Studiengang Kz '.$row_anz->studiengang_kz.'\'>'.$lvb.' '.$row_anz->gruppe_kurzbz.' '.(!$row_anz->anz?'':'').$row_anz->bezeichnung.(!$row_anz->anz?'':'').' '.$row_anz->anz.'
    max.Personen:'.$max_person.' Belegung:'. number_format($gefunden_anz / $max_person,2)*100 .'% Ges.:'.$gefunden_anz.'
    '; - - - $rechte = new benutzerberechtigung(); - $rechte->getBerechtigungen($uid); - if($rechte->isBerechtigt('admin')) - { - echo ''; - echo ''; - - echo ''; - echo ''; - for ($i=0; $i'.strftime('%a',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).' '. date('d M Y',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).''; - } - echo ''; - $stunde_proz=0; - $stunde=0; - $stunde_max=0; - for ($k=0; $k<$num_rows_stunde; $k++) - { - $row = $db->db_fetch_object($results, $k); - $row->show_beginn=substr($row->beginn,0,5); - $row->show_ende=substr($row->ende,0,5); - $row->check_beginn=str_replace(':','',substr($row->beginn,0,5)); - $row->check_ende=str_replace(':','',substr($row->ende,0,5)); - echo ''; - echo ''; - echo ''; - - $stunde=$stunde+$max_person_array[$k]['stunde']; - $stunde_max=$stunde_max+$max_person_array[$k]['stunde_max']; - - for ($i=0; $i'; - echo 'anz.:'.$max_person_array[$i][$k]['tag_stunde']; - echo '
    '; - echo 'FH   max.:'. $raum_max_anz; - echo '
    '; - echo ' '.($max_person_array[$i][$k]['tag_stunde']?number_format($max_person_array[$i][$k]['tag_stunde'] / $raum_max_anz,2)*100:0).'%'; - echo '
    '; - echo 'Raum max.:'. $max_person_array[$i][$k]['tag_stunde_max']; - echo '
    '; - echo ' '.($max_person_array[$i][$k]['tag_stunde']?number_format($max_person_array[$i][$k]['tag_stunde'] / $max_person_array[$i][$k]['tag_stunde_max'],2)*100:0).'%'; - echo ''; - } - echo '
    '; - } - - - echo ''; - echo ''; - - echo ''; - - - for ($i=0; $i'; - echo 'FH      Ø '.($max_person_array[$i]['tag']?number_format($max_person_array[$i]['tag'] / ($raum_max_anz *$num_rows_stunde),2)*100:0).'%'; - echo '
    '; - echo 'Raum Ø '.($max_person_array[$i]['tag']?number_format($max_person_array[$i]['tag'] / $max_person_array[$i]['tag_max'],2)*100:0).'%'; - echo ''; - } - - echo '
    '; - - - echo '
    '. $fh_name .'      '. (date('Ym',$montag)==date('Ym',$letzterTagAnzeige)?$tag:(date('Y',$montag)==date('Y',$letzterTagAnzeige)?$tag_monat:$tag_monat_jahr)) .' - '. $letzter_tag_monat_jahr.'
    Zeit / Datum – 
    '.$row->show_beginn.'
    '.$row->show_ende.'
    '; - echo 'anz.:'.$max_person_array[$k]['stunde']; - echo '
    '; - echo 'FH   '.($raum_max_anz*TAGE_PRO_WOCHE); - echo '
    '; - echo ' Ø '.($max_person_array[$k]['stunde']?number_format(($max_person_array[$k]['stunde'])/TAGE_PRO_WOCHE / ($raum_max_anz),2)*100:0).'%'; - echo '
    '; - echo 'Raum '.$max_person_array[$k]['stunde_max']; - echo '
    '; - echo ' Ø '.($max_person_array[$k]['stunde']?number_format(($max_person_array[$k]['stunde']/TAGE_PRO_WOCHE) / ($max_person_array[$k]['stunde_max']/TAGE_PRO_WOCHE),2)*100:0).'%'; - echo '
    Ø'; - echo 'FH      Ø '.($stunde?number_format(($stunde)/$num_rows_stunde/TAGE_PRO_WOCHE / ($raum_max_anz),2)*100:0).'%'; - echo '
    '; - echo 'Raum Ø '.($stunde_max?number_format(($stunde/$num_rows_stunde/TAGE_PRO_WOCHE) / ($stunde_max/$num_rows_stunde/TAGE_PRO_WOCHE),2)*100:0).'%'; - echo '
    '; - } -?> - - + + + + + + + +
    +
    +
    +
    +
    +
    + + + +
    +
    drucken
    + +
    +
    schliessen  
    + +
    +
    +
    +
    +
    +
    +getaktorNext(); + $objSS->load($ss); + $datum_obj = new datum(); + $ss_begin=$datum_obj->mktime_fromdate($objSS->start); + $ss_ende=$datum_obj->mktime_fromdate($objSS->ende); + + + $sql_query=' select tbl_adresse.plz,tbl_adresse.name, sum(tbl_ort.max_person) as summe '; + $sql_query.=' from public.tbl_ort,public.tbl_standort, public.tbl_adresse '; + $sql_query.=" where tbl_standort.standort_id=tbl_ort.standort_id "; + $sql_query.=" and tbl_adresse.adresse_id=tbl_standort.adresse_id "; + $sql_query.=" and tbl_adresse.adresse_id=".$db->db_add_param($adresse_id, FHC_INTEGER)." "; + $sql_query.=" and tbl_ort.aktiv and tbl_ort.lehre "; + $sql_query.=" group by tbl_adresse.plz,tbl_adresse.name "; + // Gibt es fuer das Datum und Stunde einen Stundenplaneintrag + if(!$results_anzahl=$db->db_query($sql_query)) + die($db->db_last_error()); + $raum_max_anz=0; + $fh_name='FH lese fehler'; + if ($num_rows_anzahl=$db->db_num_rows($results_anzahl)) + { + $fh_name = $db->db_result($results_anzahl,0,"name").', '.$db->db_result($results_anzahl,0,"plz"); + $raum_max_anz = $db->db_result($results_anzahl,0,"summe"); + } + + $stg=array(); + echo '

    +  Lehrveranstaltungsplan >> Wochenplan - Anzahl Studenten +    << + Wochenplan  Kw '.$kw.' +  >> +    Heute +

    '; + + // Stundentafel abfragen + $sql_query="SELECT stunde, beginn, ende FROM lehre.tbl_stunde ORDER BY stunde"; + if(!$results=$db->db_query($sql_query)) + die($db->db_last_error()); + + + echo ''; + echo ''; + echo ''; + echo ''; + for ($i=0; $i'.strftime('%a',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).' '.date('d M',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).''; + } + echo ''; + + $max_person_array=array(); + $num_rows_stunde=$db->db_num_rows($results); + echo ''; + for ($k=0; $k<$num_rows_stunde; $k++) + { + $row = $db->db_fetch_object($results, $k); + $row->show_beginn=substr($row->beginn,0,5); + $row->show_ende=substr($row->ende,0,5); + $row->check_beginn=str_replace(':','',substr($row->beginn,0,5)); + $row->check_ende=str_replace(':','',substr($row->ende,0,5)); + + echo ''; + $lehreinheiten=array(); + + for ($i=0; $i= $row->check_beginn && date('Hi')<=$row->check_ende ) + $aktiv=true; + + echo ''; + else + $tooltip.=''; + $tooltip.=''; + $gefunden_anz+=$row_anz->anz; + } + + if (!empty($gefunden_anz)) + { + $tooltip.=''; + + echo '
    Gesamt: '.$gefunden_anz; + echo ''; + } + echo ''; + + + if (!isset($max_person_array[$i]['tag'])) + $max_person_array[$i]['tag']=0; + $max_person_array[$i]['tag']=$max_person_array[$i]['tag']+$gefunden_anz; + if (!isset($max_person_array[$i]['tag_max'])) + $max_person_array[$i]['tag_max']=0; + $max_person_array[$i]['tag_max']=$max_person_array[$i]['tag_max']+$max_person; + + if (!isset($max_person_array[$k]['stunde'])) + $max_person_array[$k]['stunde']=0; + $max_person_array[$k]['stunde']=$max_person_array[$k]['stunde']+$gefunden_anz; + if (!isset($max_person_array[$k]['stunde_max'])) + $max_person_array[$k]['stunde_max']=0; + $max_person_array[$k]['stunde_max']=$max_person_array[$k]['stunde_max']+$max_person; + + if (!isset($max_person_array[$i][$k]['tag_stunde'])) + $max_person_array[$i][$k]['tag_stunde']=0; + $max_person_array[$i][$k]['tag_stunde']=$max_person_array[$i][$k]['tag_stunde']+$gefunden_anz; + if (!isset($max_person_array[$i][$k]['tag_stunde_max'])) + $max_person_array[$i][$k]['tag_stunde_max']=0; + $max_person_array[$i][$k]['tag_stunde_max']=$max_person_array[$i][$k]['tag_stunde_max']+$max_person; + + } + echo ''; + + } + echo '
    '. $fh_name .'      '. (date('Ym',$montag)==date('Ym',$letzterTagAnzeige)?$tag:(date('Y',$montag)==date('Y',$letzterTagAnzeige)?$tag_monat:$tag_monat_jahr)) .' - '. $letzter_tag_monat_jahr.'
    Stunde
    '.$row->show_beginn.'
    '.$row->show_ende.'
    '; + + $sql_query=' select distinct vw_'.$stpl_table.'.stg_bezeichnung as bezeichnung,vw_'.$stpl_table.'.stg_kurzbzlang as kurzbzlang,vw_'.$stpl_table.'.stg_kurzbz as kurzbz, vw_'.$stpl_table.'.'.$stpl_table.'_id,vw_'.$stpl_table.'.lehrform, vw_'.$stpl_table.'.gruppe, vw_'.$stpl_table.'.gruppe_kurzbz, vw_'.$stpl_table.'.unr,vw_'.$stpl_table.'.verband,vw_'.$stpl_table.'.ort_kurzbz,vw_'.$stpl_table.'.lehreinheit_id,vw_'.$stpl_table.'.studiengang_kz,vw_'.$stpl_table.'.semester,tbl_ort.max_person,tbl_standort.adresse_id,tbl_adresse.plz,tbl_adresse.name '; + $sql_query.=' from lehre.vw_'.$stpl_table.', public.tbl_ort,public.tbl_standort, public.tbl_adresse '; + $sql_query.=" where vw_".$stpl_table.".datum=".$db->db_add_param(date('Y-m-d',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))))." "; + $sql_query.=" and vw_".$stpl_table.".stunde=".$db->db_add_param($row->stunde, FHC_INTEGER)." "; + $sql_query.=" and tbl_ort.ort_kurzbz=vw_".$stpl_table.".ort_kurzbz "; + $sql_query.=" and tbl_standort.standort_id=tbl_ort.standort_id "; + $sql_query.=" and tbl_adresse.adresse_id=tbl_standort.adresse_id "; + $sql_query.=" and tbl_adresse.adresse_id=".$db->db_add_param($adresse_id, FHC_INTEGER)." "; + $sql_query.=" order by tbl_adresse.plz,vw_".$stpl_table.".ort_kurzbz "; + + // Gibt es fuer das Datum und Stunde einen Stundenplaneintrag + if(!$results_anzahl=$db->db_query($sql_query)) + die($db->db_last_error()); + $num_rows_anzahl=$db->db_num_rows($results_anzahl); + + $gefunden_anz=0; + $tooltip=''; + for ($k_anz=0; $k_anz<$num_rows_anzahl; $k_anz++) + { + $row_anz = $db->db_fetch_object($results_anzahl, $k_anz); + // Lehreinheit wird aufgeteilt in zwei Raeume - nicht verarbeiten , das sind die selben Personen + if (isset($lehreinheiten[trim($row_anz->lehreinheit_id).trim($row_anz->gruppe_kurzbz)])) + continue; + $lehreinheiten[$row_anz->lehreinheit_id]=trim($row_anz->lehreinheit_id).trim($row_anz->gruppe_kurzbz); + + $max_person=$row_anz->max_person+$max_person; + $row_anz->verband=trim($row_anz->verband); + $row_anz->gruppe=trim($row_anz->gruppe); + $row_anz->gruppe_kurzbz=trim($row_anz->gruppe_kurzbz); + + $stsem=$ss; + + $gruppe=($row_anz->gruppe_kurzbz?$row_anz->gruppe_kurzbz:null); + $student=new student(); + + $row_anz->anz=0; + if ($result=$student->getStudents($row_anz->studiengang_kz,$row_anz->semester,$row_anz->verband,$row_anz->gruppe,$gruppe, $stsem)) + $row_anz->anz=count($result); + + + if (empty($row_anz->anz)) + $fehler=true; + + $lvb=$row_anz->kurzbzlang.'-'.$row_anz->semester; + if (!is_null($row_anz->verband) && !empty($row_anz->verband)) + { + $lvb.=$row_anz->verband; + if (!is_null($row_anz->gruppe) && !empty($row_anz->gruppe) ) + $lvb.=$row_anz->gruppe; + } + if (!empty($k_anz)) + $tooltip.='
    '. date('d M Y',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).' '.$row->show_beginn.' - '.$row->show_ende.'Anzahl
    stundenplan_id:$row_anz->stundenplandev_id).'\'>'.trim($row_anz->ort_kurzbz).' ort_kurzbz).'\' target=\'_blank\' titel=\'Studiengang Kz '.$row_anz->studiengang_kz.'\'>'.$lvb.' '.$row_anz->gruppe_kurzbz.' '.(!$row_anz->anz?'':'').$row_anz->bezeichnung.(!$row_anz->anz?'':'').' '.$row_anz->anz.'
    max.Personen:'.$max_person.' Belegung:'. number_format($gefunden_anz / $max_person,2)*100 .'% Ges.:'.$gefunden_anz.'
    '; + + + $rechte = new benutzerberechtigung(); + $rechte->getBerechtigungen($uid); + if($rechte->isBerechtigt('admin')) + { + echo ''; + echo ''; + + echo ''; + echo ''; + for ($i=0; $i'.strftime('%a',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).' '. date('d M Y',mktime(0,0,0,date('m',$montag),date('d',$montag) + $i,date('Y',$montag))).''; + } + echo ''; + $stunde_proz=0; + $stunde=0; + $stunde_max=0; + for ($k=0; $k<$num_rows_stunde; $k++) + { + $row = $db->db_fetch_object($results, $k); + $row->show_beginn=substr($row->beginn,0,5); + $row->show_ende=substr($row->ende,0,5); + $row->check_beginn=str_replace(':','',substr($row->beginn,0,5)); + $row->check_ende=str_replace(':','',substr($row->ende,0,5)); + echo ''; + echo ''; + echo ''; + + $stunde=$stunde+$max_person_array[$k]['stunde']; + $stunde_max=$stunde_max+$max_person_array[$k]['stunde_max']; + + for ($i=0; $i'; + echo 'anz.:'.$max_person_array[$i][$k]['tag_stunde']; + echo '
    '; + echo 'FH   max.:'. $raum_max_anz; + echo '
    '; + echo ' '.($max_person_array[$i][$k]['tag_stunde']?number_format($max_person_array[$i][$k]['tag_stunde'] / $raum_max_anz,2)*100:0).'%'; + echo '
    '; + echo 'Raum max.:'. $max_person_array[$i][$k]['tag_stunde_max']; + echo '
    '; + echo ' '.($max_person_array[$i][$k]['tag_stunde']?number_format($max_person_array[$i][$k]['tag_stunde'] / $max_person_array[$i][$k]['tag_stunde_max'],2)*100:0).'%'; + echo ''; + } + echo '
    '; + } + + + echo ''; + echo ''; + + echo ''; + + + for ($i=0; $i'; + echo 'FH      Ø '.($max_person_array[$i]['tag']?number_format($max_person_array[$i]['tag'] / ($raum_max_anz *$num_rows_stunde),2)*100:0).'%'; + echo '
    '; + echo 'Raum Ø '.($max_person_array[$i]['tag']?number_format($max_person_array[$i]['tag'] / $max_person_array[$i]['tag_max'],2)*100:0).'%'; + echo ''; + } + + echo '
    '; + + + echo '
    '. $fh_name .'      '. (date('Ym',$montag)==date('Ym',$letzterTagAnzeige)?$tag:(date('Y',$montag)==date('Y',$letzterTagAnzeige)?$tag_monat:$tag_monat_jahr)) .' - '. $letzter_tag_monat_jahr.'
    Zeit / Datum – 
    '.$row->show_beginn.'
    '.$row->show_ende.'
    '; + echo 'anz.:'.$max_person_array[$k]['stunde']; + echo '
    '; + echo 'FH   '.($raum_max_anz*TAGE_PRO_WOCHE); + echo '
    '; + echo ' Ø '.($max_person_array[$k]['stunde']?number_format(($max_person_array[$k]['stunde'])/TAGE_PRO_WOCHE / ($raum_max_anz),2)*100:0).'%'; + echo '
    '; + echo 'Raum '.$max_person_array[$k]['stunde_max']; + echo '
    '; + echo ' Ø '.($max_person_array[$k]['stunde']?number_format(($max_person_array[$k]['stunde']/TAGE_PRO_WOCHE) / ($max_person_array[$k]['stunde_max']/TAGE_PRO_WOCHE),2)*100:0).'%'; + echo '
    Ø'; + echo 'FH      Ø '.($stunde?number_format(($stunde)/$num_rows_stunde/TAGE_PRO_WOCHE / ($raum_max_anz),2)*100:0).'%'; + echo '
    '; + echo 'Raum Ø '.($stunde_max?number_format(($stunde/$num_rows_stunde/TAGE_PRO_WOCHE) / ($stunde_max/$num_rows_stunde/TAGE_PRO_WOCHE),2)*100:0).'%'; + echo '
    '; + } +?> + + From 1cf06681d3efa138706769b623304d73658a6a7f Mon Sep 17 00:00:00 2001 From: Manfred Kindl Date: Wed, 18 Nov 2020 17:45:37 +0100 Subject: [PATCH 060/313] =?UTF-8?q?bpk=20vorr=C3=BCbergehend=20auskommenti?= =?UTF-8?q?ert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vilesci/bis/lehrgangsmeldung.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/vilesci/bis/lehrgangsmeldung.php b/vilesci/bis/lehrgangsmeldung.php index 07a62a9ae..9cc560d32 100644 --- a/vilesci/bis/lehrgangsmeldung.php +++ b/vilesci/bis/lehrgangsmeldung.php @@ -379,7 +379,7 @@ if($result = $db->db_query($qry)) } } } - if($row->bpk == '' || $row->bpk == null) + /*if($row->bpk == '' || $row->bpk == null) { $error_log .= (!empty($error_log) ? ', ' : '') . "bPK fehlt"; } @@ -395,7 +395,7 @@ if($result = $db->db_query($qry)) { $error_log.=(!empty($error_log) ? ', ' : ''). "bPK ist nicht 28 Zeichen lang"; } - } + }*/ if ($zustell_plz == '' || $zustell_plz == null) { @@ -626,9 +626,9 @@ if($result = $db->db_query($qry)) ".$row->ersatzkennzeichen.""; } - $datei.=" + /*$datei.=" ".$row->bpk." - "; + ";*/ $datei.=" ".$row->staatsbuergerschaft." From 451e0e784382c82088bde507477036186f932008 Mon Sep 17 00:00:00 2001 From: Paolo Date: Thu, 19 Nov 2020 00:09:53 +0100 Subject: [PATCH 061/313] Fixed MessageLib->_sendNoticeEmails: date and array comparisons --- application/libraries/MessageLib.php | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index 8c58d1a90..2970fbd6d 100644 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -606,7 +606,7 @@ class MessageLib if (hasData($benutzerResult)) { // Checks if the user was NOT created in the last 24 hours - if (getData($benutzerResult)[0]->insertamum > date('Y-m-d H:i:s', strtotime('+1 day'))) + if (getData($benutzerResult)[0]->insertamum > date('Y-m-d H:i:s', strtotime('-1 day'))) { // Use the uid + domain email $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; @@ -657,7 +657,7 @@ class MessageLib // If there are presetudent if (hasData($prestudentResults)) { - $inArray = true; + $privateOnly = false; $organisationUnits = getData($prestudentResults); // Look if any of the organization units of this prestudent are in the list of the @@ -665,16 +665,21 @@ class MessageLib foreach ($organisationUnits as $organisationUnit) { // If the recipient organisation unit is NOT in the list of organisation units that sent only to private emails + // NOTE: done in this way because it is easyer to check the result of array_search if (array_search($organisationUnit, $this->_ci->config->item(self::CFG_OU_RECEIVERS_PRIVATE)) === false) { - $inArray = false; + // NOP + } + else // otherwise If the recipient organisation unit is the list of organisation units that sent only to private emails + { + $privateOnly = true; break; } } // If the recipient prestudent organization unit is not in in the list of the // organization units that will not send the notice email to the internal account - if (!$inArray) + if ($privateOnly) { // Then use the private email $privateEmailResult = $this->_getPrivateEmail($message->receiver_id); @@ -703,7 +708,7 @@ class MessageLib foreach (getData($benutzerResult) as $benutzer) { // Checks if the user was NOT created in the last 24 hours - if (getData($benutzerResult)[0]->insertamum > date('Y-m-d H:i:s', strtotime('+1 day'))) + if (getData($benutzerResult)[0]->insertamum > date('Y-m-d H:i:s', strtotime('-1 day'))) { // Use the uid + domain as email address $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; From 119d5d99df73ca398e689bd7f50b926ab497307b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Mon, 23 Nov 2020 16:18:43 +0100 Subject: [PATCH 062/313] Fixed Query to get User for Messages by PersonID and OrganisationUnit --- application/models/person/Benutzer_model.php | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/application/models/person/Benutzer_model.php b/application/models/person/Benutzer_model.php index 3c5a6d08a..c1e76ce38 100644 --- a/application/models/person/Benutzer_model.php +++ b/application/models/person/Benutzer_model.php @@ -23,14 +23,17 @@ class Benutzer_model extends DB_Model */ public function getActiveUserByPersonIdAndOrganisationUnit($person_id, $oe_kurzbz) { - $sql = 'SELECT b.uid, - b.insertamum - FROM public.tbl_benutzer b - JOIN public.tbl_prestudent ps USING (person_id) - JOIN public.tbl_studiengang sg USING (studiengang_kz) - WHERE ps.person_id = ? - AND sg.oe_kurzbz = ? - AND b.aktiv = TRUE'; + $sql = 'SELECT + b.uid, + b.insertamum + FROM + public.tbl_prestudent ps + JOIN public.tbl_studiengang sg USING (studiengang_kz) + JOIN public.tbl_student USING(prestudent_id) + JOIN public.tbl_benutzer b ON(uid = student_uid) + WHERE ps.person_id = ? + AND sg.oe_kurzbz = ? + AND b.aktiv = TRUE'; return $this->execQuery($sql, array($person_id, $oe_kurzbz)); } @@ -98,4 +101,3 @@ class Benutzer_model extends DB_Model return mb_strtolower(str_replace(' ','_', $str)); } } - From 6e5c555a40dcc9b2e28d512e5b8cf2aaf149fc22 Mon Sep 17 00:00:00 2001 From: Paolo Date: Mon, 23 Nov 2020 16:19:23 +0100 Subject: [PATCH 063/313] Fixed MessageLib->_sendNoticeEmail --- application/libraries/MessageLib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index 2970fbd6d..db760ec03 100644 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -606,7 +606,7 @@ class MessageLib if (hasData($benutzerResult)) { // Checks if the user was NOT created in the last 24 hours - if (getData($benutzerResult)[0]->insertamum > date('Y-m-d H:i:s', strtotime('-1 day'))) + if (getData($benutzerResult)[0]->insertamum < date('Y-m-d H:i:s', strtotime('-1 day'))) { // Use the uid + domain email $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; @@ -708,7 +708,7 @@ class MessageLib foreach (getData($benutzerResult) as $benutzer) { // Checks if the user was NOT created in the last 24 hours - if (getData($benutzerResult)[0]->insertamum > date('Y-m-d H:i:s', strtotime('-1 day'))) + if (getData($benutzerResult)[0]->insertamum < date('Y-m-d H:i:s', strtotime('-1 day'))) { // Use the uid + domain as email address $message->receiverContact = getData($benutzerResult)[0]->uid .'@'.DOMAIN; From 562fab9281de94d22265eee2f3dfd0e446e1490e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Wed, 25 Nov 2020 14:43:22 +0100 Subject: [PATCH 064/313] ZGV-Nation in Infocenter Filter per Default sichtbar --- system/filtersupdate.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/system/filtersupdate.php b/system/filtersupdate.php index 9fbaf936f..2a9b26d1c 100644 --- a/system/filtersupdate.php +++ b/system/filtersupdate.php @@ -33,6 +33,7 @@ $filters = array( {"name": "Vorname"}, {"name": "Nachname"}, {"name": "Nation"}, + {"name": "ZGVNation"}, {"name": "StgAbgeschickt"}, {"name": "Studiensemester"}, {"name": "LastAction"}, @@ -66,6 +67,7 @@ $filters = array( {"name": "Vorname"}, {"name": "Nachname"}, {"name": "Nation"}, + {"name": "ZGVNation"}, {"name": "StgAbgeschickt"}, {"name": "Studiensemester"}, {"name": "LastAction"}, @@ -105,6 +107,7 @@ $filters = array( {"name": "Vorname"}, {"name": "Nachname"}, {"name": "Nation"}, + {"name": "ZGVNation"}, {"name": "LastAction"}, {"name": "LastActionType"}, {"name": "User/Operator"}, @@ -140,6 +143,7 @@ $filters = array( {"name": "Vorname"}, {"name": "Nachname"}, {"name": "Nation"}, + {"name": "ZGVNation"}, {"name": "LastAction"}, {"name": "User/Operator"}, {"name": "LockUser"}, @@ -180,6 +184,7 @@ $filters = array( {"name": "Vorname"}, {"name": "Nachname"}, {"name": "Nation"}, + {"name": "ZGVNation"}, {"name": "StgAbgeschickt"}, {"name": "Studiensemester"}, {"name": "LastAction"}, @@ -218,6 +223,7 @@ $filters = array( {"name": "Vorname"}, {"name": "Nachname"}, {"name": "Nation"}, + {"name": "ZGVNation"}, {"name": "LastAction"}, {"name": "User/Operator"}, {"name": "LockUser"}, From 9b6cb231c0b68acb52dbff2ea2901e51d94230bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Wed, 25 Nov 2020 16:54:44 +0100 Subject: [PATCH 065/313] Messages in FAS show the Date of the last Status change (read/unread-status) --- content/messages.xul.php | 5 +++++ rdf/messages.rdf.php | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/content/messages.xul.php b/content/messages.xul.php index eb3ace222..2ee733c82 100644 --- a/content/messages.xul.php +++ b/content/messages.xul.php @@ -122,6 +122,10 @@ echo ']> class="sortDirectionIndicator" sort="rdf:http://www.technikum-wien.at/messages/rdf#status"/> +