diff --git a/application/config/fhcomplete.php b/application/config/fhcomplete.php index 3b24595a7..b680d6f5d 100644 --- a/application/config/fhcomplete.php +++ b/application/config/fhcomplete.php @@ -207,6 +207,7 @@ $config['fhc_acl'] = array 'system.tbl_udf' => 'system/udf', 'system.tbl_extensions' => 'system/extensions', 'system.tbl_log' => 'basis/log', + 'system.tbl_person_lock' => 'system/personlock', 'testtool.tbl_ablauf' => 'basis/ablauf', 'testtool.tbl_antwort' => 'basis/antwort', 'testtool.tbl_frage' => 'basis/frage', diff --git a/application/config/roles.php b/application/config/roles.php index 227321f32..a95a94215 100644 --- a/application/config/roles.php +++ b/application/config/roles.php @@ -55,7 +55,8 @@ $config['roles'] = array ( 'basis/adresse','basis/akte','basis/kontakt','basis/log','basis/nation','basis/notiz','basis/notizzuordnung', 'basis/person','basis/prestudent','basis/prestudentstatus','basis/status','basis/zgv','basis/zgvmaster', - 'lehre/studienplan','system/filters','fs/dms','basis/message','basis/benutzerrolle', 'basis/sprache' + 'lehre/studienplan','system/filters','fs/dms','basis/message','basis/benutzerrolle', 'basis/sprache', + 'system/personlock','basis/benutzerfunktion','system/vorlagestudiengang' ) ) ); diff --git a/application/controllers/ViewMessage.php b/application/controllers/ViewMessage.php index fa294a4ec..48c0a09f1 100644 --- a/application/controllers/ViewMessage.php +++ b/application/controllers/ViewMessage.php @@ -33,7 +33,7 @@ class ViewMessage extends CI_Controller // Load model MessageToken_model, not calling the authentication system $this->load->model('system/MessageToken_model', 'MessageTokenModel'); } - + /** * Using the MessageTokenModel instead of MessageLib to allow * viewing the message without prompting the login @@ -50,32 +50,37 @@ class ViewMessage extends CI_Controller if (is_array($msg->retval) && count($msg->retval) > 0) { $setReadMessageStatusByToken = $this->MessageTokenModel->setReadMessageStatusByToken($token); - + if (isError($setReadMessageStatusByToken)) { show_error($msg->$setReadMessageStatusByToken); } - + $sender_id = $msg->retval[0]->sender_id; $receiver_id = $msg->retval[0]->receiver_id; $sender = $this->MessageTokenModel->getSenderData($sender_id); - + // To decide how to change the redirection $isEmployee = $this->MessageTokenModel->isEmployee($receiver_id); if (!is_bool($isEmployee) && isError($isEmployee)) { show_error($isEmployee); } - + + if($this->config->item('redirect_view_message_url') != '') + $href = APP_ROOT . $this->config->item('redirect_view_message_url') . $token; + else + $href = ''; + $data = array ( 'sender_id' => $sender_id, 'sender' => $sender->retval[0], 'message' => $msg->retval[0], 'isEmployee' => $isEmployee, - 'href' => APP_ROOT . $this->config->item('redirect_view_message_url') . $token + 'href' => $href ); - + $this->load->view('system/messageHTML.php', $data); } } -} \ No newline at end of file +} diff --git a/application/controllers/api/v1/project/Scrumteam.php b/application/controllers/api/v1/project/Scrumteam.php deleted file mode 100644 index 5890cbbcb..000000000 --- a/application/controllers/api/v1/project/Scrumteam.php +++ /dev/null @@ -1,78 +0,0 @@ -load->model('project/scrumteam_model', 'ScrumteamModel'); - - - } - - /** - * @return void - */ - public function getScrumteam() - { - $scrumteam_kurzbz = $this->get('scrumteam_kurzbz'); - - if (isset($scrumteam_kurzbz)) - { - $result = $this->ScrumteamModel->load($scrumteam_kurzbz); - - $this->response($result, REST_Controller::HTTP_OK); - } - else - { - $this->response(); - } - } - - /** - * @return void - */ - public function postScrumteam() - { - if ($this->_validate($this->post())) - { - if (isset($this->post()['scrumteam_kurzbz'])) - { - $result = $this->ScrumteamModel->update($this->post()['scrumteam_kurzbz'], $this->post()); - } - else - { - $result = $this->ScrumteamModel->insert($this->post()); - } - - $this->response($result, REST_Controller::HTTP_OK); - } - else - { - $this->response(); - } - } - - private function _validate($scrumteam = NULL) - { - return true; - } -} \ No newline at end of file diff --git a/application/controllers/system/Messages.php b/application/controllers/system/Messages.php index 2c2474a1e..36db0238d 100644 --- a/application/controllers/system/Messages.php +++ b/application/controllers/system/Messages.php @@ -10,19 +10,19 @@ class Messages extends VileSci_Controller * */ public function __construct() - { - parent::__construct(); + { + parent::__construct(); - // Loads the message library - $this->load->library('MessageLib'); + // Loads the message library + $this->load->library('MessageLib'); - // Loads the widget library + // Loads the widget library $this->load->library('WidgetLib'); $this->load->model('person/Person_model', 'PersonModel'); $this->_setAuthUID(); // sets property uid - } + } /** * write diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index f1cd674b7..c65d15238 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -64,6 +64,7 @@ class InfoCenter extends VileSci_Controller $this->load->model('person/person_model', 'PersonModel'); $this->load->model('system/message_model', 'MessageModel'); $this->load->model('system/filters_model', 'FiltersModel'); + $this->load->model('system/personLock_model', 'PersonLockModel'); // Loads libraries $this->load->library('DmsLib'); @@ -110,10 +111,20 @@ class InfoCenter extends VileSci_Controller if (!is_numeric($person_id)) show_error('person id is not numeric!'); - $persondata = $this->_loadPersonData($person_id); - if (!isset($persondata)) + $personexists = $this->PersonModel->load($person_id); + if(isError($personexists)) + show_error($personexists->retval); + + if (empty($personexists->retval[0])) show_error('person does not exist!'); + //mark person as locked for editing + $result = $this->PersonLockModel->lockPerson($person_id, $this->uid, self::APP); + + if(isError($result)) + show_error($result->retval); + + $persondata = $this->_loadPersonData($person_id); $prestudentdata = $this->_loadPrestudentData($person_id); $this->load->view( @@ -129,6 +140,20 @@ class InfoCenter extends VileSci_Controller ); } + /** + * unlocks page from edit by a person, redirects to overview filter page + * @param $person_id + */ + public function unlockPerson($person_id) + { + $result = $this->PersonLockModel->unlockPerson($person_id, self::APP); + + if(isError($result)) + show_error($result->retval); + + redirect(self::URL_PREFIX); + } + /** * Saves if a document has been formal geprueft. saves current timestamp if checked as geprueft, or null if not. */ @@ -235,7 +260,7 @@ class InfoCenter extends VileSci_Controller } //check if still Interessent and not freigegeben yet - if($lastStatus->retval[0]->status_kurzbz === 'Interessent' && !isset($lastStatus->retval[0]->bestaetigtam)) + if ($lastStatus->retval[0]->status_kurzbz === 'Interessent' && !isset($lastStatus->retval[0]->bestaetigtam)) { $result = $this->PrestudentstatusModel->insert( array( @@ -288,7 +313,7 @@ class InfoCenter extends VileSci_Controller $lastStatus = $lastStatus->retval[0]; //check if still Interessent and not freigegeben yet - if($lastStatus->status_kurzbz === 'Interessent' && !isset($lastStatus->bestaetigtam)) + if ($lastStatus->status_kurzbz === 'Interessent' && !isset($lastStatus->bestaetigtam)) { $result = $this->PrestudentstatusModel->update( array( @@ -310,6 +335,8 @@ class InfoCenter extends VileSci_Controller show_error($result->retval); } + $this->_sendFreigabeMail($prestudent_id); + $logdata = $this->_getPersonAndStudiengangFromPrestudent($prestudent_id); $this->_log($logdata['person_id'], 'freigegeben', array($prestudent_id, $logdata['studiengang_kurzbz'])); @@ -517,6 +544,25 @@ class InfoCenter extends VileSci_Controller */ private function _loadPersonData($person_id) { + $locked = $this->PersonLockModel->checkIfLocked($person_id, self::APP); + + if (isError($locked)) + { + show_error($locked->retval); + } + + $lockedby = null; + + //mark red if locked by other user + $lockedbyother = false; + + if (isset($locked->retval[0]->uid)) + { + $lockedby = $locked->retval[0]->uid; + if ($lockedby !== $this->uid) + $lockedbyother = true; + } + $stammdaten = $this->PersonModel->getPersonStammdaten($person_id, true); if (isError($stammdaten)) @@ -567,6 +613,8 @@ class InfoCenter extends VileSci_Controller $messagelink = base_url('/index.ci.php/system/Messages/write/'.$user_person->retval[0]->person_id); $data = array ( + 'lockedby' => $lockedby, + 'lockedbyother' => $lockedbyother, 'stammdaten' => $stammdaten->retval, 'dokumente' => $dokumente->retval, 'dokumente_nachgereicht' => $dokumente_nachgereicht->retval, @@ -598,6 +646,7 @@ class InfoCenter extends VileSci_Controller foreach ($prestudenten->retval as $prestudent) { $prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent->prestudent_id); + $personid = $this->_getPersonAndStudiengangFromPrestudent($person_id); if (isError($prestudent)) { @@ -606,7 +655,7 @@ class InfoCenter extends VileSci_Controller $zgvpruefung = $prestudent->retval[0]; - if(isset($zgvpruefung->prestudentstatus)) + if (isset($zgvpruefung->prestudentstatus)) { $position = strpos($zgvpruefung->prestudentstatus->anmerkung, 'Alt:'); @@ -708,4 +757,86 @@ class InfoCenter extends VileSci_Controller $this->uid ); } + + /** + * Sends infomail with prestudent and person data when Prestudent is freigegeben + * @param $prestudent_id + */ + private function _sendFreigabeMail($prestudent_id) + { + //get data + $prestudent = $this->PrestudentModel->getPrestudentWithZgv($prestudent_id)->retval[0]; + $prestudentstatus = $prestudent->prestudentstatus; + $person_id = $prestudent->person_id; + $person = $this->PersonModel->getPersonStammdaten($person_id, true)->retval; + + //fill mail variables + $interessentbez = $person->geschlecht == 'm' ? 'Ein Interessent' : 'Eine Interessentin'; + $sprache = $prestudentstatus->sprachedetails->bezeichnung[0]; + $orgform = $prestudentstatus->orgform != '' ? ' ('.$prestudentstatus->orgform.')' : ''; + $geschlecht = $person->geschlecht == 'm' ? 'männlich' : 'weiblich'; + $geburtsdatum = date('d.m.Y', strtotime($person->gebdatum)); + + $notizenBewerbung = $this->NotizModel->getNotizByTitel($person_id, 'Anmerkung zur Bewerbung')->retval; + + $notizentext = ''; + $lastElement = end($notizenBewerbung); + foreach ($notizenBewerbung as $notiz) + { + $notizentext .= $notiz->text; + if ($notiz != $lastElement) + $notizentext .= ' | '; + } + + $mailadresse = ''; + foreach ($person->kontakte as $kontakt) + { + if ($kontakt->kontakttyp === 'email') + { + $mailadresse = $kontakt->kontakt; + break; + } + } + + $data = array + ( + 'interessentbez' => $interessentbez, + 'studiengangbez' => $prestudent->studiengangbezeichnung, + 'studiengangtypbez' => $prestudent->studiengangtyp_bez, + 'orgform' => $orgform, + 'studiensemester' => $prestudentstatus->studiensemester_kurzbz, + 'sprache' => $sprache, + 'geschlecht' => $geschlecht, + 'vorname' => $person->vorname, + 'nachname' => $person->nachname, + 'gebdatum' => $geburtsdatum, + 'mailadresse' => $mailadresse, + 'prestudentid' => $prestudent_id, + 'notizentext' => $notizentext + ); + + $this->load->library('parser'); + $this->load->library('MailLib'); + $this->load->library('LogLib'); + + //parse freigabe html email template, wordwrap wraps text so no display errors + $email = wordwrap($this->parser->parse('templates/mailtemplates/interessentFreigabe', $data, true), 70); + + $subject = ($person->geschlecht == 'm' ? 'Interessent ' : 'Interessentin ').$person->vorname.' '.$person->nachname.' freigegeben'; + + $receiver = $prestudent->studiengangmail; + + if (!empty($receiver)) + { + //Freigabeinformationmail sent from default system mail to studiengang mail(s) + $sent = $this->maillib->send('', $receiver, $subject, $email); + + if (!$sent) + $this->loglib->logError('Error when sending Freigabe mail'); + } + else + { + $this->loglib->logError('Studiengang has no mail for sending Freigabe mail'); + } + } } diff --git a/application/core/DB_Model.php b/application/core/DB_Model.php index 3dc5e85ac..be9e39082 100644 --- a/application/core/DB_Model.php +++ b/application/core/DB_Model.php @@ -540,6 +540,21 @@ class DB_Model extends FHC_Model return $this->db->escape($value); } + /** + * This method call the method escape_like_str from class CI_DB_driver, therefore: + * this method should be used when strings are to be used in LIKE conditions so that LIKE wildcards (‘%’, ‘_’) + * in the string are also properly escaped. + * NOTE: The escape_like_str() method uses ‘!’ (exclamation mark) to escape special characters for LIKE conditions. + * Because this method escapes partial strings that you would wrap in quotes yourself, it cannot automatically + * add the ESCAPE '!' condition for you, and so you’ll have to manually do that. + * + * @return void + */ + public function escapeLike($value) + { + return $this->db->escape_like_str($value); + } + /** * Convert PG-Boolean to PHP-Boolean * diff --git a/application/libraries/LogLib.php b/application/libraries/LogLib.php index 222ed7cc7..a42132644 100644 --- a/application/libraries/LogLib.php +++ b/application/libraries/LogLib.php @@ -55,7 +55,7 @@ class LogLib $function = $backtrace_arr[$functionIndex]['function']; } - if (isset($backtrace_arr[$lineIndex]['line']) && $backgrace_arr[$lineIndex]['line'] != '') + if (isset($backtrace_arr[$lineIndex]['line']) && $backtrace_arr[$lineIndex]['line'] != '') { $line = $backtrace_arr[$lineIndex]['line']; } diff --git a/application/libraries/MailLib.php b/application/libraries/MailLib.php index 5c7093461..e7d3435e0 100644 --- a/application/libraries/MailLib.php +++ b/application/libraries/MailLib.php @@ -58,6 +58,14 @@ class MailLib $alias = $this->alias_from_system; } } + if (defined('MAIL_FROM') && MAIL_FROM != '') + { + $from = MAIL_FROM; + if (is_null($alias) || $alias == '') + { + $alias = $this->alias_from_system; + } + } $this->ci->email->from($from, $alias); @@ -65,12 +73,14 @@ class MailLib $recipient = $to; $recipientCC = $cc; $recipientBCC = $bcc; - if ($this->validateEmailAddress(MAIL_DEBUG)) + if (defined('MAIL_DEBUG') && MAIL_DEBUG != '') { // if is it valid use it!!! $recipient = MAIL_DEBUG; - $recipientCC = MAIL_DEBUG; - $recipientBCC = MAIL_DEBUG; + if ($recipientCC != '') + $recipientCC = MAIL_DEBUG; + if ($recipientBCC != '') + $recipientBCC = MAIL_DEBUG; } $this->ci->email->to($recipient); diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index ee5f77230..3daac4590 100644 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -15,7 +15,7 @@ class MessageLib public function __construct() { // Get code igniter instance - $this->ci =& get_instance(); + $this->ci =& get_instance(); // Loads message configuration $this->ci->config->load('message'); @@ -41,70 +41,70 @@ class MessageLib $this->ci->load->helper('message'); // Loads phrases - $this->ci->lang->load('message'); - } + $this->ci->lang->load('message'); + } - /** - * getMessage() - returns the specified received message for a specified person - */ - public function getMessage($msg_id, $person_id) - { - if (empty($msg_id)) - return $this->_error('', MSG_ERR_INVALID_MSG_ID); + /** + * getMessage() - returns the specified received message for a specified person + */ + public function getMessage($msg_id, $person_id) + { + if (empty($msg_id)) + return $this->_error('', MSG_ERR_INVALID_MSG_ID); if (empty($person_id)) - return $this->_error('', MSG_ERR_INVALID_RECIPIENTS); + return $this->_error('', MSG_ERR_INVALID_RECIPIENTS); $msg = $this->ci->RecipientModel->getMessage($msg_id, $person_id); - return $msg; - } + return $msg; + } /** - * getMessagesByUID() - will return all messages, including the latest status for specified user. It don´t returns Attachments. - */ - public function getMessagesByUID($uid, $oe_kurzbz = null, $all = false) - { - if (empty($uid)) - return $this->_error('', MSG_ERR_INVALID_MSG_ID); + * getMessagesByUID() - will return all messages, including the latest status for specified user. It don´t returns Attachments. + */ + public function getMessagesByUID($uid, $oe_kurzbz = null, $all = false) + { + if (empty($uid)) + return $this->_error('', MSG_ERR_INVALID_MSG_ID); $msg = $this->ci->RecipientModel->getMessagesByUID($uid, $oe_kurzbz, $all); - return $msg; - } + return $msg; + } /** - * getMessagesByPerson() - will return all messages, including the latest status for specified user. It don´t returns Attachments. - */ - public function getMessagesByPerson($person_id, $oe_kurzbz = null, $all = false) - { - if (empty($person_id)) - return $this->_error('', MSG_ERR_INVALID_MSG_ID); + * getMessagesByPerson() - will return all messages, including the latest status for specified user. It don´t returns Attachments. + */ + public function getMessagesByPerson($person_id, $oe_kurzbz = null, $all = false) + { + if (empty($person_id)) + return $this->_error('', MSG_ERR_INVALID_MSG_ID); $msg = $this->ci->RecipientModel->getMessagesByPerson($person_id, $oe_kurzbz, $all); - return $msg; - } + return $msg; + } /** - * getSentMessagesByPerson() - Get all sent messages from a person identified by person_id - */ - public function getSentMessagesByPerson($person_id, $oe_kurzbz = null, $all = false) - { - if (empty($person_id)) - return $this->_error('', MSG_ERR_INVALID_MSG_ID); + * getSentMessagesByPerson() - Get all sent messages from a person identified by person_id + */ + public function getSentMessagesByPerson($person_id, $oe_kurzbz = null, $all = false) + { + if (empty($person_id)) + return $this->_error('', MSG_ERR_INVALID_MSG_ID); $msg = $this->ci->MessageModel->getMessagesByPerson($person_id, $oe_kurzbz, $all); - return $msg; - } + return $msg; + } /** - * getMessageByToken - */ - public function getMessageByToken($token) - { - if (empty($token)) - return $this->_error('', MSG_ERR_INVALID_TOKEN); + * getMessageByToken + */ + public function getMessageByToken($token) + { + if (empty($token)) + return $this->_error('', MSG_ERR_INVALID_TOKEN); $result = $this->ci->RecipientModel->getMessageByToken($token); if (hasData($result)) @@ -138,43 +138,43 @@ class MessageLib } } - return $result; - } + return $result; + } - /** - * getCountUnreadMessages - */ - public function getCountUnreadMessages($person_id, $oe_kurzbz = null) - { - if (!is_numeric($person_id)) - return $this->_error('', MSG_ERR_INVALID_RECIPIENTS); + /** + * getCountUnreadMessages + */ + public function getCountUnreadMessages($person_id, $oe_kurzbz = null) + { + if (!is_numeric($person_id)) + return $this->_error('', MSG_ERR_INVALID_RECIPIENTS); $msg = $this->ci->RecipientModel->getCountUnreadMessages($person_id, $oe_kurzbz); - return $msg; - } + return $msg; + } - /** - * updateMessageStatus() - will change status on message for particular user + /** + * updateMessageStatus() - will change status on message for particular user * NOTE: it performs an insert, NOT an update - */ - public function updateMessageStatus($message_id, $person_id, $status) - { - if (empty($message_id)) - { - return $this->_error('', MSG_ERR_INVALID_MSG_ID); - } + */ + public function updateMessageStatus($message_id, $person_id, $status) + { + if (empty($message_id)) + { + return $this->_error('', MSG_ERR_INVALID_MSG_ID); + } - if (empty($person_id)) - { - return $this->_error('', MSG_ERR_INVALID_USER_ID); - } + if (empty($person_id)) + { + return $this->_error('', MSG_ERR_INVALID_USER_ID); + } // NOTE: Not use empty otherwise if status is 0 it returns an error - if (!isset($status)) - { - return $this->_error('', MSG_ERR_INVALID_STATUS_ID); - } + if (!isset($status)) + { + return $this->_error('', MSG_ERR_INVALID_STATUS_ID); + } // Searches if the status is already present $result = $this->ci->MsgStatusModel->load(array($message_id, $person_id, $status)); @@ -195,17 +195,17 @@ class MessageLib } return $result; - } + } - /** - * sendMessage() - sends new internal message. This function will create a new thread - */ - public function sendMessage($sender_id, $receiver_id, $subject, $body, $priority = PRIORITY_NORMAL, $relationmessage_id = null, $oe_kurzbz = null, $multiPartMime = true) - { - if (!is_numeric($sender_id)) - { + /** + * sendMessage() - sends new internal message. This function will create a new thread + */ + public function sendMessage($sender_id, $receiver_id, $subject, $body, $priority = PRIORITY_NORMAL, $relationmessage_id = null, $oe_kurzbz = null, $multiPartMime = true) + { + if (!is_numeric($sender_id)) + { $sender_id = $this->ci->config->item('system_person_id'); - } + } $receivers = $this->_getReceivers($receiver_id, $oe_kurzbz); @@ -270,17 +270,17 @@ class MessageLib } return $result; - } + } /** - * sendMessageVorlage() - sends new internal message using a template - */ - public function sendMessageVorlage($sender_id, $receiver_id, $vorlage_kurzbz, $oe_kurzbz, $data, $relationmessage_id = null, $orgform_kurzbz = null, $multiPartMime = true) - { - if (!is_numeric($sender_id)) - { + * sendMessageVorlage() - sends new internal message using a template + */ + public function sendMessageVorlage($sender_id, $receiver_id, $vorlage_kurzbz, $oe_kurzbz, $data, $relationmessage_id = null, $orgform_kurzbz = null, $multiPartMime = true) + { + if (!is_numeric($sender_id)) + { $sender_id = $this->ci->config->item('system_person_id'); - } + } $receivers = $this->_getReceivers($receiver_id, $oe_kurzbz); @@ -387,7 +387,7 @@ class MessageLib } return $result; - } + } /** * Gets all the messages from DB and sends them via email @@ -426,54 +426,90 @@ class MessageLib if ((!is_null($result->retval[$i]->receiver) && $result->retval[$i]->receiver != '') || (!is_null($result->retval[$i]->employeecontact) && $result->retval[$i]->employeecontact != '')) { - $href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[0]->token; - // Using a template for the html email body - $body = $this->ci->parser->parse( - 'templates/mailHTML', - array( - 'href' => $href, - 'subject' => $result->retval[0]->subject, - 'body' => $result->retval[0]->body - ), - true - ); + $href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[$i]->token; + + $vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailHTML'); + + if(hasData($vorlage)) + { + // Using a template for the html email body + $body = $this->ci->parser->parse_string( + $vorlage->retval[0]->text, + array( + 'href' => $href, + 'subject' => $result->retval[$i]->subject, + 'body' => $result->retval[$i]->body + ), + true + ); + } + else + { + // Using a template for the html email body + $body = $this->ci->parser->parse( + 'templates/mailHTML', + array( + 'href' => $href, + 'subject' => $result->retval[$i]->subject, + 'body' => $result->retval[$i]->body + ), + true + ); + } if (is_null($body) || $body == '') { $this->ci->loglib->logError('Error while parsing the mail template'); } - // Using a template for the plain text email body - $altBody = $this->ci->parser->parse( - 'templates/mailTXT', - array( - 'href' => $href, - 'subject' => $result->retval[0]->subject, - 'body' => $result->retval[0]->body - ), - true - ); + $vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailTXT'); + if(hasData($vorlage)) + { + // Using a template for the plain text email body + $altBody = $this->ci->parser->parse_string( + $vorlage->retval[0]->text, + array( + 'href' => $href, + 'subject' => $result->retval[$i]->subject, + 'body' => $result->retval[$i]->body + ), + true + ); + } + else + { + // Using a template for the plain text email body + $altBody = $this->ci->parser->parse( + 'templates/mailTXT', + array( + 'href' => $href, + 'subject' => $result->retval[$i]->subject, + 'body' => $result->retval[$i]->body + ), + true + ); + } if (is_null($altBody) || $altBody == '') { $this->ci->loglib->logError('Error while parsing the mail template'); } - // If the sender kontakt does not exist, then system-sender is used if empty + // If the sender is not an employee, then system-sender is used if empty $sender = ''; - if (!is_null($result->retval[0]->sender) && $result->retval[0]->sender != '') + if (!is_null($result->retval[0]->senderemployeecontact) && $result->retval[0]->senderemployeecontact != '') { - $sender = $result->retval[0]->sender; + $sender = $result->retval[0]->senderemployeecontact.'@'.DOMAIN; } - $receiverContanct = $result->retval[$i]->receiver; + $receiverContact = $result->retval[$i]->receiver; if (!is_null($result->retval[$i]->employeecontact) && $result->retval[$i]->employeecontact != '') { - $receiverContanct = $result->retval[$i]->employeecontact.'@'.DOMAIN; + $receiverContact = $result->retval[$i]->employeecontact.'@'.DOMAIN; } // Sending email $sent = $this->ci->maillib->send( $sender, - $receiverContanct, + $receiverContact, $result->retval[$i]->subject, $body, null, @@ -571,15 +607,32 @@ class MessageLib { // Using a template for the html email body $href = $this->ci->config->item('message_server').$this->ci->config->item('message_html_view_url').$result->retval[0]->token; - $bodyMsg = $this->ci->parser->parse( - 'templates/mailHTML', - array( - 'href' => $href, - 'subject' => $result->retval[0]->subject, - 'body' => $result->retval[0]->body - ), - true - ); + + $vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailHTML'); + if(hasData($vorlage)) + { + $bodyMsg = $this->ci->parser->parse_string( + $vorlage->retval[0]->text, + array( + 'href' => $href, + 'subject' => $result->retval[0]->subject, + 'body' => $result->retval[0]->body + ), + true + ); + } + else + { + $bodyMsg = $this->ci->parser->parse( + 'templates/mailHTML', + array( + 'href' => $href, + 'subject' => $result->retval[0]->subject, + 'body' => $result->retval[0]->body + ), + true + ); + } if (is_null($bodyMsg) || $bodyMsg == '') { // $body = $result->retval[0]->body; @@ -587,15 +640,31 @@ class MessageLib } // Using a template for the plain text email body - $altBody = $this->ci->parser->parse( - 'templates/mailTXT', - array( - 'href' => $href, - 'subject' => $result->retval[0]->subject, - 'body' => $result->retval[0]->body - ), - true - ); + $vorlage = $this->ci->vorlagelib->loadVorlagetext('MessageMailHTML'); + if(hasData($vorlage)) + { + $altBody = $this->ci->parser->parse_string( + $vorlage->retval[0]->text, + array( + 'href' => $href, + 'subject' => $result->retval[0]->subject, + 'body' => $result->retval[0]->body + ), + true + ); + } + else + { + $altBody = $this->ci->parser->parse( + 'templates/mailTXT', + array( + 'href' => $href, + 'subject' => $result->retval[0]->subject, + 'body' => $result->retval[0]->body + ), + true + ); + } if (is_null($altBody) || $altBody == '') { $this->ci->loglib->logError('Error while parsing the plain text mail template'); @@ -606,23 +675,23 @@ class MessageLib $bodyMsg = $altBody = $body; } - // If the sender kontakt does not exist, then system-sender is used if empty + // If the sender is not an employee, then system-sender is used if empty $sender = ''; - if (!is_null($result->retval[0]->sender) && $result->retval[0]->sender != '') + if (!is_null($result->retval[0]->senderemployeecontact) && $result->retval[0]->senderemployeecontact != '') { - $sender = $result->retval[0]->sender; + $sender = $result->retval[0]->senderemployeecontact.'@'.DOMAIN; } - $receiverContanct = $result->retval[0]->receiver; + $receiverContact = $result->retval[0]->receiver; if (!is_null($result->retval[0]->employeecontact) && $result->retval[0]->employeecontact != '') { - $receiverContanct = $result->retval[0]->employeecontact.'@'.DOMAIN; + $receiverContact = $result->retval[0]->employeecontact.'@'.DOMAIN; } // Sending email $sent = $this->ci->maillib->send( $sender, - $receiverContanct, + $receiverContact, is_null($subject) ? $result->retval[0]->subject : $subject, // if parameter subject is not null, use it! $bodyMsg, null, @@ -689,8 +758,8 @@ class MessageLib return $sent; } - // ------------------------------------------------------------------------ - // Private methods + // ------------------------------------------------------------------------ + // Private methods /** * Update the table tbl_msg_recipient @@ -736,29 +805,29 @@ class MessageLib } /** - * Gets the receivers id that are enabled to read messages for that oe_kurzbz - */ - private function _getReceiversByOekurzbz($oe_kurzbz) - { + * Gets the receivers id that are enabled to read messages for that oe_kurzbz + */ + private function _getReceiversByOekurzbz($oe_kurzbz) + { // Load Benutzerfunktion_model $this->ci->load->model('person/Benutzerfunktion_model', 'BenutzerfunktionModel'); // Join with table public.tbl_benutzer on field uid $this->ci->BenutzerfunktionModel->addJoin('public.tbl_benutzer', 'uid'); // Get all the valid receivers id using the oe_kurzbz $receivers = $this->ci->BenutzerfunktionModel->loadWhere( - 'oe_kurzbz = \''.$oe_kurzbz.'\''. - ' AND funktion_kurzbz = \''.$this->ci->config->item('assistent_function').'\''. + 'oe_kurzbz = '.$this->ci->db->escape($oe_kurzbz). + ' AND funktion_kurzbz = '.$this->ci->db->escape($this->ci->config->item('assistent_function')). ' AND (NOW() BETWEEN COALESCE(datum_von, NOW()) AND COALESCE(datum_bis, NOW()))' ); return $receivers; - } + } - /** - * Gets the receivers id - */ - private function _getReceivers($receiver_id, $oe_kurzbz = null) - { + /** + * Gets the receivers id + */ + private function _getReceivers($receiver_id, $oe_kurzbz = null) + { $receivers = null; // If no receiver_id is given... @@ -782,13 +851,13 @@ class MessageLib } return $receivers; - } + } - /** - * Checks if the given receiver id is a valid person - */ - private function _checkReceiverId($receiver_id) - { + /** + * Checks if the given receiver id is a valid person + */ + private function _checkReceiverId($receiver_id) + { // Load Person_model $this->ci->load->model('person/Person_model', 'PersonModel'); $result = $this->ci->PersonModel->load($receiver_id); @@ -798,13 +867,13 @@ class MessageLib } return false; - } + } - /** - * Save a message in DB - **/ - private function _saveMessage($sender_id, $receiver_id, $subject, $body, $relationmessage_id, $oe_kurzbz) - { + /** + * Save a message in DB + **/ + private function _saveMessage($sender_id, $receiver_id, $subject, $body, $relationmessage_id, $oe_kurzbz) + { // Starts db transaction $this->ci->db->trans_start(false); @@ -854,27 +923,27 @@ class MessageLib } return $result; - } + } - /** - * Wrapper for function error - */ - private function _error($retval = '', $code = null) - { + /** + * Wrapper for function error + */ + private function _error($retval = '', $code = null) + { return error($retval, $code, MessageLib::MSG_INDX_PREFIX); - } + } - /** - * Wrapper for function success - */ - private function _success($retval = '', $code = null) - { + /** + * Wrapper for function success + */ + private function _success($retval = '', $code = null) + { return success($retval, $code, MessageLib::MSG_INDX_PREFIX); - } + } - /** - * - */ + /** + * + */ public function parseMessageText($text, $data = array()) { return $this->ci->parser->parse_string($text, $data, true); diff --git a/application/libraries/VorlageLib.php b/application/libraries/VorlageLib.php index 81ce44149..7ea3de93d 100644 --- a/application/libraries/VorlageLib.php +++ b/application/libraries/VorlageLib.php @@ -9,9 +9,9 @@ class VorlageLib /** * Loads parser library and OrganisationseinheitLib library */ - public function __construct() - { - require_once APPPATH.'config/message.php'; + public function __construct() + { + require_once APPPATH.'config/message.php'; $this->ci =& get_instance(); @@ -21,83 +21,83 @@ class VorlageLib $this->ci->load->model('system/Vorlage_model', 'VorlageModel'); $this->ci->load->model('system/Vorlagestudiengang_model', 'VorlageStudiengangModel'); - $this->ci->load->helper('language'); - // Loads helper message to manage returning messages + $this->ci->load->helper('language'); + // Loads helper message to manage returning messages $this->ci->load->helper('message'); - //$this->ci->lang->load('fhcomplete'); - } + //$this->ci->lang->load('fhcomplete'); + } /** - * getVorlage() - will load a spezific Template - * - * @param int $vorlage_kurzbz REQUIRED - * @return struct - */ - public function getVorlage($vorlage_kurzbz) - { - if (empty($vorlage_kurzbz)) - return error(MSG_ERR_INVALID_MSG_ID); - - $vorlage = $this->ci->VorlageModel->load($vorlage_kurzbz); - return $vorlage; - } - - /** - * getSubMessages() - will return all Messages subordinated from a specified message. - * - * @param int $msg_id REQUIRED - * @return array - */ - public function getVorlageByMimetype($mimetype = null) - { - $vorlage = $this->ci->VorlageModel->loadWhere(array('mimetype' => $mimetype)); - return $vorlage; - } - - /** - * saveVorlage() - will save a spezific Template. - * - * @param array $data REQUIRED - * @return array - */ - public function saveVorlage($vorlage_kurzbz, $data) - { - if (empty($data)) - return error(MSG_ERR_INVALID_MSG_ID); - - $vorlage = $this->ci->VorlageModel->update($vorlage_kurzbz, $data); - return $vorlage; - } - - /** - * getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template. - * - * @param string $vorlage_kurzbz REQUIRED - * @return array - */ - public function getVorlagetextByVorlage($vorlage_kurzbz) + * getVorlage() - will load a spezific Template + * + * @param int $vorlage_kurzbz REQUIRED + * @return struct + */ + public function getVorlage($vorlage_kurzbz) { - if (empty($vorlage_kurzbz)) - return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false)); + if (empty($vorlage_kurzbz)) + return error(MSG_ERR_INVALID_MSG_ID); - $vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array('vorlage_kurzbz' => $vorlage_kurzbz)); - return $vorlage; - } + $vorlage = $this->ci->VorlageModel->load($vorlage_kurzbz); + return $vorlage; + } /** - * loadVorlagetext() - will load the best fitting Template. - * - * @param string $vorlage_kurzbz REQUIRED - * @param string $oe_kurzbz OPTIONAL - * @param string $orgform_kurzbz OPTIONAL + * getSubMessages() - will return all Messages subordinated from a specified message. + * + * @param int $msg_id REQUIRED + * @return array + */ + public function getVorlageByMimetype($mimetype = null) + { + $vorlage = $this->ci->VorlageModel->loadWhere(array('mimetype' => $mimetype)); + return $vorlage; + } + + /** + * saveVorlage() - will save a spezific Template. + * + * @param array $data REQUIRED + * @return array + */ + public function saveVorlage($vorlage_kurzbz, $data) + { + if (empty($data)) + return error(MSG_ERR_INVALID_MSG_ID); + + $vorlage = $this->ci->VorlageModel->update($vorlage_kurzbz, $data); + return $vorlage; + } + + /** + * getVorlagetextByVorlage() - will load tbl_vorlagestudiengang for a spezific Template. + * + * @param string $vorlage_kurzbz REQUIRED + * @return array + */ + public function getVorlagetextByVorlage($vorlage_kurzbz) + { + if (empty($vorlage_kurzbz)) + return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false)); + + $vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array('vorlage_kurzbz' => $vorlage_kurzbz)); + return $vorlage; + } + + /** + * loadVorlagetext() - will load the best fitting Template. + * + * @param string $vorlage_kurzbz REQUIRED + * @param string $oe_kurzbz OPTIONAL + * @param string $orgform_kurzbz OPTIONAL * @param string $sprache OPTIONAL - * @return array - */ - public function loadVorlagetext($vorlage_kurzbz, $oe_kurzbz = null, $orgform_kurzbz = null, $sprache = null) + * @return array + */ + public function loadVorlagetext($vorlage_kurzbz, $oe_kurzbz = null, $orgform_kurzbz = null, $sprache = null) { - if (empty($vorlage_kurzbz)) - return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false)); - + if (empty($vorlage_kurzbz)) + return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false)); + // Try to search the template with the given vorlage_kurzbz and other parameters if present $queryParameters = array("vorlage_kurzbz" => $vorlage_kurzbz, "aktiv" => true); @@ -120,7 +120,7 @@ class VorlageLib { // Builds where clause $where = $this->_where($vorlage_kurzbz, $orgform_kurzbz, $sprache); - + $vorlage = $this->ci->organisationseinheitlib->treeSearch( 'public', 'tbl_vorlagestudiengang', @@ -133,17 +133,17 @@ class VorlageLib ); } - return $vorlage; - } + return $vorlage; + } - /** - * _where - */ - private function _where($vorlage_kurzbz, $orgform_kurzbz, $sprache) - { + /** + * _where + */ + private function _where($vorlage_kurzbz, $orgform_kurzbz, $sprache) + { // Builds where clause $where = "vorlage_kurzbz = ".$this->ci->VorlageModel->escape($vorlage_kurzbz); - + if (is_null($sprache)) { $where .= " AND sprache IS NULL"; @@ -152,60 +152,60 @@ class VorlageLib { $where .= " AND sprache = ".$this->ci->VorlageModel->escape($sprache); } - + $where .= " AND aktiv = true"; - + return $where; - } + } /** - * insertVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template. - * - * @param string $vorlage_kurzbz REQUIRED - * @return array - */ - public function insertVorlagetext($data) + * insertVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template. + * + * @param string $vorlage_kurzbz REQUIRED + * @return array + */ + public function insertVorlagetext($data) { - $vorlagetext = $this->ci->VorlageStudiengangModel->insert($data); - return $vorlagetext; - } + $vorlagetext = $this->ci->VorlageStudiengangModel->insert($data); + return $vorlagetext; + } /** - * loadVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template. - * - * @param string $vorlage_kurzbz REQUIRED - * @return array - */ - public function getVorlagetextById($vorlagestudiengang_id) + * loadVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template. + * + * @param string $vorlage_kurzbz REQUIRED + * @return array + */ + public function getVorlagetextById($vorlagestudiengang_id) { - $vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id); - return $vorlagetext; - } + $vorlagetext = $this->ci->VorlageStudiengangModel->load($vorlagestudiengang_id); + return $vorlagetext; + } /** - * saveVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template. - * - * @param string $vorlage_kurzbz REQUIRED - * @return array - */ - public function updateVorlagetext($vorlagestudiengang_id, $data) + * saveVorlagetext() - will load tbl_vorlagestudiengang for a spezific Template. + * + * @param string $vorlage_kurzbz REQUIRED + * @return array + */ + public function updateVorlagetext($vorlagestudiengang_id, $data) { - $vorlagetext = $this->ci->VorlageStudiengangModel->update($vorlagestudiengang_id, $data); - return $vorlagetext; - } + $vorlagetext = $this->ci->VorlageStudiengangModel->update($vorlagestudiengang_id, $data); + return $vorlagetext; + } /** - * parseVorlagetext() - will parse a Vorlagetext. - * - * @param string $text REQUIRED - * @param array $data REQUIRED - * @return string - */ - public function parseVorlagetext($text, $data = array()) + * parseVorlagetext() - will parse a Vorlagetext. + * + * @param string $text REQUIRED + * @param array $data REQUIRED + * @return string + */ + public function parseVorlagetext($text, $data = array()) { - if (empty($text)) - return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false)); + if (empty($text)) + return error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false)); $text = $this->ci->parser->parse_string($text, $data, true); return $text; - } + } } diff --git a/application/models/crm/Prestudent_model.php b/application/models/crm/Prestudent_model.php index a56592467..d75d17236 100644 --- a/application/models/crm/Prestudent_model.php +++ b/application/models/crm/Prestudent_model.php @@ -201,10 +201,12 @@ class Prestudent_model extends DB_Model */ public function getPrestudentWithZgv($prestudent_id) { - $this->addSelect('tbl_prestudent.*, tbl_studiengang.kurzbzlang as studiengang, tbl_studiengang.bezeichnung as studiengangbezeichnung, tbl_studiengang.english as studiengangenglish, tbl_studiengang.typ as studiengangtyp, - tbl_zgv.zgv_code, tbl_zgv.zgv_bez, tbl_prestudent.zgvort, tbl_prestudent.zgvdatum, tbl_prestudent.zgvnation as zgvnation_code, zgvnat.kurztext as zgvnation_kurzbez, zgvnat.langtext as zgvnation_bez, zgvnat.engltext as zgvnation_englbez, - tbl_zgvmaster.zgvmas_code, tbl_zgvmaster.zgvmas_bez, tbl_prestudent.zgvmaort, tbl_prestudent.zgvmadatum, tbl_prestudent.zgvmanation as zgvmanation_code, zgvmanat.kurztext as zgvmanation_kurzbez, zgvmanat.langtext as zgvmanation_bez, zgvmanat.engltext as zgvmanation_englbez'); + $this->addSelect('tbl_prestudent.*, tbl_studiengang.studiengang_kz, tbl_studiengang.kurzbzlang as studiengang, tbl_studiengang.bezeichnung as studiengangbezeichnung, tbl_studiengang.english as studiengangenglish, + tbl_studiengang.email as studiengangmail, tbl_studiengang.typ as studiengangtyp, tbl_studiengangstyp.bezeichnung as studiengangtyp_bez, + tbl_zgv.zgv_code, tbl_zgv.zgv_bez, tbl_prestudent.zgvnation as zgvnation_code, zgvnat.kurztext as zgvnation_kurzbez, zgvnat.langtext as zgvnation_bez, zgvnat.engltext as zgvnation_englbez, + tbl_zgvmaster.zgvmas_code, tbl_zgvmaster.zgvmas_bez, tbl_prestudent.zgvmanation as zgvmanation_code, zgvmanat.kurztext as zgvmanation_kurzbez, zgvmanat.langtext as zgvmanation_bez, zgvmanat.engltext as zgvmanation_englbez'); $this->addJoin('public.tbl_studiengang', 'studiengang_kz', 'LEFT'); + $this->addJoin('public.tbl_studiengangstyp', 'typ', 'LEFT'); $this->addJoin('bis.tbl_zgv', 'zgv_code', 'LEFT'); $this->addJoin('bis.tbl_zgvmaster', 'zgvmas_code', 'LEFT'); $this->addJoin('bis.tbl_nation zgvnat', 'zgvnation = zgvnat.nation_code', 'LEFT'); @@ -223,13 +225,13 @@ class Prestudent_model extends DB_Model return error($lastStatus->retval); } - if(count($lastStatus->retval) > 0) + if (count($lastStatus->retval) > 0) { $this->load->model('system/sprache_model', 'SpracheModel'); $language = $this->SpracheModel->load($lastStatus->retval[0]->sprache); - if($language->error) + if ($language->error) return error($language->retval); - if(count($language->retval) > 0) + if (count($language->retval) > 0) $lastStatus->retval[0]->sprachedetails = $language->retval[0]; $prestudent->retval[0]->prestudentstatus = $lastStatus->retval[0]; } diff --git a/application/models/person/Notiz_model.php b/application/models/person/Notiz_model.php index 61f935d19..ccc1e2719 100644 --- a/application/models/person/Notiz_model.php +++ b/application/models/person/Notiz_model.php @@ -144,6 +144,19 @@ class Notiz_model extends DB_Model return $this->loadWhere(array('person_id' => $person_id)); } + + /** + * gets all Notizen for a person with a specific title + * @param $person_id + * @param $titel + */ + public function getNotizByTitel($person_id, $titel) + { + // Join with the table public.tbl_notizzuordnung using notiz_id + $this->addJoin('public.tbl_notizzuordnung', 'notiz_id'); + + return $this->loadWhere(array('person_id' => $person_id, 'titel' => $titel)); + } // ------------------------------------------------------------------------------------------------------ } diff --git a/application/models/person/Person_model.php b/application/models/person/Person_model.php index 9c6f14f89..0c7c169bb 100644 --- a/application/models/person/Person_model.php +++ b/application/models/person/Person_model.php @@ -209,5 +209,4 @@ class Person_model extends DB_Model return $this->loadWhere(array('uid' => $uid)); } - } diff --git a/application/models/project/Scrumteam_model.php b/application/models/project/Scrumteam_model.php deleted file mode 100644 index 0a19c9837..000000000 --- a/application/models/project/Scrumteam_model.php +++ /dev/null @@ -1,14 +0,0 @@ -dbTable = 'fue.tbl_scrumteam'; - $this->pk = 'scrumteam_kurzbz'; - } -} diff --git a/application/models/system/PersonLock_model.php b/application/models/system/PersonLock_model.php new file mode 100644 index 000000000..1d106b789 --- /dev/null +++ b/application/models/system/PersonLock_model.php @@ -0,0 +1,88 @@ +dbTable = 'system.tbl_person_lock'; + $this->pk = 'lock_id'; + } + + /** + * Checks if a specific person is locked. By default, looks for entries with no app in locktable for the person. + * Alternatively, looks only for locks in a certain app. + * @param $person_id + * @param null $app + * @return array all locks for a person if locked, null otherwise + */ + public function checkIfLocked($person_id, $app = null) + { + $lockdata = array('person_id' => $person_id, 'app' => $app); + + $result = $this->loadWhere($lockdata); + + if ($result->error) + return error($result->retval); + + if (count($result->retval) > 0) + return success($result->retval); + else + return success(null); + } + + /** + * Locks a person. Returns null if person was not locked (e.g. when already locked). + * @param $person_id + * @param $uid user who locks the person + * @param $app optional, application in which person is locked + * @return array inserted lock id if person was locked, null otherwise + */ + public function lockPerson($person_id, $uid, $app = null) + { + $locked = $this->checkIfLocked($person_id, $app); + + if ($locked->error) + return error($locked->retval); + + //insert only if not already locked + if ($locked->retval === null) + return $this->insert(array('person_id' => $person_id, 'uid' => $uid, 'app' => $app)); + else + return success(null); + } + + /** + * Remove a lock for a person. By default, removes any entries in locktable for the person. + * Alternatively, removes only locks in a certain app. + * @param $person_id + * @param null $app + * @return array deleted lock ids if person was locked, null otherwise + */ + public function unlockPerson($person_id, $app = null) + { + $deleted = array(); + $locks = $this->checkIfLocked($person_id, $app); + + if ($locks->retval === null) + return success(null); + + foreach ($locks->retval as $lock) + { + $result = $this->delete($lock->lock_id); + if ($result->error) + return error($result->retval); + + $deleted[] = $lock; + } + + return success($deleted); + } +} diff --git a/application/models/system/Recipient_model.php b/application/models/system/Recipient_model.php index 40ef39f65..b9e170fbf 100644 --- a/application/models/system/Recipient_model.php +++ b/application/models/system/Recipient_model.php @@ -261,6 +261,7 @@ class Recipient_model extends DB_Model ks.kontakt as sender, kr.kontakt as receiver, mu.mitarbeiter_uid as employeeContact, + ms.mitarbeiter_uid as senderemployeeContact, mr.person_id as receiver_id, mr.token, mm.subject, @@ -278,7 +279,13 @@ class Recipient_model extends DB_Model m.mitarbeiter_uid FROM public.tbl_benutzer b INNER JOIN public.tbl_mitarbeiter m ON(b.uid = m.mitarbeiter_uid) WHERE b.aktiv = TRUE - ) mu ON (mu.person_id = mr.person_id)'; + ) mu ON (mu.person_id = mr.person_id) + LEFT JOIN ( + SELECT b.person_id, + m.mitarbeiter_uid + FROM public.tbl_benutzer b INNER JOIN public.tbl_mitarbeiter m ON(b.uid = m.mitarbeiter_uid) + WHERE b.aktiv = TRUE + ) ms ON (ms.person_id = mm.person_id)'; $parametersArray = array($kontaktType, $kontaktType); diff --git a/application/views/system/infocenter/infocenter.php b/application/views/system/infocenter/infocenter.php index 8244e8c67..3ceaf1fa1 100644 --- a/application/views/system/infocenter/infocenter.php +++ b/application/views/system/infocenter/infocenter.php @@ -4,12 +4,13 @@ array( 'title' => 'Info Center', 'jquery' => true, + 'jqueryui' => true, 'bootstrap' => true, 'fontawesome' => true, 'sbadmintemplate' => true, 'tablesorter' => true, 'customCSSs' => 'skin/tablesort_bootstrap.css', - 'customJSs' => array('include/js/infocenterPersonDataset.js', 'include/js/bootstrapper.js') + 'customJSs' => array('include/js/bootstrapper.js', 'include/js/infocenter/infocenterPersonDataset.js') ) ); ?> @@ -40,9 +41,6 @@ - load->view('templates/FHC-Footer'); ?> diff --git a/application/views/system/infocenter/infocenterData.php b/application/views/system/infocenter/infocenterData.php index 28b2d018e..1caa6ffb4 100644 --- a/application/views/system/infocenter/infocenterData.php +++ b/application/views/system/infocenter/infocenterData.php @@ -1,4 +1,7 @@ ' SELECT @@ -60,8 +63,10 @@ AND ps.person_id = p.person_id AND tbl_studiengang.typ in(\'b\') LIMIT 1 - ) AS "AnzahlAbgeschickt" + ) AS "AnzahlAbgeschickt", + pl.zeitpunkt AS "LockDate" FROM public.tbl_person p + LEFT JOIN (SELECT person_id, zeitpunkt FROM system.tbl_person_lock WHERE app = \''.$APP.'\') pl USING(person_id) WHERE EXISTS( SELECT 1 @@ -135,7 +140,22 @@ } } + if ($fieldName == 'LockDate') + { + if ($datasetRaw->{$fieldName} == '01.01.1970 01:00:00') + { + $datasetRaw->{$fieldName} = 'Not locked'; + } + } + return $datasetRaw; + }, + 'markRow' => function($datasetRaw) { + + if ($datasetRaw->LockDate != '') + { + return FilterWidget::DEFAULT_MARK_ROW_CLASS; + } } ); @@ -147,7 +167,7 @@ } else { - $filterWidgetArray['app'] = 'infocenter'; + $filterWidgetArray['app'] = $APP; $filterWidgetArray['datasetName'] = 'PersonActions'; $filterWidgetArray['filterKurzbz'] = 'InfoCenterNotSentApplicationAll'; } diff --git a/application/views/system/infocenter/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php index 16effcfdd..6b672cd87 100644 --- a/application/views/system/infocenter/infocenterDetails.php +++ b/application/views/system/infocenter/infocenterDetails.php @@ -1,19 +1,27 @@ load->view( - 'templates/FHC-Header', - array( - 'title' => 'InfocenterDetails', - 'jquery' => true, - 'bootstrap' => true, - 'fontawesome' => true, - 'jqueryui' => true, - 'tablesorter' => true, - 'tinymce' => true, - 'sbadmintemplate' => true, - 'customCSSs' => array('skin/admintemplate.css', 'skin/tablesort_bootstrap.css'), - 'customJSs' => 'include/js/bootstrapper.js' - ) -); + $this->load->view( + 'templates/FHC-Header', + array( + 'title' => 'InfocenterDetails', + 'jquery' => true, + 'bootstrap' => true, + 'fontawesome' => true, + 'jqueryui' => true, + 'tablesorter' => true, + 'tinymce' => true, + 'sbadmintemplate' => true, + 'customCSSs' => + array( + 'skin/admintemplate.css', + 'skin/tablesort_bootstrap.css' + ), + 'customJSs' => + array( + 'include/js/bootstrapper.js', + 'include/js/tablesort/tablesort.js', + 'include/js/infocenter/infocenterDetails.js') + ) + ); ?>
@@ -28,13 +36,26 @@ $this->load->view( ?>
-
-
- +
+
+ +
+
+
+ wird bearbeitet von: + +    +  Freigeben + +
+
@@ -124,27 +145,9 @@ $this->load->view(
diff --git a/application/views/system/infocenter/stammdaten.php b/application/views/system/infocenter/stammdaten.php index 3e2ec1fb7..6aae1c9f6 100644 --- a/application/views/system/infocenter/stammdaten.php +++ b/application/views/system/infocenter/stammdaten.php @@ -80,7 +80,9 @@ strasse.', '.$adresse->plz.' '.$adresse->ort : '' ?> - heimatadresse === true ? 'Heimatadresse' : '').($adresse->heimatadresse === true && $adresse->rechnungsadresse === true ? ', ' : '').($adresse->rechnungsadresse === true ? 'Rechnungsadresse' : ''); ?> + heimatadresse === true ? 'Heimatadresse' : ''). + ($adresse->heimatadresse === true && $adresse->rechnungsadresse === true ? ', ' : ''). + ($adresse->rechnungsadresse === true ? 'Rechnungsadresse' : ''); ?> @@ -103,13 +105,4 @@
-
- \ No newline at end of file +
\ No newline at end of file diff --git a/application/views/system/infocenter/zgvpruefungen.php b/application/views/system/infocenter/zgvpruefungen.php index 59935dd1d..cf2bf12b8 100644 --- a/application/views/system/infocenter/zgvpruefungen.php +++ b/application/views/system/infocenter/zgvpruefungen.php @@ -35,7 +35,7 @@ prestudentstatus->status_kurzbz)) { - echo $zgvpruefung->prestudentstatus->status_kurzbz.(isset($zgvpruefung->prestudentstatus->bezeichnung_statusgrund[0]) && $zgvpruefung->prestudentstatus->status_kurzbz === 'Abgewiesener' ? ' ('.$zgvpruefung->prestudentstatus->bezeichnung_statusgrund[0].')' : ''); + echo $zgvpruefung->prestudentstatus->status_kurzbz.(isset($zgvpruefung->prestudentstatus->bezeichnung_statusgrund[0]) ? ' ('.$zgvpruefung->prestudentstatus->bezeichnung_statusgrund[0].')' : ''); } ?>
@@ -57,12 +57,12 @@
- prestudentstatus->orgform)) ? ', ' : ''; - echo (isset($zgvpruefung->prestudentstatus->orgform) ? $zgvpruefung->prestudentstatus->orgform : '') - .(isset($zgvpruefung->prestudentstatus->sprachedetails->bezeichnung) ? $separator.$zgvpruefung->prestudentstatus->sprachedetails->bezeichnung[0] : '') - .(isset($zgvpruefung->prestudentstatus->alternative) ? ' ('.$zgvpruefung->prestudentstatus->alternative.')' : '') ?> - + prestudentstatus->orgform)) ? ', ' : ''; + echo (isset($zgvpruefung->prestudentstatus->orgform) ? $zgvpruefung->prestudentstatus->orgform : '') + .(isset($zgvpruefung->prestudentstatus->sprachedetails->bezeichnung) ? $separator.$zgvpruefung->prestudentstatus->sprachedetails->bezeichnung[0] : '') + .(isset($zgvpruefung->prestudentstatus->alternative) ? ' ('.$zgvpruefung->prestudentstatus->alternative.')' : '') ?> +
diff --git a/application/views/system/messageHTML.php b/application/views/system/messageHTML.php index 4a2eb2f07..6a1d509ba 100644 --- a/application/views/system/messageHTML.php +++ b/application/views/system/messageHTML.php @@ -27,7 +27,8 @@ - + +
Message: @@ -38,7 +39,7 @@ @@ -48,7 +49,7 @@ + ?> diff --git a/application/views/system/messageList.php b/application/views/system/messageList.php index e0369ae56..d549d68a4 100644 --- a/application/views/system/messageList.php +++ b/application/views/system/messageList.php @@ -6,7 +6,7 @@ $widthColumn = $msgExists === true ? 8 : 12; - + diff --git a/application/views/templates/mailtemplates/interessentFreigabe.php b/application/views/templates/mailtemplates/interessentFreigabe.php new file mode 100644 index 000000000..91ca22f94 --- /dev/null +++ b/application/views/templates/mailtemplates/interessentFreigabe.php @@ -0,0 +1,54 @@ + + + Interessentenfreigabe mail + + +
+ {interessentbez} wurde freigegeben. +

