Commit 92c255bf8083b033610e5142ceaf282eea798e1a

Authored by Megan Watson
1 parent aae61d9e

Allowed class to be created without passing parameters, added _FieldToSelect arr…

…ay to map DB columns to variables. It was causing a php error and killing the baobab get properties and rename functions.
Jira: BBS-1626

Committed by: Megan Watson
lib/documentmanagement/DocumentTransaction.inc
... ... @@ -9,7 +9,7 @@
9 9 * KnowledgeTree Community Edition
10 10 * Document Management Made Simple
11 11 * Copyright (C) 2008, 2009 KnowledgeTree Inc.
12   - *
  12 + *
13 13 *
14 14 * This program is free software; you can redistribute it and/or modify it under
15 15 * the terms of the GNU General Public License version 3 as published by the
... ... @@ -59,8 +59,23 @@ class DocumentTransaction extends KTEntity {
59 59 var $sFileName;
60 60 var $sComment;
61 61 var $sTransactionNS;
  62 + var $iSessionId;
62 63 var $bAdminMode = 0;
63 64  
  65 + var $_aFieldToSelect = array(
  66 + 'iId' => 'id',
  67 + 'iDocumentID' => 'document_id',
  68 + 'sVersion' => 'version',
  69 + 'iUserID' => 'user_id',
  70 + 'dDateTime' => 'datetime',
  71 + 'sIP' => 'ip',
  72 + 'sFileName' => 'filename',
  73 + 'sComment' => 'comment',
  74 + 'sTransactionNS' => 'transaction_namespace',
  75 + 'iSessionId' => 'session_id',
  76 + 'bAdminMode' => 'admin_mode',
  77 + );
  78 +
64 79 /**
65 80 * Constructor
66 81 *
... ... @@ -69,10 +84,17 @@ class DocumentTransaction extends KTEntity {
69 84 * @param Primary key of transaction type
70 85 *
71 86 */
72   - function DocumentTransaction($oDocument, $sNewComment, $sTransactionNS, $aOptions = null) {
  87 + function DocumentTransaction($oDocument = null, $sNewComment = null, $sTransactionNS = null, $aOptions = null) {
73 88 if (is_null($aOptions)) {
74 89 $aOptions = array();
75 90 }
  91 +
  92 + // class breaks convention and passes the document object into the constructor
  93 + // ktentity creates the object to get the sql columns, adding a workaround to exit if the document object is empty
  94 + if(empty($oDocument)){
  95 + return ;
  96 + }
  97 +
76 98 //object not stored yet, id = -1
77 99 $this->iId = -1;
78 100  
... ...