Commit f679697a68b0dcf32a5dafff0edee75c7145e2e2

Authored by kevin_fourie
1 parent 4a5b936a

Merged in from STABLE trunk...

KTS-3641
"CLONE -Changing metadata via Edit Metadata (i.e. webbased) leads to an increase of the content version(SUP-1008)"
Fixed. Added a config setting updateContentVersion, if true then the content version increases with the metadata.

Committed by: Megan Watson
Reviewed by: Conrad Vermeulen


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/STABLE/branches/3.5.3a-Release-Branch@9343 c91229c3-7414-0410-bfa2-8a42b809f60b
plugins/ktcore/document/edit.php
@@ -5,31 +5,31 @@ @@ -5,31 +5,31 @@
5 * Document Management Made Simple 5 * Document Management Made Simple
6 * Copyright (C) 2008 KnowledgeTree Inc. 6 * Copyright (C) 2008 KnowledgeTree Inc.
7 * Portions copyright The Jam Warehouse Software (Pty) Limited 7 * Portions copyright The Jam Warehouse Software (Pty) Limited
8 - * 8 + *
9 * This program is free software; you can redistribute it and/or modify it under 9 * This program is free software; you can redistribute it and/or modify it under
10 * the terms of the GNU General Public License version 3 as published by the 10 * the terms of the GNU General Public License version 3 as published by the
11 * Free Software Foundation. 11 * Free Software Foundation.
12 - * 12 + *
13 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * This program is distributed in the hope that it will be useful, but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
16 * details. 16 * details.
17 - * 17 + *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 - *  
21 - * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco, 20 + *
  21 + * You can contact KnowledgeTree Inc., PO Box 7775 #87847, San Francisco,
22 * California 94120-7775, or email info@knowledgetree.com. 22 * California 94120-7775, or email info@knowledgetree.com.
23 - * 23 + *
24 * The interactive user interfaces in modified source and object code versions 24 * The interactive user interfaces in modified source and object code versions
25 * of this program must display Appropriate Legal Notices, as required under 25 * of this program must display Appropriate Legal Notices, as required under
26 * Section 5 of the GNU General Public License version 3. 26 * Section 5 of the GNU General Public License version 3.
27 - * 27 + *
28 * In accordance with Section 7(b) of the GNU General Public License version 3, 28 * In accordance with Section 7(b) of the GNU General Public License version 3,
29 * these Appropriate Legal Notices must retain the display of the "Powered by 29 * these Appropriate Legal Notices must retain the display of the "Powered by
30 - * KnowledgeTree" logo and retain the original copyright notice. If the display of the 30 + * KnowledgeTree" logo and retain the original copyright notice. If the display of the
31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices 31 * logo is not reasonably feasible for technical reasons, the Appropriate Legal Notices
32 - * must display the words "Powered by KnowledgeTree" and retain the original 32 + * must display the words "Powered by KnowledgeTree" and retain the original
33 * copyright notice. 33 * copyright notice.
34 * Contributor( s): ______________________________________ 34 * Contributor( s): ______________________________________
35 * 35 *
@@ -200,11 +200,16 @@ class KTDocumentEditAction extends KTDocumentAction { @@ -200,11 +200,16 @@ class KTDocumentEditAction extends KTDocumentAction {
200 $this->oDocument->setDocumentTypeId($doctypeid); 200 $this->oDocument->setDocumentTypeId($doctypeid);
201 } 201 }
202 $this->oDocument->setName(($data['document_title'])); 202 $this->oDocument->setName(($data['document_title']));
203 - $this->oDocument->startNewContentVersion($this->oUser);  
204 - $this->oDocument->setMinorVersionNumber($this->oDocument->getMinorVersionNumber()+1);  
205 $this->oDocument->setLastModifiedDate(getCurrentDateTime()); 203 $this->oDocument->setLastModifiedDate(getCurrentDateTime());
206 $this->oDocument->setModifiedUserId($this->oUser->getId()); 204 $this->oDocument->setModifiedUserId($this->oUser->getId());
207 205
  206 + // Update the content version / document version
  207 + global $default;
  208 + if($default->updateContentVersion){
  209 + $this->oDocument->startNewContentVersion($this->oUser);
  210 + $this->oDocument->setMinorVersionNumber($this->oDocument->getMinorVersionNumber()+1);
  211 + }
  212 +
