mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
refactor creation of benutzerfunktiondata, add check for already used benutzerfunktionen in another vb
This commit is contained in:
@@ -15,4 +15,21 @@ class VertragsbestandteilFunktion_model extends DB_Model
|
||||
$this->dbTable = 'hr.tbl_vertragsbestandteil_funktion';
|
||||
$this->pk = 'vertragsbestandteil_id';
|
||||
}
|
||||
|
||||
public function isBenutzerfunktionAlreadyAttachedToAnotherVB($benutzerfunktion_id, $vertragsbestandteil_id)
|
||||
{
|
||||
$where = array('benutzerfunktion_id' => $benutzerfunktion_id);
|
||||
if( intval($vertragsbestandteil_id) > 0 )
|
||||
{
|
||||
$where['vertragsbestandteil_id != '] = $vertragsbestandteil_id;
|
||||
}
|
||||
$this->addSelect('count(*) AS vbscount');
|
||||
$res = $this->loadWhere($where);
|
||||
if(isError($res))
|
||||
{
|
||||
throw new Exception('failed to check if benutzerfunktionid is already attached to another vertragsbestanteil');
|
||||
}
|
||||
$count = (getData($res))[0]->vbscount;
|
||||
return $count > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,9 @@ class Vertragsbestandteil_model extends DB_Model
|
||||
$sql = <<<EOSQL
|
||||
SELECT
|
||||
v.*,
|
||||
bf.funktion_kurzbz, funktion.beschreibung funktion_bezeichnung,
|
||||
oe.oe_kurzbz, oe.bezeichnung oe_bezeichnung, sap.oe_kurzbz_sap,
|
||||
bf.funktion_kurzbz, bf.uid AS mitarbeiter_uid,
|
||||
funktion.beschreibung AS funktion_bezeichnung,
|
||||
oe.oe_kurzbz, oe.bezeichnung AS oe_bezeichnung, sap.oe_kurzbz_sap,
|
||||
oet.organisationseinheittyp_kurzbz AS oe_typ_kurzbz, oet.bezeichnung AS oe_typ_bezeichnung,
|
||||
ft.freitexttyp_kurzbz, ft.titel, ft.anmerkung,
|
||||
f.benutzerfunktion_id,
|
||||
|
||||
Reference in New Issue
Block a user