Commit 540abd98c5da5470813f8a40e7717502be2ea0a4
1 parent
14995472
added copyright and gpl notice
removed owl prefix from table aliases git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2557 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
13 changed files
with
405 additions
and
228 deletions
lib/documentmanagement/DependantDocumentInstance.inc
| 1 | -<?php | 1 | +<?php |
| 2 | /** | 2 | /** |
| 3 | -* | ||
| 4 | -* Class DependantDocumentInstance | ||
| 5 | -* | ||
| 6 | -* Represents a dependant document as per the database table dependant_document | ||
| 7 | -* Used to chain documents together in the collaboration process | ||
| 8 | -* | ||
| 9 | -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 10 | -* @date 14 May 2003 | ||
| 11 | -* @package lib.documentmanagement | ||
| 12 | -*/ | ||
| 13 | - | ||
| 14 | - | 3 | + * $Id$ |
| 4 | + * | ||
| 5 | + * Represents a dependant document instance as per the database table dependant_document_instance. | ||
| 6 | + * Used to chain documents together in the collaboration process/ | ||
| 7 | + * | ||
| 8 | + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 9 | + * | ||
| 10 | + * This program is free software; you can redistribute it and/or modify | ||
| 11 | + * it under the terms of the GNU General Public License as published by | ||
| 12 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | + * (at your option) any later version. | ||
| 14 | + * | ||
| 15 | + * This program is distributed in the hope that it will be useful, | ||
| 16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | + * GNU General Public License for more details. | ||
| 19 | + * | ||
| 20 | + * You should have received a copy of the GNU General Public License | ||
| 21 | + * along with this program; if not, write to the Free Software | ||
| 22 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 23 | + * | ||
| 24 | + * @version $Revision$ | ||
| 25 | + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 26 | + * @package lib.documentmanagement | ||
| 27 | + */ | ||
| 15 | class DependantDocumentInstance { | 28 | class DependantDocumentInstance { |
| 16 | 29 | ||
| 17 | /** primary key value */ | 30 | /** primary key value */ |
| @@ -114,7 +127,7 @@ class DependantDocumentInstance { | @@ -114,7 +127,7 @@ class DependantDocumentInstance { | ||
| 114 | //if the object hasn't been created | 127 | //if the object hasn't been created |
| 115 | if ($this -> iId < 0) { | 128 | if ($this -> iId < 0) { |
| 116 | $sql = $default -> db; | 129 | $sql = $default -> db; |
| 117 | - $result = $sql -> query("INSERT INTO $default->owl_dependant_document_instance_table (document_title, user_id,template_document_id, parent_document_id) VALUES ('" . addslashes($this->sDocumentTitle) . "', $this->iUserID, " . (isset($this->iTemplateDocumentID) ? "$this->iTemplateDocumentID" : "NULL") . ", " . $this->iParentDocumentID . ")"); | 130 | + $result = $sql -> query("INSERT INTO $default->dependant_document_instance_table (document_title, user_id,template_document_id, parent_document_id) VALUES ('" . addslashes($this->sDocumentTitle) . "', $this->iUserID, " . (isset($this->iTemplateDocumentID) ? "$this->iTemplateDocumentID" : "NULL") . ", " . $this->iParentDocumentID . ")"); |
| 118 | if ($result) { | 131 | if ($result) { |
| 119 | $this -> iId = $sql -> insert_id(); | 132 | $this -> iId = $sql -> insert_id(); |
| 120 | return true; | 133 | return true; |
| @@ -159,7 +172,7 @@ class DependantDocumentInstance { | @@ -159,7 +172,7 @@ class DependantDocumentInstance { | ||
| 159 | //only delete the object if it exists in the database | 172 | //only delete the object if it exists in the database |
| 160 | if ($this -> iId >= 0) { | 173 | if ($this -> iId >= 0) { |
| 161 | $sql = $default -> db; | 174 | $sql = $default -> db; |
| 162 | - $result = $sql -> query("DELETE FROM $default->owl_dependant_document_instance_table WHERE id = $this->iId"); | 175 | + $result = $sql -> query("DELETE FROM $default->dependant_document_instance_table WHERE id = $this->iId"); |
| 163 | if ($result) { | 176 | if ($result) { |
| 164 | return true; | 177 | return true; |
| 165 | } | 178 | } |
| @@ -181,14 +194,14 @@ class DependantDocumentInstance { | @@ -181,14 +194,14 @@ class DependantDocumentInstance { | ||
| 181 | function & get($iDependantDocumentID) { | 194 | function & get($iDependantDocumentID) { |
| 182 | global $default; | 195 | global $default; |
| 183 | $sql = $default -> db; | 196 | $sql = $default -> db; |
| 184 | - $result = $sql -> query("SELECT * FROM $default->owl_dependant_document_instance_table WHERE id = $iDependantDocumentID"); | 197 | + $result = $sql -> query("SELECT * FROM $default->dependant_document_instance_table WHERE id = $iDependantDocumentID"); |
| 185 | if ($result) { | 198 | if ($result) { |
| 186 | if ($sql -> next_record()) { | 199 | if ($sql -> next_record()) { |
| 187 | $oDependantDocument = & new DependantDocumentInstance(stripslashes($sql -> f("document_title")), $sql -> f("user_id"), $sql -> f("template_document_id"), $sql->f("parent_document_id")); | 200 | $oDependantDocument = & new DependantDocumentInstance(stripslashes($sql -> f("document_title")), $sql -> f("user_id"), $sql -> f("template_document_id"), $sql->f("parent_document_id")); |
| 188 | $oDependantDocument -> iId = $sql -> f("id"); | 201 | $oDependantDocument -> iId = $sql -> f("id"); |
| 189 | return $oDependantDocument; | 202 | return $oDependantDocument; |
| 190 | } | 203 | } |
| 191 | - $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->owl_dependant_document_instance_table"; | 204 | + $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->dependant_document_instance_table"; |
| 192 | return false; | 205 | return false; |
| 193 | } | 206 | } |
| 194 | $_SESSION["errorMessage"] = $lang_err_database; | 207 | $_SESSION["errorMessage"] = $lang_err_database; |
lib/documentmanagement/DependantDocumentTemplate.inc
| 1 | <?php | 1 | <?php |
| 2 | /** | 2 | /** |
| 3 | -* | ||
| 4 | -* Class DependantDocument | ||
| 5 | -* | ||
| 6 | -* Represents a dependant document as per the database table dependant_document | ||
| 7 | -* Used to chain documents together in the collaboration process | ||
| 8 | -* | ||
| 9 | -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 10 | -* @date 14 May 2003 | ||
| 11 | -* @package lib.documentmanagement | ||
| 12 | -*/ | ||
| 13 | - | ||
| 14 | - | 3 | + * $Id$ |
| 4 | + * | ||
| 5 | + * Represents a dependant document template as per the database table dependant_document_template. | ||
| 6 | + * Used to chain documents together in the collaboration process. | ||
| 7 | + * | ||
| 8 | + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 9 | + * | ||
| 10 | + * This program is free software; you can redistribute it and/or modify | ||
| 11 | + * it under the terms of the GNU General Public License as published by | ||
| 12 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | + * (at your option) any later version. | ||
| 14 | + * | ||
| 15 | + * This program is distributed in the hope that it will be useful, | ||
| 16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | + * GNU General Public License for more details. | ||
| 19 | + * | ||
| 20 | + * You should have received a copy of the GNU General Public License | ||
| 21 | + * along with this program; if not, write to the Free Software | ||
| 22 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 23 | + * | ||
| 24 | + * @version $Revision$ | ||
| 25 | + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 26 | + * @package lib.documentmanagement | ||
| 27 | + */ | ||
| 15 | class DependantDocumentTemplate { | 28 | class DependantDocumentTemplate { |
| 16 | 29 | ||
| 17 | /** primary key value */ | 30 | /** primary key value */ |
| @@ -122,7 +135,7 @@ class DependantDocumentTemplate { | @@ -122,7 +135,7 @@ class DependantDocumentTemplate { | ||
| 122 | //if the object hasn't been created | 135 | //if the object hasn't been created |
| 123 | if ($this -> iId < 0) { | 136 | if ($this -> iId < 0) { |
| 124 | $sql = $default -> db; | 137 | $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)"); | 138 | + $result = $sql -> query("INSERT INTO $default->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)"); |
| 126 | if ($result) { | 139 | if ($result) { |
| 127 | $this -> iId = $sql -> insert_id(); | 140 | $this -> iId = $sql -> insert_id(); |
| 128 | return true; | 141 | return true; |
| @@ -130,7 +143,7 @@ class DependantDocumentTemplate { | @@ -130,7 +143,7 @@ class DependantDocumentTemplate { | ||
| 130 | $_SESSION["errorMessage"] = $lang_err_database; | 143 | $_SESSION["errorMessage"] = $lang_err_database; |
| 131 | return false; | 144 | return false; |
| 132 | } | 145 | } |
| 133 | - $_SESSION["errorMessage"] = $lang_err_object_exists."id = ".$this->iId." Table = $default->owl_dependant_document_template_table"; | 146 | + $_SESSION["errorMessage"] = $lang_err_object_exists."id = ".$this->iId." Table = $default->dependant_document_template_table"; |
| 134 | return false; | 147 | return false; |
| 135 | } | 148 | } |
| 136 | 149 | ||
| @@ -145,7 +158,7 @@ class DependantDocumentTemplate { | @@ -145,7 +158,7 @@ class DependantDocumentTemplate { | ||
| 145 | //only update if the object has been stored | 158 | //only update if the object has been stored |
| 146 | if ($this -> iId > 0) { | 159 | if ($this -> iId > 0) { |
| 147 | $sql = $default -> db; | 160 | $sql = $default -> db; |
| 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 == null) ? "NULL" : $this->iTemplateDocumentID) . ", group_folder_approval_link_id = $this->iGroupFolderApprovalLinkID WHERE id = $this->iId"); | 161 | + $result = $sql -> query("UPDATE $default->dependant_document_template_table SET document_title = '".addslashes($this -> sDocumentTitle)."', default_user_id = $this->iDefaultUserID, template_document_id = " . (($this->iTemplateDocumentID == null) ? "NULL" : $this->iTemplateDocumentID) . ", group_folder_approval_link_id = $this->iGroupFolderApprovalLinkID WHERE id = $this->iId"); |
| 149 | if ($result) { | 162 | if ($result) { |
| 150 | return true; | 163 | return true; |
| 151 | } | 164 | } |
| @@ -167,7 +180,7 @@ class DependantDocumentTemplate { | @@ -167,7 +180,7 @@ class DependantDocumentTemplate { | ||
| 167 | //only delete the object if it exists in the database | 180 | //only delete the object if it exists in the database |
| 168 | if ($this -> iId >= 0) { | 181 | if ($this -> iId >= 0) { |
| 169 | $sql = $default -> db; | 182 | $sql = $default -> db; |
| 170 | - $result = $sql -> query("DELETE FROM $default->owl_dependant_document_template_table WHERE id = $this->iId"); | 183 | + $result = $sql -> query("DELETE FROM $default->dependant_document_template_table WHERE id = $this->iId"); |
| 171 | if ($result) { | 184 | if ($result) { |
| 172 | return true; | 185 | return true; |
| 173 | } | 186 | } |
| @@ -189,7 +202,7 @@ class DependantDocumentTemplate { | @@ -189,7 +202,7 @@ class DependantDocumentTemplate { | ||
| 189 | function & get($iDependantDocumentID) { | 202 | function & get($iDependantDocumentID) { |
| 190 | global $default; | 203 | global $default; |
| 191 | $sql = $default -> db; | 204 | $sql = $default -> db; |
| 192 | - $result = $sql -> query("SELECT * FROM $default->owl_dependant_document_template_table WHERE id = $iDependantDocumentID"); | 205 | + $result = $sql -> query("SELECT * FROM $default->dependant_document_template_table WHERE id = $iDependantDocumentID"); |
| 193 | if ($result) { | 206 | if ($result) { |
| 194 | if ($sql -> next_record()) { | 207 | if ($sql -> next_record()) { |
| 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")); | 208 | $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")); |
| @@ -199,7 +212,7 @@ class DependantDocumentTemplate { | @@ -199,7 +212,7 @@ class DependantDocumentTemplate { | ||
| 199 | }*/ | 212 | }*/ |
| 200 | return $DependantDocumentTemplate; | 213 | return $DependantDocumentTemplate; |
| 201 | } | 214 | } |
| 202 | - $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->owl_dependant_document_template_table"; | 215 | + $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDependantDocumentID." table = $default->dependant_document_template_table"; |
| 203 | return false; | 216 | return false; |
| 204 | } | 217 | } |
| 205 | $_SESSION["errorMessage"] = $lang_err_database; | 218 | $_SESSION["errorMessage"] = $lang_err_database; |
| @@ -220,7 +233,7 @@ class DependantDocumentTemplate { | @@ -220,7 +233,7 @@ class DependantDocumentTemplate { | ||
| 220 | settype($aDependatDocumentTemplateArray, "array"); | 233 | settype($aDependatDocumentTemplateArray, "array"); |
| 221 | $sql = $default->db; | 234 | $sql = $default->db; |
| 222 | // TODO: join on sys_deleted | 235 | // TODO: join on sys_deleted |
| 223 | - $result = $sql->query("SELECT * FROM " . $default->owl_dependant_document_template_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "")); | 236 | + $result = $sql->query("SELECT * FROM " . $default->dependant_document_template_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "")); |
| 224 | if ($result) { | 237 | if ($result) { |
| 225 | $iCount = 0; | 238 | $iCount = 0; |
| 226 | while ($sql->next_record()) { | 239 | while ($sql->next_record()) { |
lib/documentmanagement/Document.inc
| 1 | <?php | 1 | <?php |
| 2 | - | ||
| 3 | // document statuses | 2 | // document statuses |
| 4 | DEFINE("LIVE", 1); | 3 | DEFINE("LIVE", 1); |
| 5 | DEFINE("PUBLISHED", 2); | 4 | DEFINE("PUBLISHED", 2); |
| 6 | DEFINE("DELETED", 3); | 5 | DEFINE("DELETED", 3); |
| 7 | DEFINE("ARCHIVED", 4); | 6 | DEFINE("ARCHIVED", 4); |
| 8 | - | ||
| 9 | require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); | 7 | require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); |
| 10 | - | ||
| 11 | /** | 8 | /** |
| 12 | * $Id$ | 9 | * $Id$ |
| 13 | * | 10 | * |
| 14 | - * Represents a document as per the documents database table | 11 | + * Represents a document as per the documents database table. |
| 12 | + * | ||
| 13 | + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 14 | + * | ||
| 15 | + * This program is free software; you can redistribute it and/or modify | ||
| 16 | + * it under the terms of the GNU General Public License as published by | ||
| 17 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 18 | + * (at your option) any later version. | ||
| 19 | + * | ||
| 20 | + * This program is distributed in the hope that it will be useful, | ||
| 21 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 22 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 23 | + * GNU General Public License for more details. | ||
| 24 | + * | ||
| 25 | + * You should have received a copy of the GNU General Public License | ||
| 26 | + * along with this program; if not, write to the Free Software | ||
| 27 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 15 | * | 28 | * |
| 16 | * @version $Revision$ | 29 | * @version $Revision$ |
| 17 | * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | 30 | * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa |
| 18 | * @package lib.documentmanagement | 31 | * @package lib.documentmanagement |
| 19 | * @todo add in document change transaction functionality | 32 | * @todo add in document change transaction functionality |
| 20 | - */ | 33 | + */ |
| 21 | class Document { | 34 | class Document { |
| 22 | /** primary key */ | 35 | /** primary key */ |
| 23 | var $iId; | 36 | var $iId; |
| @@ -273,7 +286,7 @@ class Document { | @@ -273,7 +286,7 @@ class Document { | ||
| 273 | //if the folder is not the root folder | 286 | //if the folder is not the root folder |
| 274 | if ($iFolderID != 0) { | 287 | if ($iFolderID != 0) { |
| 275 | $sql = $default->db; | 288 | $sql = $default->db; |
| 276 | - $sql->query("SELECT parent_id FROM $default->owl_folders_table WHERE ID = $iFolderID"); | 289 | + $sql->query("SELECT parent_id FROM $default->folders_table WHERE ID = $iFolderID"); |
| 277 | $sql->next_record(); | 290 | $sql->next_record(); |
| 278 | return $this->generateParentFolderIDS($sql->f("parent_id")) . ",$iFolderID"; | 291 | return $this->generateParentFolderIDS($sql->f("parent_id")) . ",$iFolderID"; |
| 279 | } | 292 | } |
| @@ -291,7 +304,7 @@ class Document { | @@ -291,7 +304,7 @@ class Document { | ||
| 291 | //if the folder is not the root folder | 304 | //if the folder is not the root folder |
| 292 | if ($iFolderID != 0) { | 305 | if ($iFolderID != 0) { |
| 293 | $sql = $default->db; | 306 | $sql = $default->db; |
| 294 | - $sql->query("SELECT name, parent_id FROM $default->owl_folders_table WHERE ID = $iFolderID"); | 307 | + $sql->query("SELECT name, parent_id FROM $default->folders_table WHERE ID = $iFolderID"); |
| 295 | $sql->next_record(); | 308 | $sql->next_record(); |
| 296 | return $this->generateFullFolderPath($sql->f("parent_id")) . "/" . stripslashes($sql->f("name")); | 309 | return $this->generateFullFolderPath($sql->f("parent_id")) . "/" . stripslashes($sql->f("name")); |
| 297 | } | 310 | } |
| @@ -312,7 +325,7 @@ class Document { | @@ -312,7 +325,7 @@ class Document { | ||
| 312 | $this->sFullPath = substr($sFullPath, 1, strlen($sFullPath)); | 325 | $this->sFullPath = substr($sFullPath, 1, strlen($sFullPath)); |
| 313 | $sParentFolderIDs = $this->generateParentFolderIDS($this->iFolderID); | 326 | $sParentFolderIDs = $this->generateParentFolderIDS($this->iFolderID); |
| 314 | $this->sParentFolderIDs = substr($sParentFolderIDs, 1, strlen($sParentFolderIDs)); | 327 | $this->sParentFolderIDs = substr($sParentFolderIDs, 1, strlen($sParentFolderIDs)); |
| 315 | - $result = $sql->query("INSERT INTO " . $default->owl_documents_table . " (document_type_id, name, filename, size, creator_id, modified, description, mime_id, folder_id, major_version, minor_version, is_checked_out, checked_out_user_id, parent_folder_ids, full_path, status_id) " . | 328 | + $result = $sql->query("INSERT INTO " . $default->documents_table . " (document_type_id, name, filename, size, creator_id, modified, description, mime_id, folder_id, major_version, minor_version, is_checked_out, checked_out_user_id, parent_folder_ids, full_path, status_id) " . |
| 316 | "VALUES ($this->iDocumentTypeID, '" . addslashes($this->sName) . "', '" . addslashes($this->sFileName) . "', $this->iSize, $this->iCreatorID, '" . getCurrentDateTime() . "', '" . addslashes($this->sDescription) . "', $this->iMimeTypeID, $this->iFolderID, $this->iMajorVersion, $this->iMinorVersion, " . ($this->bIsCheckedOut ? 1 : 0) . ", $this->iCheckedOutUserID, '$this->sParentFolderIDs','" . addslashes($this->sFullPath) . "', $this->iStatusID)"); | 329 | "VALUES ($this->iDocumentTypeID, '" . addslashes($this->sName) . "', '" . addslashes($this->sFileName) . "', $this->iSize, $this->iCreatorID, '" . getCurrentDateTime() . "', '" . addslashes($this->sDescription) . "', $this->iMimeTypeID, $this->iFolderID, $this->iMajorVersion, $this->iMinorVersion, " . ($this->bIsCheckedOut ? 1 : 0) . ", $this->iCheckedOutUserID, '$this->sParentFolderIDs','" . addslashes($this->sFullPath) . "', $this->iStatusID)"); |
| 317 | if ($result) { | 330 | if ($result) { |
| 318 | //set the current documents primary key | 331 | //set the current documents primary key |
| @@ -337,9 +350,9 @@ class Document { | @@ -337,9 +350,9 @@ class Document { | ||
| 337 | // group permissions | 350 | // group permissions |
| 338 | $sGroupPerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " . | 351 | $sGroupPerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " . |
| 339 | "SELECT UGL.user_id AS user_id, D.id AS document_id " . | 352 | "SELECT UGL.user_id AS user_id, D.id AS document_id " . |
| 340 | - "FROM $default->owl_documents_table AS D INNER JOIN folders AS F ON D.folder_id = F.id " . | ||
| 341 | - "INNER JOIN $default->owl_groups_folders_table AS GFL ON GFL.folder_id = F.id " . | ||
| 342 | - "INNER JOIN $default->owl_users_groups_table AS UGL ON UGL.group_id = GFL.group_id " . | 353 | + "FROM $default->documents_table AS D INNER JOIN folders AS F ON D.folder_id = F.id " . |
| 354 | + "INNER JOIN $default->groups_folders_table AS GFL ON GFL.folder_id = F.id " . | ||
| 355 | + "INNER JOIN $default->users_groups_table AS UGL ON UGL.group_id = GFL.group_id " . | ||
| 343 | "WHERE D.id=$this->iId"; | 356 | "WHERE D.id=$this->iId"; |
| 344 | $default->log->info("addDocument groupPerms=$sGroupPerms"); | 357 | $default->log->info("addDocument groupPerms=$sGroupPerms"); |
| 345 | if ($sql->query($sGroupPerms)) { | 358 | if ($sql->query($sGroupPerms)) { |
| @@ -350,7 +363,7 @@ class Document { | @@ -350,7 +363,7 @@ class Document { | ||
| 350 | // role permissions | 363 | // role permissions |
| 351 | $sRolePerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " . | 364 | $sRolePerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " . |
| 352 | "SELECT user_id, document_id " . | 365 | "SELECT user_id, document_id " . |
| 353 | - "FROM $default->owl_folders_user_roles_table " . | 366 | + "FROM $default->folders_user_roles_table " . |
| 354 | "WHERE document_id=$this->iId"; | 367 | "WHERE document_id=$this->iId"; |
| 355 | $default->log->info("addDocument rolePerms=$sRolePerms"); | 368 | $default->log->info("addDocument rolePerms=$sRolePerms"); |
| 356 | if ($sql->query($sRolePerms)) { | 369 | if ($sql->query($sRolePerms)) { |
| @@ -362,7 +375,7 @@ class Document { | @@ -362,7 +375,7 @@ class Document { | ||
| 362 | // public folders | 375 | // public folders |
| 363 | $sPublicFolderPerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " . | 376 | $sPublicFolderPerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " . |
| 364 | "SELECT U.id, D.id " . | 377 | "SELECT U.id, D.id " . |
| 365 | - "FROM $default->owl_users_table AS U, $default->owl_documents_table AS D INNER JOIN $default->owl_folders_table AS F ON D.folder_id = F.id " . | 378 | + "FROM $default->users_table AS U, $default->documents_table AS D INNER JOIN $default->folders_table AS F ON D.folder_id = F.id " . |
| 366 | "WHERE F.is_public = 1 " . | 379 | "WHERE F.is_public = 1 " . |
| 367 | "AND D.id=$this->iId"; | 380 | "AND D.id=$this->iId"; |
| 368 | $default->log->info("addDocument publicFolder=$sPublicFolderPerms"); | 381 | $default->log->info("addDocument publicFolder=$sPublicFolderPerms"); |
| @@ -375,7 +388,7 @@ class Document { | @@ -375,7 +388,7 @@ class Document { | ||
| 375 | // creator permissions | 388 | // creator permissions |
| 376 | $sCreatorPerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " . | 389 | $sCreatorPerms = "INSERT INTO $default->search_permissions_table (user_id, document_id) " . |
| 377 | "SELECT creator_id, id " . | 390 | "SELECT creator_id, id " . |
| 378 | - "FROM $default->owl_documents_table " . | 391 | + "FROM $default->documents_table " . |
| 379 | "WHERE id=$this->iId"; | 392 | "WHERE id=$this->iId"; |
| 380 | $default->log->info("addDocument creatorPerms=$sCreatorPerms"); | 393 | $default->log->info("addDocument creatorPerms=$sCreatorPerms"); |
| 381 | if ($sql->query($sCreatorPerms)) { | 394 | if ($sql->query($sCreatorPerms)) { |
| @@ -394,7 +407,7 @@ class Document { | @@ -394,7 +407,7 @@ class Document { | ||
| 394 | global $default, $lang_err_database, $lang_err_object_key; | 407 | global $default, $lang_err_database, $lang_err_object_key; |
| 395 | if ($this->iId >= 0) { | 408 | if ($this->iId >= 0) { |
| 396 | $sql = $default->db; | 409 | $sql = $default->db; |
| 397 | - $sQuery = "UPDATE " . $default->owl_documents_table . " SET " . | 410 | + $sQuery = "UPDATE " . $default->documents_table . " SET " . |
| 398 | "document_type_id = $this->iDocumentTypeID, " . | 411 | "document_type_id = $this->iDocumentTypeID, " . |
| 399 | "name = '" . addslashes($this->sName) . "', " . | 412 | "name = '" . addslashes($this->sName) . "', " . |
| 400 | "filename = '" . addslashes($this->sFileName) . "', " . | 413 | "filename = '" . addslashes($this->sFileName) . "', " . |
| @@ -441,7 +454,7 @@ class Document { | @@ -441,7 +454,7 @@ class Document { | ||
| 441 | global $default, $lang_err_database, $lang_err_object_key; | 454 | global $default, $lang_err_database, $lang_err_object_key; |
| 442 | if ($this->iId >= 0) { | 455 | if ($this->iId >= 0) { |
| 443 | $sql = $default->db; | 456 | $sql = $default->db; |
| 444 | - $result = $sql->query("DELETE FROM " . $default->owl_documents_table . " WHERE id = $this->iId"); | 457 | + $result = $sql->query("DELETE FROM " . $default->documents_table . " WHERE id = $this->iId"); |
| 445 | if ($result) { | 458 | if ($result) { |
| 446 | $this->iId = -1; | 459 | $this->iId = -1; |
| 447 | // clean up for this deleted document | 460 | // clean up for this deleted document |
| @@ -463,7 +476,7 @@ class Document { | @@ -463,7 +476,7 @@ class Document { | ||
| 463 | global $default; | 476 | global $default; |
| 464 | //get the steps in this document's collaboration process | 477 | //get the steps in this document's collaboration process |
| 465 | $sQuery = "SELECT FURL.id, GFAL.precedence " . | 478 | $sQuery = "SELECT FURL.id, GFAL.precedence " . |
| 466 | - "FROM $default->owl_folders_user_roles_table AS FURL INNER JOIN $default->owl_groups_folders_approval_table AS GFAL ON FURL.group_folder_approval_id = GFAL.id " . | 479 | + "FROM $default->folders_user_roles_table AS FURL INNER JOIN $default->groups_folders_approval_table AS GFAL ON FURL.group_folder_approval_id = GFAL.id " . |
| 467 | "WHERE document_id = " . $this->iId . " " . | 480 | "WHERE document_id = " . $this->iId . " " . |
| 468 | "ORDER BY GFAL.precedence ASC"; | 481 | "ORDER BY GFAL.precedence ASC"; |
| 469 | $sql = $default->db; | 482 | $sql = $default->db; |
| @@ -522,7 +535,7 @@ class Document { | @@ -522,7 +535,7 @@ class Document { | ||
| 522 | //if the user is assinged to two or more roles, make sure we get the current | 535 | //if the user is assinged to two or more roles, make sure we get the current |
| 523 | //one by ordering by precedence | 536 | //one by ordering by precedence |
| 524 | $sql->query("SELECT FURL.id AS id, GFAT.precedence " . | 537 | $sql->query("SELECT FURL.id AS id, GFAT.precedence " . |
| 525 | - "FROM $default->owl_groups_folders_approval_table AS GFAT INNER JOIN $default->owl_folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " . | 538 | + "FROM $default->groups_folders_approval_table AS GFAT INNER JOIN $default->folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " . |
| 526 | "WHERE document_id = $this->iId AND FURL.user_id = " . $_SESSION["userID"] . " " . | 539 | "WHERE document_id = $this->iId AND FURL.user_id = " . $_SESSION["userID"] . " " . |
| 527 | "AND done = 0 " . | 540 | "AND done = 0 " . |
| 528 | "ORDER BY precedence ASC"); | 541 | "ORDER BY precedence ASC"); |
| @@ -550,7 +563,7 @@ class Document { | @@ -550,7 +563,7 @@ class Document { | ||
| 550 | if (strlen($iDocumentID) > 0) { | 563 | if (strlen($iDocumentID) > 0) { |
| 551 | $sql = $default->db; | 564 | $sql = $default->db; |
| 552 | // TODO: join on sys_deleted | 565 | // TODO: join on sys_deleted |
| 553 | - $sql->query("SELECT * FROM $default->owl_documents_table WHERE id = $iDocumentID"); | 566 | + $sql->query("SELECT * FROM $default->documents_table WHERE id = $iDocumentID"); |
| 554 | if ($sql->next_record()) { | 567 | if ($sql->next_record()) { |
| 555 | $oDocument = & new Document(stripslashes($sql->f("name")), stripslashes($sql->f("filename")), $sql->f("size"), $sql->f("creator_id"), $sql->f("mime_id"), $sql->f("folder_id"), $sql->f("description")); | 568 | $oDocument = & new Document(stripslashes($sql->f("name")), stripslashes($sql->f("filename")), $sql->f("size"), $sql->f("creator_id"), $sql->f("mime_id"), $sql->f("folder_id"), $sql->f("description")); |
| 556 | $oDocument->setDocumentTypeID($sql->f("document_type_id")); | 569 | $oDocument->setDocumentTypeID($sql->f("document_type_id")); |
| @@ -587,7 +600,7 @@ class Document { | @@ -587,7 +600,7 @@ class Document { | ||
| 587 | $aDocumentArray; | 600 | $aDocumentArray; |
| 588 | settype($aDocumentArray, "array"); | 601 | settype($aDocumentArray, "array"); |
| 589 | $sql = $default->db; | 602 | $sql = $default->db; |
| 590 | - $result = $sql->query("SELECT * FROM " . $default->owl_documents_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "")); | 603 | + $result = $sql->query("SELECT * FROM " . $default->documents_table . (isset($sWhereClause) ? " WHERE " . $sWhereClause : "")); |
| 591 | if ($result) { | 604 | if ($result) { |
| 592 | $iCount = 0; | 605 | $iCount = 0; |
| 593 | while ($sql->next_record()) { | 606 | while ($sql->next_record()) { |
| @@ -642,7 +655,7 @@ class Document { | @@ -642,7 +655,7 @@ class Document { | ||
| 642 | $aDocumentHistory; | 655 | $aDocumentHistory; |
| 643 | settype($aDocumentHistory, "array"); | 656 | settype($aDocumentHistory, "array"); |
| 644 | $sql = $default->db; | 657 | $sql = $default->db; |
| 645 | - $result = $sql->query("SELECT * FROM " . $default->owl_document_transactions_table . " WHERE document_id = $this->iId ORDER BY datetime DESC"); | 658 | + $result = $sql->query("SELECT * FROM " . $default->document_transactions_table . " WHERE document_id = $this->iId ORDER BY datetime DESC"); |
| 646 | if ($result) { | 659 | if ($result) { |
| 647 | $iCount = 0; | 660 | $iCount = 0; |
| 648 | while($sql->next_record()) { | 661 | while($sql->next_record()) { |
| @@ -666,7 +679,7 @@ class Document { | @@ -666,7 +679,7 @@ class Document { | ||
| 666 | global $default; | 679 | global $default; |
| 667 | if ($this->iMimeTypeID) { | 680 | if ($this->iMimeTypeID) { |
| 668 | // lookup the icon from the table | 681 | // lookup the icon from the table |
| 669 | - $sIconPath = lookupField($default->owl_mime_table, "icon_path", "id", $this->iMimeTypeID); | 682 | + $sIconPath = lookupField($default->mimetypes_table, "icon_path", "id", $this->iMimeTypeID); |
| 670 | if (strlen($sIconPath) > 0) { | 683 | if (strlen($sIconPath) > 0) { |
| 671 | return $default->graphicsUrl . "/" . $sIconPath; | 684 | return $default->graphicsUrl . "/" . $sIconPath; |
| 672 | } else { | 685 | } else { |
| @@ -717,7 +730,7 @@ class Document { | @@ -717,7 +730,7 @@ class Document { | ||
| 717 | function documentExists($sFileName, $iFolderID) { | 730 | function documentExists($sFileName, $iFolderID) { |
| 718 | global $default; | 731 | global $default; |
| 719 | $sql = $default->db; | 732 | $sql = $default->db; |
| 720 | - $sQuery = "SELECT * FROM $default->owl_documents_table " . | 733 | + $sQuery = "SELECT * FROM $default->documents_table " . |
| 721 | "WHERE filename = '" . addslashes($sFileName) . "' " . | 734 | "WHERE filename = '" . addslashes($sFileName) . "' " . |
| 722 | "AND folder_id = $iFolderID " . | 735 | "AND folder_id = $iFolderID " . |
| 723 | "AND status_id = " . LIVE; | 736 | "AND status_id = " . LIVE; |
| @@ -738,7 +751,7 @@ class Document { | @@ -738,7 +751,7 @@ class Document { | ||
| 738 | global $default, $lang_err_database, $lang_err_doc_not_exist; | 751 | global $default, $lang_err_database, $lang_err_doc_not_exist; |
| 739 | $sql = $default->db; | 752 | $sql = $default->db; |
| 740 | 753 | ||
| 741 | - if ($sql->query("SELECT name FROM " . $default->owl_documents_table . " WHERE id = $iDocumentID")) { | 754 | + if ($sql->query("SELECT name FROM " . $default->documents_table . " WHERE id = $iDocumentID")) { |
| 742 | if ($sql->next_record()) { | 755 | if ($sql->next_record()) { |
| 743 | return $sql->f("name"); | 756 | return $sql->f("name"); |
| 744 | } else { | 757 | } else { |
| @@ -772,8 +785,8 @@ class Document { | @@ -772,8 +785,8 @@ class Document { | ||
| 772 | global $default; | 785 | global $default; |
| 773 | $sql = $default->db; | 786 | $sql = $default->db; |
| 774 | $sql->query("SELECT * " . | 787 | $sql->query("SELECT * " . |
| 775 | - "FROM $default->owl_folder_doctypes_table AS FDL " . | ||
| 776 | - "INNER JOIN $default->owl_documents_table AS D ON D.document_type_id = FDL.document_type_id " . | 788 | + "FROM $default->folder_doctypes_table AS FDL " . |
| 789 | + "INNER JOIN $default->documents_table AS D ON D.document_type_id = FDL.document_type_id " . | ||
| 777 | "WHERE FDL.id = $iFolderDocTypeID " . | 790 | "WHERE FDL.id = $iFolderDocTypeID " . |
| 778 | "AND D.folder_id = $iFolderID"); | 791 | "AND D.folder_id = $iFolderID"); |
| 779 | if ($sql->next_record()) { | 792 | if ($sql->next_record()) { |
| @@ -788,8 +801,8 @@ class Document { | @@ -788,8 +801,8 @@ class Document { | ||
| 788 | */ | 801 | */ |
| 789 | function removeInvalidDocumentTypeEntries() { | 802 | function removeInvalidDocumentTypeEntries() { |
| 790 | global $default; | 803 | global $default; |
| 791 | - $sQuery = "SELECT field_id FROM $default->owl_document_type_fields_table DTFL " . | ||
| 792 | - "INNER JOIN $default->owl_fields_table AS DF ON DF.id = DTFL.field_id " . | 804 | + $sQuery = "SELECT field_id FROM $default->document_type_fields_table DTFL " . |
| 805 | + "INNER JOIN $default->document_fields_table AS DF ON DF.id = DTFL.field_id " . | ||
| 793 | "WHERE DTFL.document_type_id = $this->iDocumentTypeID " . | 806 | "WHERE DTFL.document_type_id = $this->iDocumentTypeID " . |
| 794 | "AND DF.is_generic = 0"; | 807 | "AND DF.is_generic = 0"; |
| 795 | $sql = $default->db; | 808 | $sql = $default->db; |
| @@ -801,7 +814,7 @@ class Document { | @@ -801,7 +814,7 @@ class Document { | ||
| 801 | } | 814 | } |
| 802 | if (count($aFieldIDs) > 0) { | 815 | if (count($aFieldIDs) > 0) { |
| 803 | //delete the entries | 816 | //delete the entries |
| 804 | - $sQuery = "DELETE FROM $default->owl_document_fields_table WHERE document_id = $this->iId AND document_field_id IN (" . implode(",",$aFieldIDs) . ")"; | 817 | + $sQuery = "DELETE FROM $default->document_fields_link_table WHERE document_id = $this->iId AND document_field_id IN (" . implode(",",$aFieldIDs) . ")"; |
| 805 | if ($sql->query($sQuery)) { | 818 | if ($sql->query($sQuery)) { |
| 806 | return true; | 819 | return true; |
| 807 | } | 820 | } |
| @@ -821,7 +834,7 @@ class Document { | @@ -821,7 +834,7 @@ class Document { | ||
| 821 | function hasCollaboration() { | 834 | function hasCollaboration() { |
| 822 | global $default; | 835 | global $default; |
| 823 | $sql = $default->db; | 836 | $sql = $default->db; |
| 824 | - $sql->query("SELECT id AS count from $default->owl_groups_folders_approval_table WHERE folder_id = $this->iFolderID"); | 837 | + $sql->query("SELECT id AS count from $default->groups_folders_approval_table WHERE folder_id = $this->iFolderID"); |
| 825 | if ($sql->next_record()) { | 838 | if ($sql->next_record()) { |
| 826 | return true; | 839 | return true; |
| 827 | } | 840 | } |
| @@ -834,9 +847,9 @@ class Document { | @@ -834,9 +847,9 @@ class Document { | ||
| 834 | function cleanupDocumentData($iDocumentID) { | 847 | function cleanupDocumentData($iDocumentID) { |
| 835 | global $default; | 848 | global $default; |
| 836 | $sql = $default->db; | 849 | $sql = $default->db; |
| 837 | - $result = $sql->query("DELETE FROM $default->owl_document_text_table WHERE document_id = $iDocumentID") && | 850 | + $result = $sql->query("DELETE FROM $default->document_text_table WHERE document_id = $iDocumentID") && |
| 838 | $sql->query("DELETE FROM $default->search_permissions_table WHERE document_id = $iDocumentID") && | 851 | $sql->query("DELETE FROM $default->search_permissions_table WHERE document_id = $iDocumentID") && |
| 839 | - $sql->query("DELETE FROM $default->owl_document_fields_table WHERE document_id = $iDocumentID"); | 852 | + $sql->query("DELETE FROM $default->document_fields_link_table WHERE document_id = $iDocumentID"); |
| 840 | return $result; | 853 | return $result; |
| 841 | } | 854 | } |
| 842 | } | 855 | } |
lib/documentmanagement/DocumentCollaboration.inc
| 1 | <?php | 1 | <?php |
| 2 | -/** | 2 | +/** |
| 3 | + * $Id$ | ||
| 3 | * | 4 | * |
| 4 | - * Static functions dealing with the document approval process | 5 | + * Static functions dealing with the document approval process. |
| 6 | + * | ||
| 7 | + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 8 | + * | ||
| 9 | + * This program is free software; you can redistribute it and/or modify | ||
| 10 | + * it under the terms of the GNU General Public License as published by | ||
| 11 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 12 | + * (at your option) any later version. | ||
| 13 | + * | ||
| 14 | + * This program is distributed in the hope that it will be useful, | ||
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | + * GNU General Public License for more details. | ||
| 5 | * | 18 | * |
| 19 | + * You should have received a copy of the GNU General Public License | ||
| 20 | + * along with this program; if not, write to the Free Software | ||
| 21 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 22 | + * | ||
| 23 | + * @version $Revision$ | ||
| 6 | * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | 24 | * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa |
| 7 | * @package lib.documentmanagement | 25 | * @package lib.documentmanagement |
| 8 | */ | 26 | */ |
| 9 | - | ||
| 10 | class DocumentCollaboration { | 27 | class DocumentCollaboration { |
| 11 | 28 | ||
| 12 | /** | 29 | /** |
| @@ -17,7 +34,7 @@ class DocumentCollaboration { | @@ -17,7 +34,7 @@ class DocumentCollaboration { | ||
| 17 | function documentCollaborationStarted($iDocumentID) { | 34 | function documentCollaborationStarted($iDocumentID) { |
| 18 | global $default; | 35 | global $default; |
| 19 | $sql = $default->db; | 36 | $sql = $default->db; |
| 20 | - $sql->query("SELECT id FROM $default->owl_folders_user_roles_table WHERE document_id = $iDocumentID AND (active = 1 OR done = 1)"); | 37 | + $sql->query("SELECT id FROM $default->folders_user_roles_table WHERE document_id = $iDocumentID AND (active = 1 OR done = 1)"); |
| 21 | if ($sql->next_record()) { | 38 | if ($sql->next_record()) { |
| 22 | return true; | 39 | return true; |
| 23 | } | 40 | } |
| @@ -27,7 +44,7 @@ class DocumentCollaboration { | @@ -27,7 +44,7 @@ class DocumentCollaboration { | ||
| 27 | function documentCollaborationDone($iDocumentID) { | 44 | function documentCollaborationDone($iDocumentID) { |
| 28 | global $default; | 45 | global $default; |
| 29 | $sql = $default->db; | 46 | $sql = $default->db; |
| 30 | - $sql->query("SELECT id FROM $default->owl_folders_user_roles_table WHERE document_id = $iDocumentID AND done = 0"); | 47 | + $sql->query("SELECT id FROM $default->folders_user_roles_table WHERE document_id = $iDocumentID AND done = 0"); |
| 31 | if ($sql->num_rows() > 0) { | 48 | if ($sql->num_rows() > 0) { |
| 32 | return false; | 49 | return false; |
| 33 | } else { | 50 | } else { |
| @@ -43,7 +60,7 @@ class DocumentCollaboration { | @@ -43,7 +60,7 @@ class DocumentCollaboration { | ||
| 43 | function userIsPerformingCurrentCollaborationStep($iDocumentID) { | 60 | function userIsPerformingCurrentCollaborationStep($iDocumentID) { |
| 44 | global $default; | 61 | global $default; |
| 45 | $sql = $default->db; | 62 | $sql = $default->db; |
| 46 | - $sql->query("SELECT id FROM $default->owl_folders_user_roles_table WHERE document_id = $iDocumentID AND active = 1 AND user_id = " . $_SESSION["userID"]); | 63 | + $sql->query("SELECT id FROM $default->folders_user_roles_table WHERE document_id = $iDocumentID AND active = 1 AND user_id = " . $_SESSION["userID"]); |
| 47 | if ($sql->next_record()) { | 64 | if ($sql->next_record()) { |
| 48 | return true; | 65 | return true; |
| 49 | } | 66 | } |
| @@ -59,7 +76,7 @@ class DocumentCollaboration { | @@ -59,7 +76,7 @@ class DocumentCollaboration { | ||
| 59 | function resetDocumentCollaborationSteps($iDocumentID) { | 76 | function resetDocumentCollaborationSteps($iDocumentID) { |
| 60 | global $default; | 77 | global $default; |
| 61 | $sql = $default->db; | 78 | $sql = $default->db; |
| 62 | - if ($sql->query("UPDATE $default->owl_folders_user_roles_table SET active = 0, done = 0 WHERE document_id = $iDocumentID")) { | 79 | + if ($sql->query("UPDATE $default->folders_user_roles_table SET active = 0, done = 0 WHERE document_id = $iDocumentID")) { |
| 63 | return true; | 80 | return true; |
| 64 | } | 81 | } |
| 65 | return false; | 82 | return false; |
| @@ -73,7 +90,7 @@ class DocumentCollaboration { | @@ -73,7 +90,7 @@ class DocumentCollaboration { | ||
| 73 | function isLastStepInCollaborationProcess($iDocumentID) { | 90 | function isLastStepInCollaborationProcess($iDocumentID) { |
| 74 | global $default; | 91 | global $default; |
| 75 | $sql = $default->db; | 92 | $sql = $default->db; |
| 76 | - $sQuery = "SELECT id FROM $default->owl_folders_user_roles_table WHERE document_id = $iDocumentID AND done = 0"; | 93 | + $sQuery = "SELECT id FROM $default->folders_user_roles_table WHERE document_id = $iDocumentID AND done = 0"; |
| 77 | $sql->query($sQuery); | 94 | $sql->query($sQuery); |
| 78 | $default->log->info("lastCollabStep:$sQuery"); | 95 | $default->log->info("lastCollabStep:$sQuery"); |
| 79 | if ($sql->num_rows() > 1) { | 96 | if ($sql->num_rows() > 1) { |
| @@ -91,8 +108,8 @@ class DocumentCollaboration { | @@ -91,8 +108,8 @@ class DocumentCollaboration { | ||
| 91 | global $default; | 108 | global $default; |
| 92 | $sql = $default->db; | 109 | $sql = $default->db; |
| 93 | // returns all users, the sequence of their collaboration and the time of completion | 110 | // returns all users, the sequence of their collaboration and the time of completion |
| 94 | - $sQuery = "SELECT FURL.user_id, FURL.datetime, GFAL.precedence FROM $default->owl_folders_user_roles_table FURL " . | ||
| 95 | - "INNER JOIN $default->owl_groups_folders_approval_table GFAL ON FURL.group_folder_approval_id = GFAL.id " . | 111 | + $sQuery = "SELECT FURL.user_id, FURL.datetime, GFAL.precedence FROM $default->folders_user_roles_table FURL " . |
| 112 | + "INNER JOIN $default->groups_folders_approval_table GFAL ON FURL.group_folder_approval_id = GFAL.id " . | ||
| 96 | "WHERE FURL.document_id = $iDocumentID " . | 113 | "WHERE FURL.document_id = $iDocumentID " . |
| 97 | "ORDER BY GFAL.precedence"; | 114 | "ORDER BY GFAL.precedence"; |
| 98 | $sql->query($sQuery); | 115 | $sql->query($sQuery); |
| @@ -124,8 +141,8 @@ class DocumentCollaboration { | @@ -124,8 +141,8 @@ class DocumentCollaboration { | ||
| 124 | //if the user is assigned to two or more roles, make sure we get the current | 141 | //if the user is assigned to two or more roles, make sure we get the current |
| 125 | //one by ordering by precedence | 142 | //one by ordering by precedence |
| 126 | $sql->query("SELECT FURL.id AS id, GFAT.precedence " . | 143 | $sql->query("SELECT FURL.id AS id, GFAT.precedence " . |
| 127 | - "FROM $default->owl_groups_folders_approval_table AS GFAT " . | ||
| 128 | - "INNER JOIN $default->owl_folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " . | 144 | + "FROM $default->groups_folders_approval_table AS GFAT " . |
| 145 | + "INNER JOIN $default->folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " . | ||
| 129 | "WHERE document_id = $iDocumentID AND FURL.user_id = " . $_SESSION["userID"] . " AND done=0 " . | 146 | "WHERE document_id = $iDocumentID AND FURL.user_id = " . $_SESSION["userID"] . " AND done=0 " . |
| 130 | "ORDER BY precedence ASC"); | 147 | "ORDER BY precedence ASC"); |
| 131 | if ($sql->next_record()) { | 148 | if ($sql->next_record()) { |
| @@ -138,16 +155,16 @@ class DocumentCollaboration { | @@ -138,16 +155,16 @@ class DocumentCollaboration { | ||
| 138 | //get it's sequence number | 155 | //get it's sequence number |
| 139 | $iCurrentSequenceNumber = $sql->f("precedence"); | 156 | $iCurrentSequenceNumber = $sql->f("precedence"); |
| 140 | $sql->query("SELECT MIN(precedence) AS precedence " . | 157 | $sql->query("SELECT MIN(precedence) AS precedence " . |
| 141 | - "FROM $default->owl_groups_folders_approval_table AS GFAT " . | ||
| 142 | - "INNER JOIN $default->owl_folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " . | 158 | + "FROM $default->groups_folders_approval_table AS GFAT " . |
| 159 | + "INNER JOIN $default->folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " . | ||
| 143 | "WHERE document_id = $iDocumentID AND done = 0"); | 160 | "WHERE document_id = $iDocumentID AND done = 0"); |
| 144 | if ($sql->next_record()) { | 161 | if ($sql->next_record()) { |
| 145 | if ($sql->f("precedence") != $iCurrentSequenceNumber) { | 162 | if ($sql->f("precedence") != $iCurrentSequenceNumber) { |
| 146 | //if there are no concurrent steps outstanding | 163 | //if there are no concurrent steps outstanding |
| 147 | $iNextSequenceNumber = $sql->f("precedence"); | 164 | $iNextSequenceNumber = $sql->f("precedence"); |
| 148 | $sql->query("SELECT FURL.id " . | 165 | $sql->query("SELECT FURL.id " . |
| 149 | - "FROM $default->owl_groups_folders_approval_table AS GFAT " . | ||
| 150 | - "INNER JOIN $default->owl_folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " . | 166 | + "FROM $default->groups_folders_approval_table AS GFAT " . |
| 167 | + "INNER JOIN $default->folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " . | ||
| 151 | "WHERE document_id = $iDocumentID AND precedence = $iNextSequenceNumber"); | 168 | "WHERE document_id = $iDocumentID AND precedence = $iNextSequenceNumber"); |
| 152 | while ($sql->next_record()) { | 169 | while ($sql->next_record()) { |
| 153 | $oFolderUserRole = FolderUserRole::get($sql->f("id")); | 170 | $oFolderUserRole = FolderUserRole::get($sql->f("id")); |
| @@ -187,7 +204,7 @@ class DocumentCollaboration { | @@ -187,7 +204,7 @@ class DocumentCollaboration { | ||
| 187 | global $default; | 204 | global $default; |
| 188 | //only create the documents if they haven't been created | 205 | //only create the documents if they haven't been created |
| 189 | if ($oFolderUserRole->getDependantDocumentsCreated() == false) { | 206 | if ($oFolderUserRole->getDependantDocumentsCreated() == false) { |
| 190 | - $sQuery = "SELECT * FROM $default->owl_dependant_document_template_table WHERE group_folder_approval_link_id = " . $oFolderUserRole->getGroupFolderApprovalID(); | 207 | + $sQuery = "SELECT * FROM $default->dependant_document_template_table WHERE group_folder_approval_link_id = " . $oFolderUserRole->getGroupFolderApprovalID(); |
| 191 | $sql = $default->db; | 208 | $sql = $default->db; |
| 192 | $sql->query($sQuery); | 209 | $sql->query($sQuery); |
| 193 | while ($sql->next_record()) { | 210 | while ($sql->next_record()) { |
| @@ -231,8 +248,8 @@ class DocumentCollaboration { | @@ -231,8 +248,8 @@ class DocumentCollaboration { | ||
| 231 | global $default; | 248 | global $default; |
| 232 | //get the current sequence number | 249 | //get the current sequence number |
| 233 | $sQuery = "SELECT GFAT.precedence, GFAT.folder_id, FURL.id AS furl_id, FURL.document_id AS document_id " . | 250 | $sQuery = "SELECT GFAT.precedence, GFAT.folder_id, FURL.id AS furl_id, FURL.document_id AS document_id " . |
| 234 | - "FROM $default->owl_folders_user_roles_table AS FURL " . | ||
| 235 | - "INNER JOIN $default->owl_groups_folders_approval_table AS GFAT ON FURL.group_folder_approval_id = GFAT.id " . | 251 | + "FROM $default->folders_user_roles_table AS FURL " . |
| 252 | + "INNER JOIN $default->groups_folders_approval_table AS GFAT ON FURL.group_folder_approval_id = GFAT.id " . | ||
| 236 | "WHERE FURL.document_id = $iDocumentID " . | 253 | "WHERE FURL.document_id = $iDocumentID " . |
| 237 | "AND FURL.user_id = " . $_SESSION["userID"] . " " . | 254 | "AND FURL.user_id = " . $_SESSION["userID"] . " " . |
| 238 | "AND FURL.active = 1 " . | 255 | "AND FURL.active = 1 " . |
| @@ -251,8 +268,8 @@ class DocumentCollaboration { | @@ -251,8 +268,8 @@ class DocumentCollaboration { | ||
| 251 | //if there are concurrent collaboration steps and one is rejected, then all | 268 | //if there are concurrent collaboration steps and one is rejected, then all |
| 252 | //must be rolled back, whether they were accepted or not | 269 | //must be rolled back, whether they were accepted or not |
| 253 | $sQuery = "SELECT FURL.id, FURL.user_id " . | 270 | $sQuery = "SELECT FURL.id, FURL.user_id " . |
| 254 | - "FROM $default->owl_folders_user_roles_table AS FURL " . | ||
| 255 | - "INNER JOIN $default->owl_groups_folders_approval_table AS GFAT ON FURL.group_folder_approval_id = GFAT.id " . | 271 | + "FROM $default->folders_user_roles_table AS FURL " . |
| 272 | + "INNER JOIN $default->groups_folders_approval_table AS GFAT ON FURL.group_folder_approval_id = GFAT.id " . | ||
| 256 | "WHERE FURL.document_id = $iDocumentID AND GFAT.precedence = $iCurrentSequenceNumber"; | 273 | "WHERE FURL.document_id = $iDocumentID AND GFAT.precedence = $iCurrentSequenceNumber"; |
| 257 | $sql->query($sQuery); | 274 | $sql->query($sQuery); |
| 258 | 275 | ||
| @@ -287,7 +304,7 @@ class DocumentCollaboration { | @@ -287,7 +304,7 @@ class DocumentCollaboration { | ||
| 287 | 304 | ||
| 288 | //get the previous sequence number | 305 | //get the previous sequence number |
| 289 | $sQuery = "SELECT COALESCE(MAX(precedence), -1) AS precedence " . | 306 | $sQuery = "SELECT COALESCE(MAX(precedence), -1) AS precedence " . |
| 290 | - "FROM $default->owl_groups_folders_approval_table AS GFAT " . | 307 | + "FROM $default->groups_folders_approval_table AS GFAT " . |
| 291 | "WHERE precedence < $iCurrentSequenceNumber"; | 308 | "WHERE precedence < $iCurrentSequenceNumber"; |
| 292 | "AND folder_id = $iFolderID"; | 309 | "AND folder_id = $iFolderID"; |
| 293 | $sql->query($sQuery); | 310 | $sql->query($sQuery); |
| @@ -312,7 +329,7 @@ class DocumentCollaboration { | @@ -312,7 +329,7 @@ class DocumentCollaboration { | ||
| 312 | } else { | 329 | } else { |
| 313 | //there are steps prior to this step | 330 | //there are steps prior to this step |
| 314 | $sQuery = "SELECT FURL.id AS furl_id " . | 331 | $sQuery = "SELECT FURL.id AS furl_id " . |
| 315 | - "FROM $default->owl_folders_user_roles_table AS FURL INNER JOIN $default->owl_groups_folders_approval_table AS GFAT ON FURL.group_folder_approval_id = GFAT.id " . | 332 | + "FROM $default->folders_user_roles_table AS FURL INNER JOIN $default->groups_folders_approval_table AS GFAT ON FURL.group_folder_approval_id = GFAT.id " . |
| 316 | "WHERE FURL.document_id = $iDocumentID " . | 333 | "WHERE FURL.document_id = $iDocumentID " . |
| 317 | "AND GFAT.precedence = " . $sql->f("precedence"); | 334 | "AND GFAT.precedence = " . $sql->f("precedence"); |
| 318 | 335 | ||
| @@ -354,7 +371,7 @@ class DocumentCollaboration { | @@ -354,7 +371,7 @@ class DocumentCollaboration { | ||
| 354 | */ | 371 | */ |
| 355 | function documentIsPendingWebPublishing($iDocumentID) { | 372 | function documentIsPendingWebPublishing($iDocumentID) { |
| 356 | global $default; | 373 | global $default; |
| 357 | - $sQuery = "SELECT id FROM $default->owl_web_documents_table WHERE document_id = $iDocumentID AND status_id = 1"; | 374 | + $sQuery = "SELECT id FROM $default->web_documents_table WHERE document_id = $iDocumentID AND status_id = 1"; |
| 358 | $sql = $default->db; | 375 | $sql = $default->db; |
| 359 | $sql->query($sQuery); | 376 | $sql->query($sQuery); |
| 360 | if ($sql->next_record()) { | 377 | if ($sql->next_record()) { |
| @@ -368,7 +385,7 @@ class DocumentCollaboration { | @@ -368,7 +385,7 @@ class DocumentCollaboration { | ||
| 368 | */ | 385 | */ |
| 369 | function documentIsPublished($iDocumentID) { | 386 | function documentIsPublished($iDocumentID) { |
| 370 | global $default; | 387 | global $default; |
| 371 | - $sQuery = "SELECT id FROM $default->owl_web_documents_table WHERE document_id = $iDocumentID AND status_id = 2"; | 388 | + $sQuery = "SELECT id FROM $default->web_documents_table WHERE document_id = $iDocumentID AND status_id = 2"; |
| 372 | $sql = $default->db; | 389 | $sql = $default->db; |
| 373 | $sql->query($sQuery); | 390 | $sql->query($sQuery); |
| 374 | if ($sql->next_record()) { | 391 | if ($sql->next_record()) { |
| @@ -386,8 +403,8 @@ class DocumentCollaboration { | @@ -386,8 +403,8 @@ class DocumentCollaboration { | ||
| 386 | function notifyWebMaster($iDocumentID, $sComment) { | 403 | function notifyWebMaster($iDocumentID, $sComment) { |
| 387 | global $default; | 404 | global $default; |
| 388 | $sQuery = "SELECT WS.web_master_id, WS.web_site_name, WS.web_site_url " . | 405 | $sQuery = "SELECT WS.web_master_id, WS.web_site_name, WS.web_site_url " . |
| 389 | - "FROM $default->owl_web_sites_table AS WS " . | ||
| 390 | - "INNER JOIN $default->owl_web_documents_table AS WD ON WS.id = WD.web_site_id " . | 406 | + "FROM $default->web_sites_table AS WS " . |
| 407 | + "INNER JOIN $default->web_documents_table AS WD ON WS.id = WD.web_site_id " . | ||
| 391 | "WHERE WD.document_id = $iDocumentID"; | 408 | "WHERE WD.document_id = $iDocumentID"; |
| 392 | 409 | ||
| 393 | $sql = $default->db; | 410 | $sql = $default->db; |
lib/documentmanagement/DocumentField.inc
| 1 | <?php | 1 | <?php |
| 2 | require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentType.inc"); | 2 | require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentType.inc"); |
| 3 | /** | 3 | /** |
| 4 | + * $Id$ | ||
| 4 | * | 5 | * |
| 5 | - * Class DocumentField | 6 | + * Represents a document field as per the database document_fields table. |
| 6 | * | 7 | * |
| 7 | - * Represents a document field as per the database document_fields table | 8 | + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com |
| 8 | * | 9 | * |
| 10 | + * This program is free software; you can redistribute it and/or modify | ||
| 11 | + * it under the terms of the GNU General Public License as published by | ||
| 12 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | + * (at your option) any later version. | ||
| 14 | + * | ||
| 15 | + * This program is distributed in the hope that it will be useful, | ||
| 16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | + * GNU General Public License for more details. | ||
| 19 | + * | ||
| 20 | + * You should have received a copy of the GNU General Public License | ||
| 21 | + * along with this program; if not, write to the Free Software | ||
| 22 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 23 | + * | ||
| 24 | + * @version $Revision$ | ||
| 9 | * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | 25 | * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa |
| 10 | - * @date 19 January 2003 | ||
| 11 | - * @package lib.documentmanagement | ||
| 12 | - */ | 26 | + * @package lib.documentmanagement |
| 27 | + */ | ||
| 13 | class DocumentField { | 28 | class DocumentField { |
| 14 | 29 | ||
| 15 | /** primary key value */ | 30 | /** primary key value */ |
| @@ -146,7 +161,7 @@ class DocumentField { | @@ -146,7 +161,7 @@ class DocumentField { | ||
| 146 | //if the object hasn't been created | 161 | //if the object hasn't been created |
| 147 | if ($this->iId < 0) { | 162 | if ($this->iId < 0) { |
| 148 | $sql = $default->db; | 163 | $sql = $default->db; |
| 149 | - $result = $sql->query("INSERT INTO " . $default->owl_fields_table . " (name, data_type,is_generic,has_lookup) VALUES ('" . addslashes($this->sName) . "', '" . addslashes($this->sDataType) . "', '" . $this->bIsGeneric . "', '" . $this->bHasLookup ."')"); | 164 | + $result = $sql->query("INSERT INTO " . $default->document_fields_table . " (name, data_type,is_generic,has_lookup) VALUES ('" . addslashes($this->sName) . "', '" . addslashes($this->sDataType) . "', '" . $this->bIsGeneric . "', '" . $this->bHasLookup ."')"); |
| 150 | if ($result) { | 165 | if ($result) { |
| 151 | $this->iId = $sql->insert_id(); | 166 | $this->iId = $sql->insert_id(); |
| 152 | return true; | 167 | return true; |
| @@ -169,7 +184,7 @@ class DocumentField { | @@ -169,7 +184,7 @@ class DocumentField { | ||
| 169 | //only update if the object has been stored | 184 | //only update if the object has been stored |
| 170 | if ($this->iId > 0) { | 185 | if ($this->iId > 0) { |
| 171 | $sql = $default->db; | 186 | $sql = $default->db; |
| 172 | - $result = $sql->query("UPDATE " . $default->owl_fields_table . " SET name = '" . addslashes($this->sName) . "', data_type = '" . addslashes($this->sDataType) . "', is_generic = '" . $this->bIsGeneric . "', has_lookup = '" . $this->bHasLookup . "' WHERE id = $this->iId"); | 187 | + $result = $sql->query("UPDATE " . $default->document_fields_table . " SET name = '" . addslashes($this->sName) . "', data_type = '" . addslashes($this->sDataType) . "', is_generic = '" . $this->bIsGeneric . "', has_lookup = '" . $this->bHasLookup . "' WHERE id = $this->iId"); |
| 173 | if ($result) { | 188 | if ($result) { |
| 174 | return true; | 189 | return true; |
| 175 | } | 190 | } |
| @@ -191,7 +206,7 @@ class DocumentField { | @@ -191,7 +206,7 @@ class DocumentField { | ||
| 191 | //only delete the object if it exists in the database | 206 | //only delete the object if it exists in the database |
| 192 | if ($this->iId >= 0) { | 207 | if ($this->iId >= 0) { |
| 193 | $sql = $default->db; | 208 | $sql = $default->db; |
| 194 | - $result = $sql->query("DELETE FROM $default->owl_fields_table WHERE id = $this->iId"); | 209 | + $result = $sql->query("DELETE FROM $default->document_fields_table WHERE id = $this->iId"); |
| 195 | if ($result) { | 210 | if ($result) { |
| 196 | return true; | 211 | return true; |
| 197 | } | 212 | } |
| @@ -213,14 +228,14 @@ class DocumentField { | @@ -213,14 +228,14 @@ class DocumentField { | ||
| 213 | function & get($iDocumentFieldsID) { | 228 | function & get($iDocumentFieldsID) { |
| 214 | global $default; | 229 | global $default; |
| 215 | $sql = $default->db; | 230 | $sql = $default->db; |
| 216 | - $result = $sql->query("SELECT * FROM $default->owl_fields_table WHERE id = $iDocumentFieldsID"); | 231 | + $result = $sql->query("SELECT * FROM $default->document_fields_table WHERE id = $iDocumentFieldsID"); |
| 217 | if ($result) { | 232 | if ($result) { |
| 218 | if ($sql->next_record()) { | 233 | if ($sql->next_record()) { |
| 219 | $oDocumentField = & new DocumentField(stripslashes($sql->f("name")), stripslashes($sql->f("data_type")), $sql->f("is_generic"), $sql->f("has_lookup")); | 234 | $oDocumentField = & new DocumentField(stripslashes($sql->f("name")), stripslashes($sql->f("data_type")), $sql->f("is_generic"), $sql->f("has_lookup")); |
| 220 | $oDocumentField->iId = $sql->f("id"); | 235 | $oDocumentField->iId = $sql->f("id"); |
| 221 | return $oDocumentField; | 236 | return $oDocumentField; |
| 222 | } | 237 | } |
| 223 | - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->owl_fields_table"; | 238 | + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->document_fields_table"; |
| 224 | return false; | 239 | return false; |
| 225 | } | 240 | } |
| 226 | $_SESSION["errorMessage"] = $lang_err_database; | 241 | $_SESSION["errorMessage"] = $lang_err_database; |
| @@ -238,7 +253,7 @@ class DocumentField { | @@ -238,7 +253,7 @@ class DocumentField { | ||
| 238 | global $default; | 253 | global $default; |
| 239 | $aDocumentFieldArray = array(); | 254 | $aDocumentFieldArray = array(); |
| 240 | $sql = $default->db; | 255 | $sql = $default->db; |
| 241 | - $sQuery = "SELECT id FROM " . $default->owl_fields_table . (isset($sWhereClause) ? " WHERE $sWhereClause" : ""); | 256 | + $sQuery = "SELECT id FROM " . $default->document_fields_table . (isset($sWhereClause) ? " WHERE $sWhereClause" : ""); |
| 242 | $result = $sql->query($sQuery); | 257 | $result = $sql->query($sQuery); |
| 243 | if ($result) { | 258 | if ($result) { |
| 244 | while ($sql->next_record()) { | 259 | while ($sql->next_record()) { |
| @@ -256,7 +271,7 @@ class DocumentField { | @@ -256,7 +271,7 @@ class DocumentField { | ||
| 256 | global $default; | 271 | global $default; |
| 257 | $aDocumentTypes = array(); | 272 | $aDocumentTypes = array(); |
| 258 | $sql = $default->db; | 273 | $sql = $default->db; |
| 259 | - $query = "SELECT document_type_id FROM " . $default->owl_document_type_fields_table . " WHERE field_id = $this->iId"; | 274 | + $query = "SELECT document_type_id FROM " . $default->document_type_fields_table . " WHERE field_id = $this->iId"; |
| 260 | if ($sql->query($query)) { | 275 | if ($sql->query($query)) { |
| 261 | while ($sql->next_record()) { | 276 | while ($sql->next_record()) { |
| 262 | $aDocumentTypes[] = & DocumentType::get($sql->f("document_type_id")); | 277 | $aDocumentTypes[] = & DocumentType::get($sql->f("document_type_id")); |
| @@ -275,7 +290,7 @@ class DocumentField { | @@ -275,7 +290,7 @@ class DocumentField { | ||
| 275 | function isFieldLinkedToType() { | 290 | function isFieldLinkedToType() { |
| 276 | global $default; | 291 | global $default; |
| 277 | $sql = $default->db; | 292 | $sql = $default->db; |
| 278 | - $query = "SELECT document_type_id FROM " . $default->owl_document_type_fields_table . " WHERE field_id = $this->iId"; | 293 | + $query = "SELECT document_type_id FROM " . $default->document_type_fields_table . " WHERE field_id = $this->iId"; |
| 279 | if ($sql->query($query)) { | 294 | if ($sql->query($query)) { |
| 280 | $rows = $sql->num_rows($sql); | 295 | $rows = $sql->num_rows($sql); |
| 281 | if ($rows > 0) { | 296 | if ($rows > 0) { |
| @@ -299,7 +314,7 @@ class DocumentField { | @@ -299,7 +314,7 @@ class DocumentField { | ||
| 299 | $aDataTypes; | 314 | $aDataTypes; |
| 300 | settype($aDataTypes, "array"); | 315 | settype($aDataTypes, "array"); |
| 301 | $sql = $default->db; | 316 | $sql = $default->db; |
| 302 | - $result = $sql->query("SELECT id, name FROM " . $default->owl_data_types_table ); | 317 | + $result = $sql->query("SELECT id, name FROM " . $default->data_types_table ); |
| 303 | if ($result) { | 318 | if ($result) { |
| 304 | $iCount = 0; | 319 | $iCount = 0; |
| 305 | while ($sql->next_record()) { | 320 | while ($sql->next_record()) { |
| @@ -318,7 +333,7 @@ class DocumentField { | @@ -318,7 +333,7 @@ class DocumentField { | ||
| 318 | global $default; | 333 | global $default; |
| 319 | 334 | ||
| 320 | $sql = $default->db; | 335 | $sql = $default->db; |
| 321 | - $result = $sql->query("SELECT COUNT(*) AS count FROM " . $default->owl_metadata_table . " WHERE document_field_id = " . $iDocumentFieldID); | 336 | + $result = $sql->query("SELECT COUNT(*) AS count FROM " . $default->metadata_table . " WHERE document_field_id = " . $iDocumentFieldID); |
| 322 | if ($result) { | 337 | if ($result) { |
| 323 | if ($sql->next_record()) { | 338 | if ($sql->next_record()) { |
| 324 | return $sql->f("count"); | 339 | return $sql->f("count"); |
lib/documentmanagement/DocumentFieldLink.inc
| 1 | <?php | 1 | <?php |
| 2 | - | ||
| 3 | /** | 2 | /** |
| 4 | -* | ||
| 5 | -* Class DocumentFieldLink | ||
| 6 | -* | ||
| 7 | -* Represents a document field link as per the database table document_fields_link | ||
| 8 | -* | ||
| 9 | -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 10 | -* @date 19 January 2003 | ||
| 11 | -* @package lib.documentmanagement | ||
| 12 | -*/ | ||
| 13 | - | 3 | + * $Id$ |
| 4 | + * | ||
| 5 | + * Represents a document field link as per the database table document_fields_link. | ||
| 6 | + * | ||
| 7 | + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 8 | + * | ||
| 9 | + * This program is free software; you can redistribute it and/or modify | ||
| 10 | + * it under the terms of the GNU General Public License as published by | ||
| 11 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 12 | + * (at your option) any later version. | ||
| 13 | + * | ||
| 14 | + * This program is distributed in the hope that it will be useful, | ||
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | + * GNU General Public License for more details. | ||
| 18 | + * | ||
| 19 | + * You should have received a copy of the GNU General Public License | ||
| 20 | + * along with this program; if not, write to the Free Software | ||
| 21 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 22 | + * | ||
| 23 | + * @version $Revision$ | ||
| 24 | + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | + * @package lib.documentmanagement | ||
| 26 | + */ | ||
| 14 | class DocumentFieldLink { | 27 | class DocumentFieldLink { |
| 15 | 28 | ||
| 16 | /** document field link primary key */ | 29 | /** document field link primary key */ |
| @@ -119,7 +132,7 @@ class DocumentFieldLink { | @@ -119,7 +132,7 @@ class DocumentFieldLink { | ||
| 119 | //if the id >= 0, then the object has already been created | 132 | //if the id >= 0, then the object has already been created |
| 120 | if ($this->iId < 0) { | 133 | if ($this->iId < 0) { |
| 121 | $sql = $default->db; | 134 | $sql = $default->db; |
| 122 | - $result = $sql->query("INSERT INTO " . $default->owl_document_fields_table . " (document_id, document_field_id, value) " . | 135 | + $result = $sql->query("INSERT INTO " . $default->document_fields_link_table . " (document_id, document_field_id, value) " . |
| 123 | "VALUES ($this->iDocumentID, $this->iDocumentFieldID, '" . addslashes($this->sValue) . "')"); | 136 | "VALUES ($this->iDocumentID, $this->iDocumentFieldID, '" . addslashes($this->sValue) . "')"); |
| 124 | if ($result) { | 137 | if ($result) { |
| 125 | //set the current documents primary key | 138 | //set the current documents primary key |
| @@ -129,7 +142,7 @@ class DocumentFieldLink { | @@ -129,7 +142,7 @@ class DocumentFieldLink { | ||
| 129 | $_SESSION["errorMessage"] = $lang_err_database; | 142 | $_SESSION["errorMessage"] = $lang_err_database; |
| 130 | return false; | 143 | return false; |
| 131 | } | 144 | } |
| 132 | - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_document_fields_table"; | 145 | + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->document_fields_link_table"; |
| 133 | return false; | 146 | return false; |
| 134 | 147 | ||
| 135 | } | 148 | } |
| @@ -143,7 +156,7 @@ class DocumentFieldLink { | @@ -143,7 +156,7 @@ class DocumentFieldLink { | ||
| 143 | global $default, $lang_err_database, $lang_err_object_key; | 156 | global $default, $lang_err_database, $lang_err_object_key; |
| 144 | if ($this->iId >= 0) { | 157 | if ($this->iId >= 0) { |
| 145 | $sql = $default->db; | 158 | $sql = $default->db; |
| 146 | - $result = $sql->query("UPDATE " . $default->owl_document_fields_table . " SET " . | 159 | + $result = $sql->query("UPDATE " . $default->document_fields_link_table . " SET " . |
| 147 | "document_id = $this->iDocumentID, document_field_id = $this->iDocumentFieldID, value = '" . addslashes($this->sValue) . "'" . | 160 | "document_id = $this->iDocumentID, document_field_id = $this->iDocumentFieldID, value = '" . addslashes($this->sValue) . "'" . |
| 148 | "WHERE id = $this->iId"); | 161 | "WHERE id = $this->iId"); |
| 149 | if ($result) { | 162 | if ($result) { |
| @@ -167,7 +180,7 @@ class DocumentFieldLink { | @@ -167,7 +180,7 @@ class DocumentFieldLink { | ||
| 167 | global $default, $lang_err_database, $lang_err_object_key; | 180 | global $default, $lang_err_database, $lang_err_object_key; |
| 168 | if ($this->iId >= 0) { | 181 | if ($this->iId >= 0) { |
| 169 | $sql = $default->db; | 182 | $sql = $default->db; |
| 170 | - $result = $sql->query("DELETE FROM " . $default->owl_document_fields_table . " WHERE id = $this->iId"); | 183 | + $result = $sql->query("DELETE FROM " . $default->document_fields_link_table . " WHERE id = $this->iId"); |
| 171 | if ($result) { | 184 | if ($result) { |
| 172 | $this->iId = -1; | 185 | $this->iId = -1; |
| 173 | return true; | 186 | return true; |
| @@ -191,13 +204,13 @@ class DocumentFieldLink { | @@ -191,13 +204,13 @@ class DocumentFieldLink { | ||
| 191 | function & get($iDocumentFieldLinkID) { | 204 | function & get($iDocumentFieldLinkID) { |
| 192 | global $default, $lang_err_doc_not_exist; | 205 | global $default, $lang_err_doc_not_exist; |
| 193 | $sql = $default->db; | 206 | $sql = $default->db; |
| 194 | - $sql->query("SELECT * FROM " . $default->owl_document_fields_table . " WHERE id = " . $iDocumentFieldLinkID); | 207 | + $sql->query("SELECT * FROM " . $default->document_fields_link_table . " WHERE id = " . $iDocumentFieldLinkID); |
| 195 | if ($sql->next_record()) { | 208 | if ($sql->next_record()) { |
| 196 | $oDocumentFieldLink = & new DocumentFieldLink($sql->f("document_id"), $sql->f("document_field_id"), $sql->f("value")); | 209 | $oDocumentFieldLink = & new DocumentFieldLink($sql->f("document_id"), $sql->f("document_field_id"), $sql->f("value")); |
| 197 | $oDocumentFieldLink->iId = $iDocumentFieldLinkID; | 210 | $oDocumentFieldLink->iId = $iDocumentFieldLinkID; |
| 198 | return $oDocumentFieldLink; | 211 | return $oDocumentFieldLink; |
| 199 | } | 212 | } |
| 200 | - $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->owl_document_fields_table"; | 213 | + $_SESSION["errorMessage"] = $lang_err_object_not_exist . "id = " . $iDocumentID . " table = $default->document_fields_link_table"; |
| 201 | return false; | 214 | return false; |
| 202 | } | 215 | } |
| 203 | } | 216 | } |
lib/documentmanagement/DocumentLink.inc
| 1 | <?php | 1 | <?php |
| 2 | /** | 2 | /** |
| 3 | -* | ||
| 4 | -* Class DocumentLink | ||
| 5 | -* | ||
| 6 | -* Represents a document link as per the database document_link table | ||
| 7 | -* Links a child document to a parent document. Direction of relationship | ||
| 8 | -* is defined through document collaboration | ||
| 9 | -* | ||
| 10 | -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 11 | -* @date 14 May 2003 | ||
| 12 | -* @package lib.documentmanagement | ||
| 13 | -*/ | ||
| 14 | - | ||
| 15 | - | 3 | + * $Id$ |
| 4 | + * | ||
| 5 | + * Represents a document link as per the database document_link table. | ||
| 6 | + * Links a child document to a parent document. Direction of relationship | ||
| 7 | + * is defined through document collaboration. | ||
| 8 | + * | ||
| 9 | + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 10 | + * | ||
| 11 | + * This program is free software; you can redistribute it and/or modify | ||
| 12 | + * it under the terms of the GNU General Public License as published by | ||
| 13 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 14 | + * (at your option) any later version. | ||
| 15 | + * | ||
| 16 | + * This program is distributed in the hope that it will be useful, | ||
| 17 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 18 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 19 | + * GNU General Public License for more details. | ||
| 20 | + * | ||
| 21 | + * You should have received a copy of the GNU General Public License | ||
| 22 | + * along with this program; if not, write to the Free Software | ||
| 23 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 24 | + * | ||
| 25 | + * @version $Revision$ | ||
| 26 | + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 27 | + * @package lib.documentmanagement | ||
| 28 | + */ | ||
| 16 | class DocumentLink { | 29 | class DocumentLink { |
| 17 | 30 | ||
| 18 | /** primary key value */ | 31 | /** primary key value */ |
| @@ -141,7 +154,7 @@ class DocumentLink { | @@ -141,7 +154,7 @@ class DocumentLink { | ||
| 141 | //only delete the object if it exists in the database | 154 | //only delete the object if it exists in the database |
| 142 | if ($this -> iId >= 0) { | 155 | if ($this -> iId >= 0) { |
| 143 | $sql = $default -> db; | 156 | $sql = $default -> db; |
| 144 | - $result = $sql -> query("DELETE FROM $default->owl_document_link_table WHERE id = $this->iId"); | 157 | + $result = $sql -> query("DELETE FROM $default->document_link_table WHERE id = $this->iId"); |
| 145 | if ($result) { | 158 | if ($result) { |
| 146 | return true; | 159 | return true; |
| 147 | } | 160 | } |
| @@ -163,14 +176,14 @@ class DocumentLink { | @@ -163,14 +176,14 @@ class DocumentLink { | ||
| 163 | function & get($iDocumentLinkID) { | 176 | function & get($iDocumentLinkID) { |
| 164 | global $default; | 177 | global $default; |
| 165 | $sql = $default -> db; | 178 | $sql = $default -> db; |
| 166 | - $result = $sql -> query("SELECT * FROM $default->owl_document_link_table WHERE id = $iDocumentLinkID"); | 179 | + $result = $sql -> query("SELECT * FROM $default->document_link_table WHERE id = $iDocumentLinkID"); |
| 167 | if ($result) { | 180 | if ($result) { |
| 168 | if ($sql -> next_record()) { | 181 | if ($sql -> next_record()) { |
| 169 | $oDocumentLink = & new DocumentLink($sql -> f("parent_document_id"), $sql -> f("parent_document_id")); | 182 | $oDocumentLink = & new DocumentLink($sql -> f("parent_document_id"), $sql -> f("parent_document_id")); |
| 170 | $oDocumentLink -> iId = $sql -> f("id"); | 183 | $oDocumentLink -> iId = $sql -> f("id"); |
| 171 | return $oDocumentLink; | 184 | return $oDocumentLink; |
| 172 | } | 185 | } |
| 173 | - $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDocumentLinkID." table = $default->owl_document_link_table"; | 186 | + $_SESSION["errorMessage"] = $lang_err_object_not_exist."id = ".$iDocumentLinkID." table = $default->document_link_table"; |
| 174 | return false; | 187 | return false; |
| 175 | } | 188 | } |
| 176 | $_SESSION["errorMessage"] = $lang_err_database; | 189 | $_SESSION["errorMessage"] = $lang_err_database; |
lib/documentmanagement/DocumentTransaction.inc
| @@ -14,21 +14,33 @@ DEFINE("EXPUNGE", 11); | @@ -14,21 +14,33 @@ DEFINE("EXPUNGE", 11); | ||
| 14 | DEFINE("FORCE_CHECKIN", 12); | 14 | DEFINE("FORCE_CHECKIN", 12); |
| 15 | DEFINE("EMAIL_LINK", 13); | 15 | DEFINE("EMAIL_LINK", 13); |
| 16 | DEFINE("COLLAB_ACCEPT", 14); | 16 | DEFINE("COLLAB_ACCEPT", 14); |
| 17 | - | ||
| 18 | /** | 17 | /** |
| 19 | -* | ||
| 20 | -* Class DocumentTransaction | ||
| 21 | -* | ||
| 22 | -* Represents a document transaction as per the database table document_transaction | ||
| 23 | -* | ||
| 24 | -* No delete or update functions are provided. Once a transaction has been stored | ||
| 25 | -* in the database it may not be changed. | ||
| 26 | -* | ||
| 27 | -* @author Rob Cherry, Jam Warehouse(Pty) Ltd, South Africa | ||
| 28 | -* @date 18 January 2003 | ||
| 29 | -* @package lib.documentmanagement | ||
| 30 | -*/ | ||
| 31 | - | 18 | + * $Id$ |
| 19 | + * | ||
| 20 | + * Represents a document transaction as per the database table document_transaction. | ||
| 21 | + * No delete or update functions are provided. Once a transaction has been stored | ||
| 22 | + * in the database it may not be changed. | ||
| 23 | + * | ||
| 24 | + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 25 | + * | ||
| 26 | + * This program is free software; you can redistribute it and/or modify | ||
| 27 | + * it under the terms of the GNU General Public License as published by | ||
| 28 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 29 | + * (at your option) any later version. | ||
| 30 | + * | ||
| 31 | + * This program is distributed in the hope that it will be useful, | ||
| 32 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 33 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 34 | + * GNU General Public License for more details. | ||
| 35 | + * | ||
| 36 | + * You should have received a copy of the GNU General Public License | ||
| 37 | + * along with this program; if not, write to the Free Software | ||
| 38 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 39 | + * | ||
| 40 | + * @version $Revision$ | ||
| 41 | + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 42 | + * @package lib.documentmanagement | ||
| 43 | + */ | ||
| 32 | class DocumentTransaction { | 44 | class DocumentTransaction { |
| 33 | 45 | ||
| 34 | /** primary key of document transaction */ | 46 | /** primary key of document transaction */ |
| @@ -92,7 +104,7 @@ class DocumentTransaction { | @@ -92,7 +104,7 @@ class DocumentTransaction { | ||
| 92 | //if the object hasn't been stored yet | 104 | //if the object hasn't been stored yet |
| 93 | if ($this->iId < 0) { | 105 | if ($this->iId < 0) { |
| 94 | $sql = $default->db; | 106 | $sql = $default->db; |
| 95 | - $result = $sql->query("INSERT INTO " . $default->owl_document_transactions_table . " (document_id, version, user_id, datetime, ip, filename, comment, transaction_id) " . | 107 | + $result = $sql->query("INSERT INTO " . $default->document_transactions_table . " (document_id, version, user_id, datetime, ip, filename, comment, transaction_id) " . |
| 96 | "VALUES ($this->iDocumentID, '" . addslashes($this->sVersion) . "', $this->iUserID, '" . addslashes($this->dDateTime) . "', '" . addslashes($this->sIP) . "', '" . addslashes($this->sFileName) . "', '" . addslashes($this->sComment) . "', $this->iTransactionID)"); | 108 | "VALUES ($this->iDocumentID, '" . addslashes($this->sVersion) . "', $this->iUserID, '" . addslashes($this->dDateTime) . "', '" . addslashes($this->sIP) . "', '" . addslashes($this->sFileName) . "', '" . addslashes($this->sComment) . "', $this->iTransactionID)"); |
| 97 | if ($result) { | 109 | if ($result) { |
| 98 | //object has been stored, set the primary key | 110 | //object has been stored, set the primary key |
| @@ -113,9 +125,7 @@ class DocumentTransaction { | @@ -113,9 +125,7 @@ class DocumentTransaction { | ||
| 113 | global $default, $lang_err_database, $lang_err_object_key; | 125 | global $default, $lang_err_database, $lang_err_object_key; |
| 114 | if ($this->iId >= 0) { | 126 | if ($this->iId >= 0) { |
| 115 | $sql = $default->db; | 127 | $sql = $default->db; |
| 116 | - // TODO: insert into sys_deleted | ||
| 117 | - //$result = $sql->query("INSERT INTO " . $default->owl_sys_deleted_table . " () VALUES ()"); | ||
| 118 | - $result = $sql->query("DELETE FROM " . $default->owl_document_transactions_table . " WHERE id = " . $this->iId); | 128 | + $result = $sql->query("DELETE FROM " . $default->document_transactions_table . " WHERE id = " . $this->iId); |
| 119 | if ($result) { | 129 | if ($result) { |
| 120 | $this->iId = -1; | 130 | $this->iId = -1; |
| 121 | return true; | 131 | return true; |
| @@ -138,7 +148,7 @@ class DocumentTransaction { | @@ -138,7 +148,7 @@ class DocumentTransaction { | ||
| 138 | global $default, $lang_err_doc_not_exist; | 148 | global $default, $lang_err_doc_not_exist; |
| 139 | if (strlen($iDocumentTransactionID) > 0) { | 149 | if (strlen($iDocumentTransactionID) > 0) { |
| 140 | $sql = $default->db; | 150 | $sql = $default->db; |
| 141 | - $sql->query("SELECT * FROM $default->owl_document_transactions_table WHERE id = $iDocumentTransactionID"); | 151 | + $sql->query("SELECT * FROM $default->document_transactions_table WHERE id = $iDocumentTransactionID"); |
| 142 | if ($sql->next_record()) { | 152 | if ($sql->next_record()) { |
| 143 | $oDocumentTransaction = & new DocumentTransaction($sql->f("document_id"), stripslashes($sql->f("comment")), $sql->f("transaction_id")); | 153 | $oDocumentTransaction = & new DocumentTransaction($sql->f("document_id"), stripslashes($sql->f("comment")), $sql->f("transaction_id")); |
| 144 | $oDocumentTransaction->iId = $sql->f("id"); | 154 | $oDocumentTransaction->iId = $sql->f("id"); |
| @@ -169,7 +179,7 @@ class DocumentTransaction { | @@ -169,7 +179,7 @@ class DocumentTransaction { | ||
| 169 | global $default, $lang_err_database; | 179 | global $default, $lang_err_database; |
| 170 | $aDocumentTransactionArray = array(); | 180 | $aDocumentTransactionArray = array(); |
| 171 | $sql = $default->db; | 181 | $sql = $default->db; |
| 172 | - $sQuery = "SELECT * FROM $default->owl_document_transactions_table " . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""); | 182 | + $sQuery = "SELECT * FROM $default->document_transactions_table " . (isset($sWhereClause) ? " WHERE " . $sWhereClause : ""); |
| 173 | $result = $sql->query($sQuery); | 183 | $result = $sql->query($sQuery); |
| 174 | if ($result) { | 184 | if ($result) { |
| 175 | while ($sql->next_record()) { | 185 | while ($sql->next_record()) { |
lib/documentmanagement/DocumentType.inc
| 1 | <?php | 1 | <?php |
| 2 | /** | 2 | /** |
| 3 | -* | ||
| 4 | -* Class DocumentType | ||
| 5 | -* | ||
| 6 | -* Represents a document type as per the database document_types_lookup table | ||
| 7 | -* | ||
| 8 | -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 9 | -* @date 19 January 2003 | ||
| 10 | -* @package lib.documentmanagement | ||
| 11 | -*/ | ||
| 12 | - | 3 | + * $Id$ |
| 4 | + * | ||
| 5 | + * Represents a document type as per the database document_types_lookup table. | ||
| 6 | + * | ||
| 7 | + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 8 | + * | ||
| 9 | + * This program is free software; you can redistribute it and/or modify | ||
| 10 | + * it under the terms of the GNU General Public License as published by | ||
| 11 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 12 | + * (at your option) any later version. | ||
| 13 | + * | ||
| 14 | + * This program is distributed in the hope that it will be useful, | ||
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | + * GNU General Public License for more details. | ||
| 18 | + * | ||
| 19 | + * You should have received a copy of the GNU General Public License | ||
| 20 | + * along with this program; if not, write to the Free Software | ||
| 21 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 22 | + * | ||
| 23 | + * @version $Revision$ | ||
| 24 | + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | + * @package lib.documentmanagement | ||
| 26 | + */ | ||
| 13 | class DocumentType { | 27 | class DocumentType { |
| 14 | 28 | ||
| 15 | /** primary key value */ | 29 | /** primary key value */ |
| @@ -73,7 +87,7 @@ class DocumentType { | @@ -73,7 +87,7 @@ class DocumentType { | ||
| 73 | if ($this->iId < 0) { | 87 | if ($this->iId < 0) { |
| 74 | //check to see if name exsits | 88 | //check to see if name exsits |
| 75 | $sql = $default->db; | 89 | $sql = $default->db; |
| 76 | - $query = "SELECT name FROM ". $default->owl_document_types_table ." WHERE name = '" . $this->sName . "'"; | 90 | + $query = "SELECT name FROM ". $default->document_types_table ." WHERE name = '" . $this->sName . "'"; |
| 77 | $sql->query($query); | 91 | $sql->query($query); |
| 78 | $rows = $sql->num_rows($sql); | 92 | $rows = $sql->num_rows($sql); |
| 79 | 93 | ||
| @@ -84,7 +98,7 @@ class DocumentType { | @@ -84,7 +98,7 @@ class DocumentType { | ||
| 84 | 98 | ||
| 85 | }else{ | 99 | }else{ |
| 86 | $sql = $default->db; | 100 | $sql = $default->db; |
| 87 | - $result = $sql->query("INSERT INTO " . $default->owl_document_types_table . " (name) VALUES ('" . addslashes($this->sName) . "')"); | 101 | + $result = $sql->query("INSERT INTO " . $default->document_types_table . " (name) VALUES ('" . addslashes($this->sName) . "')"); |
| 88 | if ($result) { | 102 | if ($result) { |
| 89 | $this->iId = $sql->insert_id(); | 103 | $this->iId = $sql->insert_id(); |
| 90 | return true; | 104 | return true; |
| @@ -109,7 +123,7 @@ class DocumentType { | @@ -109,7 +123,7 @@ class DocumentType { | ||
| 109 | //only update if the object has been stored | 123 | //only update if the object has been stored |
| 110 | if ($this->iId > 0) { | 124 | if ($this->iId > 0) { |
| 111 | $sql = $default->db; | 125 | $sql = $default->db; |
| 112 | - $result = $sql->query("UPDATE " . $default->owl_document_types_table . " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId"); | 126 | + $result = $sql->query("UPDATE " . $default->document_types_table . " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId"); |
| 113 | if ($result) { | 127 | if ($result) { |
| 114 | return true; | 128 | return true; |
| 115 | } | 129 | } |
| @@ -132,7 +146,7 @@ class DocumentType { | @@ -132,7 +146,7 @@ class DocumentType { | ||
| 132 | if ($this->iId > 0) { | 146 | if ($this->iId > 0) { |
| 133 | //check to see if name exsits | 147 | //check to see if name exsits |
| 134 | $sql = $default->db; | 148 | $sql = $default->db; |
| 135 | - $query = "SELECT folder_id FROM ". $default->owl_folder_doctypes_table ." WHERE document_type_id = '" . $this->iId . "'"; | 149 | + $query = "SELECT folder_id FROM ". $default->folder_doctypes_table ." WHERE document_type_id = '" . $this->iId . "'"; |
| 136 | $sql->query($query); | 150 | $sql->query($query); |
| 137 | $rows = $sql->num_rows($sql); | 151 | $rows = $sql->num_rows($sql); |
| 138 | 152 | ||
| @@ -143,7 +157,7 @@ class DocumentType { | @@ -143,7 +157,7 @@ class DocumentType { | ||
| 143 | 157 | ||
| 144 | }else{ | 158 | }else{ |
| 145 | $sql = $default->db; | 159 | $sql = $default->db; |
| 146 | - $result = $sql->query("DELETE FROM " . $default->owl_document_types_table . " WHERE id = '" . $this->iId . "'"); | 160 | + $result = $sql->query("DELETE FROM " . $default->document_types_table . " WHERE id = '" . $this->iId . "'"); |
| 147 | if ($result) { | 161 | if ($result) { |
| 148 | return true; | 162 | return true; |
| 149 | } | 163 | } |
| @@ -165,7 +179,7 @@ class DocumentType { | @@ -165,7 +179,7 @@ class DocumentType { | ||
| 165 | global $default, $lang_err_database, $lang_err_object_key; | 179 | global $default, $lang_err_database, $lang_err_object_key; |
| 166 | if ($this->iId >= 0) { | 180 | if ($this->iId >= 0) { |
| 167 | $sql = $default->db; | 181 | $sql = $default->db; |
| 168 | - $result = $sql->query("DELETE FROM " . $default->owl_document_type_fields_table . " WHERE document_type_id = $this->iId"); | 182 | + $result = $sql->query("DELETE FROM " . $default->document_type_fields_table . " WHERE document_type_id = $this->iId"); |
| 169 | if ($result) { | 183 | if ($result) { |
| 170 | $this->iId = -1; | 184 | $this->iId = -1; |
| 171 | return true; | 185 | return true; |
| @@ -187,7 +201,7 @@ class DocumentType { | @@ -187,7 +201,7 @@ class DocumentType { | ||
| 187 | function & get($iDocumentTypeID) { | 201 | function & get($iDocumentTypeID) { |
| 188 | global $default; | 202 | global $default; |
| 189 | $sql = $default->db; | 203 | $sql = $default->db; |
| 190 | - $result = $sql->query("SELECT * FROM ". $default->owl_document_types_table ." WHERE id = $iDocumentTypeID"); | 204 | + $result = $sql->query("SELECT * FROM ". $default->document_types_table ." WHERE id = $iDocumentTypeID"); |
| 191 | if ($result) { | 205 | if ($result) { |
| 192 | if ($sql->next_record()) { | 206 | if ($sql->next_record()) { |
| 193 | $oDocumentType = & new DocumentType(stripslashes($sql->f("name"))); | 207 | $oDocumentType = & new DocumentType(stripslashes($sql->f("name"))); |
| @@ -212,7 +226,7 @@ class DocumentType { | @@ -212,7 +226,7 @@ class DocumentType { | ||
| 212 | global $default, $lang_err_database; | 226 | global $default, $lang_err_database; |
| 213 | $aDocumentTypeArray = array(); | 227 | $aDocumentTypeArray = array(); |
| 214 | $sql = $default->db; | 228 | $sql = $default->db; |
| 215 | - $result = $sql->query("SELECT * FROM " . $default->owl_document_types_table . (isset($sWhereClause) ? " WHERE $sWhereClause" : "")); | 229 | + $result = $sql->query("SELECT * FROM " . $default->document_types_table . (isset($sWhereClause) ? " WHERE $sWhereClause" : "")); |
| 216 | if ($result) { | 230 | if ($result) { |
| 217 | while ($sql->next_record()) { | 231 | while ($sql->next_record()) { |
| 218 | $aDocumentTypeArray[] = & DocumentType::get($sql->f("id")); | 232 | $aDocumentTypeArray[] = & DocumentType::get($sql->f("id")); |
lib/documentmanagement/DocumentTypeFieldLink.inc
| 1 | <?php | 1 | <?php |
| 2 | require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentField.inc"); | 2 | require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentField.inc"); |
| 3 | - | ||
| 4 | /** | 3 | /** |
| 5 | - * | ||
| 6 | - * Class DocumentTypeFieldLink | 4 | + * $Id$ |
| 7 | * | 5 | * |
| 8 | * Represents a document type field link as per the database table document_types_fields_link | 6 | * Represents a document type field link as per the database table document_types_fields_link |
| 9 | * | 7 | * |
| 8 | + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 9 | + * | ||
| 10 | + * This program is free software; you can redistribute it and/or modify | ||
| 11 | + * it under the terms of the GNU General Public License as published by | ||
| 12 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 13 | + * (at your option) any later version. | ||
| 14 | + * | ||
| 15 | + * This program is distributed in the hope that it will be useful, | ||
| 16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | + * GNU General Public License for more details. | ||
| 19 | + * | ||
| 20 | + * You should have received a copy of the GNU General Public License | ||
| 21 | + * along with this program; if not, write to the Free Software | ||
| 22 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 23 | + * | ||
| 24 | + * @version $Revision$ | ||
| 10 | * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | 25 | * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa |
| 11 | - * @date 19 January 2003 | ||
| 12 | - * @package lib.documentmanagement | ||
| 13 | - */ | 26 | + * @package lib.documentmanagement |
| 27 | + */ | ||
| 14 | class DocumentTypeFieldLink { | 28 | class DocumentTypeFieldLink { |
| 15 | 29 | ||
| 16 | /** document field link primary key */ | 30 | /** document field link primary key */ |
| @@ -120,7 +134,7 @@ class DocumentTypeFieldLink { | @@ -120,7 +134,7 @@ class DocumentTypeFieldLink { | ||
| 120 | if ($this->iId < 0) { | 134 | if ($this->iId < 0) { |
| 121 | //check to see if name exsits | 135 | //check to see if name exsits |
| 122 | $sql = $default->db; | 136 | $sql = $default->db; |
| 123 | - $query = "SELECT id FROM ". $default->owl_document_type_fields_table ." WHERE document_type_id = '" . $this->iDocumentTypeID . "' and field_id = '". $this->iFieldID . "'"; | 137 | + $query = "SELECT id FROM ". $default->document_type_fields_table ." WHERE document_type_id = '" . $this->iDocumentTypeID . "' and field_id = '". $this->iFieldID . "'"; |
| 124 | $sql->query($query); | 138 | $sql->query($query); |
| 125 | $rows = $sql->num_rows($sql); | 139 | $rows = $sql->num_rows($sql); |
| 126 | 140 | ||
| @@ -131,7 +145,7 @@ class DocumentTypeFieldLink { | @@ -131,7 +145,7 @@ class DocumentTypeFieldLink { | ||
| 131 | 145 | ||
| 132 | }else{ | 146 | }else{ |
| 133 | $sql = $default->db; | 147 | $sql = $default->db; |
| 134 | - $result = $sql->query("INSERT INTO " . $default->owl_document_type_fields_table . " (document_type_id, field_id, is_mandatory) " . | 148 | + $result = $sql->query("INSERT INTO " . $default->document_type_fields_table . " (document_type_id, field_id, is_mandatory) " . |
| 135 | "VALUES ($this->iDocumentTypeID, $this->iFieldID, '" . $this->bIsMandatory . "')"); | 149 | "VALUES ($this->iDocumentTypeID, $this->iFieldID, '" . $this->bIsMandatory . "')"); |
| 136 | if ($result) { | 150 | if ($result) { |
| 137 | //set the current documents primary key | 151 | //set the current documents primary key |
| @@ -142,7 +156,7 @@ class DocumentTypeFieldLink { | @@ -142,7 +156,7 @@ class DocumentTypeFieldLink { | ||
| 142 | return false; | 156 | return false; |
| 143 | } | 157 | } |
| 144 | } | 158 | } |
| 145 | - $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->owl_document_type_fields_table"; | 159 | + $_SESSION["errorMessage"] = $lang_err_object_exists . "id = " . $this->iId . " table = $default->document_type_fields_table"; |
| 146 | return false; | 160 | return false; |
| 147 | 161 | ||
| 148 | } | 162 | } |
| @@ -156,7 +170,7 @@ class DocumentTypeFieldLink { | @@ -156,7 +170,7 @@ class DocumentTypeFieldLink { | ||
| 156 | global $default, $lang_err_database, $lang_err_object_key; | 170 | global $default, $lang_err_database, $lang_err_object_key; |
| 157 | if ($this->iId >= 0) { | 171 | if ($this->iId >= 0) { |
| 158 | $sql = $default->db; | 172 | $sql = $default->db; |
| 159 | - $sQuery = "UPDATE " . $default->owl_document_type_fields_table . " SET " . | 173 | + $sQuery = "UPDATE " . $default->document_type_fields_table . " SET " . |
| 160 | "document_type_id = $this->iDocumentTypeID, field_id = $this->iFieldID, is_mandatory = '" . $this->bIsMandatory . "'" . | 174 | "document_type_id = $this->iDocumentTypeID, field_id = $this->iFieldID, is_mandatory = '" . $this->bIsMandatory . "'" . |
| 161 | "WHERE id = $this->iId"; | 175 | "WHERE id = $this->iId"; |
| 162 | $result = $sql->query($sQuery); | 176 | $result = $sql->query($sQuery); |
| @@ -181,7 +195,7 @@ class DocumentTypeFieldLink { | @@ -181,7 +195,7 @@ class DocumentTypeFieldLink { | ||
| 181 | global $default, $lang_err_database, $lang_err_object_key; | 195 | global $default, $lang_err_database, $lang_err_object_key; |
| 182 | if ($this->iId >= 0) { | 196 | if ($this->iId >= 0) { |
| 183 | $sql = $default->db; | 197 | $sql = $default->db; |
| 184 | - $result = $sql->query("DELETE FROM " . $default->owl_document_type_fields_table . " WHERE id = $this->iId"); | 198 | + $result = $sql->query("DELETE FROM " . $default->document_type_fields_table . " WHERE id = $this->iId"); |
| 185 | if ($result) { | 199 | if ($result) { |
| 186 | $this->iId = -1; | 200 | $this->iId = -1; |
| 187 | return true; | 201 | return true; |
| @@ -205,7 +219,7 @@ class DocumentTypeFieldLink { | @@ -205,7 +219,7 @@ class DocumentTypeFieldLink { | ||
| 205 | function & get($iDocumentTypeFieldLinkID) { | 219 | function & get($iDocumentTypeFieldLinkID) { |
| 206 | global $default; | 220 | global $default; |
| 207 | $sql = $default->db; | 221 | $sql = $default->db; |
| 208 | - $sql->query("SELECT * FROM " . $default->owl_document_type_fields_table . " WHERE id = " . $iDocumentTypeFieldLinkID); | 222 | + $sql->query("SELECT * FROM " . $default->document_type_fields_table . " WHERE id = " . $iDocumentTypeFieldLinkID); |
| 209 | if ($sql->next_record()) { | 223 | if ($sql->next_record()) { |
| 210 | $oDocumentTypeFieldLink = & new DocumentTypeFieldLink($sql->f("document_type_id"), $sql->f("field_id"), $sql->f("is_mandatory")); | 224 | $oDocumentTypeFieldLink = & new DocumentTypeFieldLink($sql->f("document_type_id"), $sql->f("field_id"), $sql->f("is_mandatory")); |
| 211 | $oDocumentTypeFieldLink->iId = $iDocumentTypeFieldLinkID; | 225 | $oDocumentTypeFieldLink->iId = $iDocumentTypeFieldLinkID; |
| @@ -222,7 +236,7 @@ class DocumentTypeFieldLink { | @@ -222,7 +236,7 @@ class DocumentTypeFieldLink { | ||
| 222 | */ | 236 | */ |
| 223 | function docTypeBelongsToField($iDocTypeID) { | 237 | function docTypeBelongsToField($iDocTypeID) { |
| 224 | global $default; | 238 | global $default; |
| 225 | - return lookupField("$default->owl_document_type_fields_table", "field_id", "document_type_id", $iDocTypeID ); | 239 | + return lookupField("$default->document_type_fields_table", "field_id", "document_type_id", $iDocTypeID ); |
| 226 | } | 240 | } |
| 227 | 241 | ||
| 228 | /** | 242 | /** |
| @@ -235,7 +249,7 @@ class DocumentTypeFieldLink { | @@ -235,7 +249,7 @@ class DocumentTypeFieldLink { | ||
| 235 | function getByFieldAndTypeIDs($iDocTypeID, $iDocFieldID) { | 249 | function getByFieldAndTypeIDs($iDocTypeID, $iDocFieldID) { |
| 236 | global $default; | 250 | global $default; |
| 237 | $sql = $default->db; | 251 | $sql = $default->db; |
| 238 | - $sQuery = "SELECT id FROM $default->owl_document_type_fields_table WHERE field_id = $iDocFieldID AND document_type_id = $iDocTypeID"; | 252 | + $sQuery = "SELECT id FROM $default->document_type_fields_table WHERE field_id = $iDocFieldID AND document_type_id = $iDocTypeID"; |
| 239 | $result = $sql->query($sQuery); | 253 | $result = $sql->query($sQuery); |
| 240 | if ($result) { | 254 | if ($result) { |
| 241 | if ($sql->next_record()) { | 255 | if ($sql->next_record()) { |
| @@ -258,7 +272,7 @@ class DocumentTypeFieldLink { | @@ -258,7 +272,7 @@ class DocumentTypeFieldLink { | ||
| 258 | global $default; | 272 | global $default; |
| 259 | $aFields = array(); | 273 | $aFields = array(); |
| 260 | $sql = $default->db; | 274 | $sql = $default->db; |
| 261 | - $result = $sql->query("SELECT field_id FROM " . $default->owl_document_type_fields_table . " WHERE document_type_id = ". $iDocTypeID); | 275 | + $result = $sql->query("SELECT field_id FROM " . $default->document_type_fields_table . " WHERE document_type_id = ". $iDocTypeID); |
| 262 | if ($result) { | 276 | if ($result) { |
| 263 | while ($sql->next_record()) { | 277 | while ($sql->next_record()) { |
| 264 | $aFields[] = DocumentField::get($sql->f("field_id")); | 278 | $aFields[] = DocumentField::get($sql->f("field_id")); |
lib/documentmanagement/MetaData.inc
| 1 | <?php | 1 | <?php |
| 2 | /** | 2 | /** |
| 3 | -* | ||
| 4 | -* Class DocumentType | ||
| 5 | -* | ||
| 6 | -* Represents a MetaData as per the database document_types_lookup table | ||
| 7 | -* | ||
| 8 | -* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 9 | -* @date 19 January 2003 | ||
| 10 | -* @package lib.documentmanagement | ||
| 11 | -*/ | ||
| 12 | - | 3 | + * $Id$ |
| 4 | + * | ||
| 5 | + * Represents a document field lookups as per the database document_types_lookup table | ||
| 6 | + * | ||
| 7 | + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 8 | + * | ||
| 9 | + * This program is free software; you can redistribute it and/or modify | ||
| 10 | + * it under the terms of the GNU General Public License as published by | ||
| 11 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 12 | + * (at your option) any later version. | ||
| 13 | + * | ||
| 14 | + * This program is distributed in the hope that it will be useful, | ||
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | + * GNU General Public License for more details. | ||
| 18 | + * | ||
| 19 | + * You should have received a copy of the GNU General Public License | ||
| 20 | + * along with this program; if not, write to the Free Software | ||
| 21 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 22 | + * | ||
| 23 | + * @version $Revision$ | ||
| 24 | + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 25 | + * @package lib.documentmanagement | ||
| 26 | + */ | ||
| 13 | class MetaData { | 27 | class MetaData { |
| 14 | 28 | ||
| 15 | /** primary key value */ | 29 | /** primary key value */ |
| @@ -98,7 +112,7 @@ class MetaData { | @@ -98,7 +112,7 @@ class MetaData { | ||
| 98 | if ($this->iId < 0) { | 112 | if ($this->iId < 0) { |
| 99 | //check to see if name exsits | 113 | //check to see if name exsits |
| 100 | $sql = $default->db; | 114 | $sql = $default->db; |
| 101 | - $query = "SELECT name FROM ". $default->owl_metadata_table ." WHERE name = '" . $this->sName . "' and document_field_id = '". $this->iDocFieldID . "'"; | 115 | + $query = "SELECT name FROM ". $default->metadata_table ." WHERE name = '" . $this->sName . "' and document_field_id = '". $this->iDocFieldID . "'"; |
| 102 | $sql->query($query); | 116 | $sql->query($query); |
| 103 | $rows = $sql->num_rows($sql); | 117 | $rows = $sql->num_rows($sql); |
| 104 | 118 | ||
| @@ -109,7 +123,7 @@ class MetaData { | @@ -109,7 +123,7 @@ class MetaData { | ||
| 109 | 123 | ||
| 110 | }else{ | 124 | }else{ |
| 111 | $sql = $default->db; | 125 | $sql = $default->db; |
| 112 | - $result = $sql->query("INSERT INTO " . $default->owl_metadata_table . " (document_field_id,name) VALUES ('". $this->iDocFieldID . "','" . addslashes($this->sName) . "')"); | 126 | + $result = $sql->query("INSERT INTO " . $default->metadata_table . " (document_field_id,name) VALUES ('". $this->iDocFieldID . "','" . addslashes($this->sName) . "')"); |
| 113 | if ($result) { | 127 | if ($result) { |
| 114 | $this->iId = $sql->insert_id(); | 128 | $this->iId = $sql->insert_id(); |
| 115 | return true; | 129 | return true; |
| @@ -134,7 +148,7 @@ class MetaData { | @@ -134,7 +148,7 @@ class MetaData { | ||
| 134 | //only update if the object has been stored | 148 | //only update if the object has been stored |
| 135 | if ($this->iId > 0) { | 149 | if ($this->iId > 0) { |
| 136 | $sql = $default->db; | 150 | $sql = $default->db; |
| 137 | - $result = $sql->query("UPDATE " . $default->owl_metadata_table. " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId"); | 151 | + $result = $sql->query("UPDATE " . $default->metadata_table. " SET name = '" . addslashes($this->sName) . "' WHERE id = $this->iId"); |
| 138 | if ($result) { | 152 | if ($result) { |
| 139 | return true; | 153 | return true; |
| 140 | } | 154 | } |
| @@ -156,7 +170,7 @@ class MetaData { | @@ -156,7 +170,7 @@ class MetaData { | ||
| 156 | //only delete the object if it exists in the database | 170 | //only delete the object if it exists in the database |
| 157 | if ($this->iId >= 0) { | 171 | if ($this->iId >= 0) { |
| 158 | $sql = $default->db; | 172 | $sql = $default->db; |
| 159 | - $result = $sql->query("DELETE FROM " . $default->owl_metadata_table. " WHERE id = $this->iId"); | 173 | + $result = $sql->query("DELETE FROM " . $default->metadata_table. " WHERE id = $this->iId"); |
| 160 | if ($result) { | 174 | if ($result) { |
| 161 | return true; | 175 | return true; |
| 162 | } | 176 | } |
| @@ -178,7 +192,7 @@ class MetaData { | @@ -178,7 +192,7 @@ class MetaData { | ||
| 178 | function & get($iMetaDataID) { | 192 | function & get($iMetaDataID) { |
| 179 | global $default; | 193 | global $default; |
| 180 | $sql = $default->db; | 194 | $sql = $default->db; |
| 181 | - $result = $sql->query("SELECT * FROM ". $default->owl_metadata_table." WHERE id = $iMetaDataID"); | 195 | + $result = $sql->query("SELECT * FROM ". $default->metadata_table." WHERE id = $iMetaDataID"); |
| 182 | if ($result) { | 196 | if ($result) { |
| 183 | if ($sql->next_record()) { | 197 | if ($sql->next_record()) { |
| 184 | $oDocumentType = & new MetaData($sql->f("document_field_id"),stripslashes($sql->f("name"))); | 198 | $oDocumentType = & new MetaData($sql->f("document_field_id"),stripslashes($sql->f("name"))); |
| @@ -209,7 +223,7 @@ class MetaData { | @@ -209,7 +223,7 @@ class MetaData { | ||
| 209 | { | 223 | { |
| 210 | global $default; | 224 | global $default; |
| 211 | $sql = $default->db; | 225 | $sql = $default->db; |
| 212 | - $result = $sql->query("SELECT id FROM $default->owl_metadata_table WHERE document_field_id = $iDocFieldID and name = '" . $sMetaDataName . "' "); | 226 | + $result = $sql->query("SELECT id FROM $default->metadata_table WHERE document_field_id = $iDocFieldID and name = '" . $sMetaDataName . "' "); |
| 213 | if ($result) { | 227 | if ($result) { |
| 214 | if ($sql->next_record()) { | 228 | if ($sql->next_record()) { |
| 215 | $id = $sql->f("id"); | 229 | $id = $sql->f("id"); |
lib/documentmanagement/PhysicalDocumentManager.inc
| @@ -11,14 +11,26 @@ | @@ -11,14 +11,26 @@ | ||
| 11 | * o $fFolderID - primary key of folder into which file will be placed | 11 | * o $fFolderID - primary key of folder into which file will be placed |
| 12 | * o When calling deleteDocument: | 12 | * o When calling deleteDocument: |
| 13 | * | 13 | * |
| 14 | - * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING. | 14 | + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com |
| 15 | + * | ||
| 16 | + * This program is free software; you can redistribute it and/or modify | ||
| 17 | + * it under the terms of the GNU General Public License as published by | ||
| 18 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 19 | + * (at your option) any later version. | ||
| 20 | + * | ||
| 21 | + * This program is distributed in the hope that it will be useful, | ||
| 22 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 23 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 24 | + * GNU General Public License for more details. | ||
| 25 | + * | ||
| 26 | + * You should have received a copy of the GNU General Public License | ||
| 27 | + * along with this program; if not, write to the Free Software | ||
| 28 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 15 | * | 29 | * |
| 16 | - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 17 | * @version $Revision$ | 30 | * @version $Revision$ |
| 18 | - * @date 13 January 2003 | ||
| 19 | - * @package lib.documentmanagement | 31 | + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa |
| 32 | + * @package lib.documentmanagement | ||
| 20 | */ | 33 | */ |
| 21 | - | ||
| 22 | class PhysicalDocumentManager { | 34 | class PhysicalDocumentManager { |
| 23 | 35 | ||
| 24 | /** | 36 | /** |
| @@ -138,7 +150,7 @@ class PhysicalDocumentManager { | @@ -138,7 +150,7 @@ class PhysicalDocumentManager { | ||
| 138 | // FIXME: refactor array getOldVersionPaths($iDocumentID)?? | 150 | // FIXME: refactor array getOldVersionPaths($iDocumentID)?? |
| 139 | 151 | ||
| 140 | $sql = $default->db; | 152 | $sql = $default->db; |
| 141 | - $result = $sql->query("SELECT DISTINCT version FROM $default->owl_document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); | 153 | + $result = $sql->query("SELECT DISTINCT version FROM $default->document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); |
| 142 | if ($result) { | 154 | if ($result) { |
| 143 | while ($sql->next_record()) { | 155 | while ($sql->next_record()) { |
| 144 | $sVersion = $sql->f("version"); | 156 | $sVersion = $sql->f("version"); |
| @@ -212,7 +224,7 @@ class PhysicalDocumentManager { | @@ -212,7 +224,7 @@ class PhysicalDocumentManager { | ||
| 212 | // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions | 224 | // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions |
| 213 | // FIXME: refactor | 225 | // FIXME: refactor |
| 214 | $sql = $default->db; | 226 | $sql = $default->db; |
| 215 | - $result = $sql->query("SELECT DISTINCT version FROM $default->owl_document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); | 227 | + $result = $sql->query("SELECT DISTINCT version FROM $default->document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); |
| 216 | if ($result) { | 228 | if ($result) { |
| 217 | while ($sql->next_record()) { | 229 | while ($sql->next_record()) { |
| 218 | $sVersion = $sql->f("version"); | 230 | $sVersion = $sql->f("version"); |
| @@ -254,7 +266,7 @@ class PhysicalDocumentManager { | @@ -254,7 +266,7 @@ class PhysicalDocumentManager { | ||
| 254 | // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions | 266 | // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions |
| 255 | // FIXME: refactor | 267 | // FIXME: refactor |
| 256 | $sql = $default->db; | 268 | $sql = $default->db; |
| 257 | - $result = $sql->query("SELECT DISTINCT version FROM $default->owl_document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); | 269 | + $result = $sql->query("SELECT DISTINCT version FROM $default->document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); |
| 258 | if ($result) { | 270 | if ($result) { |
| 259 | while ($sql->next_record()) { | 271 | while ($sql->next_record()) { |
| 260 | $sVersion = $sql->f("version"); | 272 | $sVersion = $sql->f("version"); |
| @@ -309,7 +321,7 @@ class PhysicalDocumentManager { | @@ -309,7 +321,7 @@ class PhysicalDocumentManager { | ||
| 309 | // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions | 321 | // ie. interrogate transaction history for all CHECKIN transactions and retrieve the versions |
| 310 | // FIXME: refactor | 322 | // FIXME: refactor |
| 311 | $sql = $default->db; | 323 | $sql = $default->db; |
| 312 | - $result = $sql->query("SELECT DISTINCT version FROM $default->owl_document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); | 324 | + $result = $sql->query("SELECT DISTINCT version FROM $default->document_transactions_table WHERE document_id=" . $oDocument->getID() . " AND transaction_id=" . CHECKOUT); |
| 313 | if ($result) { | 325 | if ($result) { |
| 314 | while ($sql->next_record()) { | 326 | while ($sql->next_record()) { |
| 315 | $sVersion = $sql->f("version"); | 327 | $sVersion = $sql->f("version"); |
| @@ -392,14 +404,14 @@ class PhysicalDocumentManager { | @@ -392,14 +404,14 @@ class PhysicalDocumentManager { | ||
| 392 | 404 | ||
| 393 | // check by file extension | 405 | // check by file extension |
| 394 | $sExtension = strtolower(substr($sFileName, strpos($sFileName, ".")+1, strlen($sFileName) - strpos($sFileName, "."))); | 406 | $sExtension = strtolower(substr($sFileName, strpos($sFileName, ".")+1, strlen($sFileName) - strpos($sFileName, "."))); |
| 395 | - $sql->query("SELECT id FROM " . $default->owl_mime_table . " WHERE LOWER(filetypes) = '$sExtension'"); | 407 | + $sql->query("SELECT id FROM " . $default->mimetypes_table . " WHERE LOWER(filetypes) = '$sExtension'"); |
| 396 | if ($sql->next_record()) { | 408 | if ($sql->next_record()) { |
| 397 | return $sql->f("id"); | 409 | return $sql->f("id"); |
| 398 | } | 410 | } |
| 399 | 411 | ||
| 400 | //get the mime type | 412 | //get the mime type |
| 401 | if (isset($sMimeType)) { | 413 | if (isset($sMimeType)) { |
| 402 | - $sql->query("SELECT id FROM " . $default->owl_mime_table . " WHERE mimetypes = '$sMimeType'"); | 414 | + $sql->query("SELECT id FROM " . $default->mimetypes_table . " WHERE mimetypes = '$sMimeType'"); |
| 403 | if ($sql->next_record()) { | 415 | if ($sql->next_record()) { |
| 404 | //get the mime type id | 416 | //get the mime type id |
| 405 | return $sql->f("id"); | 417 | return $sql->f("id"); |
| @@ -419,7 +431,7 @@ class PhysicalDocumentManager { | @@ -419,7 +431,7 @@ class PhysicalDocumentManager { | ||
| 419 | function getDefaultMimeTypeID() { | 431 | function getDefaultMimeTypeID() { |
| 420 | global $default; | 432 | global $default; |
| 421 | $sql = $default->db; | 433 | $sql = $default->db; |
| 422 | - $sql->query("SELECT id FROM " . $default->owl_mime_table . " WHERE mimetypes = 'text/plain'"); | 434 | + $sql->query("SELECT id FROM " . $default->mimetypes_table . " WHERE mimetypes = 'text/plain'"); |
| 423 | $sql->next_record(); | 435 | $sql->next_record(); |
| 424 | //get the mime type id | 436 | //get the mime type id |
| 425 | return $sql->f("id"); | 437 | return $sql->f("id"); |
| @@ -428,7 +440,7 @@ class PhysicalDocumentManager { | @@ -428,7 +440,7 @@ class PhysicalDocumentManager { | ||
| 428 | function getMimeTypeName($iMimeTypeID) { | 440 | function getMimeTypeName($iMimeTypeID) { |
| 429 | global $default; | 441 | global $default; |
| 430 | $sql = $default->db; | 442 | $sql = $default->db; |
| 431 | - $sql->query("SELECT mimetypes FROM " . $default->owl_mime_table . " WHERE id = " . $iMimeTypeID); | 443 | + $sql->query("SELECT mimetypes FROM " . $default->mimetypes_table . " WHERE id = " . $iMimeTypeID); |
| 432 | if ($sql->next_record()) { | 444 | if ($sql->next_record()) { |
| 433 | return $sql->f("mimetypes"); | 445 | return $sql->f("mimetypes"); |
| 434 | } | 446 | } |
lib/email/Email.inc
| @@ -2,11 +2,27 @@ | @@ -2,11 +2,27 @@ | ||
| 2 | /** | 2 | /** |
| 3 | * $Id$ | 3 | * $Id$ |
| 4 | * | 4 | * |
| 5 | - * Contains static functions concerned with sending emails | 5 | + * Contains static functions concerned with sending emails. |
| 6 | + * | ||
| 7 | + * Copyright (c) 2003 Jam Warehouse http://www.jamwarehouse.com | ||
| 8 | + * | ||
| 9 | + * This program is free software; you can redistribute it and/or modify | ||
| 10 | + * it under the terms of the GNU General Public License as published by | ||
| 11 | + * the Free Software Foundation; either version 2 of the License, or | ||
| 12 | + * (at your option) any later version. | ||
| 13 | + * | ||
| 14 | + * This program is distributed in the hope that it will be useful, | ||
| 15 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | + * GNU General Public License for more details. | ||
| 18 | + * | ||
| 19 | + * You should have received a copy of the GNU General Public License | ||
| 20 | + * along with this program; if not, write to the Free Software | ||
| 21 | + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
| 6 | * | 22 | * |
| 7 | - * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | ||
| 8 | * @version $Revision$ | 23 | * @version $Revision$ |
| 9 | - * @package lib.email | 24 | + * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa |
| 25 | + * @package lib.email | ||
| 10 | */ | 26 | */ |
| 11 | class Email { | 27 | class Email { |
| 12 | 28 |