+
Gelesen amGesendet am Sender Empfänger Betreff
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Studiengang{studiengangbez} {studiengangtypbez} {orgform} {sprache}
Studiensemester{studiensemester}
Geschlecht{geschlecht}
Vorname{vorname}
Nachname{nachname}
Geburtsdatum{gebdatum}
E-Mail Adresse{mailadresse}
Prestudent ID{prestudentid}
Anmerkungen zur Bewerbung{notizentext}
+
+ Für mehr Details verwenden Sie die Personenansicht im FAS. + + + + diff --git a/application/views/widgets/filter/filter.php b/application/views/widgets/filter/filter.php index c6df10073..5f2ba79e5 100644 --- a/application/views/widgets/filter/filter.php +++ b/application/views/widgets/filter/filter.php @@ -1,5 +1,13 @@
-
- -
-
- -
+ -
- +
+
+
+

+ Filter options +

+
+
+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+
+

-
-
+
-
-
+
+
diff --git a/application/views/widgets/filter/selectFields.php b/application/views/widgets/filter/selectFields.php index c94168d6f..87694f3ca 100644 --- a/application/views/widgets/filter/selectFields.php +++ b/application/views/widgets/filter/selectFields.php @@ -1,63 +1,54 @@ -
-
-
-

- Select columns -

