Commit 2faf2f50e7eb192fc1e9d2d4385252fcd43435d9

Authored by rob
1 parent f92d28af

added some getters and setters


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1875 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/documentmanagement/DependantDocumentTemplate.inc
... ... @@ -40,8 +40,6 @@ class DependantDocumentTemplate {
40 40 $this->iDefaultUserID = $iNewDefaultUserID;
41 41 $this->iTemplateDocumentID = $iNewTemplateDocumentID;
42 42 $this->iGroupFolderApprovalLinkID = $iNewGroupFolderApprovalLinkID;
43   -
44   -
45 43 }
46 44  
47 45 /**
... ... @@ -57,9 +55,13 @@ class DependantDocumentTemplate {
57 55 /**
58 56 * Get the primary key of the user responsbile for new document creation
59 57 */
60   - function getUserID() {
  58 + function getDefaultUserID() {
61 59 return $this->iDefaultUserID;
62 60 }
  61 +
  62 + function setDefaultUserID($iNewValue) {
  63 + $this->iDefaultUserID = $iNewValue;
  64 + }
63 65  
64 66 /**
65 67 * Set the document field's name
... ... @@ -116,11 +118,11 @@ class DependantDocumentTemplate {
116 118 *
117 119 */
118 120 function create() {
119   - global $default, $lang_err_database, $lang_err_object_exists;
  121 + global $default, $lang_err_database, $lang_err_object_exists;
120 122 //if the object hasn't been created
121 123 if ($this -> iId < 0) {
122   - $sql = $default -> db;
123   - $result = $sql -> query("INSERT INTO $default->owl_dependant_document_template_table (document_title, default_user_id,template_document_id, group_folder_approval_link_id) VALUES ('" . addslashes($this->sDocumentTitle) . "', $this->iDefaultUserID, " . (isset($this->iTemplateDocumentID) ? $this->iTemplateDocumentID : "'NULL'") . ", $this->iGroupFolderApprovalLinkID)");
  124 + $sql = $default -> db;
  125 + $result = $sql -> query("INSERT INTO $default->owl_dependant_document_template_table (document_title, default_user_id,template_document_id, group_folder_approval_link_id) VALUES ('" . addslashes($this->sDocumentTitle) . "', $this->iDefaultUserID, " . (($this->iTemplateDocumentID == null) ? "NULL" : $this->iTemplateDocumentID) . ", $this->iGroupFolderApprovalLinkID)");
124 126 if ($result) {
125 127 $this -> iId = $sql -> insert_id();
126 128 return true;
... ... @@ -143,7 +145,7 @@ class DependantDocumentTemplate {
143 145 //only update if the object has been stored
144 146 if ($this -> iId > 0) {
145 147 $sql = $default -> db;
146   - $result = $sql -> query("UPDATE $default -> owl_dependant_documents SET document_title = '".addslashes($this -> sDocumentTitle)."', user_id = $this->iDefaultUserID, template_document_id = $this->iTemplateDocumentID, group_folder_approval_link_id = $this->iGroupFolderApprovalLinkID WHERE id = $this->iId");
  148 + $result = $sql -> query("UPDATE $default->owl_dependant_document_template_table SET document_title = '".addslashes($this -> sDocumentTitle)."', default_user_id = $this->iDefaultUserID, template_document_id = $this->iTemplateDocumentID, group_folder_approval_link_id = $this->iGroupFolderApprovalLinkID WHERE id = $this->iId");
147 149 if ($result) {
148 150 return true;
149 151 }
... ... @@ -190,9 +192,12 @@ class DependantDocumentTemplate {
190 192 $result = $sql -> query("SELECT * FROM $default->owl_dependant_document_template_table WHERE id = $iDependantDocumentID");
191 193 if ($result) {
192 194 if ($sql -> next_record()) {
193   - $oDependantDocument = & new DependantDocument(stripslashes($sql -> f("document_title")), $sql -> f("user_id"), $sql -> f("template_document_id"), $sql->f("group_folder_approval_link_id"));
194   - $oDependantDocument -> iId = $sql -> f("id");
195   - return $oDependantDocument;
  195 + $DependantDocumentTemplate = & new DependantDocumentTemplate(stripslashes($sql -> f("document_title")), $sql -> f("default_user_id"), $sql->f("group_folder_approval_link_id"), $sql->f("template_document_id"));
  196 + $DependantDocumentTemplate -> iId = $sql -> f("id");
  197 + /*if (!($sql -> f("template_document_id") == null)) {
  198 + $DependantDocumentTemplate->setTemplateDocumentID($sql->f("template_document_id"));
  199 + }*/
  200 + return $DependantDocumentTemplate;
196 201 }
197 202 $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->owl_dependant_document_template_table";
198 203 return false;
... ...