From 803c1cb4c34c8898de9ce787c44cc998a1321182 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20=C3=96sterreicher?= Date: Tue, 23 Apr 2019 15:32:37 +0200 Subject: [PATCH] =?UTF-8?q?=C3=84ndern=20des=20Erledigt-Status=20von=20Not?= =?UTF-8?q?izen=20setzt=20jetzt=20immer=20das=20Updatevon/Updateamum=20Fel?= =?UTF-8?q?d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- soap/notiz.soap.php | 386 ++++++++++++++++++++++---------------------- 1 file changed, 194 insertions(+), 192 deletions(-) diff --git a/soap/notiz.soap.php b/soap/notiz.soap.php index 56c1f5498..66ee76373 100644 --- a/soap/notiz.soap.php +++ b/soap/notiz.soap.php @@ -1,192 +1,194 @@ -, - * Andreas Oesterreicher and - * Karl Burkhart . - */ -header("Cache-Control: no-cache"); -header("Cache-Control: post-check=0, pre-check=0",false); -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Pragma: no-cache"); -session_start(); - -require_once('../config/vilesci.config.inc.php'); -require_once('../include/notiz.class.php'); -require_once('../include/datum.class.php'); -require_once('../include/functions.inc.php'); -require_once('../include/benutzerberechtigung.class.php'); -require_once('../include/dms.class.php'); - -$SOAPServer = new SoapServer(APP_ROOT."/soap/notiz.wsdl.php?".microtime(true)); -$SOAPServer->addFunction("saveNotiz"); -$SOAPServer->addFunction("deleteNotiz"); -$SOAPServer->addFunction("deleteDokument"); -$SOAPServer->addFunction("setErledigt"); -$SOAPServer->handle(); - -// WSDL Chache auf aus -ini_set("soap.wsdl_cache_enabled", "0"); - -/** - * - * Speichert Notizen in die Datenbank - * - * @param string $username - * @param string $passwort - * @param complextype $notiz - */ -function saveNotiz($username, $passwort, $notiz) -{ - - if(!$user = check_user($username, $passwort)) - return new SoapFault("Server", "Invalid Credentials"); - - $rechte = new benutzerberechtigung(); - $rechte->getBerechtigungen($user); - - if(!$rechte->isBerechtigt('basis/notiz', null, 'sui')) - return new SoapFault("Server", "Sie haben keine Berechtigung zum Speichern von Notizen"); - - $notiz_obj = new notiz(); - if($notiz->notiz_id != '') - { - if($notiz_obj->load($notiz->notiz_id)) - { - $notiz_obj->new = false; - } - else - return new SoapFault("Server", "Fehler beim Laden"); - } - else - { - $notiz_obj->new=true; - $notiz_obj->insertvon = $user; - $notiz_obj->insertamum = date('Y-m-d H:i:s'); - } - - $notiz_obj->titel=$notiz->titel; - $notiz_obj->text=$notiz->text; - $notiz_obj->verfasser_uid = $notiz->verfasser_uid; - $notiz_obj->bearbeiter_uid = $notiz->bearbeiter_uid; - $notiz_obj->start = $notiz->start; - $notiz_obj->ende = $notiz->ende; - $notiz_obj->erledigt=($notiz->erledigt=='true'?true:false); - $notiz_obj->updateamum = date('Y-m-d H:i:s'); - $notiz_obj->updatevon = $username; - - if($notiz_obj->save()) - { - if($notiz_obj->new) - { - $notiz_obj->projekt_kurzbz = $notiz->projekt_kurzbz; - $notiz_obj->projektphase_id = $notiz->projektphase_id; - $notiz_obj->projekttask_id = $notiz->projekttask_id; - $notiz_obj->uid = $notiz->uid; - $notiz_obj->person_id = $notiz->person_id; - $notiz_obj->prestudent_id = $notiz->prestudent_id; - $notiz_obj->bestellung_id = $notiz->bestellung_id; - $notiz_obj->lehreinheit_id = $notiz->lehreinheit_id; - $notiz_obj->anrechnung_id = $notiz->anrechnung_id; - - if(!$notiz_obj->saveZuordnung()) - return new SoapFault("Server", $notiz_obj->errormsg); - } - return $notiz_obj->notiz_id; - } - else - return new SoapFault("Server", $notiz_obj->errormsg); -} - -/** - * - * Löscht die Notiz mit der vom Webservice übergebenen ID - * @param $notiz_id - */ -function deleteNotiz($username, $passwort, $notiz_id) -{ - if(!$user = check_user($username, $passwort)) - return new SoapFault("Server", "Invalid Credentials"); - - $rechte = new benutzerberechtigung(); - $rechte->getBerechtigungen($user); - - if(!$rechte->isBerechtigt('basis/notiz', null, 'suid')) - return new SoapFault("Server", "Sie haben keine Berechtigung zum Loeschen von Notizen"); - - $notiz = new notiz(); - if($notiz->delete($notiz_id)) - return "OK"; - else - return new SoapFault("Server", $projekttask->errormsg); -} - -/** - * - * Löscht das Dokument mit der vom Webservice übergebenen DMS-ID - * @param $dms_id - */ -function deleteDokument($username, $passwort, $dms_id) -{ - if(!$user = check_user($username, $passwort)) - return new SoapFault("Server", "Invalid Credentials"); - - $rechte = new benutzerberechtigung(); - $rechte->getBerechtigungen($user); - - if(!$rechte->isBerechtigt('basis/notiz', null, 'suid')) - return new SoapFault("Server", "Sie haben keine Berechtigung zum Loeschen von Dokumenten"); - - $dms = new dms(); - if($dms->deleteDms($dms_id)) - return "OK"; - else - return new SoapFault("Server", $dms->errormsg); -} - -/** - * - * Setzt den erledigt Status - * @param $notiz_id - * @param $erledigt - */ -function setErledigt($notiz_id, $erledigt) -{ - $user = get_uid(); - - $rechte = new benutzerberechtigung(); - $rechte->getBerechtigungen($user); - - if(!$rechte->isBerechtigt('basis/notiz', null, 'su')) - return new SoapFault("Server", "Sie haben keine Berechtigung zum Speichern von Notizen"); - - $notiz = new notiz(); - if($notiz->load($notiz_id)) - { - $notiz->erledigt=$erledigt; - - if($notiz->save()) - { - return true; - } - else - return new SoapFault("Server", $notiz->errormsg); - } - else - return new SoapFault("Server", "Fehler beim Laden"); -} -?> +, + * Andreas Oesterreicher and + * Karl Burkhart . + */ +header("Cache-Control: no-cache"); +header("Cache-Control: post-check=0, pre-check=0",false); +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Pragma: no-cache"); +session_start(); + +require_once('../config/vilesci.config.inc.php'); +require_once('../include/notiz.class.php'); +require_once('../include/datum.class.php'); +require_once('../include/functions.inc.php'); +require_once('../include/benutzerberechtigung.class.php'); +require_once('../include/dms.class.php'); + +$SOAPServer = new SoapServer(APP_ROOT."/soap/notiz.wsdl.php?".microtime(true)); +$SOAPServer->addFunction("saveNotiz"); +$SOAPServer->addFunction("deleteNotiz"); +$SOAPServer->addFunction("deleteDokument"); +$SOAPServer->addFunction("setErledigt"); +$SOAPServer->handle(); + +// WSDL Chache auf aus +ini_set("soap.wsdl_cache_enabled", "0"); + +/** + * + * Speichert Notizen in die Datenbank + * + * @param string $username + * @param string $passwort + * @param complextype $notiz + */ +function saveNotiz($username, $passwort, $notiz) +{ + + if(!$user = check_user($username, $passwort)) + return new SoapFault("Server", "Invalid Credentials"); + + $rechte = new benutzerberechtigung(); + $rechte->getBerechtigungen($user); + + if(!$rechte->isBerechtigt('basis/notiz', null, 'sui')) + return new SoapFault("Server", "Sie haben keine Berechtigung zum Speichern von Notizen"); + + $notiz_obj = new notiz(); + if($notiz->notiz_id != '') + { + if($notiz_obj->load($notiz->notiz_id)) + { + $notiz_obj->new = false; + } + else + return new SoapFault("Server", "Fehler beim Laden"); + } + else + { + $notiz_obj->new=true; + $notiz_obj->insertvon = $user; + $notiz_obj->insertamum = date('Y-m-d H:i:s'); + } + + $notiz_obj->titel=$notiz->titel; + $notiz_obj->text=$notiz->text; + $notiz_obj->verfasser_uid = $notiz->verfasser_uid; + $notiz_obj->bearbeiter_uid = $notiz->bearbeiter_uid; + $notiz_obj->start = $notiz->start; + $notiz_obj->ende = $notiz->ende; + $notiz_obj->erledigt=($notiz->erledigt=='true'?true:false); + $notiz_obj->updateamum = date('Y-m-d H:i:s'); + $notiz_obj->updatevon = $user; + + if($notiz_obj->save()) + { + if($notiz_obj->new) + { + $notiz_obj->projekt_kurzbz = $notiz->projekt_kurzbz; + $notiz_obj->projektphase_id = $notiz->projektphase_id; + $notiz_obj->projekttask_id = $notiz->projekttask_id; + $notiz_obj->uid = $notiz->uid; + $notiz_obj->person_id = $notiz->person_id; + $notiz_obj->prestudent_id = $notiz->prestudent_id; + $notiz_obj->bestellung_id = $notiz->bestellung_id; + $notiz_obj->lehreinheit_id = $notiz->lehreinheit_id; + $notiz_obj->anrechnung_id = $notiz->anrechnung_id; + + if(!$notiz_obj->saveZuordnung()) + return new SoapFault("Server", $notiz_obj->errormsg); + } + return $notiz_obj->notiz_id; + } + else + return new SoapFault("Server", $notiz_obj->errormsg); +} + +/** + * + * Löscht die Notiz mit der vom Webservice übergebenen ID + * @param $notiz_id + */ +function deleteNotiz($username, $passwort, $notiz_id) +{ + if(!$user = check_user($username, $passwort)) + return new SoapFault("Server", "Invalid Credentials"); + + $rechte = new benutzerberechtigung(); + $rechte->getBerechtigungen($user); + + if(!$rechte->isBerechtigt('basis/notiz', null, 'suid')) + return new SoapFault("Server", "Sie haben keine Berechtigung zum Loeschen von Notizen"); + + $notiz = new notiz(); + if($notiz->delete($notiz_id)) + return "OK"; + else + return new SoapFault("Server", $projekttask->errormsg); +} + +/** + * + * Löscht das Dokument mit der vom Webservice übergebenen DMS-ID + * @param $dms_id + */ +function deleteDokument($username, $passwort, $dms_id) +{ + if(!$user = check_user($username, $passwort)) + return new SoapFault("Server", "Invalid Credentials"); + + $rechte = new benutzerberechtigung(); + $rechte->getBerechtigungen($user); + + if(!$rechte->isBerechtigt('basis/notiz', null, 'suid')) + return new SoapFault("Server", "Sie haben keine Berechtigung zum Loeschen von Dokumenten"); + + $dms = new dms(); + if($dms->deleteDms($dms_id)) + return "OK"; + else + return new SoapFault("Server", $dms->errormsg); +} + +/** + * + * Setzt den erledigt Status + * @param $notiz_id + * @param $erledigt + */ +function setErledigt($notiz_id, $erledigt) +{ + $user = get_uid(); + + $rechte = new benutzerberechtigung(); + $rechte->getBerechtigungen($user); + + if(!$rechte->isBerechtigt('basis/notiz', null, 'su')) + return new SoapFault("Server", "Sie haben keine Berechtigung zum Speichern von Notizen"); + + $notiz = new notiz(); + if($notiz->load($notiz_id)) + { + $notiz->erledigt=$erledigt; + $notiz->updateamum = date('Y-m-d H:i:s'); + $notiz->updatevon = $user; + + if($notiz->save()) + { + return true; + } + else + return new SoapFault("Server", $notiz->errormsg); + } + else + return new SoapFault("Server", "Fehler beim Laden"); +} +?>