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() { /* {{{ */
/** @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);
$this->_validation_error = $attrdef->getValidationError();
return $result;
@ -1123,11 +1123,6 @@ class SeedDMS_Core_AttributeDefinition { /* {{{ */
if(!$success)
$this->_validation_error = 3;
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:
foreach($values as $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';
/** @noinspection PhpUndefinedConstantInspection */
$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`";
else if ($orderby=='u') $queryStr .= "ORDER BY `statusDate`";
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) {
$queryStr = "SELECT MAX(`version`) as m from `tblDocumentContent` where `document` = ".$this->_id;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$res)
if (is_bool($resArr) && !$resArr)
return false;
$version = $resArr[0]['m']+1;
@ -1563,7 +1563,6 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
// a document be rejected.
$pendingReview=false;
/** @noinspection PhpUnusedLocalVariableInspection */
$reviewRes = array(); /** @todo unused variable */
foreach (array("i", "g") as $i){
if (isset($reviewers[$i])) {
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.
$pendingApproval=false;
/** @noinspection PhpUnusedLocalVariableInspection */
$approveRes = array(); /** @todo unused variable */
foreach (array("i", "g") as $i){
if (isset($approvers[$i])) {
foreach ($approvers[$i] as $approverID) {
@ -1621,7 +1619,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
}
/** @noinspection PhpMethodParametersCountMismatchInspection */
$docResultSet->setStatus($status,$comment,$user); /** @todo parameter count wrong */
$docResultSet->setStatus($status);
$db->commitTransaction();
return $docResultSet;
@ -1659,7 +1657,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
if ((int) $version<1) {
$queryStr = "SELECT MAX(`version`) as m from `tblDocumentContent` where `document` = ".$this->_id;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$res) /** @todo undefined variable */
if (is_bool($resArr) && !$resArr)
return false;
$version = $resArr[0]['m'];
@ -1725,7 +1723,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
if (!isset($this->_content)) {
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." ORDER BY `version`";
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$res) /** @todo undefined variable */
if (is_bool($resArr) && !$resArr)
return false;
$this->_content = array();
@ -1771,7 +1769,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$db = $this->_dms->getDB();
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." AND `version` = " . (int) $version;
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$res) /** @todo undefined variable */
if (is_bool($resArr) && !$resArr)
return false;
if (count($resArr) != 1)
return false;
@ -1829,7 +1827,7 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
$db = $this->_dms->getDB();
$queryStr = "SELECT * FROM `tblDocumentContent` WHERE `document` = ".$this->_id." ORDER BY `version` DESC";
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$res) /** @todo: $res not defined */
if (is_bool($resArr) && !$resArr)
return false;
$classname = $this->_dms->getClassname('documentcontent');

View File

@ -555,7 +555,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
$db = $this->_dms->getDB();
if (isset($this->_subFolders)) {
/** @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;
$resArr = $db->getResultArray($queryStr);
@ -757,7 +757,7 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
$db = $this->_dms->getDB();
if (isset($this->_documents)) {
/** @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;
$resArr = $db->getResultArray($queryStr);

View File

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