mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-06-01 20:29:29 +00:00
Löschen einer Ressourcezuteilung inst jetzt möglich
This commit is contained in:
@@ -43,6 +43,7 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
<xul:toolbox>
|
||||
<xul:toolbar >
|
||||
<xul:toolbarbutton label="Aktualisieren" oncommand="document.getBindingParent(this).RefreshRessource()" disabled="false" image="../skin/images/refresh.png" tooltiptext="Liste neu laden"/>
|
||||
<xul:toolbarbutton label="Loeschen" oncommand="document.getBindingParent(this).DeleteRessource(document.getBindingParent(this).value)" disabled="false" image="../skin/images/DeleteIcon.png" tooltiptext="Ressource löschen"/>
|
||||
</xul:toolbar>
|
||||
</xul:toolbox>
|
||||
<xul:tree anonid="tree-ressource"
|
||||
@@ -243,6 +244,68 @@ echo '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>';
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="DeleteRessource">
|
||||
<parameter name="ressource_id"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
//debug('Refresh Notiz');
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
try
|
||||
{
|
||||
var projekt_kurzbz = this.getAttribute('projekt_kurzbz');
|
||||
var projektphase_id = this.getAttribute('projektphase_id');
|
||||
|
||||
var soapBody = new SOAPObject("deleteProjektRessource");
|
||||
//soapBody.appendChild(new SOAPObject("username")).val('joe');
|
||||
//soapBody.appendChild(new SOAPObject("passwort")).val('waschl');
|
||||
|
||||
var projektRessource = new SOAPObject("projektRessource");
|
||||
|
||||
if(projekt_kurzbz != '')
|
||||
{
|
||||
projektRessource.appendChild(new SOAPObject("projektphase_id")).val('');
|
||||
projektRessource.appendChild(new SOAPObject("projekt_kurzbz")).val(projekt_kurzbz);
|
||||
}else if(projektphase_id != '')
|
||||
{
|
||||
projektRessource.appendChild(new SOAPObject("projektphase_id")).val(projektphase_id);
|
||||
projektRessource.appendChild(new SOAPObject("projekt_kurzbz")).val('');
|
||||
}
|
||||
projektRessource.appendChild(new SOAPObject("ressource_id")).val(ressource_id);
|
||||
soapBody.appendChild(projektRessource);
|
||||
|
||||
var sr = new SOAPRequest("deleteProjektRessource",soapBody);
|
||||
SOAPClient.Proxy="<?php echo APP_ROOT;?>soap/ressource_projekt.soap.php?"+gettimestamp();
|
||||
|
||||
function mycallb(obj) {
|
||||
var me=obj;
|
||||
this.invoke=function (respObj) {
|
||||
try
|
||||
{
|
||||
var id = respObj.Body[0].deleteProjektRessourceResponse[0].message[0].Text;
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
var fehler = respObj.Body[0].Fault[0].faultstring[0].Text;
|
||||
alert('Fehler: '+fehler);
|
||||
return;
|
||||
}
|
||||
me.RefreshRessource();
|
||||
}
|
||||
}
|
||||
var cb=new mycallb(this);
|
||||
|
||||
SOAPClient.SendRequest(sr,cb.invoke);
|
||||
|
||||
}
|
||||
catch(e)
|
||||
{
|
||||
debug("Ressource load failed with exception: "+e);
|
||||
}
|
||||
|
||||
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
<method name="LoadRessourceTree">
|
||||
<parameter name="projekt_kurzbz"/>
|
||||
<parameter name="projektphase_id"/>
|
||||
|
||||
@@ -513,7 +513,66 @@ class ressource extends basis_db
|
||||
$this->errorsmg = 'Fehler beim Laden';
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Löscht eine Ressource zu Projekt Zuordnung
|
||||
* @param type $ressource_id
|
||||
* @param type $projekt_kurzbz
|
||||
* @return boolean
|
||||
*/
|
||||
public function deleteFromProjekt($ressource_id, $projekt_kurzbz)
|
||||
{
|
||||
if($ressource_id == '' || !is_numeric($ressource_id))
|
||||
{
|
||||
$this->errormsg = 'Ressource Id ist keine gültige Zahl';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry="DELETE FROM fue.tbl_projekt_ressource WHERE ressource_id =".$this->db_add_param($ressource_id, FHC_INTEGER, false)."
|
||||
AND projekt_kurzbz=".$this->db_add_param($projekt_kurzbz, FHC_STRING, false).';';
|
||||
|
||||
if($this->db_query($qry))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Löschen der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Löscht eine Ressource zu Phase Zuordnung
|
||||
* @param type $ressource_id
|
||||
* @param type $projekt_kurzbz
|
||||
* @return boolean
|
||||
*/
|
||||
public function deleteFromPhase($ressource_id, $projektphase_id)
|
||||
{
|
||||
if($ressource_id == '' || !is_numeric($ressource_id))
|
||||
{
|
||||
$this->errormsg = 'Ressource Id ist keine gültige Zahl';
|
||||
return false;
|
||||
}
|
||||
|
||||
if($projektphase_id == '' || !is_numeric($projektphase_id))
|
||||
{
|
||||
$this->errormsg = 'Ressource Id ist keine gültige Zahl';
|
||||
return false;
|
||||
}
|
||||
|
||||
$qry="DELETE FROM fue.tbl_projekt_ressource WHERE ressource_id =".$this->db_add_param($ressource_id, FHC_INTEGER, false)."
|
||||
AND projektphase_id=".$this->db_add_param($projektphase_id, FHC_INTEGER, false).';';
|
||||
|
||||
if($this->db_query($qry))
|
||||
return true;
|
||||
else
|
||||
{
|
||||
$this->errormsg = 'Fehler beim Löschen der Daten';
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -33,6 +33,7 @@ require_once('../include/benutzerberechtigung.class.php');
|
||||
|
||||
$SOAPServer = new SoapServer(APP_ROOT."/soap/ressource_projekt.wsdl.php?".microtime());
|
||||
$SOAPServer->addFunction("saveProjektRessource");
|
||||
$SOAPServer->addFunction("deleteProjektRessource");
|
||||
$SOAPServer->handle();
|
||||
|
||||
// WSDL Chache auf aus
|
||||
@@ -79,6 +80,47 @@ function saveProjektRessource($username, $passwort, $projektRessource)
|
||||
else
|
||||
return new SoapFault("Server", $ressource->errormsg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Löscht entweder eine Projekt zu Ressource oder Phase zu Ressource Zuordnung
|
||||
* @param type $username
|
||||
* @param type $passwort
|
||||
* @param type $projektRessource
|
||||
* @return \SoapFault
|
||||
*/
|
||||
function deleteProjektRessource($username, $passwort, $projektRessource)
|
||||
{
|
||||
if(!$user = check_user($username, $passwort))
|
||||
return new SoapFault ("Server", "Invalid Credentials");
|
||||
|
||||
$recht = new benutzerberechtigung();
|
||||
$recht->getBerechtigungen($user);
|
||||
|
||||
// if(!$rechte->isBerechtigt('planner', null, 'sui'))
|
||||
// return new SoapFault("Server", "Sie haben keine Berechtigung zum Speichern von Projekten.");
|
||||
|
||||
$ressource = new ressource();
|
||||
|
||||
if($projektRessource->projektphase_id != '')
|
||||
{
|
||||
// von Projektphase löschen
|
||||
if($ressource->deleteFromPhase($projektRessource->ressource_id, $projektRessource->projektphase_id))
|
||||
return "Erfolg";
|
||||
else
|
||||
return "Fehler beim Löschen";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// von Projekt löschen
|
||||
if($ressource->deleteFromProjekt($projektRessource->ressource_id, $projektRessource->projekt_kurzbz))
|
||||
return "Erfolg";
|
||||
else
|
||||
return "Fehler beim Löschen";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
@@ -33,11 +33,25 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<wsdl:part name="message" type="xsd:string"></wsdl:part>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:message name="DeleteProjektRessourceRequest">
|
||||
<wsdl:part name="username" type="xsd:string" minOccurs="0"></wsdl:part>
|
||||
<wsdl:part name="passwort" type="xsd:string" minOccurs="0"></wsdl:part>
|
||||
<wsdl:part name="projektRessource" type="tns:projektRessource"></wsdl:part>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:message name="DeleteProjektRessourceResponse">
|
||||
<wsdl:part name="message" type="xsd:string"></wsdl:part>
|
||||
</wsdl:message>
|
||||
|
||||
<wsdl:portType name="ConfigPortType" >
|
||||
<wsdl:operation name="saveProjektRessource">
|
||||
<wsdl:input message="tns:SaveProjektRessourceRequest"></wsdl:input>
|
||||
<wsdl:output message="tns:SaveProjektRessourceResponse"></wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="deleteProjektRessource">
|
||||
<wsdl:input message="tns:DeleteProjektRessourceRequest"></wsdl:input>
|
||||
<wsdl:output message="tns:DeleteProjektRessourceResponse"></wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
|
||||
<wsdl:binding name="ConfigBinding" type="tns:ConfigPortType">
|
||||
@@ -51,6 +65,15 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
|
||||
<soap:body use="encoded" namespace="http://localhost/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="deleteProjektRessource">
|
||||
<soap:operation soapAction="<?php echo APP_ROOT."soap/deleteProjektRessource";?>" />
|
||||
<wsdl:input>
|
||||
<soap:body use="encoded" namespace="http://localhost/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<soap:body use="encoded" namespace="http://localhost/soap/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
|
||||
<wsdl:service name="ProjektRessource">
|
||||
|
||||
Reference in New Issue
Block a user