-
-
-
-
- + - - - -
-
- - Add field: - - - - -
-
-
-
+ if ($columnsAliases != null) + { + $indx = array_search($selectedField, $listFields); + if ($indx !== false) + { + $selectedFieldAlias = $columnsAliases[$indx]; + } + } + ?> + + + X + + + +
+ +
+ + Add field: + + + +
diff --git a/application/views/widgets/filter/selectFilters.php b/application/views/widgets/filter/selectFilters.php index 82986d064..a6b638224 100644 --- a/application/views/widgets/filter/selectFilters.php +++ b/application/views/widgets/filter/selectFilters.php @@ -1,82 +1,69 @@ -
-
-
-

- Select filters -

-
-
-
-
- + name; + $md = FilterWidget::getFilterMetaData($selectedFilter, $metaData); + $selectedFieldAlias = $md->name; - if ($columnsAliases != null) - { - $indx = array_search($selectedFilter, $listFields); - if ($indx !== false) - { - $selectedFieldAlias = $columnsAliases[$indx]; - } - } + if ($columnsAliases != null) + { + $indx = array_search($selectedFilter, $listFields); + if ($indx !== false) + { + $selectedFieldAlias = $columnsAliases[$indx]; + } + } - ?> -
+ ?> +
- - - + + + - + - - - + + + -
- - -
-
- - Add filter: - - - - - - - - -
-
+ + +
+
+ + Add filter: + + + + + + + +
-
diff --git a/application/views/widgets/filter/tableDataset.php b/application/views/widgets/filter/tableDataset.php index b8de42803..e84ae0715 100644 --- a/application/views/widgets/filter/tableDataset.php +++ b/application/views/widgets/filter/tableDataset.php @@ -55,7 +55,7 @@ { $result = $results[$resultsCounter]; ?> - + filterId = $filterSessionArray[self::FILTER_ID]; } + // + if ($this->filterName == null && isset($filterSessionArray[self::FILTER_NAME])) + { + $this->filterName = $filterSessionArray[self::FILTER_NAME]; + } + // if ($filterSessionArray[self::FILTER_ID] != $this->filterId) { @@ -385,6 +397,25 @@ class FilterWidget extends Widget return $tmpDatasetRaw; } + /** + * + */ + public static function markRow($datasetRaw) + { + $class = ''; + + if (is_object($datasetRaw)) + { + $markRow = self::$FilterWidgetInstance->getMarkRow(); + if ($markRow != null) + { + $class = $markRow($datasetRaw); + } + } + + return $class; + } + /** * */ @@ -393,6 +424,17 @@ class FilterWidget extends Widget return self::$FilterWidgetInstance->_getCheckboxes(); } + /** + * + */ + public static function displayFilterName() + { + if (self::$FilterWidgetInstance->filterName != null && self::$FilterWidgetInstance->filterName != '') + { + echo '
'.self::$FilterWidgetInstance->filterName.'

