From ab59c265d46a2373f6a54abd62924b2ae9b5195c Mon Sep 17 00:00:00 2001 From: Paolo Date: Mon, 4 Oct 2021 14:05:10 +0200 Subject: [PATCH 001/873] First commit --- include/Docsbox.php | 112 ++++++++++++++++++++++++++++++ include/dokument_export.class.php | 71 +++++++++---------- 2 files changed, 148 insertions(+), 35 deletions(-) create mode 100644 include/Docsbox.php diff --git a/include/Docsbox.php b/include/Docsbox.php new file mode 100644 index 000000000..08b04f71b --- /dev/null +++ b/include/Docsbox.php @@ -0,0 +1,112 @@ +attach(array('file' => $inputFileName)) + ->expectsJson() + ->send(); + + var_dump($response);exit; + } + catch(\Httpful\Exception\ConnectionErrorException $cee) + { + // Error + } + catch (Exception $e) + { + // Error + } + + if (is_object($response) && isset($response->id) && isset($response->status)) + { + $status = null; + $result_url = null; + + while ($status == null) + { + try + { + $response = \Httpful\Request::get('http://docconverter.technikum-wien.at/api/v1/'.$response->id) + ->expectsJson() + ->send(); + + var_dump($response); + } + catch(\Httpful\Exception\ConnectionErrorException $cee) + { + // Error + } + catch (Exception $e) + { + // Error + } + + if (is_object($response) && isset($response->id) && isset($response->status)) + { + if ($response->status == 'finished' && isset($response->result_url)) + { + $status = $response->status; + $result_url = $response->result_url; + } + else + { + // Error + } + } + else + { + // Error + } + } + + try + { + $response = \Httpful\Request::get($result_url)->send(); + + var_dump($response); + } + catch(\Httpful\Exception\ConnectionErrorException $cee) + { + // Error + } + catch (Exception $e) + { + // Error + } + + var_dump($response);exit; + } + else + { + // Error + } + } +} + diff --git a/include/dokument_export.class.php b/include/dokument_export.class.php index 4f23a7dcd..30af55ac6 100644 --- a/include/dokument_export.class.php +++ b/include/dokument_export.class.php @@ -37,7 +37,6 @@ class dokument_export private $images=array(); private $sourceDir; public $errormsg; - private $unoconv_version; private $sign; private $sign_user; private $sign_profile; @@ -50,18 +49,6 @@ class dokument_export if(!isset($vorlage)) return; - exec('unoconv --version',$ret_arr); - if(isset($ret_arr[0])) - { - $hlp = explode(' ',$ret_arr[0]); - if(isset($hlp[1])) - $this->unoconv_version = $hlp[1]; - else - die('Could not get Unoconv Version'); - } - else - die('Unoconv not found'); - //Vorlage aus der Datenbank holen $this->vorlage = new vorlage(); if(!$this->vorlage->getAktuelleVorlage($oe_kurzbz, $vorlage, $version)) @@ -281,20 +268,27 @@ class dokument_export // Unoconv Version 0.6 hat eine Bug wodurch die Berechtigungen des PDF/Doc nicht korrekt gesetzt // werden. Deshalb wird dies hier speziell behandelt. // Die 2. Variante hat den Vorteil dass hier eine bessere Fehlerbehandlung moeglich ist - if($this->unoconv_version=='0.6') - $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' %2$s > %1$s'; - else - $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' --output %s %s 2>&1'; + //if($this->unoconv_version=='0.6') + // $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' %2$s > %1$s'; + //else + // $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' --output %s %s 2>&1'; - $command = sprintf($command, $this->temp_filename, $tempname_zip); + //$command = sprintf($command, $this->temp_filename, $tempname_zip); - exec($command, $out, $ret); + //exec($command, $out, $ret); - if($ret!=0) - { - $this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator'; - return false; - } + require_once('Docsbox.php'); + + var_dump($tempname_zip); + var_dump($this->temp_filename); + + Docsbox::convert($tempname_zip, $this->temp_filename); + + //if($ret!=0) + //{ + // $this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator'; + // return false; + //} break; case 'odt': default: @@ -455,19 +449,26 @@ class dokument_export */ public function convert($inFile, $outFile, $format = "pdf") { - if($this->unoconv_version=='0.6') - $command = 'unoconv -f %1$s %3$s > %2$s'; - else - $command = 'unoconv -f %s --output %s %s 2>&1'; - $command = sprintf($command, $format, $outFile, $inFile); + //require_once('Docsbox.php'); - exec($command, $out, $ret); + //var_dump($inFile); + //var_dump($outFile); - if($ret!=0) - { - $this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator'; - return false; - } + //Docsbox::convert(); + + //if($this->unoconv_version=='0.6') + // $command = 'unoconv -f %1$s %3$s > %2$s'; + //else + // $command = 'unoconv -f %s --output %s %s 2>&1'; + //$command = sprintf($command, $format, $outFile, $inFile); + + //exec($command, $out, $ret); + + //if($ret!=0) + //{ + // $this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator'; + // return false; + //} return true; } From 2fb4be0e5548b662085b56a4eedbfc0d5622d153 Mon Sep 17 00:00:00 2001 From: Paolo Date: Thu, 14 Oct 2021 11:34:27 +0200 Subject: [PATCH 002/873] - Added new config entry DOCSBOX_ENABLED to config/global.config-default.inc.php - Added new library application/libraries/DocsboxLib.php to manage document conversion using docsbox - Added new config file application/config/docsbox.php - Integrated DocsboxLib into include/dokument_export.class.php --- application/config/docsbox.php | 7 + application/libraries/DocsboxLib.php | 297 +++++++++++++++++++++++++++ config/global.config-default.inc.php | 3 + include/Docsbox.php | 112 ---------- include/dokument_export.class.php | 101 +++++---- 5 files changed, 372 insertions(+), 148 deletions(-) create mode 100644 application/config/docsbox.php create mode 100644 application/libraries/DocsboxLib.php delete mode 100644 include/Docsbox.php diff --git a/application/config/docsbox.php b/application/config/docsbox.php new file mode 100644 index 000000000..ca64698f9 --- /dev/null +++ b/application/config/docsbox.php @@ -0,0 +1,7 @@ +attach(array('file' => $inputFileName)) + ->expectsJson() + ->send(); + + // Checks that: + // - the response is not empty + // - the reponse body has the property id + // - the property id is a valid string + // - the reponse body has the property status + // - docsbox queued the conversion of the posted file + if (is_object($postFileResponse) + && isset($postFileResponse->body) + && isset($postFileResponse->body->id) + && $postFileResponse->body->id != '' && $postFileResponse->body->id != null + && isset($postFileResponse->body->status) + && $postFileResponse->body->status == self::STATUS_QUEUED) + { + $queueId = $postFileResponse->body->id; + } + else + { + // If docsbox refused to convert the posted file + if (isset($postFileResponse->body->status) + && $postFileResponse->body->status != self::STATUS_QUEUED) + { + error_log( + 'Docsbox did not queue the posted file. Returned status: '. + $postFileResponse->body->status + ); + } + else // any other generic error + { + error_log( + 'An error occurred while posting to docsbox. Response: '. + print_r($postFileResponse, 1) + ); + } + } + } + catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception + { + error_log($cee->getMessage()); + } + catch (Exception $e) // any other exception + { + error_log($e->getMessage()); + } + + return $queueId; + } + + /** + * Check the status of the file convertion identified by the given queue element id + * A URL is returned with the path where it is possible to download the converted file + * If an error occurred then a null value is returned + */ + private static function _checkConvertion($queueId) + { + $resultUrl = null; + $startConvertionsTime = time(); // time when the file conversion has started + + // Until a timeout has occurred + while (time() - $startConvertionsTime <= DOCSBOX_CONVERSION_TIMEOUT) + { + sleep(DOCSBOX_WAITING_SLEEP_TIME); // takes a nap on every round + + try + { + // Calls the docsbox server to check the status of the + // file conversion using the provided queue id + // it expects a response in JSON format + $getStatusResponse = \Httpful\Request::get(DOCSBOX_SERVER.DOCSBOX_PATH_API.$queueId) + ->expectsJson() + ->send(); + + // Checks that: + // - the response is not empty + // - the reponse body has the property id + // - the property id is a valid string + // - the reponse body has the property status + // - docsbox is working the conversion of the posted file + if (is_object($getStatusResponse) + && isset($getStatusResponse->body->id) + && $getStatusResponse->body->id != '' && $getStatusResponse->body->id != null + && isset($getStatusResponse->body->status)) + { + // Checks that docsbox has finished working on the file conversion + // and that there is a valid resultUrl property + if ($getStatusResponse->body->status == self::STATUS_FINISHED + && isset($getStatusResponse->body->result_url) + && $getStatusResponse->body->result_url != '' + && $getStatusResponse->body->result_url != null) + { + $resultUrl = $getStatusResponse->body->result_url; + break; + } + // Just started or still working on it + elseif ($getStatusResponse->body->status == self::STATUS_WORKING + || $getStatusResponse->body->status == self::STATUS_STARTED) + { + // go on! + } + else // any other status is abnormal + { + error_log( + 'Not valid status for queue element: '.$queueId.'. Response: '. + print_r($getStatusResponse, 1) + ); + break; // interrupt the loop on error + } + } + else // if the response from the docsbox server is not valid + { + error_log( + 'An error occurred while checking the docsbox activity. Response: '. + print_r($getStatusResponse, 1) + ); + break; // interrupt the loop on error + } + } + catch(\Httpful\Exception\ConnectionErrorException $cee) // Httpful exception + { + error_log($cee->getMessage()); + break; // interrupt the loop on error + } + catch (Exception $e) // any other exception + { + error_log($e->getMessage()); + break; // interrupt the loop on error + } + } + + return $resultUrl; + } + + /** + * Download the converted file using the provided URL, unzip it, and renames it into the provided file name + */ + private static function _downloadFile($resultUrl, $outputFileName) + { + $downloaded = false; // pessimistic assumption + + try + { + // Download the file + $getFileResponse = \Httpful\Request::get(DOCSBOX_SERVER.$resultUrl)->send(); + + // If the downloaded file content is valid and not empty + if (isset($getFileResponse->body) + && $getFileResponse->body != null + && $getFileResponse->body != '') + { + // Output directory where to unzip the downloaded zip file + $outputDirectory = dirname($outputFileName); + // The path and name of the downloaded zip file + $temporaryDownloadedZip = sys_get_temp_dir().'/'.basename($resultUrl); + + // Write the file content into a temporary directory and file + if (file_put_contents($temporaryDownloadedZip, $getFileResponse->body) != false) + { + $zipArchive = new ZipArchive; + + // Open and extract the dowloaded zip file into the directory of the output file + if ($zipArchive->open($temporaryDownloadedZip) === true + && $zipArchive->extractTo($outputDirectory) === true + && $zipArchive->close() === true) + { + // Opened, extracted and closed! + + // Rename the extracted file to the given output file name + if (rename($outputDirectory.'/'.self::OUTPUT_FILENAME, $outputFileName)) + { + $downloaded = true; + } + else + { + error_log( + 'An error occurred while renaming the extracted file: '. + $outputDirectory.'/'.self::OUTPUT_FILENAME.' into: '. + $outputFileName + ); + } + } + else + { + error_log( + 'An error occurred while working the dowloaded zip file: '. + $temporaryDownloadedZip + ); + } + } + else // if an error occurred while writing + { + error_log( + 'An error occurred while writing the file content to: '. + $temporaryDownloadedZip + ); + } + } + else // if the downloaded file is not valid + { + error_log( + 'An error occurred while downloading the file from the docsbox server: '. + print_r($getFileResponse, 1) + ); + } + } + catch(\Httpful\Exception\ConnectionErrorException $cee) + { + error_log($cee->getMessage()); + } + catch (Exception $e) + { + error_log($e->getMessage()); + } + + return $downloaded; + } +} + diff --git a/config/global.config-default.inc.php b/config/global.config-default.inc.php index b31447994..f4909ba5c 100644 --- a/config/global.config-default.inc.php +++ b/config/global.config-default.inc.php @@ -310,4 +310,7 @@ define ('ZAHLUNGSBESTAETIGUNG_ANZEIGEN_FUER_LEHRGAENGE', true); // Gibt an, ob im CIS die Zahlungsreferenz angezeigt wird define ('ZAHLUNGSBESTAETIGUNG_ZAHLUNGSREFERENZ_ANZEIGEN', false); + +define('DOCSBOX_ENABLED', false); + ?> diff --git a/include/Docsbox.php b/include/Docsbox.php deleted file mode 100644 index 08b04f71b..000000000 --- a/include/Docsbox.php +++ /dev/null @@ -1,112 +0,0 @@ -attach(array('file' => $inputFileName)) - ->expectsJson() - ->send(); - - var_dump($response);exit; - } - catch(\Httpful\Exception\ConnectionErrorException $cee) - { - // Error - } - catch (Exception $e) - { - // Error - } - - if (is_object($response) && isset($response->id) && isset($response->status)) - { - $status = null; - $result_url = null; - - while ($status == null) - { - try - { - $response = \Httpful\Request::get('http://docconverter.technikum-wien.at/api/v1/'.$response->id) - ->expectsJson() - ->send(); - - var_dump($response); - } - catch(\Httpful\Exception\ConnectionErrorException $cee) - { - // Error - } - catch (Exception $e) - { - // Error - } - - if (is_object($response) && isset($response->id) && isset($response->status)) - { - if ($response->status == 'finished' && isset($response->result_url)) - { - $status = $response->status; - $result_url = $response->result_url; - } - else - { - // Error - } - } - else - { - // Error - } - } - - try - { - $response = \Httpful\Request::get($result_url)->send(); - - var_dump($response); - } - catch(\Httpful\Exception\ConnectionErrorException $cee) - { - // Error - } - catch (Exception $e) - { - // Error - } - - var_dump($response);exit; - } - else - { - // Error - } - } -} - diff --git a/include/dokument_export.class.php b/include/dokument_export.class.php index 30af55ac6..c6c609ce9 100644 --- a/include/dokument_export.class.php +++ b/include/dokument_export.class.php @@ -37,6 +37,7 @@ class dokument_export private $images=array(); private $sourceDir; public $errormsg; + private $unoconv_version; private $sign; private $sign_user; private $sign_profile; @@ -49,6 +50,25 @@ class dokument_export if(!isset($vorlage)) return; + if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) + { + // Use docsbox!! + } + else + { + exec('unoconv --version',$ret_arr); + if(isset($ret_arr[0])) + { + $hlp = explode(' ',$ret_arr[0]); + if(isset($hlp[1])) + $this->unoconv_version = $hlp[1]; + else + die('Could not get Unoconv Version'); + } + else + die('Unoconv not found'); + } + //Vorlage aus der Datenbank holen $this->vorlage = new vorlage(); if(!$this->vorlage->getAktuelleVorlage($oe_kurzbz, $vorlage, $version)) @@ -263,32 +283,36 @@ class dokument_export { case 'pdf': case 'doc': + $ret = 0; $this->temp_filename = $this->temp_folder . '/out.' . $this->outputformat; - // Unoconv Version 0.6 hat eine Bug wodurch die Berechtigungen des PDF/Doc nicht korrekt gesetzt - // werden. Deshalb wird dies hier speziell behandelt. - // Die 2. Variante hat den Vorteil dass hier eine bessere Fehlerbehandlung moeglich ist - //if($this->unoconv_version=='0.6') - // $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' %2$s > %1$s'; - //else - // $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' --output %s %s 2>&1'; + // If it is set to use docsbox + if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) + { + require_once(dirname(__FILE__).'/../application/libraries/DocsboxLib.php'); - //$command = sprintf($command, $this->temp_filename, $tempname_zip); + $ret = DocsboxLib::convert($tempname_zip, $this->temp_filename); + } + else // otherwise use unoconv + { + // Unoconv Version 0.6 hat eine Bug wodurch die Berechtigungen des PDF/Doc nicht korrekt gesetzt + // werden. Deshalb wird dies hier speziell behandelt. + // Die 2. Variante hat den Vorteil dass hier eine bessere Fehlerbehandlung moeglich ist + if ($this->unoconv_version == '0.6') + $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' %2$s > %1$s'; + else + $command = 'unoconv -e IsSkipEmptyPages=false -f ' . $this->outputformat . ' --output %s %s 2>&1'; - //exec($command, $out, $ret); + $command = sprintf($command, $this->temp_filename, $tempname_zip); - require_once('Docsbox.php'); + exec($command, $out, $ret); + } - var_dump($tempname_zip); - var_dump($this->temp_filename); - - Docsbox::convert($tempname_zip, $this->temp_filename); - - //if($ret!=0) - //{ - // $this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator'; - // return false; - //} + if ($ret != 0) + { + $this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator'; + return false; + } break; case 'odt': default: @@ -449,26 +473,31 @@ class dokument_export */ public function convert($inFile, $outFile, $format = "pdf") { - //require_once('Docsbox.php'); + $ret = 0; - //var_dump($inFile); - //var_dump($outFile); + // If it is set to use DOCSBOX + if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) + { + require_once(dirname(__FILE__).'/../application/libraries/DocsboxLib.php'); - //Docsbox::convert(); + $ret = DocsboxLib::convert($inFile, $outFile); + } + else // fallback to unoconv + { + if($this->unoconv_version=='0.6') + $command = 'unoconv -f %1$s %3$s > %2$s'; + else + $command = 'unoconv -f %s --output %s %s 2>&1'; + $command = sprintf($command, $format, $outFile, $inFile); - //if($this->unoconv_version=='0.6') - // $command = 'unoconv -f %1$s %3$s > %2$s'; - //else - // $command = 'unoconv -f %s --output %s %s 2>&1'; - //$command = sprintf($command, $format, $outFile, $inFile); + exec($command, $out, $ret); + } - //exec($command, $out, $ret); - - //if($ret!=0) - //{ - // $this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator'; - // return false; - //} + if ($ret != 0) + { + $this->errormsg = 'Dokumentenkonvertierung ist derzeit nicht möglich. Bitte versuchen Sie es in einer Minute erneut oder kontaktieren Sie einen Administrator'; + return false; + } return true; } From 6f14b5cec599f881a75d35c85ce9c6079c24009d Mon Sep 17 00:00:00 2001 From: Paolo Date: Thu, 14 Oct 2021 14:25:35 +0200 Subject: [PATCH 003/873] - Changed DocsboxLib->convert, not it accepts a new optional parameter called format - Integrated the DocsboxLib into the application/libraries/DocumentLib.php --- application/libraries/DocsboxLib.php | 3 +- application/libraries/DocumentLib.php | 66 +++++++++++++++++++-------- 2 files changed, 48 insertions(+), 21 deletions(-) diff --git a/application/libraries/DocsboxLib.php b/application/libraries/DocsboxLib.php index 2b0715513..ce43f1bc5 100644 --- a/application/libraries/DocsboxLib.php +++ b/application/libraries/DocsboxLib.php @@ -39,8 +39,9 @@ class DocsboxLib /** * Static method used to convert a document using a Docsbox installation (local/remote) over the network * It return 0 on success and any other integer on error + * NOTE: currently format is not supported */ - public static function convert($inputFileName, $outputFileName) + public static function convert($inputFileName, $outputFileName, $format = 'pdf') { // Posts the file to docsbox $queueId = self::_postFile($inputFileName); diff --git a/application/libraries/DocumentLib.php b/application/libraries/DocumentLib.php index 98e546b4e..d78a9c0df 100644 --- a/application/libraries/DocumentLib.php +++ b/application/libraries/DocumentLib.php @@ -14,20 +14,27 @@ class DocumentLib // Gets CI instance $this->ci =& get_instance(); - exec('unoconv --version', $ret_arr); - - if(isset($ret_arr[0])) + if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) { - $hlp = explode(' ', $ret_arr[0]); - if(isset($hlp[1])) - { - $this->unoconv_version = $hlp[1]; - } - else - show_error('Could not get Unoconv Version'); + // Use docsbox!! } else - show_error('Unoconv not found - Please install Unoconv'); + { + exec('unoconv --version', $ret_arr); + + if(isset($ret_arr[0])) + { + $hlp = explode(' ', $ret_arr[0]); + if(isset($hlp[1])) + { + $this->unoconv_version = $hlp[1]; + } + else + show_error('Could not get Unoconv Version'); + } + else + show_error('Unoconv not found - Please install Unoconv'); + } } /** @@ -57,9 +64,16 @@ class DocumentLib case 'application/vnd.ms-word': case 'application/vnd.oasis.opendocument.text': case 'text/plain': - // Unoconv Version 0.6 seems to fail on converting TXT Files - if ($this->unoconv_version == '0.6') - return error(); + if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) + { + // Use docsbox + } + else + { + // Unoconv Version 0.6 seems to fail on converting TXT Files + if ($this->unoconv_version == '0.6') + return error(); + } $ret = $this->convert($filename, $outFile, 'pdf'); if(isSuccess($ret)) @@ -123,13 +137,25 @@ class DocumentLib */ public function convert($inFile, $outFile, $format) { - if ($this->unoconv_version == '0.6') - $command = 'unoconv -f %1$s %3$s > %2$s'; - else - $command = 'unoconv -f %s --output %s %s 2>&1'; - $command = sprintf($command, $format, $outFile, $inFile); + $ret = 0; - exec($command, $out, $ret); + // If it is set to use docsbox + if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) + { + require_once(dirname(__FILE__).'/../application/libraries/DocsboxLib.php'); + + $ret = DocsboxLib::convert($inFile, $outFile, $format); + } + else // otherwise use unoconv + { + if ($this->unoconv_version == '0.6') + $command = 'unoconv -f %1$s %3$s > %2$s'; + else + $command = 'unoconv -f %s --output %s %s 2>&1'; + $command = sprintf($command, $format, $outFile, $inFile); + + exec($command, $out, $ret); + } if ($ret != 0) { From 297172113d7cb10d4b0cc3db36f3af34a301f3cd Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 10 Feb 2022 11:04:31 +0100 Subject: [PATCH 004/873] =?UTF-8?q?neue=20Funktion=20getAll()=20f=C3=BCr?= =?UTF-8?q?=20Anzeige=20Entwicklungsteams?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/entwicklungsteam.class.php | 46 ++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/include/entwicklungsteam.class.php b/include/entwicklungsteam.class.php index a811e8ba3..e6603f95b 100644 --- a/include/entwicklungsteam.class.php +++ b/include/entwicklungsteam.class.php @@ -16,8 +16,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. * * Authors: Christian Paminger , - * Andreas Oesterreicher and - * Rudolf Hangl . + * Andreas Oesterreicher , + * Rudolf Hangl + * Manuela Thamer */ require_once(dirname(__FILE__).'/basis_db.class.php'); @@ -256,7 +257,7 @@ class entwicklungsteam extends basis_db } /** - * Preuft ob der Eintrag schon existiert + * Prueft ob der Eintrag schon existiert * * @param $mitarbeiter_uid * @param $studiengang_kz @@ -288,5 +289,44 @@ class entwicklungsteam extends basis_db return false; } } + + /** + * Liefert alle Entwicklungsteameinträge + * @param $studiengang_kz Studiengangkennzeichen + * @return alle Entwicklungsteameinträge + */ + public function getAll($stg_kz=null) + { + $qry = "SELECT * FROM bis.tbl_entwicklungsteam"; + if($stg_kz!=null) + $qry.=" WHERE studiengang_kz=".$this->db_add_param($stg_kz); + $qry.=";"; + + if($this->db_query($qry)) + { + while($row = $this->db_fetch_object()) + { + $obj = new entwicklungsteam(); + + $obj->mitarbeiter_uid = $row->mitarbeiter_uid; + $obj->studiengang_kz = $row->studiengang_kz; + $obj->besqualcode = $row->besqualcode; + $obj->beginn = $row->beginn; + $obj->ende = $row->ende; + $obj->insertamum = $row->insertamum; + $obj->insertvon = $row->insertvon; + $obj->updateamum = $row->updateamum; + $obj->updatevon = $row->updatevon; + + $this->result[] = $obj; + } + return true; + } + else + { + $this->errormsg = 'Fehler beim Laden der Entwicklungsteameinträge.'; + return false; + } + } } ?> From db49f2b1e77248328388213bea238a0b5956966f Mon Sep 17 00:00:00 2001 From: Paolo Date: Fri, 4 Mar 2022 19:47:32 +0100 Subject: [PATCH 005/873] - libraries/DocsboxLib: - Added new constant DEFAULT_FORMAT - ERROR and SUCCESS constant values are the same of EXIT_ERROR and EXIT_SUCCESS - public method convert parameter format does not have a default value anymore - Added use import of ZipArchive - libraries/DocumentLib: removed unused variables --- application/libraries/DocsboxLib.php | 23 +++++++++++++++-------- application/libraries/DocumentLib.php | 7 ++++--- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/application/libraries/DocsboxLib.php b/application/libraries/DocsboxLib.php index ce43f1bc5..5ec028a49 100644 --- a/application/libraries/DocsboxLib.php +++ b/application/libraries/DocsboxLib.php @@ -1,11 +1,11 @@ body != '') { // Output directory where to unzip the downloaded zip file - $outputDirectory = dirname($outputFileName); + $outputDirectory = dirname($outputFileName); // The path and name of the downloaded zip file $temporaryDownloadedZip = sys_get_temp_dir().'/'.basename($resultUrl); diff --git a/application/libraries/DocumentLib.php b/application/libraries/DocumentLib.php index d78a9c0df..eec3b6938 100644 --- a/application/libraries/DocumentLib.php +++ b/application/libraries/DocumentLib.php @@ -14,6 +14,7 @@ class DocumentLib // Gets CI instance $this->ci =& get_instance(); + // Which document converter has to be used if (defined('DOCSBOX_ENABLED') && DOCSBOX_ENABLED === true) { // Use docsbox!! @@ -119,7 +120,7 @@ class DocumentLib finfo_close($finfo); - exec($cmd, $out, $ret); + exec($cmd, null, $ret); if ($ret != 0) { return error('PDF-zusammenfuegung ist derzeit nicht möglich. Bitte informieren Sie den Administrator'); @@ -154,7 +155,7 @@ class DocumentLib $command = 'unoconv -f %s --output %s %s 2>&1'; $command = sprintf($command, $format, $outFile, $inFile); - exec($command, $out, $ret); + exec($command, null, $ret); } if ($ret != 0) @@ -217,7 +218,7 @@ class DocumentLib $cmd .= '/countspaces { [ exch { dup 32 ne { pop } if } forall ] length } bind def >> '; $cmd .= 'setpagedevice viewJPEG"'; - exec($cmd, $out, $ret); + exec($cmd, null, $ret); if ($ret != 0) { $this->errormsg = 'jpegToPdf ist derzeit nicht möglich. Bitte informieren Sie den Administrator'; From e50cc27a89f4bbdfc7d9192f215504d4e50b6068 Mon Sep 17 00:00:00 2001 From: Paolo Date: Fri, 4 Mar 2022 20:13:03 +0100 Subject: [PATCH 006/873] Fixed exec second parameter value --- application/libraries/DocumentLib.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/application/libraries/DocumentLib.php b/application/libraries/DocumentLib.php index eec3b6938..c1dd21c29 100644 --- a/application/libraries/DocumentLib.php +++ b/application/libraries/DocumentLib.php @@ -120,7 +120,8 @@ class DocumentLib finfo_close($finfo); - exec($cmd, null, $ret); + $out = null; + exec($cmd, $out, $ret); if ($ret != 0) { return error('PDF-zusammenfuegung ist derzeit nicht möglich. Bitte informieren Sie den Administrator'); @@ -155,7 +156,8 @@ class DocumentLib $command = 'unoconv -f %s --output %s %s 2>&1'; $command = sprintf($command, $format, $outFile, $inFile); - exec($command, null, $ret); + $out = null; + exec($command, $out, $ret); } if ($ret != 0) @@ -218,7 +220,8 @@ class DocumentLib $cmd .= '/countspaces { [ exch { dup 32 ne { pop } if } forall ] length } bind def >> '; $cmd .= 'setpagedevice viewJPEG"'; - exec($cmd, null, $ret); + $out = null; + exec($cmd, $out, $ret); if ($ret != 0) { $this->errormsg = 'jpegToPdf ist derzeit nicht möglich. Bitte informieren Sie den Administrator'; From 5838e1caa5610b4a4914f0dca800fb901cee816f Mon Sep 17 00:00:00 2001 From: ma0068 Date: Sat, 5 Mar 2022 12:51:06 +0100 Subject: [PATCH 007/873] =?UTF-8?q?neue=20Funktion=20getAll=20f=C3=BCr=20E?= =?UTF-8?q?ntwicklungsteam=20STGV?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/mitarbeiter.class.php | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/include/mitarbeiter.class.php b/include/mitarbeiter.class.php index 226ae0206..a4218d377 100644 --- a/include/mitarbeiter.class.php +++ b/include/mitarbeiter.class.php @@ -1645,5 +1645,45 @@ class mitarbeiter extends benutzer return false; } + /** + * Liefert alle Mitarbeiter*innen + * + * @param $filter + * @return boolean + */ + public function getAll() + { + $qry = ' + SELECT + ma.mitarbeiter_uid, p.nachname, p.vorname, b.alias + FROM + public.tbl_mitarbeiter ma + JOIN public.tbl_benutzer b ON (mitarbeiter_uid=uid) + JOIN public.tbl_person p USING(person_id) + ORDER BY p.nachname + '; + + if($this->db_query($qry)) + { + while($row = $this->db_fetch_object()) + { + $ma_obj = new mitarbeiter(); + + $ma_obj->nachname = $row->nachname; + $ma_obj->vorname = $row->vorname; + $ma_obj->mitarbeiter_uid = $row->mitarbeiter_uid; + $ma_obj->alias = $row->alias; + + $this->maData[] = $ma_obj; + } + return true; + } + else + { + $this->errormsg = 'Fehler beim Laden der Daten'; + return false; + } + } + } ?> From 9c1b6bcd44807a669f2823dfcdb8a5ee91540b15 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Tue, 15 Mar 2022 09:43:46 +0100 Subject: [PATCH 008/873] =?UTF-8?q?Entwicklungsteam:=20Adpatierungen=20f?= =?UTF-8?q?=C3=BCr=20Sorierung=20und=20Anzeige=20Mitarbeiter=20Grid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/besqualcode.class.php | 109 +++++++++++++++++++++++++++++ include/entwicklungsteam.class.php | 41 ++++++++--- 2 files changed, 140 insertions(+), 10 deletions(-) create mode 100644 include/besqualcode.class.php diff --git a/include/besqualcode.class.php b/include/besqualcode.class.php new file mode 100644 index 000000000..04a309e60 --- /dev/null +++ b/include/besqualcode.class.php @@ -0,0 +1,109 @@ + + */ + +require_once(dirname(__FILE__). '/basis_db.class.php'); +require_once(dirname(__FILE__). '/sprache.class.php'); +require_once(dirname(__FILE__). '/functions.inc.php'); + +class besqualcode extends basis_db +{ + //Objekt besqualcode + public $result = array(); + + //Tabellenspalten + public $besqualcode; + public $besqualbez; + + /** + * Konstruktor - Laedt optional einen besqualcode + * @param char $besqualcode Besqualcode der geladen werden soll. + */ + public function __construct($besqualcode = null) + { + parent::__construct(); + + if($besqualcode != null) + $this->load($besqualcode); + } + + + /** + * Liefert alle Lehrmodi aus der table tbl_besqualcode + * @return true wenn ok, false im Fehlerfall + */ + public function getAll() + { + $qry = "SELECT * FROM bis.tbl_besqual"; + + if ($this->db_query($qry)) + { + while ($row = $this->db_fetch_object()) + { + $besqualcode = new besqualcode(); + + $besqualcode->besqualcode = $row->besqualcode; + $besqualcode->besqualbez = $row->besqualbez; + + $this->result[] = $besqualcode; + } + return true; + } + else + { + $this->errormsg = "Fehler bei der Abfrage aufgetreten"; + return false; + } + } + + /** + * Laedt einen besqualcode + * @param char $besqualcode ID des Datensatzes der zu laden ist. + * @return true wenn ok, false im Fehlerfall + */ + public function load($besqualcode) + { + $qry = "SELECT + * + FROM + bis.tbl_besqual + WHERE + besqualcode=".$this->db_add_param($besqualcode).";"; + + if (!$this->db_query($qry)) + { + $this->errormsg = 'Fehler beim Lesen vom besqualcode'; + return false; + } + + if ($row = $this->db_fetch_object()) + { + $this->besqualcode = $row->besqualcode; + $this->besqualbez = $row->besqualbez; + } + else + { + $this->errormsg = 'Es ist kein besqualcode mit dieser ID vorhanden'; + return false; + } + return true; + } +} + +?> diff --git a/include/entwicklungsteam.class.php b/include/entwicklungsteam.class.php index e6603f95b..0fe83577a 100644 --- a/include/entwicklungsteam.class.php +++ b/include/entwicklungsteam.class.php @@ -29,6 +29,8 @@ class entwicklungsteam extends basis_db //Tabellenspalten public $mitarbeiter_uid; + public $nachname; + public $vorname; public $studiengang_kz; public $besqualcode; public $beginn; @@ -70,7 +72,9 @@ class entwicklungsteam extends basis_db //laden des Datensatzes $qry = "SELECT * FROM bis.tbl_entwicklungsteam JOIN bis.tbl_besqual USING(besqualcode) - WHERE mitarbeiter_uid=".$this->db_add_param($mitarbeiter_uid)." AND studiengang_kz=".$this->db_add_param($studiengang_kz, FHC_INTEGER).";"; + WHERE mitarbeiter_uid=".$this->db_add_param($mitarbeiter_uid)." AND studiengang_kz=".$this->db_add_param($studiengang_kz, FHC_INTEGER); + + $qry.=";"; if($this->db_query($qry)) { @@ -149,7 +153,12 @@ class entwicklungsteam extends basis_db } if($this->besqualcode=='') { - $this->errormsg = 'BesondereQualifikation muss eingetragen werden'; + $this->errormsg = 'Besondere Qualifikation muss eingetragen werden'; + return false; + } + if($this->beginn > $this->ende) + { + $this->errormsg = 'Endedatum darf nicht vor Anfangsdatum liegen'; return false; } return true; @@ -292,23 +301,35 @@ class entwicklungsteam extends basis_db /** * Liefert alle Entwicklungsteameinträge - * @param $studiengang_kz Studiengangkennzeichen + * @param int $studiengang_kz Studiengangkennzeichen. + * @param char $sort Parameter, nach dem sortiert werden soll. * @return alle Entwicklungsteameinträge */ - public function getAll($stg_kz=null) + public function getAll($studiengang_kz = null, $sort = null) { - $qry = "SELECT * FROM bis.tbl_entwicklungsteam"; - if($stg_kz!=null) - $qry.=" WHERE studiengang_kz=".$this->db_add_param($stg_kz); - $qry.=";"; + $qry = "SELECT e.*, p.nachname, p.vorname FROM bis.tbl_entwicklungsteam e + JOIN public.tbl_benutzer b ON e.mitarbeiter_uid = b.uid + JOIN public.tbl_person p ON b.person_id = p.person_id + "; + if ($studiengang_kz != null) + $qry .= " WHERE e.studiengang_kz = ".$this->db_add_param($studiengang_kz); - if($this->db_query($qry)) + if ($sort != null) { - while($row = $this->db_fetch_object()) + $qry .= " ORDER BY ".$sort; + } + + $qry .= ";"; + + if ($this->db_query($qry)) + { + while ($row = $this->db_fetch_object()) { $obj = new entwicklungsteam(); $obj->mitarbeiter_uid = $row->mitarbeiter_uid; + $obj->nachname = $row->nachname; + $obj->vorname = $row->vorname; $obj->studiengang_kz = $row->studiengang_kz; $obj->besqualcode = $row->besqualcode; $obj->beginn = $row->beginn; From 67c9c79113234ddc7a5650efe6957bccd1adfa35 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Wed, 16 Mar 2022 13:02:52 +0100 Subject: [PATCH 009/873] =?UTF-8?q?=C3=84nderung=20Klasse=20Entwicklungste?= =?UTF-8?q?am=20auf=20neuen=20Key=20entwicklungsteam=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/entwicklungsteam.class.php | 42 ++++++++++++++++-------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/include/entwicklungsteam.class.php b/include/entwicklungsteam.class.php index 0fe83577a..bdedc7542 100644 --- a/include/entwicklungsteam.class.php +++ b/include/entwicklungsteam.class.php @@ -28,6 +28,7 @@ class entwicklungsteam extends basis_db public $result = array(); //Tabellenspalten + public $entwicklungsteam_id; public $mitarbeiter_uid; public $nachname; public $vorname; @@ -46,33 +47,32 @@ class entwicklungsteam extends basis_db /** * Konstruktor - * @param mitarbeiter_uid ID des zu ladenden Datensatzes + * @param entwicklungsteam_id ID des zu ladenden Datensatzes * studiengang_kz */ - public function __construct($mitarbeiter_uid=null, $studiengang_kz=null) + public function __construct($entwicklungsteam_id = null) { parent::__construct(); - if(!is_null($mitarbeiter_uid) && !is_null($studiengang_kz)) - $this->load($mitarbeiter_uid, $studiengang_kz); + if(!is_null($entwicklungsteam_id)) + $this->load($entwicklungsteam_id); } /** * Laedt einen Datensatz - * @param mitarbeiter_uid ID des zu ladenden Datensatzes - * studiengang_kz + * @param entwicklungsteam_id ID des zu ladenden Datensatzes */ - public function load($mitarbeiter_uid, $studiengang_kz) + public function load($entwicklungsteam_id) { - if(!is_numeric($studiengang_kz) || $studiengang_kz == '') + if(!is_numeric($entwicklungsteam_id)) { - $this->errormsg = 'studiengang_kz muss eine gueltige Zahl sein'; + $this->errormsg = 'entwicklungsteam_id muss eine gueltige Zahl sein'; return false; } //laden des Datensatzes $qry = "SELECT * FROM bis.tbl_entwicklungsteam JOIN bis.tbl_besqual USING(besqualcode) - WHERE mitarbeiter_uid=".$this->db_add_param($mitarbeiter_uid)." AND studiengang_kz=".$this->db_add_param($studiengang_kz, FHC_INTEGER); + WHERE entwicklungsteam_id=".$this->db_add_param($entwicklungsteam_id); $qry.=";"; @@ -80,6 +80,7 @@ class entwicklungsteam extends basis_db { if($row = $this->db_fetch_object()) { + $this->entwicklungsteam_id = $row->entwicklungsteam_id; $this->mitarbeiter_uid = $row->mitarbeiter_uid; $this->studiengang_kz = $row->studiengang_kz; $this->besqualcode = $row->besqualcode; @@ -108,19 +109,19 @@ class entwicklungsteam extends basis_db /** * Loescht einen Datensatz - * @param bisverwendung_id ID des zu loeschenden Datensatzes + * @param entwicklungsteam_id ID des zu loeschenden Datensatzes * @return true wenn ok, false im Fehlerfall */ - public function delete($mitarbeiter_uid, $studiengang_kz) + public function delete($entwicklungsteam_id) { - if(!is_numeric($studiengang_kz) || $studiengang_kz == '') + if(!is_numeric($entwicklungsteam_id)) { - $this->errormsg = 'studiengang_kz muss eine gueltige Zahl sein'; + $this->errormsg = 'entwicklungsteam_id muss eine gueltige Zahl sein'; return false; } $qry = "DELETE FROM bis.tbl_entwicklungsteam - WHERE mitarbeiter_uid = ".$this->db_add_param($mitarbeiter_uid)." AND studiengang_kz=".$this->db_add_param($studiengang_kz, FHC_INTEGER).";"; + WHERE entwicklungsteam_id = ".$this->db_add_param($entwicklungsteam_id).";"; if($this->db_query($qry)) { @@ -206,7 +207,7 @@ class entwicklungsteam extends basis_db " ende=".$this->db_add_param($this->ende).",". " updateamum=".$this->db_add_param($this->updateamum).",". " updatevon=".$this->db_add_param($this->updatevon). - " WHERE mitarbeiter_uid=".$this->db_add_param($this->mitarbeiter_uid)." AND studiengang_kz=".$this->db_add_param($this->studiengang_kz_old, FHC_INTEGER).";"; + " WHERE entwicklungsteam_id=".$this->db_add_param($this->entwicklungsteam_id).";"; } if($this->db_query($qry)) @@ -268,14 +269,13 @@ class entwicklungsteam extends basis_db /** * Prueft ob der Eintrag schon existiert * - * @param $mitarbeiter_uid - * @param $studiengang_kz + * @param entwicklungsteam_id * @return true wenn vorhanden, false wenn nicht */ - public function exists($mitarbeiter_uid,$studiengang_kz) + public function exists($entwicklungsteam_id) { $qry = "SELECT count(*) as anzahl FROM bis.tbl_entwicklungsteam - WHERE mitarbeiter_uid=".$this->db_add_param($mitarbeiter_uid)." AND studiengang_kz=".$this->db_add_param($studiengang_kz, FHC_INTEGER).";"; + WHERE entwicklungsteam_id=".$this->db_add_param($entwicklungsteam_id).";"; if($this->db_query($qry)) { @@ -327,6 +327,7 @@ class entwicklungsteam extends basis_db { $obj = new entwicklungsteam(); + $obj->entwicklungsteam_id = $row->entwicklungsteam_id; $obj->mitarbeiter_uid = $row->mitarbeiter_uid; $obj->nachname = $row->nachname; $obj->vorname = $row->vorname; @@ -339,6 +340,7 @@ class entwicklungsteam extends basis_db $obj->updateamum = $row->updateamum; $obj->updatevon = $row->updatevon; + $this->result[] = $obj; } return true; From 681385946a6d75be5bcf92de7cccc4fd885f7a43 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 17 Mar 2022 12:24:18 +0100 Subject: [PATCH 010/873] Adaptierungen Tabelle bis.tbl_entwicklungsteam aufgrund Erweiterung um entwicklungsteam_id --- system/dbupdate_3.3.php | 379 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 377 insertions(+), 2 deletions(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index 50f5098c8..f4d7a01bc 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -3458,6 +3458,231 @@ if(!@$db->db_query("SELECT insertamum FROM public.tbl_vorlage LIMIT 1")) echo '
Neue Spalten insertamum,insertvon,updateamum und updatevon in public.tbl_vorlage hinzugefügt'; } +// Spalte archivierbar und signierbar in public.tbl_vorlage auf TRUE gesetzt bei Vorlage: Zertifikat +if($result = @$db->db_query("SELECT 1 FROM public.tbl_vorlage WHERE vorlage_kurzbz = 'Zertifikat' AND archivierbar AND signierbar;")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "UPDATE public.tbl_vorlage SET archivierbar = TRUE, signierbar = TRUE WHERE vorlage_kurzbz = 'Zertifikat';"; + + if(!$db->db_query($qry)) + echo 'public.tbl_vorlage '.$db->db_last_error().'
'; + else + echo 'public.tbl_vorlage: Spalten archivierbar und signierbar auf TRUE gesetzt bei Vorlage: Zertifikat
'; + } +} + +// Spalte archivierbar und signierbar in public.tbl_vorlage auf TRUE gesetzt bei Vorlage: LVZeugnis +if($result = @$db->db_query("SELECT 1 FROM public.tbl_vorlage WHERE vorlage_kurzbz = 'LVZeugnis' AND archivierbar AND signierbar;")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "UPDATE public.tbl_vorlage SET archivierbar = TRUE, signierbar = TRUE WHERE vorlage_kurzbz = 'LVZeugnis';"; + + if(!$db->db_query($qry)) + echo 'public.tbl_vorlage '.$db->db_last_error().'
'; + else + echo 'public.tbl_vorlage: Spalten archivierbar und signierbar auf TRUE gesetzt bei Vorlage: LVZeugnis
'; + } +} + +// Spalte archivierbar und signierbar in public.tbl_vorlage auf TRUE gesetzt bei Vorlage: LVZeugnisEng +if($result = @$db->db_query("SELECT 1 FROM public.tbl_vorlage WHERE vorlage_kurzbz = 'LVZeugnisEng' AND archivierbar AND signierbar;")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "UPDATE public.tbl_vorlage SET archivierbar = TRUE, signierbar = TRUE WHERE vorlage_kurzbz = 'LVZeugnisEng';"; + + if(!$db->db_query($qry)) + echo 'public.tbl_vorlage '.$db->db_last_error().'
'; + else + echo 'public.tbl_vorlage: Spalten archivierbar und signierbar auf TRUE gesetzt bei Vorlage: LVZeugnisEng
'; + } +} + +// Spalte stud_selfservice in public.tbl_vorlage auf TRUE gesetzt bei Vorlage: Zertifikat +if($result = @$db->db_query("SELECT 1 FROM public.tbl_vorlage WHERE vorlage_kurzbz = 'Zertifikat' AND stud_selfservice;")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "UPDATE public.tbl_vorlage SET stud_selfservice = TRUE WHERE vorlage_kurzbz = 'Zertifikat';"; + + if(!$db->db_query($qry)) + echo 'public.tbl_vorlage '.$db->db_last_error().'
'; + else + echo 'public.tbl_vorlage: Spalte stud_selfservice auf TRUE gesetzt bei Vorlage: Zertifikat
'; + } +} + +// Spalte stud_selfservice in public.tbl_vorlage auf TRUE gesetzt bei Vorlage: LVZeugnis +if($result = @$db->db_query("SELECT 1 FROM public.tbl_vorlage WHERE vorlage_kurzbz = 'LVZeugnis' AND stud_selfservice;")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "UPDATE public.tbl_vorlage SET stud_selfservice = TRUE WHERE vorlage_kurzbz = 'LVZeugnis';"; + + if(!$db->db_query($qry)) + echo 'public.tbl_vorlage '.$db->db_last_error().'
'; + else + echo 'public.tbl_vorlage: Spalte stud_selfservice auf TRUE gesetzt bei Vorlage: LVZeugnis
'; + } +} + +// Spalte stud_selfservice in public.tbl_vorlage auf TRUE gesetzt bei Vorlage: LVZeugnisEng +if($result = @$db->db_query("SELECT 1 FROM public.tbl_vorlage WHERE vorlage_kurzbz = 'LVZeugnisEng' AND stud_selfservice;")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "UPDATE public.tbl_vorlage SET stud_selfservice = TRUE WHERE vorlage_kurzbz = 'LVZeugnisEng';"; + + if(!$db->db_query($qry)) + echo 'public.tbl_vorlage '.$db->db_last_error().'
'; + else + echo 'public.tbl_vorlage: Spalte stud_selfservice auf TRUE gesetzt bei Vorlage: LVZeugnisEng
'; + } +} + +// dokument_kurzbz in public.tbl_dokument auf 32 Zeichen verlängert +if($result = @$db->db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'public' AND TABLE_NAME = 'tbl_dokument' AND COLUMN_NAME = 'dokument_kurzbz' AND character_maximum_length = 32")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = " ALTER TABLE public.tbl_dokument ALTER COLUMN dokument_kurzbz TYPE varchar(32)"; + + if(!$db->db_query($qry)) + echo 'public.tbl_dokument '.$db->db_last_error().'
'; + else + echo '
Spalte dokument_kurzbz in public.tbl_dokument auf varchar(32) geändert
'; + } +} + +// dokument_kurzbz in public.tbl_akte auf 32 Zeichen verlängert +if($result = @$db->db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'public' AND TABLE_NAME = 'tbl_akte' AND COLUMN_NAME = 'dokument_kurzbz' AND character_maximum_length = 32")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = " ALTER TABLE public.tbl_akte ALTER COLUMN dokument_kurzbz TYPE varchar(32)"; + + if(!$db->db_query($qry)) + echo 'public.tbl_dokument '.$db->db_last_error().'
'; + else + echo '
Spalte dokument_kurzbz in public.tbl_akte auf varchar(32) geändert
'; + } +} + + +// dokument_kurzbz in campus.tbl_dms auf 32 Zeichen verlängert +if($result = $db->db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='campus' AND TABLE_NAME='tbl_dms' AND COLUMN_NAME = 'dokument_kurzbz' AND character_maximum_length = 32")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "ALTER TABLE campus.tbl_dms ALTER COLUMN dokument_kurzbz TYPE varchar(32)"; + + if(!$db->db_query($qry)) + echo 'campus.tbl_dms '.$db->db_last_error().'
'; + else + echo '
Spalte dokument_kurzbz in campus.tbl_dms auf varchar(32) geändert
'; + } +} + +// dokument_kurzbz in public.tbl_dokumentprestudent auf 32 Zeichen verlängert +if($result = @$db->db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'public' AND TABLE_NAME = 'tbl_dokumentprestudent' AND COLUMN_NAME = 'dokument_kurzbz' AND character_maximum_length = 32")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = " ALTER TABLE public.tbl_dokumentprestudent ALTER COLUMN dokument_kurzbz TYPE varchar(32)"; + + if(!$db->db_query($qry)) + echo 'public.tbl_dokumentprestudent '.$db->db_last_error().'
'; + else + echo '
Spalte dokument_kurzbz in public.tbl_dokumentprestudent auf varchar(32) geändert
'; + } +} + +// dokument_kurzbz in public.tbl_dokumentstudiengang auf 32 Zeichen verlängert +if($result = @$db->db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'public' AND TABLE_NAME = 'tbl_dokumentstudiengang' AND COLUMN_NAME = 'dokument_kurzbz' AND character_maximum_length = 32")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = " ALTER TABLE public.tbl_dokumentstudiengang ALTER COLUMN dokument_kurzbz TYPE varchar(32)"; + + if(!$db->db_query($qry)) + echo 'public.tbl_dokumentstudiengang '.$db->db_last_error().'
'; + else + echo '
Spalte dokument_kurzbz in public.tbl_dokumentstudiengang auf varchar(32) geändert
'; + } +} + +// dokument_kurzbz in public.tbl_vorlage auf 32 Zeichen verlängert +if($result = @$db->db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'public' AND TABLE_NAME = 'tbl_vorlage' AND COLUMN_NAME = 'dokument_kurzbz' AND character_maximum_length = 32")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = " ALTER TABLE public.tbl_vorlage ALTER COLUMN dokument_kurzbz TYPE varchar(32)"; + + if(!$db->db_query($qry)) + echo 'public.tbl_vorlage '.$db->db_last_error().'
'; + else + echo '
Spalte dokument_kurzbz in public.tbl_vorlage auf varchar(32) geändert
'; + } +} + +// dokument_kurzbz in public.tbl_vorlagedokument auf 32 Zeichen verlängert +if($result = @$db->db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'public' AND TABLE_NAME = 'tbl_vorlagedokument' AND COLUMN_NAME = 'dokument_kurzbz' AND character_maximum_length = 32")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = " ALTER TABLE public.tbl_vorlagedokument ALTER COLUMN dokument_kurzbz TYPE varchar(32)"; + + if(!$db->db_query($qry)) + echo 'public.tbl_vorlage '.$db->db_last_error().'
'; + else + echo '
Spalte dokument_kurzbz in public.tbl_vorlagedokument auf varchar(32) geändert
'; + } +} + +// Neues Dokument hinzugefuegt LVZeugnisEng +if($result = @$db->db_query("SELECT 1 FROM public.tbl_dokument WHERE dokument_kurzbz = 'LVZeugnisEng'")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "INSERT INTO public.tbl_dokument (dokument_kurzbz, bezeichnung, bezeichnung_mehrsprachig) VALUES ('LVZeugnisEng', 'Lehrveranstaltungszeugnis Englisch', '{\"Lehrveranstaltungszeugnis\",\"Course Certificate\"}')"; + + if(!$db->db_query($qry)) + echo 'public.tbl_dokument '.$db->db_last_error().'
'; + else + echo 'public.tbl_dokument: LVZeugnisEng hinzugefügt
'; + } +} + +// Neues Dokument hinzugefuegt LVZeugnis +if($result = @$db->db_query("SELECT 1 FROM public.tbl_dokument WHERE dokument_kurzbz = 'LVZeugnis'")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "INSERT INTO public.tbl_dokument (dokument_kurzbz, bezeichnung, bezeichnung_mehrsprachig) VALUES ('LVZeugnis', 'Lehrveranstaltungszeugnis', '{\"Lehrveranstaltungszeugnis\",\"Course Certificate\"}')"; + + if(!$db->db_query($qry)) + echo 'public.tbl_dokument '.$db->db_last_error().'
'; + else + echo 'public.tbl_dokument: LVZeugnis hinzugefügt
'; + } +} + +// Neues Dokument hinzugefuegt Zertifikat +if($result = @$db->db_query("SELECT 1 FROM public.tbl_dokument WHERE dokument_kurzbz = 'Zertifikat'")) +{ + if($db->db_num_rows($result) == 0) + { + $qry = "INSERT INTO public.tbl_dokument (dokument_kurzbz, bezeichnung, bezeichnung_mehrsprachig) VALUES ('Zertifikat', 'Zertifikat', '{\"Zertifikat\",\"Certificate\"}')"; + + if(!$db->db_query($qry)) + echo 'public.tbl_dokument '.$db->db_last_error().'
'; + else + echo 'public.tbl_dokument: Zertifikat hinzugefügt
'; + } +} + // insert und update fuer public.tbl_vorlagestudiengang if(!@$db->db_query("SELECT insertamum FROM public.tbl_vorlagestudiengang LIMIT 1")) { @@ -5716,6 +5941,156 @@ if ($result = $db->db_query("SELECT * FROM pg_class WHERE relname='idx_tbl_zeita } } +// Change size of wawi.tbl_kostenstelle.kostenstelle_nr from character varying(4) to character varying(6) +if ($result = $db->db_query("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='wawi' AND TABLE_NAME='tbl_kostenstelle' AND COLUMN_NAME = 'kostenstelle_nr' AND character_maximum_length < 6")) +{ + if ($db->db_num_rows($result) > 0) + { + $qry = "ALTER TABLE wawi.tbl_kostenstelle ALTER COLUMN kostenstelle_nr TYPE varchar(6);"; + + if(!$db->db_query($qry)) + echo 'wawi.tbl_kostenstelle '.$db->db_last_error().'
'; + else + echo '
Spalte kostenstelle_nr in wawi.tbl_kostenstelle von varchar(4) auf varchar(6) geändert
'; + } +} + +// Add column parameterFuerBehebung to system.tbl_issue +if(!$result = @$db->db_query("SELECT behebung_parameter FROM system.tbl_issue LIMIT 1")) +{ + $qry = 'ALTER TABLE system.tbl_issue ADD COLUMN behebung_parameter JSONB;'; + if(!$db->db_query($qry)) + echo 'system.tbl_issue: '.$db->db_last_error().'
'; + else + echo '
Added column behebung_parameter to table system.tbl_issue'; +} + +//Add column entwicklungs_id to bis.tbl_entwicklungsteam +if(!@$db->db_query("SELECT entwicklungsteam_id FROM bis.tbl_entwicklungsteam LIMIT 1")) +{ + $qry = 'ALTER TABLE bis.tbl_entwicklungsteam ADD COLUMN entwicklungsteam_id integer;'; + + if(!$db->db_query($qry)) + echo ' bis.tbl_entwicklungsteam '.$db->db_last_error().'
'; + else + echo '
Neue Spalte entwicklungsteam_id zu Tabelle bis.tbl_entwicklungsteam hinzugefügt'; +} + +//Column entwicklungsteam_id mit Werten befüllen +//if($result = @$db->db_query("SELECT entwicklungsteam_id FROM bis.tbl_entwicklungsteam where entwicklungsteam_id is null")) +if(!@$db->db_query("SELECT entwicklungsteam_id FROM bis.tbl_entwicklungsteam where entwicklungsteam_id is not null LIMIT 1")) +{ + + $qry = 'UPDATE bis.tbl_entwicklungsteam et SET entwicklungsteam_id = + (SELECT rownumber FROM (SELECT ROW_NUMBER() OVER (ORDER BY mitarbeiter_uid, studiengang_kz) + AS rownumber, t.* FROM bis.tbl_entwicklungsteam t ORDER BY mitarbeiter_uid, studiengang_kz) rn + WHERE rn.mitarbeiter_uid = et.mitarbeiter_uid + AND rn.studiengang_kz = et.studiengang_kz); + '; + + if(!$db->db_query($qry)) + echo ' bis.tbl_entwicklungsteam '.$db->db_last_error().'
'; + else + echo '
Spalte bis.tbl_entwicklungsteam_id mit Werten aufgefüllt'; + + +} + +//Create Sequence bis.tbl_entwicklungsteam +if (!@$db->db_query("SELECT * FROM pg_class WHERE relname = 'tbl_entwicklungsteam_entwicklungsteam_id_seq'")) +{ + if ($count = @$db->db_query("SELECT (MAX(entwicklungsteam_id) + 1) AS start FROM bis.tbl_entwicklungsteam")) + { + $qry = 'CREATE SEQUENCE bis.tbl_entwicklungsteam_entwicklungsteam_id_seq START '; + $qry .= $count; + if(!$db->db_query($qry)) + echo ' bis.tbl_entwicklungsteam '.$db->db_last_error().'
'; + else + echo '
Sequence bis.tbl_entwicklungsteam_entwicklungsteam_id_seq mit startwert' . $count . ' erstellt'; + } +} + +//Add Permission to sequence tbl_entwicklungsteam_entwicklungsteam_id_seq +if($result = @$db->db_query("SELECT * FROM information_schema.role_table_grants WHERE table_name='tbl_entwicklungsteam' AND table_schema='bis' AND grantee='web' AND privilege_type='INSERT'")) +{ + if($db->db_num_rows($result)==0) + { + $qry = " + GRANT SELECT, UPDATE ON bis.tbl_entwicklungsteam_entwicklungsteam_id_seq TO vilesci; + GRANT SELECT, UPDATE ON bis.tbl_entwicklungsteam_entwicklungsteam_id_seq TO web;"; + + if(!$db->db_query($qry)) + { + echo 'bis.tbl_entwicklungsteam_entwicklungsteam_id_seqBerechtigungen: '.$db->db_last_error().'
'; + } + else + { + echo '
SELECT und UPDATE Rechte auf bis.tbl_entwicklungsteam_entwicklungsteam_id_seq fuer web user und vilesci gesetzt '; + } + } +} + +//Bis.tbl_entwicklungsteam auf NOTNULL setzen +if ($result = @$db->db_query("SELECT is_nullable FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tbl_entwicklungsteam' AND column_name = 'entwicklungsteam_id'")) +{ + if ($result == 'YES') + { + $qry = 'ALTER TABLE bis.tbl_entwicklungsteam ALTER COLUMN entwicklungsteam_id SET NOT NULL'; + + if(!$db->db_query($qry)) + echo ' bis.tbl_entwicklungsteam '.$db->db_last_error().'
'; + else + echo '
Spalte bis.tbl_entwicklungsteam_id auf NOT NULL gesetzt'; + } + +} + +//Bis.tbl_entwicklungsteam DEFAULT einstellen +if ($result = @$db->db_query("SELECT column_default FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tbl_entwicklungsteam'AND column_name = 'entwicklungsteam_id' and column_default is null")) +{ + if ($result == null) + { + $qry = "ALTER TABLE bis.tbl_entwicklungsteam ALTER COLUMN entwicklungsteam_id SET DEFAULT nextval('bis.tbl_entwicklungsteam_entwicklungsteam_id_seq'::regclass);"; + + if(!$db->db_query($qry)) + echo ' bis.tbl_entwicklungsteam '.$db->db_last_error().'
'; + else + echo '
Spalte bis.tbl_entwicklungsteam_id: Defaultwert gesetzt'; + } + +} + +//DELETE PRIMARY KEY pk_tbl_entwicklungsteam (mitarbeiter_uid, studiengang_kz) entfernen +if ($result = @$db->db_query("SELECT conname FROM pg_constraint WHERE conname = 'pk_tbl_entwicklungsteam'")) +{ + if ($db->db_num_rows($result) == 1) + { + $qry = "ALTER TABLE bis.tbl_entwicklungsteam DROP CONSTRAINT pk_tbl_entwicklungsteam;"; + + if (!$db->db_query($qry)) + echo 'bis.tbl_entwicklungsteam: '.$db->db_last_error().'
'; + else + echo '
Spalte bis.tbl_entwicklungsteam: Primary Key pk_tbl_entwicklungsteam entfernt '; + } +} + + +// ADD PRIMARY KEY tbl_entwicklungsteam_pk to bis.tbl_entwicklungsteam +if ($result = @$db->db_query("SELECT conname FROM pg_constraint WHERE conname = 'tbl_entwicklungsteam_pk'")) +{ + if ($db->db_num_rows($result) == 0) + { + $qry = "ALTER TABLE bis.tbl_entwicklungsteam ADD CONSTRAINT tbl_entwicklungsteam_pk PRIMARY KEY(entwicklungsteam_id);"; + + if (!$db->db_query($qry)) + echo 'sbis.tbl_entwicklungsteam: '.$db->db_last_error().'
'; + else + echo '
Spalte bis.tbl_entwicklungsteam: Primary Key tbl_entwicklungsteam_pk (entwicklungsteam_id) hinzugefügt'; + } +} + + + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; @@ -5736,7 +6111,7 @@ $tabellen=array( "bis.tbl_bisstandort" => array("standort_code","bezeichnung","aktiv","insertamum","insertvon","updateamum","updatevon"), "bis.tbl_bisverwendung" => array("bisverwendung_id","ba1code","ba2code","vertragsstunden","beschausmasscode","verwendung_code","mitarbeiter_uid","hauptberufcode","hauptberuflich","habilitation","beginn","ende","updateamum","updatevon","insertamum","insertvon","ext_id","dv_art","inkludierte_lehre","zeitaufzeichnungspflichtig","azgrelevant", "homeoffice"), "bis.tbl_bundesland" => array("bundesland_code","kurzbz","bezeichnung"), - "bis.tbl_entwicklungsteam" => array("mitarbeiter_uid","studiengang_kz","besqualcode","beginn","ende","updateamum","updatevon","insertamum","insertvon","ext_id"), + "bis.tbl_entwicklungsteam" => array("entwicklungsteam_id","mitarbeiter_uid","studiengang_kz","besqualcode","beginn","ende","updateamum","updatevon","insertamum","insertvon","ext_id"), "bis.tbl_gemeinde" => array("gemeinde_id","plz","name","ortschaftskennziffer","ortschaftsname","bulacode","bulabez","kennziffer"), "bis.tbl_gsstudientyp" => array("gsstudientyp_kurzbz","bezeichnung","studientyp_code"), "bis.tbl_gsprogrammtyp" => array("gsprogrammtyp_kurzbz","bezeichnung","programmtyp_code"), @@ -5984,7 +6359,7 @@ $tabellen=array( "system.tbl_fehler" => array("fehlercode","fehler_kurzbz","fehlercode_extern","fehlertext","fehlertyp_kurzbz","app"), "system.tbl_fehlertyp" => array("fehlertyp_kurzbz","bezeichnung_mehrsprachig"), "system.tbl_fehler_zustaendigkeiten" => array("fehlerzustaendigkeiten_id","fehlercode","person_id","oe_kurzbz","funktion_kurzbz"), - "system.tbl_issue" => array("issue_id","fehlercode","fehlercode_extern","inhalt","inhalt_extern","person_id","oe_kurzbz","datum","verarbeitetvon","verarbeitetamum","status_kurzbz","insertvon","insertamum","updatevon","updateamum"), + "system.tbl_issue" => array("issue_id","fehlercode","fehlercode_extern","inhalt","inhalt_extern","person_id","oe_kurzbz","datum","verarbeitetvon","verarbeitetamum","status_kurzbz","behebung_parameter","insertvon","insertamum","updatevon","updateamum"), "system.tbl_issue_status" => array("status_kurzbz","bezeichnung_mehrsprachig"), "system.tbl_log" => array("log_id","person_id","zeitpunkt","app","oe_kurzbz","logtype_kurzbz","logdata","insertvon","taetigkeit_kurzbz"), "system.tbl_logtype" => array("logtype_kurzbz", "data_schema"), From f29d838b7c6996cf544d4292dcc18994194000ab Mon Sep 17 00:00:00 2001 From: ma0068 Date: Fri, 18 Mar 2022 13:45:33 +0100 Subject: [PATCH 011/873] =?UTF-8?q?Adaptierungen=20f=C3=BCr=20checksystem?= =?UTF-8?q?=20entwicklungteam=5Fid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- system/dbupdate_3.3.php | 99 ++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 51 deletions(-) diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index f4d7a01bc..8ed1bce94 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -5973,104 +5973,100 @@ if(!@$db->db_query("SELECT entwicklungsteam_id FROM bis.tbl_entwicklungsteam LIM if(!$db->db_query($qry)) echo ' bis.tbl_entwicklungsteam '.$db->db_last_error().'
'; else - echo '
Neue Spalte entwicklungsteam_id zu Tabelle bis.tbl_entwicklungsteam hinzugefügt'; + echo '
bis.tbl_entwicklungsteam: Neue Spalte entwicklungsteam_id hinzugefügt'; } //Column entwicklungsteam_id mit Werten befüllen -//if($result = @$db->db_query("SELECT entwicklungsteam_id FROM bis.tbl_entwicklungsteam where entwicklungsteam_id is null")) -if(!@$db->db_query("SELECT entwicklungsteam_id FROM bis.tbl_entwicklungsteam where entwicklungsteam_id is not null LIMIT 1")) +if($result = @$db->db_query("SELECT entwicklungsteam_id FROM bis.tbl_entwicklungsteam where entwicklungsteam_id is not null LIMIT 1")) { - - $qry = 'UPDATE bis.tbl_entwicklungsteam et SET entwicklungsteam_id = - (SELECT rownumber FROM (SELECT ROW_NUMBER() OVER (ORDER BY mitarbeiter_uid, studiengang_kz) - AS rownumber, t.* FROM bis.tbl_entwicklungsteam t ORDER BY mitarbeiter_uid, studiengang_kz) rn - WHERE rn.mitarbeiter_uid = et.mitarbeiter_uid - AND rn.studiengang_kz = et.studiengang_kz); - '; - - if(!$db->db_query($qry)) - echo ' bis.tbl_entwicklungsteam '.$db->db_last_error().'
'; - else - echo '
Spalte bis.tbl_entwicklungsteam_id mit Werten aufgefüllt'; - - -} - -//Create Sequence bis.tbl_entwicklungsteam -if (!@$db->db_query("SELECT * FROM pg_class WHERE relname = 'tbl_entwicklungsteam_entwicklungsteam_id_seq'")) -{ - if ($count = @$db->db_query("SELECT (MAX(entwicklungsteam_id) + 1) AS start FROM bis.tbl_entwicklungsteam")) + if ($db->db_num_rows($result) == 0) { - $qry = 'CREATE SEQUENCE bis.tbl_entwicklungsteam_entwicklungsteam_id_seq START '; - $qry .= $count; + $qry = 'UPDATE bis.tbl_entwicklungsteam et SET entwicklungsteam_id = + (SELECT rownumber FROM (SELECT ROW_NUMBER() OVER (ORDER BY mitarbeiter_uid, studiengang_kz) + AS rownumber, t.* FROM bis.tbl_entwicklungsteam t ORDER BY mitarbeiter_uid, studiengang_kz) rn + WHERE rn.mitarbeiter_uid = et.mitarbeiter_uid + AND rn.studiengang_kz = et.studiengang_kz); + '; + if(!$db->db_query($qry)) - echo ' bis.tbl_entwicklungsteam '.$db->db_last_error().'
'; - else - echo '
Sequence bis.tbl_entwicklungsteam_entwicklungsteam_id_seq mit startwert' . $count . ' erstellt'; + echo ' bis.tbl_entwicklungsteam '.$db->db_last_error().'
'; + else + echo '
bis.tbl_entwicklungsteam: Spalte bis.tbl_entwicklungsteam_id mit Werten aufgefüllt'; } } -//Add Permission to sequence tbl_entwicklungsteam_entwicklungsteam_id_seq -if($result = @$db->db_query("SELECT * FROM information_schema.role_table_grants WHERE table_name='tbl_entwicklungsteam' AND table_schema='bis' AND grantee='web' AND privilege_type='INSERT'")) +//Create Sequence bis.tbl_entwicklungsteam and grant Rights +if ($result = @$db->db_query("SELECT * FROM pg_class WHERE relname = 'tbl_entwicklungsteam_entwicklungsteam_id_seq'")) { - if($db->db_num_rows($result)==0) + if ($db->db_num_rows($result) == 0) { - $qry = " - GRANT SELECT, UPDATE ON bis.tbl_entwicklungsteam_entwicklungsteam_id_seq TO vilesci; - GRANT SELECT, UPDATE ON bis.tbl_entwicklungsteam_entwicklungsteam_id_seq TO web;"; + if ($count = @$db->db_query("SELECT * FROM bis.tbl_entwicklungsteam")) + { + $count = $db->db_num_rows($count) + 1; + $qry = 'CREATE SEQUENCE bis.tbl_entwicklungsteam_entwicklungsteam_id_seq START '; + $qry .= $count; + if(!$db->db_query($qry)) + { + echo ' bis.tbl_entwicklungsteam '.$db->db_last_error().'
'; + } + else + { + echo '
bis.tbl_entwicklungsteam: Sequence bis.tbl_entwicklungsteam_entwicklungsteam_id_seq mit Startwert ' . $count . ' erstellt'; + $qry2 = "GRANT SELECT, UPDATE ON bis.tbl_entwicklungsteam_entwicklungsteam_id_seq TO vilesci; + GRANT SELECT, UPDATE ON bis.tbl_entwicklungsteam_entwicklungsteam_id_seq TO web;"; + if(!$db->db_query($qry2)) + { + echo 'bis.tbl_entwicklungsteam_entwicklungsteam_id_seqBerechtigungen: '.$db->db_last_error().'
'; + } + else + { + echo '
bis.tbl_entwicklungsteam: Rechte auf bis.tbl_entwicklungsteam_entwicklungsteam_id_seq fuer web user und vilesci gesetzt '; + } + } - if(!$db->db_query($qry)) - { - echo 'bis.tbl_entwicklungsteam_entwicklungsteam_id_seqBerechtigungen: '.$db->db_last_error().'
'; - } - else - { - echo '
SELECT und UPDATE Rechte auf bis.tbl_entwicklungsteam_entwicklungsteam_id_seq fuer web user und vilesci gesetzt '; } } } //Bis.tbl_entwicklungsteam auf NOTNULL setzen -if ($result = @$db->db_query("SELECT is_nullable FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tbl_entwicklungsteam' AND column_name = 'entwicklungsteam_id'")) +if ($result = @$db->db_query("SELECT is_nullable FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tbl_entwicklungsteam' AND column_name = 'entwicklungsteam_id' and is_nullable = 'NO'")) { - if ($result == 'YES') + if($db->db_num_rows($result)==0) { $qry = 'ALTER TABLE bis.tbl_entwicklungsteam ALTER COLUMN entwicklungsteam_id SET NOT NULL'; if(!$db->db_query($qry)) echo ' bis.tbl_entwicklungsteam '.$db->db_last_error().'
'; else - echo '
Spalte bis.tbl_entwicklungsteam_id auf NOT NULL gesetzt'; + echo '
bis.tbl_entwicklungsteam: Spalte bis.tbl_entwicklungsteam_id auf NOT NULL gesetzt'; } - } //Bis.tbl_entwicklungsteam DEFAULT einstellen if ($result = @$db->db_query("SELECT column_default FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'tbl_entwicklungsteam'AND column_name = 'entwicklungsteam_id' and column_default is null")) { - if ($result == null) + if($db->db_num_rows($result)==1) { $qry = "ALTER TABLE bis.tbl_entwicklungsteam ALTER COLUMN entwicklungsteam_id SET DEFAULT nextval('bis.tbl_entwicklungsteam_entwicklungsteam_id_seq'::regclass);"; if(!$db->db_query($qry)) echo ' bis.tbl_entwicklungsteam '.$db->db_last_error().'
'; else - echo '
Spalte bis.tbl_entwicklungsteam_id: Defaultwert gesetzt'; + echo '
bis.tbl_entwicklungsteam: Defaultwert bei Spalte bis.tbl_entwicklungsteam_id gesetzt'; } - } //DELETE PRIMARY KEY pk_tbl_entwicklungsteam (mitarbeiter_uid, studiengang_kz) entfernen if ($result = @$db->db_query("SELECT conname FROM pg_constraint WHERE conname = 'pk_tbl_entwicklungsteam'")) { - if ($db->db_num_rows($result) == 1) + if($db->db_num_rows($result)==1) { $qry = "ALTER TABLE bis.tbl_entwicklungsteam DROP CONSTRAINT pk_tbl_entwicklungsteam;"; if (!$db->db_query($qry)) echo 'bis.tbl_entwicklungsteam: '.$db->db_last_error().'
'; else - echo '
Spalte bis.tbl_entwicklungsteam: Primary Key pk_tbl_entwicklungsteam entfernt '; + echo '
bis.tbl_entwicklungsteam: Primary Key pk_tbl_entwicklungsteam (mitarbeiter_uid, studiengang_kz) entfernt '; } } @@ -6085,12 +6081,13 @@ if ($result = @$db->db_query("SELECT conname FROM pg_constraint WHERE conname = if (!$db->db_query($qry)) echo 'sbis.tbl_entwicklungsteam: '.$db->db_last_error().'
'; else - echo '
Spalte bis.tbl_entwicklungsteam: Primary Key tbl_entwicklungsteam_pk (entwicklungsteam_id) hinzugefügt'; + echo '
bis.tbl_entwicklungsteam: Primary Key tbl_entwicklungsteam_pk (entwicklungsteam_id) hinzugefügt'; } } + // *** Pruefung und hinzufuegen der neuen Attribute und Tabellen echo '

Pruefe Tabellen und Attribute!

'; From f0c40bf449de69eba142e8ba182b3559a5fe5cd8 Mon Sep 17 00:00:00 2001 From: ma0068 Date: Thu, 31 Mar 2022 12:44:45 +0200 Subject: [PATCH 012/873] =?UTF-8?q?Adaptierungen=20Entwicklungsteam=20UID?= =?UTF-8?q?=20f=C3=BCr=20FAS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- content/mitarbeiter/mitarbeiterDBDML.php | 18 +++---- .../mitarbeiterfunktionoverlay.xul.php | 16 ++++-- content/mitarbeiter/mitarbeiteroverlay.js.php | 50 ++++++++++--------- include/entwicklungsteam.class.php | 1 + rdf/entwicklungsteam.rdf.php | 13 +++-- 5 files changed, 59 insertions(+), 39 deletions(-) diff --git a/content/mitarbeiter/mitarbeiterDBDML.php b/content/mitarbeiter/mitarbeiterDBDML.php index 84a0e00f1..bbb318d5c 100644 --- a/content/mitarbeiter/mitarbeiterDBDML.php +++ b/content/mitarbeiter/mitarbeiterDBDML.php @@ -181,7 +181,7 @@ if(!$error) $verwendung->azgrelevant = false; else $verwendung->azgrelevant = ''; - + if($_POST['homeoffice']=='true') $verwendung->homeoffice = true; elseif($_POST['homeoffice']=='false') @@ -278,7 +278,7 @@ if(!$error) if($_POST['neu']!='true') { - if(!$entwt->load($_POST['mitarbeiter_uid'],$_POST['studiengang_kz_old'])) + if(!$entwt->load($_POST['entwicklungsteam_id'])) { $error = true; $return = false; @@ -289,12 +289,6 @@ if(!$error) else { - if($entwt->exists($_POST['mitarbeiter_uid'],$_POST['studiengang_kz'])) - { - $error = true; - $errormsg = 'Es existiert bereits ein Eintrag fuer diesen Studiengang'; - $return = false; - } $entwt->new = true; $entwt->insertamum = date('Y-m-d H:i:s'); $entwt->insertvon = $user; @@ -302,6 +296,7 @@ if(!$error) if(!$error) { + $entwt->entwicklungsteam_id= $_POST['entwicklungsteam_id']; $entwt->mitarbeiter_uid = $_POST['mitarbeiter_uid']; $entwt->studiengang_kz = $_POST['studiengang_kz']; $entwt->studiengang_kz_old = $_POST['studiengang_kz_old']; @@ -326,15 +321,17 @@ if(!$error) elseif(isset($_POST['type']) && $_POST['type']=='entwicklungsteamdelete') { //Loescht einen Entwicklungsteameintrag + $entwicklungsteam_id = $_POST['entwicklungsteam_id']; + $entwt = new entwicklungsteam(); - if($entwt->delete($_POST['mitarbeiter_uid'],$_POST['studiengang_kz'])) + if($entwt->delete($entwicklungsteam_id)) { $return = true; } else { $return = false; - $errormsg = $entwt->errormsg; + $errormsg = $entwt->errormsg; } } elseif(isset($_POST['type']) && $_POST['type']=='buchungsave') @@ -801,6 +798,7 @@ if(!$error) $errormsg = $konto->errormsg; } else + { $error = false; $return = true; diff --git a/content/mitarbeiter/mitarbeiterfunktionoverlay.xul.php b/content/mitarbeiter/mitarbeiterfunktionoverlay.xul.php index 6a50145eb..dd685c5da 100644 --- a/content/mitarbeiter/mitarbeiterfunktionoverlay.xul.php +++ b/content/mitarbeiter/mitarbeiterfunktionoverlay.xul.php @@ -199,7 +199,7 @@ echo ''; class="sortDirectionIndicator" sort="rdf:http://www.technikum-wien.at/bisfunktion/rdf#sws" onclick="MitarbeiterTreeFunktionSort()"/> -