From 8eeb0d9ca7ca0c1bbb3839f696bddc1df71130e8 Mon Sep 17 00:00:00 2001 From: Harald Bamberger Date: Tue, 1 Aug 2023 14:37:07 +0200 Subject: [PATCH] gehaltsbestandteillib set uid to pgsql --- .../vertragsbestandteil/GehaltsbestandteilLib.php | 13 +++++++++++++ .../vertragsbestandteil/VertragsbestandteilLib.php | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/application/libraries/vertragsbestandteil/GehaltsbestandteilLib.php b/application/libraries/vertragsbestandteil/GehaltsbestandteilLib.php index 74dc35672..27ca95107 100644 --- a/application/libraries/vertragsbestandteil/GehaltsbestandteilLib.php +++ b/application/libraries/vertragsbestandteil/GehaltsbestandteilLib.php @@ -49,6 +49,7 @@ class GehaltsbestandteilLib { try { + $this->setUIDtoPGSQL(); if( intval($gehaltsbestandteil->getGehaltsbestandteil_id()) > 0 ) { $this->updateGehaltsbestandteil($gehaltsbestandteil); @@ -109,6 +110,7 @@ class GehaltsbestandteilLib public function deleteGehaltsbestandteil(Gehaltsbestandteil $gehaltsbestandteil) { + $this->setUIDtoPGSQL(); $ret = $this->GehaltsbestandteilModel->delete($gehaltsbestandteil->getGehaltsbestandteil_id()); if (isError($ret)) @@ -119,6 +121,7 @@ class GehaltsbestandteilLib public function endGehaltsbestandteil(Gehaltsbestandteil $gehaltsbestandteil, $enddate) { + $this->setUIDtoPGSQL(); if( $gehaltsbestandteil->getBis() !== null && $gehaltsbestandteil->getBis() < $enddate ) { return; @@ -136,4 +139,14 @@ class GehaltsbestandteilLib throw new Exception('error ending gehaltsbestandteil'); } } + + protected function setUIDtoPGSQL() { + $ret = $this->GehaltsbestandteilModel + ->execReadOnlyQuery('SET LOCAL pv21.uid TO \'' + . $this->loggedInUser . '\''); + if(isError($ret)) + { + throw new Exception('error setting uid to pgsql'); + } + } } diff --git a/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php b/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php index eb335d767..053453025 100644 --- a/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php +++ b/application/libraries/vertragsbestandteil/VertragsbestandteilLib.php @@ -456,8 +456,9 @@ class VertragsbestandteilLib } protected function setUIDtoPGSQL() { - $uid = getAuthUID(); - $ret = $this->VertragsbestandteilModel->execReadOnlyQuery('SET LOCAL pv21.uid TO \'' . $uid . '\''); + $ret = $this->VertragsbestandteilModel + ->execReadOnlyQuery('SET LOCAL pv21.uid TO \'' + . $this->loggedInUser . '\''); if(isError($ret)) { throw new Exception('error setting uid to pgsql');