208 $res = $this->oDocument->update(); 213 $res = $this->oDocument->update();
209 if (PEAR::isError($res)) { 214 if (PEAR::isError($res)) {
210 $oForm->handleError(sprintf(_kt("Unexpected failure to update document title: %s"), $res->getMessage())); 215 $oForm->handleError(sprintf(_kt("Unexpected failure to update document title: %s"), $res->getMessage()));
sql/mysql/install/data.sql
@@ -272,7 +272,8 @@ INSERT INTO `config_settings` VALUES @@ -272,7 +272,8 @@ INSERT INTO `config_settings` VALUES
272 (98, 'ldapAuthentication', 'Create Groups Automatically', 'Defines whether to allow LDAP groups to be created automatically. Default is \'False\'.', 'autoGroupCreation', 'default', 'false', 'boolean', 'string', 1), 272 (98, 'ldapAuthentication', 'Create Groups Automatically', 'Defines whether to allow LDAP groups to be created automatically. Default is \'False\'.', 'autoGroupCreation', 'default', 'false', 'boolean', 'string', 1),
273 (99, 'browse', 'Truncate Document and Folder Titles in Browse View', 'Defines the length of the document or folder title displayed in the browse view.', 'titleCharLength', 'default', '40', 'numeric_string', 'string', 1), 273 (99, 'browse', 'Truncate Document and Folder Titles in Browse View', 'Defines the length of the document or folder title displayed in the browse view.', 'titleCharLength', 'default', '40', 'numeric_string', 'string', 1),
274 (100, 'import', 'Disable Bulk Import', 'Disable the bulk import plugin', 'disableBulkImport', 'default', 'false', 'string', NULL, 1), 274 (100, 'import', 'Disable Bulk Import', 'Disable the bulk import plugin', 'disableBulkImport', 'default', 'false', 'string', NULL, 1),
275 -(101, 'session', 'Enable version check', 'Compares the system version with the database version to determine if a database upgrade is needed.','dbversioncompare', 'default', 'true', 'boolean', NULL, 0); 275 +(101, 'session', 'Enable version check', 'Compares the system version with the database version to determine if a database upgrade is needed.','dbversioncompare', 'default', 'true', 'boolean', NULL, 0),
  276 +(102, 'tweaks', 'Update Document Version (Content) on Editing Metadata', 'The document version is equivalent to the document content version. When set to true the document version will be increased when the document metadata is updated.', 'updateContentVersion', 'default', 'false', 'boolean', NULL, 1);
276 /*!40000 ALTER TABLE `config_settings` ENABLE KEYS */; 277 /*!40000 ALTER TABLE `config_settings` ENABLE KEYS */;
277 UNLOCK TABLES; 278 UNLOCK TABLES;
278 279
sql/mysql/upgrade/3.5.3/length_config_setting.sql
1 INSERT INTO `config_settings` (group_name, display_name, description, item, value, default_value, type, options, can_edit) VALUES 1 INSERT INTO `config_settings` (group_name, display_name, description, item, value, default_value, type, options, can_edit) VALUES
2 2
3 ('browse', 'Truncate Document and Folder Titles in Browse View', 'Defines the length of the document or folder title displayed in the 3 ('browse', 'Truncate Document and Folder Titles in Browse View', 'Defines the length of the document or folder title displayed in the
4 -browse view.', 'titleCharLength', 'default', '40', 'numeric_string', '', 1), 4 +browse view.', 'titleCharLength', 'default', '40', 'numeric_string', NULL, 1),
5 5
6 ('import', 'Disable Bulk Import', 'Disable the bulk import plugin', 'disableBulkImport', 'default', 'false', 'string', NULL, 1), 6 ('import', 'Disable Bulk Import', 'Disable the bulk import plugin', 'disableBulkImport', 'default', 'false', 'string', NULL, 1),
7 7
8 ('session', 'Enable version check', 'Compares the system version with the database version to determine if a database upgrade is needed.', 8 ('session', 'Enable version check', 'Compares the system version with the database version to determine if a database upgrade is needed.',
9 -'dbversioncompare', 'default', 'true', 'boolean', NULL, 0);  
10 \ No newline at end of file 9 \ No newline at end of file
  10 +'dbversioncompare', 'default', 'true', 'boolean', NULL, 0),
  11 +
  12 +('tweaks', 'Update Document Version (Content) on Editing Metadata', 'The document version is equivalent to the document content version. When set to
  13 +true the document version will be increased when the document metadata is updated.', 'updateContentVersion', 'default', 'false', 'boolean', NULL, 1);
11 \ No newline at end of file 14 \ No newline at end of file