diff --git a/application/controllers/api/v1/system/Message.php b/application/controllers/api/v1/system/Message.php index 13a9834a9..e64badb33 100644 --- a/application/controllers/api/v1/system/Message.php +++ b/application/controllers/api/v1/system/Message.php @@ -118,8 +118,6 @@ class Message extends APIv1_Controller { $validation = $this->_validatePostMessageVorlage($this->post()); -// $this->response($this->post(), REST_Controller::HTTP_OK); - if (is_object($validation) && $validation->error == EXIT_SUCCESS) { $result = $this->messagelib->sendMessageVorlage( @@ -128,6 +126,7 @@ class Message extends APIv1_Controller $this->post()['vorlage_kurzbz'], $this->post()['oe_kurzbz'], $this->post()['data'], + $this->post()['sprache'], isset($this->post()['relationmessage_id']) ? $this->post()['relationmessage_id'] : null, isset($this->post()['orgform_kurzbz']) ? $this->post()['orgform_kurzbz'] : null ); @@ -214,6 +213,10 @@ class Message extends APIv1_Controller { return $this->_error('data is not set'); } + if (!isset($message['sprache'])) + { + return $this->_error('sprache is not set'); + } return $this->_success('Input data are valid'); } diff --git a/application/libraries/MessageLib.php b/application/libraries/MessageLib.php index 0c2af771b..fc43c72c8 100644 --- a/application/libraries/MessageLib.php +++ b/application/libraries/MessageLib.php @@ -268,12 +268,12 @@ class MessageLib * @param integer $priority * @return array */ - function sendMessageVorlage($sender_id, $receiver_id, $vorlage_kurzbz, $oe_kurzbz, $data, $relationmessage_id = null, $orgform_kurzbz = null) + function sendMessageVorlage($sender_id, $receiver_id, $vorlage_kurzbz, $oe_kurzbz, $data, $sprache, $relationmessage_id = null, $orgform_kurzbz = null) { if (!is_numeric($sender_id) || !is_numeric($receiver_id)) return $this->_invalid_id(MSG_ERR_INVALID_MSG_ID); - $result = $this->ci->vorlagelib->loadVorlagetext($vorlage_kurzbz, $oe_kurzbz, $orgform_kurzbz); + $result = $this->ci->vorlagelib->loadVorlagetext($vorlage_kurzbz, $oe_kurzbz, $orgform_kurzbz, $sprache); if (is_object($result) && $result->error == EXIT_SUCCESS) { if (is_array($result->retval) && count($result->retval) > 0 && diff --git a/application/libraries/VorlageLib.php b/application/libraries/VorlageLib.php index befcf0ca1..531d1ffd0 100644 --- a/application/libraries/VorlageLib.php +++ b/application/libraries/VorlageLib.php @@ -88,12 +88,13 @@ class VorlageLib /** * loadVorlagetext() - will load the best fitting Template. * - * @param string $vorlage_kurzbz REQUIRED - * @param string $oe_kurzbz OPTIONAL - * @param string $orgform_kurzbz OPTIONAL + * @param string $vorlage_kurzbz REQUIRED + * @param string $oe_kurzbz OPTIONAL + * @param string $orgform_kurzbz OPTIONAL + * @param string $sprache OPTIONAL * @return array */ - function loadVorlagetext($vorlage_kurzbz, $oe_kurzbz=null, $orgform_kurzbz=null) + function loadVorlagetext($vorlage_kurzbz, $oe_kurzbz = null, $orgform_kurzbz = null, $sprache = null) { if (empty($vorlage_kurzbz)) return $this->_error($this->ci->lang->line('fhc_'.FHC_INVALIDID, false)); @@ -101,7 +102,8 @@ class VorlageLib $vorlage = $this->ci->VorlageStudiengangModel->loadWhere(array( 'vorlage_kurzbz' => $vorlage_kurzbz, 'oe_kurzbz' => $oe_kurzbz, - 'orgform_kurzbz' => $orgform_kurzbz) + 'orgform_kurzbz' => $orgform_kurzbz, + 'sprache' => $sprache) ); return $vorlage; }