diff --git a/model/dao/ProjectDAO/PostgreSQLProjectDAO.php b/model/dao/ProjectDAO/PostgreSQLProjectDAO.php
index be02daa38..fa66977d4 100644
--- a/model/dao/ProjectDAO/PostgreSQLProjectDAO.php
+++ b/model/dao/ProjectDAO/PostgreSQLProjectDAO.php
@@ -586,56 +586,56 @@ public function partialUpdate(ProjectVO $projectVO, $update) {
}
// If the query returned a row then update
- if(sizeof($currProjectVO) > 0) {
+ if (!is_null($currProjectVO)) {
- $sql = "UPDATE project SET ";
+ $sql = "UPDATE project SET ";
- if ($update['activation'])
- $sql = $sql . "activation=" . DBPostgres::boolToString($projectVO->getActivation()) . ", ";
+ if ($update['activation'])
+ $sql .= "activation=" . DBPostgres::boolToString($projectVO->getActivation()) . ", ";
- if ($update['init'])
- $sql = $sql . "init=" . DBPostgres::formatDate($projectVO->getInit()) . ", ";
+ if ($update['init'])
+ $sql .= "init=" . DBPostgres::formatDate($projectVO->getInit()) . ", ";
- if ($update['end'])
- $sql = $sql . "_end=" . DBPostgres::formatDate($projectVO->getEnd()) . ", ";
+ if ($update['end'])
+ $sql .= "_end=" . DBPostgres::formatDate($projectVO->getEnd()) . ", ";
- if ($update['invoice'])
- $sql = $sql . "invoice=" . DBPostgres::checkNull($projectVO->getInvoice()) . ", ";
+ if ($update['invoice'])
+ $sql .= "invoice=" . DBPostgres::checkNull($projectVO->getInvoice()) . ", ";
- if ($update['estHours'])
- $sql = $sql . "est_hours=" . DBPostgres::checkNull($projectVO->getEstHours()) . ", ";
+ if ($update['estHours'])
+ $sql .= "est_hours=" . DBPostgres::checkNull($projectVO->getEstHours()) . ", ";
- if ($update['areaId'])
- $sql = $sql . "areaid=" . DBPostgres::checkNull($projectVO->getAreaId()) . ", ";
+ if ($update['areaId'])
+ $sql .= "areaid=" . DBPostgres::checkNull($projectVO->getAreaId()) . ", ";
- if ($update['customerId'])
- $sql = $sql . "customerid=" . DBPostgres::checkNull($projectVO->getCustomerId()) . ", ";
+ if ($update['customerId'])
+ $sql .= "customerid=" . DBPostgres::checkNull($projectVO->getCustomerId()) . ", ";
- if ($update['description'])
- $sql = $sql . "description=" . DBPostgres::checkStringNull($projectVO->getDescription()) . ", ";
+ if ($update['description'])
+ $sql .= "description=" . DBPostgres::checkStringNull($projectVO->getDescription()) . ", ";
- if ($update['type'])
- $sql = $sql . "type=" . DBPostgres::checkStringNull($projectVO->getType()) . ", ";
+ if ($update['type'])
+ $sql .= "type=" . DBPostgres::checkStringNull($projectVO->getType()) . ", ";
- if ($update['movHours'])
- $sql = $sql . "moved_hours=" . DBPostgres::checkNull($projectVO->getMovedHours()) . ", ";
+ if ($update['movHours'])
+ $sql .= "moved_hours=" . DBPostgres::checkNull($projectVO->getMovedHours()) . ", ";
- if ($update['schedType'])
- $sql = $sql . "sched_type=" . DBPostgres::checkStringNull($projectVO->getSchedType());
+ if ($update['schedType'])
+ $sql .= "sched_type=" . DBPostgres::checkStringNull($projectVO->getSchedType());
- if (strlen($sql) == strlen("UPDATE project SET "))
- return NULL;
+ if (strlen($sql) == strlen("UPDATE project SET "))
+ return NULL;
- $last = strrpos($sql, ",");
+ $last = strrpos($sql, ",");
- if ($last == (strlen($sql) - 2))
- $sql = substr($sql, 0, -2);
+ if ($last == (strlen($sql) - 2))
+ $sql = substr($sql, 0, -2);
- $sql = $sql . " WHERE id=".$projectVO->getId();
+ $sql .= " WHERE id=".$projectVO->getId();
$res = pg_query($this->connect, $sql);
- if ($res == NULL) throw new SQLQueryErrorException(pg_last_error());
- $affectedRows = pg_affected_rows($res);
+ if ($res == NULL) throw new SQLQueryErrorException(pg_last_error());
+ $affectedRows = pg_affected_rows($res);
}
return $affectedRows;
diff --git a/web/services/updateProjectsService.php b/web/services/updateProjectsService.php
index 04512fc02..2cb848306 100644
--- a/web/services/updateProjectsService.php
+++ b/web/services/updateProjectsService.php
@@ -95,7 +95,7 @@
$parser->next();
$parser->next();
}
- $update[activation] = true;
+ $update["activation"] = true;
break;
case "init": $dateFormat = $parser->getAttribute("format");
@@ -111,7 +111,7 @@
$parser->next();
$parser->next();
}
- $update[init] = true;
+ $update["init"] = true;
break;
case "end": $dateFormat = $parser->getAttribute("format");
@@ -127,7 +127,7 @@
$parser->next();
$parser->next();
}
- $update[end] = true;
+ $update["end"] = true;
break;
case "invoice":$parser->read();
@@ -137,7 +137,7 @@
$parser->next();
$parser->next();
}
- $update[invoice] = true;
+ $update["invoice"] = true;
break;
case "estHours":$parser->read();
@@ -147,7 +147,7 @@
$parser->next();
$parser->next();
}
- $update[estHours] = true;
+ $update["estHours"] = true;
break;
case "description":$parser->read();
@@ -157,7 +157,7 @@
$parser->next();
$parser->next();
}
- $update[description] = true;
+ $update["description"] = true;
break;
case "areaId":$parser->read();
@@ -167,7 +167,7 @@
$parser->next();
$parser->next();
}
- $update[areaId] = true;
+ $update["areaId"] = true;
break;
case "customerId":$parser->read();
@@ -177,7 +177,7 @@
$parser->next();
$parser->next();
}
- $update[customerId] = true;
+ $update["customerId"] = true;
break;
case "type": $parser->read();
@@ -187,7 +187,7 @@
$parser->next();
$parser->next();
}
- $update[type] = true;
+ $update["type"] = true;
break;
case "movedHours": $parser->read();
@@ -197,7 +197,7 @@
$parser->next();
$parser->next();
}
- $update[movHours] = true;
+ $update["movHours"] = true;
break;
case "schedType": $parser->read();
@@ -207,7 +207,7 @@
$parser->next();
$parser->next();
}
- $update[schedType] = true;
+ $update["schedType"] = true;
break;
default: $parser->next();
@@ -232,8 +232,8 @@
$string = "There was some error while updating the projects";
- if (!$string)
- $string = "Operation Success!";
+ if (!isset($string))
+ string = "Operation Success!";
// make it into a proper XML document with header etc