mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-25 16:44:28 +00:00
fixes a lot of bugs and adds the inseramum/insertvon/updateamum/updatevon fields to the cis_profil_update db table
This commit is contained in:
@@ -17,11 +17,30 @@ class Profil_change_model extends DB_Model
|
||||
/**
|
||||
* getTimestamp
|
||||
* returns insert or update timestamp of a certain profil update
|
||||
*
|
||||
* @param boolean $update: conditional whether to return insertamum or updateamum
|
||||
*/
|
||||
public function getTimestamp($uid){
|
||||
$this->addSelect(['change_timestamp']);
|
||||
$res = $this->load([$uid]);
|
||||
return hasData($res) ? getData($res)[0]->change_timestamp : null;
|
||||
public function getTimestamp($id, $update=false){
|
||||
$selectStatement = $update? 'updateamum' : 'insertamum';
|
||||
$this->addSelect([$selectStatement]);
|
||||
$res = $this->load([$id]);
|
||||
return hasData($res) ? getData($res)[0]->$selectStatement : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* getFilesFromChangeRequest
|
||||
*
|
||||
* returns all files associated to a profil update request in the following format:
|
||||
* {dms_id:123 , name:"test"}
|
||||
*
|
||||
* @param boolean $profil_update_id primary key of the profil update request
|
||||
* @return Array
|
||||
*/
|
||||
public function getFilesFromChangeRequest($profil_update_id){
|
||||
$this->addSelect(["requested_change"]);
|
||||
$res = $this->load([$profil_update_id]);
|
||||
$res = hasData($res) ? getData($res)[0] : null;
|
||||
return json_decode($res->requested_change)->files?:null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,7 +55,6 @@ class Profil_change_model extends DB_Model
|
||||
if(!is_null($uid)){
|
||||
$whereClause['uid']=$uid;
|
||||
}
|
||||
//?
|
||||
if(!is_null($id)){
|
||||
$whereClause['profil_update_id']=$id;
|
||||
}
|
||||
@@ -49,7 +67,7 @@ class Profil_change_model extends DB_Model
|
||||
|
||||
foreach($res->retval as $update){
|
||||
$update->requested_change = json_decode($update->requested_change);
|
||||
$update->change_timestamp = !is_null($update->change_timestamp)?date_create($update->change_timestamp)->format('d.m.Y'):null;
|
||||
$update->insertamum = !is_null($update->insertamum)?date_create($update->insertamum)->format('d.m.Y'):null;
|
||||
$update->status_timestamp = !is_null($update->status_timestamp)?date_create($update->status_timestamp)->format('d.m.Y'):null;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user