mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-03-12 00:45:34 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
b6a0b45867
|
@ -2076,6 +2076,40 @@ class SeedDMS_Core_Folder extends SeedDMS_Core_Object {
|
|||
return $resArr[0];
|
||||
} /* }}} */
|
||||
|
||||
/**
|
||||
* Reorder documents of folder
|
||||
*
|
||||
* Fix the sequence numbers of all documents in the folder, by assigning new
|
||||
* numbers starting from 1 incrementing by 1. This can be necessary if sequence
|
||||
* numbers are not unique which makes manual reordering for documents with
|
||||
* identical sequence numbers impossible.
|
||||
*
|
||||
* @return bool false in case of an error, otherwise true
|
||||
*/
|
||||
function reorderDocuments() { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$queryStr = "SELECT `id` FROM `tblDocuments` WHERE `folder` = " . (int) $this->_id;
|
||||
$resArr = $db->getResultArray($queryStr);
|
||||
if (is_bool($resArr) && $resArr == false)
|
||||
return false;
|
||||
|
||||
$db->startTransaction();
|
||||
$no = 1.0;
|
||||
foreach($resArr as $doc) {
|
||||
$queryStr = "UPDATE `tblDocuments` SET `sequence` = " . $no . " WHERE `id` = ". $doc['id'];
|
||||
if (!$db->getResult($queryStr)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
$no += 1.0;
|
||||
}
|
||||
$db->commitTransaction();
|
||||
|
||||
return true;
|
||||
} /* }}} */
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -2028,7 +2028,7 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp()
|
|||
- SeedDMS_Core_DMS::createPasswordRequest() creates a cryptographically secure hash
|
||||
- fix sql error when deleting a folder attribute
|
||||
- add SeedDMS_Core_Attribute::getParsedValue() and use it in SeedDMS_Core_Object::getAttributeValue()
|
||||
- add SeedDMS_Core_DMS::getDuplicateSequenceNo()
|
||||
- add SeedDMS_Core_DMS::getDuplicateSequenceNo() and SeedDMS_Core_Folder::reorderDocuments()
|
||||
</notes>
|
||||
</release>
|
||||
<release>
|
||||
|
|
Loading…
Reference in New Issue
Block a user