fix checking for subfolder (Bug #194)

This commit is contained in:
Uwe Steinmann 2015-01-29 18:15:04 +01:00
parent 8d94f75cb1
commit a4065698d6
3 changed files with 7 additions and 11 deletions

View File

@ -6,6 +6,7 @@
- unset expiration date works again - unset expiration date works again
- complete revised italian translate (Thanks to Diego Fiorani) - complete revised italian translate (Thanks to Diego Fiorani)
- preset expiration date for documents in settings - preset expiration date for documents in settings
- fix checking for subfolders when moving folder (Bug #194)
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 4.3.13 Changes in version 4.3.13

View File

@ -159,18 +159,12 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
* @return boolean true if passes folder is a subfolder * @return boolean true if passes folder is a subfolder
*/ */
function isSubFolder($subfolder) { /* {{{ */ function isSubFolder($subfolder) { /* {{{ */
$db = $this->_dms->getDB(); $target_path = $subfolder->getPath();
foreach($target_path as $next_folder) {
$path = $this->getPath(); // the target folder contains this instance in the parent path
$sfpath = $subfolder->getPath(); if($this->getID() == $next_folder->getID()) return true;
/* It is a potential sub folder start with the path of the current folder.
* If the path differs, it can't be a sub folder.
*/
for($i=0; $i < count($path); $i++) {
if($path[$i] != $sfpath[$i])
return false;
} }
return true; return false;
} /* }}} */ } /* }}} */
/** /**

View File

@ -25,6 +25,7 @@
<license uri="http://opensource.org/licenses/gpl-license">GPL License</license> <license uri="http://opensource.org/licenses/gpl-license">GPL License</license>
<notes> <notes>
- add missing start transaction in SeedDMD_Core_Folder::remove() - add missing start transaction in SeedDMD_Core_Folder::remove()
- SeedDMD_Core_Folder::isSubFolder() doesn't compare object instances anymore (Bug #194)
</notes> </notes>
<contents> <contents>
<dir baseinstalldir="SeedDMS" name="/"> <dir baseinstalldir="SeedDMS" name="/">