mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-28 04:27:32 +00:00
add sql statements to setOwner() for moving locks and checkouts
still commented out, but the idea is, that the user of a lock and checkout of a document should also be changed if the document owner changes
This commit is contained in:
parent
2d7e511bb8
commit
7bc0b8947f
|
@ -397,9 +397,31 @@ class SeedDMS_Core_Document extends SeedDMS_Core_Object { /* {{{ */
|
|||
function setOwner($newOwner) { /* {{{ */
|
||||
$db = $this->_dms->getDB();
|
||||
|
||||
$oldOwner = self::getOwner();
|
||||
|
||||
$db->startTransaction();
|
||||
$queryStr = "UPDATE tblDocuments set owner = " . $newOwner->getID() . " WHERE id = " . $this->_id;
|
||||
if (!$db->getResult($queryStr))
|
||||
if (!$db->getResult($queryStr)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
|
||||
/* FIXME: Update also all locks and checkouts done by the previous owner */
|
||||
/*
|
||||
$queryStr = "UPDATE tblDocumentLocks set userID = " . $newOwner->getID() . " WHERE document = " . $this->_id . " AND userID = " . $oldOwner->getID();
|
||||
if (!$db->getResult($queryStr)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
|
||||
$queryStr = "UPDATE tblDocumentCheckOuts set userID = " . $newOwner->getID() . " WHERE document = " . $this->_id . " AND userID = " . $oldOwner->getID();
|
||||
if (!$db->getResult($queryStr)) {
|
||||
$db->rollbackTransaction();
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
$db->commitTransaction();
|
||||
|
||||
$this->_ownerID = $newOwner->getID();
|
||||
$this->_owner = $newOwner;
|
||||
|
|
Loading…
Reference in New Issue
Block a user