diff --git a/content/projekt/projekt.overlay.js.php b/content/projekt/projekt.overlay.js.php index fcb511f00..19fe9e2e1 100644 --- a/content/projekt/projekt.overlay.js.php +++ b/content/projekt/projekt.overlay.js.php @@ -149,12 +149,22 @@ function onselectProjekt() var beginn=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#beginn" )); var ende=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#ende" )); var budget=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#budget" )); - var farbe=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#farbe" )); - var aufwand_pt=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#aufwand_pt" )); + var farbe=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#farbe" )); + var aufwand_pt=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#aufwand_pt" )); var anzahl_ma=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#anzahl_ma" )); var aufwandstyp_kurzbz=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#aufwandstyp_kurzbz" )); - - //Daten den Feldern zuweisen + var zeitaufzeichnung=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#zeitaufzeichnung" )); + + if (!zeitaufzeichnung) + { + zeitaufzeichnung='Nein'; + } + else + { + zeitaufzeichnung='Ja'; + } + + //Daten den Feldern zuweisen document.getElementById('textbox-projekt-detail-projekt_kurzbz').value=projekt_kurzbz; //document.getElementById('menulist-projekt-detail-oe_kurzbz').value=oe_kurzbz; @@ -166,9 +176,14 @@ function onselectProjekt() document.getElementById('textbox-projekt-detail-ende').value=ende; document.getElementById('textbox-projekt-detail-budget').value=budget; document.getElementById('textbox-projekt-detail-farbe').value=farbe; - document.getElementById('checkbox-projekt-detail-neu').checked=false; - document.getElementById('textbox-projekt-anzahl_ma').value=anzahl_ma; + document.getElementById('checkbox-projekt-detail-neu').checked=false; + document.getElementById('textbox-projekt-anzahl_ma').value=anzahl_ma; document.getElementById('textbox-projekt-aufwand_pt').value=aufwand_pt; + if(zeitaufzeichnung=='Nein') + document.getElementById('checkbox-projekt-detail-zeitaufzeichnung').checked=false; + else + document.getElementById('checkbox-projekt-detail-zeitaufzeichnung').checked=true; + MenulistSelectItemOnValue('menulist-projekt-detail-aufwandstyp', aufwandstyp_kurzbz); @@ -197,12 +212,13 @@ function saveProjektDetail() beginn = document.getElementById('textbox-projekt-detail-beginn').iso; ende = document.getElementById('textbox-projekt-detail-ende').iso; budget = document.getElementById('textbox-projekt-detail-budget').value; - farbe = document.getElementById('textbox-projekt-detail-farbe').value; + farbe = document.getElementById('textbox-projekt-detail-farbe').value; neu = document.getElementById('checkbox-projekt-detail-neu').checked; - aufwandstyp_kurzbz = MenulistGetSelectedValue('menulist-projekt-detail-aufwandstyp'); - anzahl_ma = document.getElementById('textbox-projekt-anzahl_ma').value; + aufwandstyp_kurzbz = MenulistGetSelectedValue('menulist-projekt-detail-aufwandstyp'); + anzahl_ma = document.getElementById('textbox-projekt-anzahl_ma').value; aufwand_pt = document.getElementById('textbox-projekt-aufwand_pt').value; - + zeitaufzeichnung = document.getElementById('checkbox-projekt-detail-zeitaufzeichnung').checked; + var soapBody = new SOAPObject("saveProjekt"); //soapBody.appendChild(new SOAPObject("username")).val('joe'); //soapBody.appendChild(new SOAPObject("passwort")).val('waschl'); @@ -217,14 +233,28 @@ function saveProjektDetail() projekt.appendChild(new SOAPObject("ende")).val(ende); projekt.appendChild(new SOAPObject("budget")).val(budget); projekt.appendChild(new SOAPObject("farbe")).val(farbe); - projekt.appendChild(new SOAPObject("aufwandstyp_kurzbz")).val(aufwandstyp_kurzbz); - projekt.appendChild(new SOAPObject("anzahl_ma")).val(anzahl_ma); + projekt.appendChild(new SOAPObject("aufwandstyp_kurzbz")).val(aufwandstyp_kurzbz); + projekt.appendChild(new SOAPObject("anzahl_ma")).val(anzahl_ma); projekt.appendChild(new SOAPObject("aufwand_pt")).val(aufwand_pt); - + + if(zeitaufzeichnung) + { + projekt.appendChild(new SOAPObject("zeitaufzeichnung")).val('true'); + } + else + { + projekt.appendChild(new SOAPObject("zeitaufzeichnung")).val('false'); + } + if(neu) + { projekt.appendChild(new SOAPObject("neu")).val('true'); - else + } + else + { projekt.appendChild(new SOAPObject("neu")).val('false'); + } + soapBody.appendChild(projekt); var sr = new SOAPRequest("saveProjekt",soapBody); @@ -342,9 +372,9 @@ function ProjektDetailReset() document.getElementById('textbox-projekt-detail-beschreibung').value=''; document.getElementById('textbox-projekt-detail-beginn').value=''; document.getElementById('textbox-projekt-detail-ende').value=''; - document.getElementById('textbox-projekt-detail-budget').value=''; - document.getElementById('textbox-projekt-anzahl_ma').value=''; - document.getElementById('textbox-projekt-aufwand_pt').value=''; + document.getElementById('textbox-projekt-detail-budget').value=''; + document.getElementById('textbox-projekt-anzahl_ma').value=''; + document.getElementById('textbox-projekt-aufwand_pt').value=''; document.getElementById('textbox-projekt-detail-projektwuerdigkeit').value=''; } @@ -362,7 +392,7 @@ function ProjektDisableFields(val) document.getElementById('textbox-projekt-detail-budget').disabled=val; document.getElementById('textbox-projekt-detail-farbe').disabled=val; document.getElementById('button-projekt-detail-speichern').disabled=val; - document.getElementById('menulist-projekt-detail-aufwandstyp').disabled=val; + document.getElementById('menulist-projekt-detail-aufwandstyp').disabled=val; document.getElementById('textbox-projekt-anzahl_ma').disabled=val; document.getElementById('textbox-projekt-aufwand_pt').disabled=val; } @@ -385,65 +415,65 @@ function ProjektNeu() document.getElementById('textbox-projekt-detail-projekt_kurzbz').disabled=false; document.getElementById('checkbox-projekt-detail-neu').checked=true; document.getElementById('caption-projekt-detail').label='Neues Projekt'; - document.getElementById('textbox-projekt-detail-farbe').value='#FF0000'; - document.getElementById('textbox-projekt-anzahl_ma').disabled=false; + document.getElementById('textbox-projekt-detail-farbe').value='#FF0000'; + document.getElementById('textbox-projekt-anzahl_ma').disabled=false; document.getElementById('textbox-projekt-aufwand_pt').disabled=false; //Detail Tab auswaehlen document.getElementById('tabs-projekt-main').selectedItem=document.getElementById('tab-projekt-detail'); } - -function makeProjektAnalyse(){ - var ergebnis_el = document.getElementById('textbox-projekt-detail-projektwuerdigkeit'); - ergebnis_el.value=""; - var anzahl_ma = document.getElementById('textbox-projekt-anzahl_ma').value; - var aufwand_pt = document.getElementById('textbox-projekt-aufwand_pt').value; - var budget = document.getElementById('textbox-projekt-detail-budget').value; + +function makeProjektAnalyse(){ + var ergebnis_el = document.getElementById('textbox-projekt-detail-projektwuerdigkeit'); + ergebnis_el.value=""; + var anzahl_ma = document.getElementById('textbox-projekt-anzahl_ma').value; + var aufwand_pt = document.getElementById('textbox-projekt-aufwand_pt').value; + var budget = document.getElementById('textbox-projekt-detail-budget').value; var beginn = document.getElementById('textbox-projekt-detail-beginn').value; - var ende = document.getElementById('textbox-projekt-detail-ende').value; - - if (!anzahl_ma || !aufwand_pt || !budget || !beginn || !ende) - { - ergebnis_el.value = 'Angaben unvollständig'; - } - else - { - var beginn_arr = beginn.split("."); - var ende_arr = ende.split("."); - var date1 = new Date(beginn_arr[2],beginn_arr[1],beginn_arr[0]); - var date2 = new Date(ende_arr[2],ende_arr[1],ende_arr[0]); - - var dauerTage = parseInt((date2 - date1) / (1000 * 60 * 60 * 24)); - - var punkte_gesamt = 0; - var projekttyp = ''; - if (aufwand_pt < 10) punkte_gesamt += 1; - else if (aufwand_pt <= 50) punkte_gesamt += 4; - else if (aufwand_pt <= 250) punkte_gesamt += 8; - else punkte_gesamt += 8; - - if (anzahl_ma < 3) punkte_gesamt += 1; - else if (anzahl_ma <= 5) punkte_gesamt += 3; - else if (anzahl_ma <= 20) punkte_gesamt += 6; - else punkte_gesamt += 9; - - if (budget < 5000) punkte_gesamt += 1; - else if (budget <= 25000) punkte_gesamt += 2; - else if (budget <= 500000) punkte_gesamt += 4; - else punkte_gesamt += 6; - - if (dauerTage < 30) punkte_gesamt += 0; - else if (dauerTage <= 90) punkte_gesamt += 4; - else if (dauerTage <= 360) punkte_gesamt += 5; - else punkte_gesamt += 7; - - if (punkte_gesamt <= 8) projekttyp = 'Vorhaben'; - else if (punkte_gesamt <= 15) projekttyp = 'Kleinprojekt'; - else if (punkte_gesamt <= 30) projekttyp = 'Projekt'; - else projekttyp = 'Großrojekt'; - ergebnis_el.value = projekttyp; - } -} + var ende = document.getElementById('textbox-projekt-detail-ende').value; + + if (!anzahl_ma || !aufwand_pt || !budget || !beginn || !ende) + { + ergebnis_el.value = 'Angaben unvollständig'; + } + else + { + var beginn_arr = beginn.split("."); + var ende_arr = ende.split("."); + var date1 = new Date(beginn_arr[2],beginn_arr[1],beginn_arr[0]); + var date2 = new Date(ende_arr[2],ende_arr[1],ende_arr[0]); + + var dauerTage = parseInt((date2 - date1) / (1000 * 60 * 60 * 24)); + + var punkte_gesamt = 0; + var projekttyp = ''; + if (aufwand_pt < 10) punkte_gesamt += 1; + else if (aufwand_pt <= 50) punkte_gesamt += 4; + else if (aufwand_pt <= 250) punkte_gesamt += 8; + else punkte_gesamt += 8; + + if (anzahl_ma < 3) punkte_gesamt += 1; + else if (anzahl_ma <= 5) punkte_gesamt += 3; + else if (anzahl_ma <= 20) punkte_gesamt += 6; + else punkte_gesamt += 9; + + if (budget < 5000) punkte_gesamt += 1; + else if (budget <= 25000) punkte_gesamt += 2; + else if (budget <= 500000) punkte_gesamt += 4; + else punkte_gesamt += 6; + + if (dauerTage < 30) punkte_gesamt += 0; + else if (dauerTage <= 90) punkte_gesamt += 4; + else if (dauerTage <= 360) punkte_gesamt += 5; + else punkte_gesamt += 7; + + if (punkte_gesamt <= 8) projekttyp = 'Vorhaben'; + else if (punkte_gesamt <= 15) projekttyp = 'Kleinprojekt'; + else if (punkte_gesamt <= 30) projekttyp = 'Projekt'; + else projekttyp = 'Großrojekt'; + ergebnis_el.value = projekttyp; + } +} function ProjektPrintStatusbericht() { diff --git a/content/projekt/projektdetail.overlay.xul.php b/content/projekt/projektdetail.overlay.xul.php index 9c814954f..fda08baa5 100644 --- a/content/projekt/projektdetail.overlay.xul.php +++ b/content/projekt/projektdetail.overlay.xul.php @@ -164,6 +164,15 @@ echo ''; + + + diff --git a/content/projekt/projektphase.overlay.js.php b/content/projekt/projektphase.overlay.js.php index c5f3a9eef..c3114d1e6 100644 --- a/content/projekt/projektphase.overlay.js.php +++ b/content/projekt/projektphase.overlay.js.php @@ -161,7 +161,16 @@ function onselectTreeProjektphase() var budget=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#budget" )); var personentage=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#personentage" )); var farbe=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#farbe" )); - + var zeitaufzeichnung=getTargetHelper(dsource,subject,rdfService.GetResource( predicateNS + "#zeitaufzeichnung" )); + + if (!zeitaufzeichnung) + { + zeitaufzeichnung='Nein'; + } + else + { + zeitaufzeichnung='Ja'; + } //alert(typ); //Daten den Feldern zuweisen @@ -180,6 +189,11 @@ function onselectTreeProjektphase() document.getElementById('textbox-projektphase-detail-personentage').value=personentage; document.getElementById('textbox-projektphase-detail-farbe').value=farbe; document.getElementById('checkbox-projektphase-detail-neu').checked=false; + if(zeitaufzeichnung=='Nein') + document.getElementById('checkbox-projektphase-detail-zeitaufzeichnung').checked=false; + else + document.getElementById('checkbox-projektphase-detail-zeitaufzeichnung').checked=true; + MenulistSelectItemOnValue('menulist-projektphase-detail-projektphase_fk', projektphase_fk); MenulistSelectItemOnValue('menulist-projektphase-detail-ressource', ressource_id); @@ -233,6 +247,7 @@ function saveProjektphaseDetail() var personentage = document.getElementById('textbox-projektphase-detail-personentage').value; var farbe = document.getElementById('textbox-projektphase-detail-farbe').value; var neu = document.getElementById('checkbox-projektphase-detail-neu').checked; + var zeitaufzeichnung = document.getElementById('checkbox-projektphase-detail-zeitaufzeichnung').checked; var soapBody = new SOAPObject("saveProjektphase"); //soapBody.appendChild(new SOAPObject("username")).val('joe'); @@ -251,10 +266,22 @@ function saveProjektphaseDetail() phase.appendChild(new SOAPObject("budget")).val(budget); phase.appendChild(new SOAPObject("personentage")).val(personentage); phase.appendChild(new SOAPObject("farbe")).val(farbe); - if(neu) - phase.appendChild(new SOAPObject("neu")).val('true'); + if(zeitaufzeichnung) + { + phase.appendChild(new SOAPObject("zeitaufzeichnung")).val('true'); + } else + { + phase.appendChild(new SOAPObject("zeitaufzeichnung")).val('false'); + } + if(neu) + { + phase.appendChild(new SOAPObject("neu")).val('true'); + } + else + { phase.appendChild(new SOAPObject("neu")).val('false'); + } phase.appendChild(new SOAPObject("user")).val(getUsername()); soapBody.appendChild(phase); diff --git a/content/projekt/projektphasedetail.overlay.xul.php b/content/projekt/projektphasedetail.overlay.xul.php index f7b4dcb5b..eeadf366f 100644 --- a/content/projekt/projektphasedetail.overlay.xul.php +++ b/content/projekt/projektphasedetail.overlay.xul.php @@ -143,6 +143,15 @@ echo ''; + + + diff --git a/include/projekt.class.php b/include/projekt.class.php index 9d1250982..389d7140c 100644 --- a/include/projekt.class.php +++ b/include/projekt.class.php @@ -45,8 +45,9 @@ class projekt extends basis_db public $updatevon; // string public $budget; public $farbe; - public $anzahl_ma; // integer - public $aufwand_pt; // integer + public $anzahl_ma; // integer + public $aufwand_pt; // integer + public $zeitaufzeichnung; //bool public $sap_project_id; @@ -71,8 +72,10 @@ class projekt extends basis_db { $qry = "SELECT * FROM fue.tbl_projekt WHERE projekt_kurzbz=" . $this->db_add_param($projekt_kurzbz); - if ($this->db_query($qry)) { - if ($row = $this->db_fetch_object()) { + if ($this->db_query($qry)) + { + if ($row = $this->db_fetch_object()) + { $this->projekt_kurzbz = $row->projekt_kurzbz; $this->nummer = $row->nummer; $this->titel = $row->titel; @@ -84,6 +87,7 @@ class projekt extends basis_db $this->farbe = $row->farbe; $this->anzahl_ma = $row->anzahl_ma; $this->aufwand_pt = $row->aufwand_pt; + $this->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung); return true; } @@ -120,8 +124,10 @@ class projekt extends basis_db $qry .= ' AND oe_kurzbz=' . $this->db_add_param($oe); $qry .= ' ORDER BY oe_kurzbz;'; - if ($this->db_query($qry)) { - while ($row = $this->db_fetch_object()) { + if ($this->db_query($qry)) + { + while ($row = $this->db_fetch_object()) + { $obj = new projekt(); $obj->projekt_kurzbz = $row->projekt_kurzbz; @@ -136,6 +142,7 @@ class projekt extends basis_db $obj->aufwandstyp_kurzbz = $row->aufwandstyp_kurzbz; $obj->anzahl_ma = $row->anzahl_ma; $obj->aufwand_pt = $row->aufwand_pt; + $obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung); $this->result[] = $obj; } @@ -161,9 +168,11 @@ class projekt extends basis_db if (!is_null($oe)) $qry .= " AND oe_kurzbz=" . $this->db_add_param($oe); $qry .= ' ORDER BY oe_kurzbz;'; - //echo $qry; - if ($this->db_query($qry)) { - while ($row = $this->db_fetch_object()) { + + if ($this->db_query($qry)) + { + while ($row = $this->db_fetch_object()) + { $obj = new projekt(); $obj->projekt_kurzbz = $row->projekt_kurzbz; @@ -177,6 +186,7 @@ class projekt extends basis_db $obj->farbe = $row->farbe; $obj->anzahl_ma = $row->anzahl_ma; $obj->aufwand_pt = $row->aufwand_pt; + $obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung); $this->result[] = $obj; } @@ -189,7 +199,6 @@ class projekt extends basis_db } } - /** * Laedt die Projeke einer Organisationseinheit * @param string $oe Organisationseinheit. @@ -201,9 +210,11 @@ class projekt extends basis_db if (!is_null($oe)) $qry .= " WHERE oe_kurzbz=" . $this->db_add_param($oe); $qry .= ' ORDER BY oe_kurzbz;'; - //echo $qry; - if ($this->db_query($qry)) { - while ($row = $this->db_fetch_object()) { + + if ($this->db_query($qry)) + { + while ($row = $this->db_fetch_object()) + { $obj = new projekt(); $obj->projekt_kurzbz = $row->projekt_kurzbz; @@ -218,6 +229,7 @@ class projekt extends basis_db $obj->aufwandstyp_kurzbz = $row->aufwandstyp_kurzbz; $obj->anzahl_ma = $row->anzahl_ma; $obj->aufwand_pt = $row->aufwand_pt; + $obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung); $this->result[] = $obj; } @@ -237,21 +249,26 @@ class projekt extends basis_db protected function validate() { //Gesamtlaenge pruefen - if ($this->projekt_kurzbz == null) { + if ($this->projekt_kurzbz == null) + { $this->errormsg = 'Projekt kurzbz darf nicht NULL sein!'; } - if ($this->oe_kurzbz == null) { + if ($this->oe_kurzbz == null) + { $this->errormsg = 'OE kurbz darf nicht NULL sein!'; } - if (mb_strlen($this->projekt_kurzbz) > 16) { + if (mb_strlen($this->projekt_kurzbz) > 16) + { $this->errormsg = 'Projektyp_kurzbz darf nicht länger als 16 Zeichen sein'; return false; } - if (mb_strlen($this->nummer) > 8) { + if (mb_strlen($this->nummer) > 8) + { $this->errormsg = 'Nummer darf nicht länger als 8 Zeichen sein'; return false; } - if (mb_strlen($this->titel) > 256) { + if (mb_strlen($this->titel) > 256) + { $this->errormsg = 'Titel darf nicht länger als 256 Zeichen sein'; return false; } @@ -276,49 +293,55 @@ class projekt extends basis_db if ($new == null) $new = $this->new; - if ($new) { + if ($new) + { //Neuen Datensatz einfuegen - $qry = 'INSERT INTO fue.tbl_projekt (projekt_kurzbz, nummer, titel,beschreibung, beginn, ende, budget, farbe, oe_kurzbz, aufwand_pt, anzahl_ma, aufwandstyp_kurzbz) VALUES(' . - $this->db_add_param($this->projekt_kurzbz) . ', ' . - $this->db_add_param($this->nummer) . ', ' . - $this->db_add_param($this->titel) . ', ' . - $this->db_add_param($this->beschreibung) . ', ' . - $this->db_add_param($this->beginn) . ', ' . - $this->db_add_param($this->ende) . ', ' . - $this->db_add_param($this->budget) . ', ' . - $this->db_add_param($this->farbe) . ', ' . - $this->db_add_param($this->oe_kurzbz) . ',' . - $this->db_add_param($this->aufwand_pt) . ',' . - $this->db_add_param($this->anzahl_ma) . ',' . - $this->db_add_param($this->aufwandstyp_kurzbz) . ');'; + $qry = 'INSERT INTO fue.tbl_projekt (projekt_kurzbz, nummer, titel,beschreibung, beginn, ende, budget, farbe, oe_kurzbz, aufwand_pt, anzahl_ma, aufwandstyp_kurzbz, zeitaufzeichnung) VALUES('. + $this->db_add_param($this->projekt_kurzbz).', '. + $this->db_add_param($this->nummer).', '. + $this->db_add_param($this->titel).', '. + $this->db_add_param($this->beschreibung).', '. + $this->db_add_param($this->beginn).', '. + $this->db_add_param($this->ende).', '. + $this->db_add_param($this->budget).', '. + $this->db_add_param($this->farbe).', '. + $this->db_add_param($this->oe_kurzbz).','. + $this->db_add_param($this->aufwand_pt).','. + $this->db_add_param($this->anzahl_ma).','. + $this->db_add_param($this->aufwandstyp_kurzbz).', '. + $this->db_add_param($this->zeitaufzeichnung,FHC_BOOLEAN).');'; } else { //Updaten des bestehenden Datensatzes - $qry = 'UPDATE fue.tbl_projekt SET ' . - 'projekt_kurzbz=' . $this->db_add_param($this->projekt_kurzbz) . ', ' . - 'nummer=' . $this->db_add_param($this->nummer) . ', ' . - 'titel=' . $this->db_add_param($this->titel) . ', ' . - 'beschreibung=' . $this->db_add_param($this->beschreibung) . ', ' . - 'beginn=' . $this->db_add_param($this->beginn) . ', ' . - 'ende=' . $this->db_add_param($this->ende) . ', ' . - 'budget=' . $this->db_add_param($this->budget) . ', ' . - 'farbe=' . $this->db_add_param($this->farbe) . ', ' . - 'oe_kurzbz=' . $this->db_add_param($this->oe_kurzbz) . ', ' . - 'anzahl_ma=' . $this->db_add_param($this->anzahl_ma) . ', ' . - 'aufwand_pt=' . $this->db_add_param($this->aufwand_pt) . ', ' . - 'aufwandstyp_kurzbz=' . $this->db_add_param($this->aufwandstyp_kurzbz) . ' ' . - 'WHERE projekt_kurzbz=' . $this->db_add_param($this->projekt_kurzbz) . ';'; + $qry = 'UPDATE fue.tbl_projekt SET '. + 'projekt_kurzbz='.$this->db_add_param($this->projekt_kurzbz).', '. + 'nummer='.$this->db_add_param($this->nummer).', '. + 'titel='.$this->db_add_param($this->titel).', '. + 'beschreibung='.$this->db_add_param($this->beschreibung).', '. + 'beginn='.$this->db_add_param($this->beginn).', '. + 'ende='.$this->db_add_param($this->ende).', '. + 'budget='.$this->db_add_param($this->budget).', '. + 'farbe='.$this->db_add_param($this->farbe).', '. + 'oe_kurzbz='.$this->db_add_param($this->oe_kurzbz).', '. + 'anzahl_ma='.$this->db_add_param($this->anzahl_ma).', '. + 'aufwand_pt='.$this->db_add_param($this->aufwand_pt).', '. + 'aufwandstyp_kurzbz='.$this->db_add_param($this->aufwandstyp_kurzbz).', '. + 'zeitaufzeichnung='.$this->db_add_param($this->zeitaufzeichnung,FHC_BOOLEAN).' '. + 'WHERE projekt_kurzbz='.$this->db_add_param($this->projekt_kurzbz).';'; } - if ($this->db_query($qry)) { + if ($this->db_query($qry)) + { return true; } else { - $this->errormsg = 'Fehler beim Speichern der Daten'; + $this->getErrorMsg(); + var_dump($this->getErrorMsg()); + $this->errormsg = $this->getErrorMsg(); return false; } } @@ -332,7 +355,8 @@ class projekt extends basis_db { $qry = "DELETE FROM lehre.tbl_projek WHERE projekt_kurzbz=" . $this->db_add_param($projekt_kurzbz); - if ($this->db_query($qry)) { + if ($this->db_query($qry)) + { return true; } else @@ -366,29 +390,33 @@ class projekt extends basis_db )"; if ($projektphasen == true) + { $qry .= "UNION - SELECT DISTINCT - tbl_projekt.* - FROM - fue.tbl_projektphase - JOIN fue.tbl_projekt USING (projekt_kurzbz) - JOIN fue.tbl_projekt_ressource USING (projektphase_id) - JOIN fue.tbl_ressource ON (tbl_ressource.ressource_id=tbl_projekt_ressource.ressource_id) - WHERE - ( - ( - (tbl_projekt.beginn<=now() or tbl_projekt.beginn is null) - AND (tbl_projekt.ende + interval '1 month 1 day' >=now() OR tbl_projekt.ende is null) - ) OR ( - (tbl_projektphase.start<=now() or tbl_projektphase.start is null) - AND (tbl_projektphase.ende + interval '1 month 1 day' >=now() OR tbl_projektphase.ende is null) - ) - ) - AND mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid); + SELECT DISTINCT + tbl_projekt.* + FROM + fue.tbl_projektphase + JOIN fue.tbl_projekt USING (projekt_kurzbz) + JOIN fue.tbl_projekt_ressource USING (projektphase_id) + JOIN fue.tbl_ressource ON (tbl_ressource.ressource_id=tbl_projekt_ressource.ressource_id) + WHERE + ( + ( + (tbl_projekt.beginn<=now() or tbl_projekt.beginn is null) + AND (tbl_projekt.ende + interval '1 month 1 day' >=now() OR tbl_projekt.ende is null) + ) OR ( + (tbl_projektphase.start<=now() or tbl_projektphase.start is null) + AND (tbl_projektphase.ende + interval '1 month 1 day' >=now() OR tbl_projektphase.ende is null) + ) + ) + AND mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid); + } - if ($result = $this->db_query($qry)) { - while ($row = $this->db_fetch_object($result)) { + if ($result = $this->db_query($qry)) + { + while ($row = $this->db_fetch_object($result)) + { $obj = new projekt(); $obj->projekt_kurzbz = $row->projekt_kurzbz; @@ -398,6 +426,7 @@ class projekt extends basis_db $obj->beginn = $row->beginn; $obj->ende = $row->ende; $obj->oe_kurzbz = $row->oe_kurzbz; + $obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung); $this->result[] = $obj; } @@ -411,7 +440,7 @@ class projekt extends basis_db } /** - * Liefert Ein Array mit Porjekten von allen Projekten des Mitarbeiters mit UID. + * Liefert Ein Array mit Projekten von allen Projekten des Mitarbeiters mit UID. * Optional auch mit den Zuteilungen zu Projektphasen. * @param string $mitarbeiter_uid MitarbeiterUID. * @param bool $projektphasen Default false. Wenn true, werden auch Zuteilungen zu Projektphasen geliefert. @@ -501,8 +530,10 @@ class projekt extends basis_db $qry .= "AND mitarbeiter_uid=" . $this->db_add_param($mitarbeiter_uid); - if ($result = $this->db_query($qry)) { - while ($row = $this->db_fetch_object($result)) { + if ($result = $this->db_query($qry)) + { + while ($row = $this->db_fetch_object($result)) + { $obj = new projekt(); $obj->projekt_kurzbz = $row->projekt_kurzbz; @@ -534,8 +565,10 @@ class projekt extends basis_db join wawi.tbl_projekt_bestellung USING (projekt_kurzbz) where bestellung_id= " . $this->db_add_param($bestellung_id); - if ($this->db_query($qry)) { - if ($row = $this->db_fetch_object()) { + if ($this->db_query($qry)) + { + if ($row = $this->db_fetch_object()) + { $this->projekt_kurzbz = $row->projekt_kurzbz; $this->nummer = $row->nummer; $this->titel = $row->titel; @@ -547,6 +580,7 @@ class projekt extends basis_db $this->farbe = $row->farbe; $this->anzahl_ma = $row->anzahl_ma; $this->aufwand_pt = $row->aufwand_pt; + $this->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung); return true; } @@ -596,7 +630,7 @@ class projekt extends basis_db } catch (Exception $e) { - error_log('Exception abgefangen: ', $e->getMessage(), "\n"); + error_log('Exception abgefangen: ', $e->getMessage(), "\n"); } } diff --git a/include/projektphase.class.php b/include/projektphase.class.php index 21d50fb68..6e8b53b6d 100644 --- a/include/projektphase.class.php +++ b/include/projektphase.class.php @@ -19,7 +19,7 @@ * Karl Burkhart */ /** - * Klasse projekttask + * Klasse projektphase * @create 2011-05-23 */ require_once(dirname(__FILE__).'/basis_db.class.php'); @@ -48,6 +48,7 @@ class projektphase extends basis_db public $insertvon; // bigint public $updateamum; // timestamp public $updatevon; // bigint + public $zeitaufzeichnung; // bool public $project_task_id; @@ -93,7 +94,7 @@ class projektphase extends basis_db $this->start = $row->start; $this->ende = $row->ende; $this->personentage = $row->personentage; - $this->farbe = $row->farbe; + $this->farbe = $row->farbe; $this->budget = $row->budget; $this->ressource_id = $row->ressource_id; $this->ressource_bezeichnung = $row->ressource_bezeichnung; @@ -101,6 +102,7 @@ class projektphase extends basis_db $this->insertvon = $row->insertvon; $this->updateamum = $row->updateamum; $this->updatevon = $row->updatevon; + $this->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung); return true; } else @@ -135,7 +137,6 @@ class projektphase extends basis_db WHERE p.projektphase_fk=tasks.projektphase_fk ) SELECT * FROM tasks) and projektphase_id not in (".$this->db_add_param($projektphase_id, FHC_INTEGER).")"; - //echo "\n".$qry."\n"; if($this->db_query($qry)) { @@ -152,17 +153,18 @@ class projektphase extends basis_db $obj->start = $row->start; $obj->ende = $row->ende; //$obj->personentage = $row->personentage; - $obj->farbe = $row->farbe; + $obj->farbe = $row->farbe; $obj->budget = $row->budget; $obj->ressource_id = $row->ressource_id; $obj->insertamum = $row->insertamum; $obj->insertvon = $row->insertvon; $obj->updateamum = $row->updateamum; $obj->updatevon = $row->updatevon; + $obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung); $this->result[] = $obj; } - //var_dump($this->result); + return true; } else @@ -184,7 +186,6 @@ class projektphase extends basis_db $qry = "SELECT tbl_projektphase.*, tbl_ressource.bezeichnung AS ressource_bezeichnung FROM fue.tbl_projektphase LEFT OUTER JOIN fue.tbl_ressource USING (ressource_id) WHERE projekt_kurzbz=".$this->db_add_param($projekt_kurzbz); - //echo "\n".$qry."\n"; if(!is_null($foreignkey)) $qry .= " and projektphase_fk is NULL"; @@ -206,7 +207,7 @@ class projektphase extends basis_db $obj->start = $row->start; $obj->ende = $row->ende; //$obj->personentage = $row->personentage; - $obj->farbe = $row->farbe; + $obj->farbe = $row->farbe; $obj->budget = $row->budget; $obj->ressource_id = $row->ressource_id; $obj->ressource_bezeichnung = $row->ressource_bezeichnung; @@ -214,10 +215,10 @@ class projektphase extends basis_db $obj->insertvon = $row->insertvon; $obj->updateamum = $row->updateamum; $obj->updatevon = $row->updatevon; + $obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung); $this->result[] = $obj; } - //var_dump($this->result); return true; } else @@ -227,22 +228,22 @@ class projektphase extends basis_db } } - /** - * Lädt alle Unterphasen zu einem Projekt - * @param type $phase_id - * @return boolean - */ - public function getAllUnterphasen($phase_id) - { - $qry = "SELECT tbl_projektphase.*, tbl_ressource.bezeichnung AS ressource_bezeichung + /** + * Lädt alle Unterphasen zu einem Projekt + * @param type $phase_id + * @return boolean + */ + public function getAllUnterphasen($phase_id) + { + $qry = "SELECT tbl_projektphase.*, tbl_ressource.bezeichnung AS ressource_bezeichung FROM fue.tbl_projektphase LEFT OUTER JOIN fue.tbl_ressource USING (ressource_id) WHERE projektphase_fk =".$this->db_add_param($phase_id, FHC_INTEGER); - if($result = $this->db_query($qry)) - { - while($row = $this->db_fetch_object()) - { - $obj = new projektphase(); + if($result = $this->db_query($qry)) + { + while($row = $this->db_fetch_object()) + { + $obj = new projektphase(); $obj->projekt_kurzbz = $row->projekt_kurzbz; $obj->projektphase_id = $row->projektphase_id; @@ -253,7 +254,7 @@ class projektphase extends basis_db $obj->start = $row->start; $obj->ende = $row->ende; //$obj->personentage = $row->personentage; - $obj->farbe = $row->farbe; + $obj->farbe = $row->farbe; $obj->budget = $row->budget; $obj->ressource_id = $row->ressource_id; $obj->ressource_bezeichnung = $row->ressource_bezeichnung; @@ -261,17 +262,18 @@ class projektphase extends basis_db $obj->insertvon = $row->insertvon; $obj->updateamum = $row->updateamum; $obj->updatevon = $row->updatevon; + $obj->zeitaufzeichnung = $this->db_parse_bool($row->zeitaufzeichnung); $this->result[] = $obj; - } - return true; - } - else - { - $this->errormsg = "Fehler beim laden der Daten"; - return false; - } - } + } + return true; + } + else + { + $this->errormsg = "Fehler beim Laden der Daten"; + return false; + } + } /** * Prueft die Variablen auf Gueltigkeit @@ -320,22 +322,22 @@ class projektphase extends basis_db if($new) { //Neuen Datensatz einfuegen - $qry='BEGIN; INSERT INTO fue.tbl_projektphase (projekt_kurzbz, projektphase_fk, bezeichnung, typ, - beschreibung, start, ende, budget, ressource_id, insertvon, insertamum, updatevon, updateamum, farbe, personentage) VALUES ('. - $this->db_add_param($this->projekt_kurzbz).', '. - $this->db_add_param($this->projektphase_fk).', '. - $this->db_add_param($this->bezeichnung).', '. - $this->db_add_param($this->typ).', '. - $this->db_add_param($this->beschreibung).', '. - $this->db_add_param($this->start).', '. - $this->db_add_param($this->ende).', '. - $this->db_add_param($this->budget).', '. - $this->db_add_param($this->ressource_id).', '. - $this->db_add_param($this->insertvon).', now(), '. - $this->db_add_param($this->updatevon).', now(), '. - $this->db_add_param($this->farbe).', '. - $this->db_add_param($this->personentage).' );'; + beschreibung, start, ende, budget, ressource_id, insertvon, insertamum, updatevon, updateamum, farbe, personentage, zeitaufzeichnung) VALUES ('. + $this->db_add_param($this->projekt_kurzbz).', '. + $this->db_add_param($this->projektphase_fk).', '. + $this->db_add_param($this->bezeichnung).', '. + $this->db_add_param($this->typ).', '. + $this->db_add_param($this->beschreibung).', '. + $this->db_add_param($this->start).', '. + $this->db_add_param($this->ende).', '. + $this->db_add_param($this->budget).', '. + $this->db_add_param($this->ressource_id).', '. + $this->db_add_param($this->insertvon).', now(), '. + $this->db_add_param($this->updatevon).', now(), '. + $this->db_add_param($this->farbe).', '. + $this->db_add_param($this->personentage).', '. + $this->db_add_param($this->zeitaufzeichnung,FHC_BOOLEAN).');'; } else { @@ -350,11 +352,12 @@ class projektphase extends basis_db 'start='.$this->db_add_param($this->start).', '. 'ende='.$this->db_add_param($this->ende).', '. 'budget='.$this->db_add_param($this->budget).', '. - 'ressource_id='.$this->db_add_param($this->ressource_id).', '. - 'farbe='.$this->db_add_param($this->farbe).', '. + 'ressource_id='.$this->db_add_param($this->ressource_id).', '. + 'farbe='.$this->db_add_param($this->farbe).', '. 'personentage='.$this->db_add_param($this->personentage).', '. 'updateamum= now(), '. - 'updatevon='.$this->db_add_param($this->updatevon).' '. + 'updatevon='.$this->db_add_param($this->updatevon).', '. + 'zeitaufzeichnung='.$this->db_add_param($this->zeitaufzeichnung,FHC_BOOLEAN).' '. 'WHERE projektphase_id='.$this->db_add_param($this->projektphase_id, FHC_INTEGER).';'; } @@ -529,7 +532,7 @@ class projektphase extends basis_db * gibt den Fortschritt der Phase in Prozent zurück --> Phasen die auf die übergebene Phase zeigen werden berücksichtigt * @param $projektphase_id */ -public function getFortschritt($projektphase_id) + public function getFortschritt($projektphase_id) { $qry = "Select * from fue.tbl_projektphase phase join fue.tbl_projekttask task using(projektphase_id) diff --git a/rdf/projekt.rdf.php b/rdf/projekt.rdf.php index 386b50fe5..38f4c52de 100644 --- a/rdf/projekt.rdf.php +++ b/rdf/projekt.rdf.php @@ -72,6 +72,7 @@ for ($i=0;$iresult);$i++) '.$projekt->anzahl_ma.' '.$projekt->aufwand_pt.' '.$projekt->aufwandstyp_kurzbz.' + '.$projekt->zeitaufzeichnung.' '."\n"; $sequenz.=''."\n"; diff --git a/rdf/projektphase.rdf.php b/rdf/projektphase.rdf.php index ddd88ef94..dfe3b1f4c 100644 --- a/rdf/projektphase.rdf.php +++ b/rdf/projektphase.rdf.php @@ -61,9 +61,10 @@ if($projektphase_id != '') $oRdf->obj[$i]->setAttribut('fortschritt',$ergebnis); $oRdf->obj[$i]->setAttribut('personentage',$phase->personentage); $oRdf->obj[$i]->setAttribut('farbe',$phase->farbe); - $oRdf->obj[$i]->setAttribut('typ',$phase->typ); + $oRdf->obj[$i]->setAttribut('typ',$phase->typ); $oRdf->obj[$i]->setAttribut('ressource_id',$phase->ressource_id); - + $oRdf->obj[$i]->setAttribut('zeitaufzeichnung',$phase->zeitaufzeichnung); + if($phase->projektphase_fk!='') $oRdf->addSequence($phase->projektphase_id, $phase->projektphase_fk); else @@ -94,7 +95,8 @@ if($projektphase_id != '') $oRdf->obj[$idx]->setAttribut('personentage', ''); $oRdf->obj[$idx]->setAttribut('farbe', ''); $oRdf->obj[$idx]->setAttribut('typ', ''); - + $oRdf->obj[$idx]->setAttribut('zeitaufzeichnung',''); + $oRdf->addSequence('opt'); } @@ -113,7 +115,8 @@ if($projektphase_id != '') $oRdf->obj[$idx]->setAttribut('personentage', $phase->personentage); $oRdf->obj[$idx]->setAttribut('farbe', $phase->farbe); $oRdf->obj[$idx]->setAttribut('typ', $phase->typ); - + $oRdf->obj[$idx]->setAttribut('zeitaufzeichnung',$phase->zeitaufzeichnung); + $oRdf->addSequence($phase->projektphase_id); } @@ -163,7 +166,8 @@ else $oRdf->obj[$idx]->setAttribut('beginn',''); $oRdf->obj[$idx]->setAttribut('ende',''); $oRdf->obj[$idx]->setAttribut('typ','organisationseinheit'); - + $oRdf->obj[$idx]->setAttribut('zeitaufzeichnung',''); + $oRdf->addSequence($projekt->oe_kurzbz); $lastOE=$currentOE; @@ -184,6 +188,8 @@ else $oRdf->obj[$idx]->setAttribut('beginn',$datum_obj->formatDatum($projekt->beginn,'d.m.Y')); $oRdf->obj[$idx]->setAttribut('ende',$datum_obj->formatDatum($projekt->ende,'d.m.Y')); $oRdf->obj[$idx]->setAttribut('typ','projekt'); + $oRdf->obj[$idx]->setAttribut('zeitaufzeichnung',$projekt->zeitaufzeichnung); + $oRdf->addSequence($projekt->oe_kurzbz.'/'.$projekt->projekt_kurzbz, $projekt->oe_kurzbz); @@ -223,6 +229,7 @@ else $oRdf->obj[$idx]->setAttribut('typ',strtolower($projektphase->typ)); $oRdf->obj[$idx]->setAttribut('ressource_bezeichnung',$projektphase->ressource_bezeichnung); $oRdf->obj[$idx]->setAttribut('ressource_id',$projektphase->ressource_id); + $oRdf->obj[$idx]->setAttribut('zeitaufzeichnung',$projektphase->zeitaufzeichnung); if (!is_null($projektphase->projektphase_fk)) $oRdf->addSequence($projekt->oe_kurzbz.'/'.$projekt->projekt_kurzbz.'/'.$projektphase->projektphase_id, $projekt->oe_kurzbz.'/'.$projekt->projekt_kurzbz.'/'.$projektphase->projektphase_fk); else diff --git a/soap/projekt.soap.php b/soap/projekt.soap.php index 6dcfce420..faeefdc2d 100644 --- a/soap/projekt.soap.php +++ b/soap/projekt.soap.php @@ -68,14 +68,27 @@ function saveProjekt($username, $passwort, $projekt) $projektNew->budget = $projekt->budget; $projektNew->farbe = $projekt->farbe; $projektNew->oe_kurzbz = $projekt->oe_kurzbz; - $projektNew->aufwandstyp_kurzbz = $projekt->aufwandstyp_kurzbz; + $projektNew->aufwandstyp_kurzbz = $projekt->aufwandstyp_kurzbz; $projektNew->anzahl_ma = $projekt->anzahl_ma; - $projektNew->aufwand_pt = $projekt->aufwand_pt; + $projektNew->aufwand_pt = $projekt->aufwand_pt; + + if($projekt->zeitaufzeichnung=='true') + { + $projektNew->zeitaufzeichnung = true; + } + else + { + $projektNew->zeitaufzeichnung = false; + } if($projekt->neu=='true') + { $projektNew->new = true; + } else + { $projektNew->new = false; + } if($projektNew->save()) return $projektNew->projekt_kurzbz; diff --git a/soap/projekt.wsdl.php b/soap/projekt.wsdl.php index c1f884672..a798dc1db 100644 --- a/soap/projekt.wsdl.php +++ b/soap/projekt.wsdl.php @@ -30,6 +30,7 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> + diff --git a/soap/projektphase.soap.php b/soap/projektphase.soap.php index 20fc0afe4..640f0c19d 100644 --- a/soap/projektphase.soap.php +++ b/soap/projektphase.soap.php @@ -70,8 +70,8 @@ function saveProjektphase($username, $passwort, $phase) $projektphase->projektphase_id=$phase->projektphase_id; $projektphase->projekt_kurzbz=$phase->projekt_kurzbz; $projektphase->projektphase_fk=$phase->projektphase_fk; - $projektphase->bezeichnung = $phase->bezeichnung; - $projektphase->typ = $phase->typ; + $projektphase->bezeichnung = $phase->bezeichnung; + $projektphase->typ = $phase->typ; $projektphase->ressource_id = $phase->ressource_id; $projektphase->beschreibung = $phase->beschreibung; $projektphase->start = $phase->start; @@ -82,10 +82,23 @@ function saveProjektphase($username, $passwort, $phase) $projektphase->updatevon = $user; $projektphase->updateamum = date('Y-m-d H:i:s'); - if($phase->neu=='true') - $projektphase->new = true; + if($phase->zeitaufzeichnung=='true') + { + $projektphase->zeitaufzeichnung = true; + } else + { + $projektphase->zeitaufzeichnung = false; + } + + if($phase->neu=='true') + { + $projektphase->new = true; + } + else + { $projektphase->new = false; + } if($projektphase->save()) return $projektphase->projektphase_id; diff --git a/soap/projektphase.wsdl.php b/soap/projektphase.wsdl.php index 6039e5184..c6aec364a 100644 --- a/soap/projektphase.wsdl.php +++ b/soap/projektphase.wsdl.php @@ -24,8 +24,8 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> - - + + @@ -35,6 +35,7 @@ xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"> + diff --git a/system/dbupdate_3.3.php b/system/dbupdate_3.3.php index bb8f250fd..db1f84ec4 100644 --- a/system/dbupdate_3.3.php +++ b/system/dbupdate_3.3.php @@ -2086,6 +2086,28 @@ if (!$result = @$db->db_query("SELECT projekt_id FROM fue.tbl_projekt LIMIT 1")) } +// add column zeitaufzeichnung to fue.tbl_project +if (!$result = @$db->db_query("SELECT zeitaufzeichnung FROM fue.tbl_projekt LIMIT 1")) +{ + $qry = "ALTER TABLE fue.tbl_projekt ADD COLUMN zeitaufzeichnung BOOLEAN NOT NULL DEFAULT true;"; + + if(!$db->db_query($qry)) + echo 'fue.tbl_projekt '.$db->db_last_error().'
'; + else + echo '
Spalte zeitaufzeichnung zu fue.tbl_projekt hinzugefügt'; +} + +// add column zeitaufzeichnung to fue.tbl_projectphase +if (!$result = @$db->db_query("SELECT zeitaufzeichnung FROM fue.tbl_projektphase LIMIT 1")) +{ + $qry = "ALTER TABLE fue.tbl_projektphase ADD COLUMN zeitaufzeichnung BOOLEAN NOT NULL DEFAULT true;"; + + if(!$db->db_query($qry)) + echo 'fue.tbl_projektphase '.$db->db_last_error().'
'; + else + echo '
Spalte zeitaufzeichnung zu fue.tbl_projektphase hinzugefügt'; +} + // Extension Schema if ($result = $db->db_query("SELECT schema_name FROM information_schema.schemata WHERE schema_name='extension'")) {