Commit 83f67ca3d46650a5d8ad1bf985eef0214808223d
1 parent
b800d3de
Use newCopy() to create copies of existing metadata and content versions
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5270 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
5 additions
and
10 deletions
lib/documentmanagement/Document.inc
| ... | ... | @@ -508,11 +508,11 @@ class Document { |
| 508 | 508 | // {{{ startNewMetadataVersion |
| 509 | 509 | function startNewMetadataVersion($oUser) { |
| 510 | 510 | $iUserId = KTUtil::getId($oUser); |
| 511 | - $this->_oDocumentMetadataVersion->setId(-1); | |
| 511 | + $this->_oDocumentMetadataVersion =& $this->_oDocumentMetadataVersion->newCopy(); | |
| 512 | 512 | $this->_oDocumentMetadataVersion->bumpMetadataVersion(); |
| 513 | 513 | $this->_oDocumentMetadataVersion->setVersionCreated(getCurrentDateTime()); |
| 514 | 514 | $this->_oDocumentMetadataVersion->setVersionCreatorId($iUserId); |
| 515 | - $this->_oDocumentMetadataVersion->create(); | |
| 515 | + $this->_oDocumentMetadataVersion->update(); | |
| 516 | 516 | $this->_oDocumentCore->setMetadataVersion($this->_oDocumentMetadataVersion->getMetadataVersion()); |
| 517 | 517 | $this->_oDocumentCore->setMetadataVersionId($this->_oDocumentMetadataVersion->iId); |
| 518 | 518 | } |
| ... | ... | @@ -521,18 +521,13 @@ class Document { |
| 521 | 521 | // {{{ startNewContentVersion |
| 522 | 522 | function startNewContentVersion($oUser) { |
| 523 | 523 | $iUserId = KTUtil::getId($oUser); |
| 524 | - $this->_oDocumentContentVersion->setId(-1); | |
| 525 | - $res = $this->_oDocumentContentVersion->create(); | |
| 526 | - if (PEAR::isError($res)) { | |
| 527 | - var_dump($res); | |
| 528 | - return $res; | |
| 529 | - } | |
| 530 | - $this->_oDocumentMetadataVersion->setId(-1); | |
| 524 | + $this->_oDocumentContentVersion =& $this->_oDocumentContentVersion->newCopy(); | |
| 525 | + $this->_oDocumentMetadataVersion =& $this->_oDocumentMetadataVersion->newCopy(); | |
| 531 | 526 | $this->_oDocumentMetadataVersion->bumpMetadataVersion(); |
| 532 | 527 | $this->_oDocumentMetadataVersion->setVersionCreated(getCurrentDateTime()); |
| 533 | 528 | $this->_oDocumentMetadataVersion->setVersionCreatorId($iUserId); |
| 534 | 529 | $this->_oDocumentMetadataVersion->setContentVersionId($this->_oDocumentContentVersion->getId()); |
| 535 | - $res = $this->_oDocumentMetadataVersion->create(); | |
| 530 | + $res = $this->_oDocumentMetadataVersion->update(); | |
| 536 | 531 | if (PEAR::isError($res)) { |
| 537 | 532 | var_dump($res); |
| 538 | 533 | return $res; | ... | ... |