mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
mark header red if locked by other person, locking is possible either generally (app null) or only for certain apps.
This commit is contained in:
@@ -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');
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
?>
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="row<?php if($lockedbyother) echo ' alert-danger' ?>">
|
||||
<div class="col-lg-8">
|
||||
<h3 class="page-header">
|
||||
Infocenter Details: <?php echo $stammdaten->vorname.' '.$stammdaten->nachname ?>
|
||||
|
||||
Reference in New Issue
Block a user