Commit 2faf2f50e7eb192fc1e9d2d4385252fcd43435d9
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
Showing
1 changed file
with
15 additions
and
10 deletions
lib/documentmanagement/DependantDocumentTemplate.inc
| @@ -40,8 +40,6 @@ class DependantDocumentTemplate { | @@ -40,8 +40,6 @@ class DependantDocumentTemplate { | ||
| 40 | $this->iDefaultUserID = $iNewDefaultUserID; | 40 | $this->iDefaultUserID = $iNewDefaultUserID; |
| 41 | $this->iTemplateDocumentID = $iNewTemplateDocumentID; | 41 | $this->iTemplateDocumentID = $iNewTemplateDocumentID; |
| 42 | $this->iGroupFolderApprovalLinkID = $iNewGroupFolderApprovalLinkID; | 42 | $this->iGroupFolderApprovalLinkID = $iNewGroupFolderApprovalLinkID; |
| 43 | - | ||
| 44 | - | ||
| 45 | } | 43 | } |
| 46 | 44 | ||
| 47 | /** | 45 | /** |
| @@ -57,9 +55,13 @@ class DependantDocumentTemplate { | @@ -57,9 +55,13 @@ class DependantDocumentTemplate { | ||
| 57 | /** | 55 | /** |
| 58 | * Get the primary key of the user responsbile for new document creation | 56 | * Get the primary key of the user responsbile for new document creation |
| 59 | */ | 57 | */ |
| 60 | - function getUserID() { | 58 | + function getDefaultUserID() { |
| 61 | return $this->iDefaultUserID; | 59 | return $this->iDefaultUserID; |
| 62 | } | 60 | } |
| 61 | + | ||
| 62 | + function setDefaultUserID($iNewValue) { | ||
| 63 | + $this->iDefaultUserID = $iNewValue; | ||
| 64 | + } | ||
| 63 | 65 | ||
| 64 | /** | 66 | /** |
| 65 | * Set the document field's name | 67 | * Set the document field's name |
| @@ -116,11 +118,11 @@ class DependantDocumentTemplate { | @@ -116,11 +118,11 @@ class DependantDocumentTemplate { | ||
| 116 | * | 118 | * |
| 117 | */ | 119 | */ |
| 118 | function create() { | 120 | function create() { |
| 119 | - global $default, $lang_err_database, $lang_err_object_exists; | 121 | + global $default, $lang_err_database, $lang_err_object_exists; |
| 120 | //if the object hasn't been created | 122 | //if the object hasn't been created |
| 121 | if ($this -> iId < 0) { | 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 | if ($result) { | 126 | if ($result) { |
| 125 | $this -> iId = $sql -> insert_id(); | 127 | $this -> iId = $sql -> insert_id(); |
| 126 | return true; | 128 | return true; |
| @@ -143,7 +145,7 @@ class DependantDocumentTemplate { | @@ -143,7 +145,7 @@ class DependantDocumentTemplate { | ||
| 143 | //only update if the object has been stored | 145 | //only update if the object has been stored |
| 144 | if ($this -> iId > 0) { | 146 | if ($this -> iId > 0) { |
| 145 | $sql = $default -> db; | 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 | if ($result) { | 149 | if ($result) { |
| 148 | return true; | 150 | return true; |
| 149 | } | 151 | } |
| @@ -190,9 +192,12 @@ class DependantDocumentTemplate { | @@ -190,9 +192,12 @@ class DependantDocumentTemplate { | ||
| 190 | $result = $sql -> query("SELECT * FROM $default->owl_dependant_document_template_table WHERE id = $iDependantDocumentID"); | 192 | $result = $sql -> query("SELECT * FROM $default->owl_dependant_document_template_table WHERE id = $iDependantDocumentID"); |
| 191 | if ($result) { | 193 | if ($result) { |
| 192 | if ($sql -> next_record()) { | 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 | $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->owl_dependant_document_template_table"; | 202 | $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->owl_dependant_document_template_table"; |
| 198 | return false; | 203 | return false; |