fix many remaining todos (moѕtly wrong var names)

This commit is contained in:
Uwe Steinmann 2020-06-05 18:06:27 +02:00
parent 76d92db9fa
commit 3cf091099b
5 changed files with 11 additions and 18 deletions

View File

@ -245,7 +245,7 @@ class SeedDMS_Core_Attribute { /* {{{ */
*/ */
function validate() { /* {{{ */ function validate() { /* {{{ */
/** @var SeedDMS_Core_AttributeDefinition $attrdef */ /** @var SeedDMS_Core_AttributeDefinition $attrdef */
$attrdef = $this->_attrdef(); /** @todo check this out, this method is not existing */ $attrdef = $this->_attrdef;
$result = $attrdef->validate($this->_value); $result = $attrdef->validate($this->_value);
$this->_validation_error = $attrdef->getValidationError(); $this->_validation_error = $attrdef->getValidationError();
return $result; return $result;
@ -1123,11 +1123,6 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
if(!$success) if(!$success)
$this->_validation_error = 3; $this->_validation_error = 3;
break; break;
case self::type_boolean: /** @todo: Same case in LINE 966 */
foreach($values as $value) {
$success &= preg_match('/^[01]$/', $value);
}
break;
case self::type_email: case self::type_email:
foreach($values as $value) { foreach($values as $value) {
$success &= preg_match('/^[a-z0-9._-]+@+[a-z0-9._-]+\.+[a-z]{2,4}$/i', $value); $success &= preg_match('/^[a-z0-9._-]+@+[a-z0-9._-]+\.+[a-z]{2,4}$/i', $value);

View File

@ -1217,7 +1217,7 @@ class SeedDMS_Core_DMS {
$orderdir = 'ASC'; $orderdir = 'ASC';
/** @noinspection PhpUndefinedConstantInspection */ /** @noinspection PhpUndefinedConstantInspection */
$queryStr .= "AND `tblDocuments`.`owner` = '".$user->getID()."' ". $queryStr .= "AND `tblDocuments`.`owner` = '".$user->getID()."' ".
"AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.", ".S_IN_REVISION.") "; /** @todo S_IN_REVISION is not defined */ "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.") ";
if ($orderby=='e') $queryStr .= "ORDER BY `expires`"; if ($orderby=='e') $queryStr .= "ORDER BY `expires`";
else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`"; else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`";
else if ($orderby=='s') $queryStr .= "ORDER BY `status`"; else if ($orderby=='s') $queryStr .= "ORDER BY `status`";

View File

@ -1492,7 +1492,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
if ((int)$version<1) { if ((int)$version<1) {
$queryStr = "SELECT MAX(`version`) as m from `tblDocumentContent` where `document` = ".$this->_id; $queryStr = "SELECT MAX(`version`) as m from `tblDocumentContent` where `document` = ".$this->_id;
$resArr = $db->getResultArray($queryStr); $resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$res) if (is_bool($resArr) && !$resArr)
return false; return false;
$version = $resArr[0]['m']+1; $version = $resArr[0]['m']+1;
@ -1563,7 +1563,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
// a document be rejected. // a document be rejected.
$pendingReview=false; $pendingReview=false;
/** @noinspection PhpUnusedLocalVariableInspection */ /** @noinspection PhpUnusedLocalVariableInspection */
$reviewRes = array(); /** @todo unused variable */
foreach (array("i", "g") as $i){ foreach (array("i", "g") as $i){
if (isset($reviewers[$i])) { if (isset($reviewers[$i])) {
foreach ($reviewers[$i] as $reviewerID) { foreach ($reviewers[$i] as $reviewerID) {
@ -1582,7 +1581,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
// and make a recommendation on its release as an approved version. // and make a recommendation on its release as an approved version.
$pendingApproval=false; $pendingApproval=false;
/** @noinspection PhpUnusedLocalVariableInspection */ /** @noinspection PhpUnusedLocalVariableInspection */
$approveRes = array(); /** @todo unused variable */
foreach (array("i", "g") as $i){ foreach (array("i", "g") as $i){
if (isset($approvers[$i])) { if (isset($approvers[$i])) {
foreach ($approvers[$i] as $approverID) { foreach ($approvers[$i] as $approverID) {
@ -1621,7 +1619,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
} }
/** @noinspection PhpMethodParametersCountMismatchInspection */ /** @noinspection PhpMethodParametersCountMismatchInspection */
$docResultSet->setStatus($status,$comment,$user); /** @todo parameter count wrong */ $docResultSet->setStatus($status);
$db->commitTransaction(); $db->commitTransaction();
return $docResultSet; return $docResultSet;
@ -1659,7 +1657,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
if ((int) $version<1) { if ((int) $version<1) {
$queryStr = "SELECT MAX(`version`) as m from `tblDocumentContent` where `document` = ".$this->_id; $queryStr = "SELECT MAX(`version`) as m from `tblDocumentContent` where `document` = ".$this->_id;
$resArr = $db->getResultArray($queryStr); $resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$res) /** @todo undefined variable */ if (is_bool($resArr) && !$resArr)
return false; return false;
$version = $resArr[0]['m']; $version = $resArr[0]['m'];
@ -1725,7 +1723,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
if (!isset($this->_content)) { if (!isset($this->_content)) {
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." ORDER BY `version`"; $queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." ORDER BY `version`";
$resArr = $db->getResultArray($queryStr); $resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$res) /** @todo undefined variable */ if (is_bool($resArr) && !$resArr)
return false; return false;
$this->_content = array(); $this->_content = array();
@ -1771,7 +1769,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." AND `version` = " . (int) $version; $queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." AND `version` = " . (int) $version;
$resArr = $db->getResultArray($queryStr); $resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$res) /** @todo undefined variable */ if (is_bool($resArr) && !$resArr)
return false; return false;
if (count($resArr) != 1) if (count($resArr) != 1)
return false; return false;
@ -1829,7 +1827,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." ORDER BY `version` DESC"; $queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." ORDER BY `version` DESC";
$resArr = $db->getResultArray($queryStr); $resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$res) /** @todo: $res not defined */ if (is_bool($resArr) && !$resArr)
return false; return false;
$classname = $this->_dms->getClassname('documentcontent'); $classname = $this->_dms->getClassname('documentcontent');

View File

@ -555,7 +555,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
if (isset($this->_subFolders)) { if (isset($this->_subFolders)) {
/** @noinspection PhpUndefinedFieldInspection */ /** @noinspection PhpUndefinedFieldInspection */
return count($this->subFolders); /** @todo not $this->_subFolders? */ return count($this->_subFolders);
} }
$queryStr = "SELECT count(*) as c FROM `tblFolders` WHERE `parent` = " . $this->_id; $queryStr = "SELECT count(*) as c FROM `tblFolders` WHERE `parent` = " . $this->_id;
$resArr = $db->getResultArray($queryStr); $resArr = $db->getResultArray($queryStr);
@ -757,7 +757,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
$db = $this->_dms->getDB(); $db = $this->_dms->getDB();
if (isset($this->_documents)) { if (isset($this->_documents)) {
/** @noinspection PhpUndefinedFieldInspection */ /** @noinspection PhpUndefinedFieldInspection */
return count($this->documents); /** @todo not $this->_documents? */ return count($this->_documents);
} }
$queryStr = "SELECT count(*) as c FROM `tblDocuments` WHERE `folder` = " . $this->_id; $queryStr = "SELECT count(*) as c FROM `tblDocuments` WHERE `folder` = " . $this->_id;
$resArr = $db->getResultArray($queryStr); $resArr = $db->getResultArray($queryStr);

View File

@ -24,7 +24,7 @@
</stability> </stability>
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license> <license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes> <notes>
- ??? - fixed remaining todos
</notes> </notes>
<contents> <contents>
<dir baseinstalldir="SeedDMS" name="/"> <dir baseinstalldir="SeedDMS" name="/">