diff --git a/application/controllers/system/infocenter/InfoCenter.php b/application/controllers/system/infocenter/InfoCenter.php index 92932b8ea..03d98dd14 100644 --- a/application/controllers/system/infocenter/InfoCenter.php +++ b/application/controllers/system/infocenter/InfoCenter.php @@ -69,6 +69,7 @@ class InfoCenter extends VileSci_Controller // Loads libraries $this->load->library('DmsLib'); $this->load->library('PersonLogLib'); + $this->load->library('MailLib'); $this->load->library('WidgetLib'); $this->_setAuthUID(); // sets property uid @@ -313,7 +314,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( @@ -542,11 +543,23 @@ class InfoCenter extends VileSci_Controller */ private function _loadPersonData($person_id) { - $lockedby = $this->PersonLockModel->checkIfLocked($person_id); + $locked = $this->PersonLockModel->checkIfLocked($person_id, self::APP); - if (isError($lockedby)) + if (isError($locked)) { - show_error($lockedby->retval); + 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); @@ -599,7 +612,8 @@ class InfoCenter extends VileSci_Controller $messagelink = base_url('/index.ci.php/system/Messages/write/'.$user_person->retval[0]->person_id); $data = array ( - 'lockedby' => isset($lockedby->retval[0]->uid) ? $lockedby->retval[0]->uid : null, + 'lockedby' => $lockedby, + 'lockedbyother' => $lockedbyother, 'stammdaten' => $stammdaten->retval, 'dokumente' => $dokumente->retval, 'dokumente_nachgereicht' => $dokumente_nachgereicht->retval, @@ -741,4 +755,9 @@ class InfoCenter extends VileSci_Controller $this->uid ); } +/* + private function _sendFreigabeMail() + { + $this->maillib->send('alex@alex-ThinkCentre-M900', 'karpen_ko@hotmail.com', 'test', 'test'); + }*/ } diff --git a/application/models/system/PersonLock_model.php b/application/models/system/PersonLock_model.php index 1a3edd917..1d106b789 100644 --- a/application/models/system/PersonLock_model.php +++ b/application/models/system/PersonLock_model.php @@ -17,31 +17,29 @@ class PersonLock_model extends DB_Model } /** - * checks if a specific person is locked. By default, looks for any entries in locktable for the person. - * Alternatively, looks only for locks in a certain app + * 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 = $app === null ? array('person_id' => $person_id) : array('person_id' => $person_id, 'app' => $app); + $lockdata = array('person_id' => $person_id, 'app' => $app); $result = $this->loadWhere($lockdata); - if($result->error) + if ($result->error) return error($result->retval); + + if (count($result->retval) > 0) + return success($result->retval); else - { - if(count($result->retval) > 0) - return success($result->retval); - else - return success(null); - } + return success(null); } /** - * locks a person. returns null if person was not locked (e.g. when already locked) + * 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 @@ -51,19 +49,19 @@ class PersonLock_model extends DB_Model { $locked = $this->checkIfLocked($person_id, $app); - if($locked->error) + if ($locked->error) return error($locked->retval); //insert only if not already locked - if($locked->retval === null) + 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 + * 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 @@ -79,7 +77,7 @@ class PersonLock_model extends DB_Model foreach ($locks->retval as $lock) { $result = $this->delete($lock->lock_id); - if($result->error) + if ($result->error) return error($result->retval); $deleted[] = $lock; diff --git a/application/views/system/infocenter/infocenterDetails.php b/application/views/system/infocenter/infocenterDetails.php index 0db3a7cdb..6b672cd87 100644 --- a/application/views/system/infocenter/infocenterDetails.php +++ b/application/views/system/infocenter/infocenterDetails.php @@ -36,7 +36,7 @@ ?>
-
+