'; + } + } + //------------------------------------------------------------------------------------------------------------------ // Protected @@ -419,6 +461,14 @@ class FilterWidget extends Widget return $this->formatRaw; } + /** + * + */ + protected function getMarkRow() + { + return $this->markRow; + } + /** * */ @@ -559,6 +609,11 @@ class FilterWidget extends Widget $filterSessionArray[self::COLUMNS_ALIASES] = array(); } + if (!isset($filterSessionArray[self::FILTER_NAME])) + { + $filterSessionArray[self::FILTER_NAME] = null; + } + $this->session->set_userdata(self::SESSION_NAME, $filterSessionArray); } @@ -574,10 +629,12 @@ class FilterWidget extends Widget $this->filterId = null; $this->additionalColumns = null; $this->formatRaw = null; + $this->markRow = null; $this->checkboxes = null; $this->hideHeader = false; $this->hideSave = false; $this->columnsAliases = null; + $this->filterName = null; if (!is_array($args) || (is_array($args) && count($args) == 0)) { @@ -638,6 +695,11 @@ class FilterWidget extends Widget $this->formatRaw = $args[self::FORMAT_RAW]; } + if (isset($args[self::MARK_ROW]) && is_callable($args[self::MARK_ROW])) + { + $this->markRow = $args[self::MARK_ROW]; + } + if (isset($args[self::CHECKBOXES]) && is_array($args[self::CHECKBOXES]) && count($args[self::CHECKBOXES]) > 0) @@ -723,6 +785,7 @@ class FilterWidget extends Widget $activeFilters = array(); $activeFiltersOperation = array(); $activeFiltersOption = array(); + $filterName = null; if (isset($jsonEncodedFilter->columns)) { @@ -756,12 +819,20 @@ class FilterWidget extends Widget } } + if (isset($jsonEncodedFilter->name)) + { + $filterName = $jsonEncodedFilter->name; + } + + $this->filterName = $filterName; + $filterSessionArray = array( self::SELECTED_FIELDS => $selectedFields, self::SELECTED_FILTERS => $selectedFilters, self::ACTIVE_FILTERS => $activeFilters, self::ACTIVE_FILTERS_OPERATION => $activeFiltersOperation, - self::ACTIVE_FILTERS_OPTION => $activeFiltersOption + self::ACTIVE_FILTERS_OPTION => $activeFiltersOption, + self::FILTER_NAME => $filterName ); $this->session->set_userdata(self::SESSION_NAME, $filterSessionArray); @@ -773,7 +844,8 @@ class FilterWidget extends Widget self::SELECTED_FILTERS => array(), self::ACTIVE_FILTERS => array(), self::ACTIVE_FILTERS_OPERATION => array(), - self::ACTIVE_FILTERS_OPTION => array() + self::ACTIVE_FILTERS_OPTION => array(), + self::FILTER_NAME => null ); $this->session->set_userdata(self::SESSION_NAME, $filterSessionArray); @@ -1038,6 +1110,7 @@ class FilterWidget extends Widget ); $filterSessionArray[self::FILTER_ID] = $this->filterId; + $filterSessionArray[self::FILTER_NAME] = $this->filterName; $this->session->set_userdata(self::SESSION_NAME, $filterSessionArray); } @@ -1130,9 +1203,11 @@ class FilterWidget extends Widget } break; case self::OP_CONTAINS: + $activeFilterValue = $this->FiltersModel->escapeLike($activeFilterValue); // escapes $condition = ' ILIKE \'%'.$activeFilterValue.'%\''; break; case self::OP_NOT_CONTAINS: + $activeFilterValue = $this->FiltersModel->escapeLike($activeFilterValue); // escapes $condition = ' NOT ILIKE \'%'.$activeFilterValue.'%\''; break; case self::OP_IS_TRUE: diff --git a/content/messages.xul.php b/content/messages.xul.php index 35e279c1d..bdd936d93 100644 --- a/content/messages.xul.php +++ b/content/messages.xul.php @@ -86,8 +86,6 @@ echo ']>