mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 18:02:18 +00:00
added "zgv uebernehmen" for prefill of zgv with latest edited zgv, optimized sort of zgvs
This commit is contained in:
@@ -239,4 +239,27 @@ class Prestudent_model extends DB_Model
|
||||
return success($prestudent->retval);
|
||||
}
|
||||
|
||||
/**
|
||||
* gets the prestudent edited last.
|
||||
* if no updateamum, sort by insertamum
|
||||
* @param $person_id
|
||||
* @param bool $withzgv if true, only prestudenten with zgv_code are taken
|
||||
* @return array|null
|
||||
*/
|
||||
public function getLastPrestudent($person_id, $withzgv = false)
|
||||
{
|
||||
$qry = 'SELECT * FROM public.tbl_prestudent
|
||||
WHERE person_id = ?
|
||||
%s
|
||||
ORDER BY updateamum DESC NULLS LAST, insertamum DESC NULLS LAST
|
||||
LIMIT 1';
|
||||
|
||||
$zgvwhere = $withzgv === true ? 'AND zgv_code IS NOT NULL' : '';
|
||||
|
||||
$qry = sprintf($qry, $zgvwhere);
|
||||
|
||||
$parametersArray = array($person_id);
|
||||
|
||||
return $this->execQuery($qry, $parametersArray);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user