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,11 +508,11 @@ class Document { | ||
| 508 | // {{{ startNewMetadataVersion | 508 | // {{{ startNewMetadataVersion |
| 509 | function startNewMetadataVersion($oUser) { | 509 | function startNewMetadataVersion($oUser) { |
| 510 | $iUserId = KTUtil::getId($oUser); | 510 | $iUserId = KTUtil::getId($oUser); |
| 511 | - $this->_oDocumentMetadataVersion->setId(-1); | 511 | + $this->_oDocumentMetadataVersion =& $this->_oDocumentMetadataVersion->newCopy(); |
| 512 | $this->_oDocumentMetadataVersion->bumpMetadataVersion(); | 512 | $this->_oDocumentMetadataVersion->bumpMetadataVersion(); |
| 513 | $this->_oDocumentMetadataVersion->setVersionCreated(getCurrentDateTime()); | 513 | $this->_oDocumentMetadataVersion->setVersionCreated(getCurrentDateTime()); |
| 514 | $this->_oDocumentMetadataVersion->setVersionCreatorId($iUserId); | 514 | $this->_oDocumentMetadataVersion->setVersionCreatorId($iUserId); |
| 515 | - $this->_oDocumentMetadataVersion->create(); | 515 | + $this->_oDocumentMetadataVersion->update(); |
| 516 | $this->_oDocumentCore->setMetadataVersion($this->_oDocumentMetadataVersion->getMetadataVersion()); | 516 | $this->_oDocumentCore->setMetadataVersion($this->_oDocumentMetadataVersion->getMetadataVersion()); |
| 517 | $this->_oDocumentCore->setMetadataVersionId($this->_oDocumentMetadataVersion->iId); | 517 | $this->_oDocumentCore->setMetadataVersionId($this->_oDocumentMetadataVersion->iId); |
| 518 | } | 518 | } |
| @@ -521,18 +521,13 @@ class Document { | @@ -521,18 +521,13 @@ class Document { | ||
| 521 | // {{{ startNewContentVersion | 521 | // {{{ startNewContentVersion |
| 522 | function startNewContentVersion($oUser) { | 522 | function startNewContentVersion($oUser) { |
| 523 | $iUserId = KTUtil::getId($oUser); | 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 | $this->_oDocumentMetadataVersion->bumpMetadataVersion(); | 526 | $this->_oDocumentMetadataVersion->bumpMetadataVersion(); |
| 532 | $this->_oDocumentMetadataVersion->setVersionCreated(getCurrentDateTime()); | 527 | $this->_oDocumentMetadataVersion->setVersionCreated(getCurrentDateTime()); |
| 533 | $this->_oDocumentMetadataVersion->setVersionCreatorId($iUserId); | 528 | $this->_oDocumentMetadataVersion->setVersionCreatorId($iUserId); |
| 534 | $this->_oDocumentMetadataVersion->setContentVersionId($this->_oDocumentContentVersion->getId()); | 529 | $this->_oDocumentMetadataVersion->setContentVersionId($this->_oDocumentContentVersion->getId()); |
| 535 | - $res = $this->_oDocumentMetadataVersion->create(); | 530 | + $res = $this->_oDocumentMetadataVersion->update(); |
| 536 | if (PEAR::isError($res)) { | 531 | if (PEAR::isError($res)) { |
| 537 | var_dump($res); | 532 | var_dump($res); |
| 538 | return $res; | 533 | return $res; |