Commit 05ad4ad2c56631f30507c5aea4c6f46f19872d71
1 parent
b5d83118
Require/include fields update. Some syntax correction
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@212 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
3 changed files
with
21 additions
and
24 deletions
lib/documentmanagement/documentLib.inc
| ... | ... | @@ -20,10 +20,10 @@ class DocumentLib { |
| 20 | 20 | global $lang_err_doc_no_folder; |
| 21 | 21 | $sql = new Owl_DB(); |
| 22 | 22 | $sql->query("SELECT folder_id from " . $default->owl_documents_table . " WHERE id = " . $iDocumentID); |
| 23 | - if (sql->next_record()) { | |
| 24 | - return sql->f("folder_id"); | |
| 23 | + if ($sql->next_record()) { | |
| 24 | + return $sql->f("folder_id"); | |
| 25 | 25 | } |
| 26 | - $_SESSION["errorMessage"] = $lang_err_doc_no_folder | |
| 26 | + $_SESSION["errorMessage"] = $lang_err_doc_no_folder . "document id " . $iDocumentID; | |
| 27 | 27 | return false; |
| 28 | 28 | } |
| 29 | 29 | ... | ... |
lib/documentmanagement/documentManager.inc
| ... | ... | @@ -3,7 +3,7 @@ |
| 3 | 3 | /** |
| 4 | 4 | * Class DocumentManager |
| 5 | 5 | * |
| 6 | -* Contains all functions required for document management, | |
| 6 | +* Contains static functions required for document management, | |
| 7 | 7 | * such as the creation/deletion/removal of document types. |
| 8 | 8 | * |
| 9 | 9 | * @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa |
| ... | ... | @@ -13,8 +13,8 @@ |
| 13 | 13 | * |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -require_once ("$default->owl_root_url/lib/owl.lib.php"); | |
| 17 | -require_once("./phpmailer/class.phpmailer.php"); // for emailing | |
| 16 | +//require_once ($default->owl_root_fs . "/lib/owl.lib.php"); | |
| 17 | +require_once($default->owl_fs_root . "/phpmailer/class.phpmailer.php"); // for emailing | |
| 18 | 18 | |
| 19 | 19 | class DocumentManager { |
| 20 | 20 | |
| ... | ... | @@ -31,9 +31,9 @@ class DocumentManager { |
| 31 | 31 | //Get hold of the global error string |
| 32 | 32 | global $default; |
| 33 | 33 | //if the document type doesn't exist |
| 34 | - if (!($this->documentTypeExists($sName))) { | |
| 34 | + if (!(DocumentManager::documentTypeExists($sName))) { | |
| 35 | 35 | $sql = new Owl_DB(); |
| 36 | - $result = $sql->query("INSERT INTO " . $default->owl_document_types_table . " (name) values ('" . $sName . "')"); | |
| 36 | + $result = $sql->query("INSERT INTO " . $default->owl_document_types_table . " (name) values ('" . $sName . "')"); | |
| 37 | 37 | if (!$result) { |
| 38 | 38 | $_SESSION["errorMessage"] = "Database Error. Failed to insert document type " . $sName; |
| 39 | 39 | return false; |
| ... | ... | @@ -57,7 +57,7 @@ class DocumentManager { |
| 57 | 57 | //Get hold of the global error string |
| 58 | 58 | global $default; |
| 59 | 59 | //only remove the document type if it exists |
| 60 | - if ($this->documentTypeExists($sName)) { | |
| 60 | + if (DocumentManager::documentTypeExists($sName)) { | |
| 61 | 61 | $sql = new Owl_DB(); |
| 62 | 62 | $result = $sql->query("DELETE FROM " . $default->owl_document_types_table . " WHERE name = '" . $sName . "'"); |
| 63 | 63 | if (!$result) { |
| ... | ... | @@ -95,7 +95,7 @@ class DocumentManager { |
| 95 | 95 | //escape special characters that may interfere with the db query |
| 96 | 96 | $sName = addslashes($sName); |
| 97 | 97 | |
| 98 | - if ($this->documentTypeExists($sName)) { | |
| 98 | + if (DocumentManager::documentTypeExists($sName)) { | |
| 99 | 99 | $sql = new Owl_DB(); |
| 100 | 100 | $sql->query("SELECT ID FROM " . $default->owl_document_types_table . " WHERE name = '" . $sName . "'"); |
| 101 | 101 | $sql->next_record(); |
| ... | ... | @@ -136,7 +136,7 @@ class DocumentManager { |
| 136 | 136 | //Get hold of the global error string |
| 137 | 137 | global $default; |
| 138 | 138 | //if the document field type is not associated with the document |
| 139 | - if (!($this->documentTypeFieldExistsForDocumentType($iDocumentTypeID, $iDocumentTypeFieldID))) { | |
| 139 | + if (!(DocumentManager::documentTypeFieldExistsForDocumentType($iDocumentTypeID, $iDocumentTypeFieldID))) { | |
| 140 | 140 | $sql = new Owl_DB(); |
| 141 | 141 | $result = $sql->query("INSERT INTO " . $default->owl_document_type_fields_table . " (document_type_id, field_id, is_mandatory) VALUES (" . $iDocumentTypeID . ", " . $iDocumentTypeFieldID . ", " . $bIsMandatory . ")"); |
| 142 | 142 | if (!$result) { |
| ... | ... | @@ -159,7 +159,7 @@ class DocumentManager { |
| 159 | 159 | global $default; |
| 160 | 160 | //Get hold of the global error string |
| 161 | 161 | global $default; |
| 162 | - if ($this->documentTypeFieldExistsForDocumentType($iDocumentTypeID, $iDocumentTypeFieldID)) { | |
| 162 | + if (DocumentManager::documentTypeFieldExistsForDocumentType($iDocumentTypeID, $iDocumentTypeFieldID)) { | |
| 163 | 163 | $sql = new Owl_DB(); |
| 164 | 164 | $result = $sql->query("DELETE FROM " . $default->owl_document_type_fields_table . " where document_type_id = " . $iDocumentTypeID . " AND field_id = " . $iDocumentTypeFieldID); |
| 165 | 165 | if (!result) { |
| ... | ... | @@ -203,7 +203,7 @@ class DocumentManager { |
| 203 | 203 | $sDataType = addslashes($sDataType); |
| 204 | 204 | //Get hold of the global error string |
| 205 | 205 | global $default; |
| 206 | - if (!$this->documentTypeFieldExists($sName)) { | |
| 206 | + if (!DocumentManager::documentTypeFieldExists($sName)) { | |
| 207 | 207 | $sql = new Owl_DB(); |
| 208 | 208 | $result = $sql->query("INSERT INTO " . $default->owl_fields_table . " (name, data_type) VALUES ('" . $sName . "', '" . $sDataType . "')"); |
| 209 | 209 | if (!$result) { |
| ... | ... | @@ -228,7 +228,7 @@ class DocumentManager { |
| 228 | 228 | $sName = addslashes($sName); |
| 229 | 229 | //Get hold of the global error string |
| 230 | 230 | global $default; |
| 231 | - if ($this->documentTypeFieldExists($sName)) { | |
| 231 | + if (DocumentManager::documentTypeFieldExists($sName)) { | |
| 232 | 232 | $sql = new Owl_DB(); |
| 233 | 233 | $result = $sql->query("DELETE FROM " . $default->owl_fields_table . " WHERE Name = '" . $sName . "'"); |
| 234 | 234 | if (!$result) { |
| ... | ... | @@ -251,7 +251,7 @@ class DocumentManager { |
| 251 | 251 | function & getDocumentTypeFieldID($sName) { |
| 252 | 252 | global $lang_err_document_type_field_does_not_exist, $default; |
| 253 | 253 | $sName = addslashes($sName); |
| 254 | - if ($this->documentTypeFieldExists($sName)) { | |
| 254 | + if (DocumentManager::documentTypeFieldExists($sName)) { | |
| 255 | 255 | $sql = new Owl_DB(); |
| 256 | 256 | $sql->query("SELECT id FROM " . $default->owl_fields_table . " WHERE name = '" . $sName . "'"); |
| 257 | 257 | $sql->next_record(); | ... | ... |
lib/foldermanagement/FolderManager.inc
| ... | ... | @@ -28,12 +28,13 @@ class FolderManager { |
| 28 | 28 | */ |
| 29 | 29 | function insertFolder($sName, $sDescription, $iParentID, $iCreatorID, $iDocumentTypeID, $iUnitID, $bIsPublic = false) { |
| 30 | 30 | $sName = addslashes($sName); |
| 31 | + $sDescription = addslashes($sDescription); | |
| 31 | 32 | global $default, $lang_err_database; |
| 32 | 33 | //if the folder doesn't exist |
| 33 | - if (!(FolderNamager::folderExistsName($sName, $iParentID)) { | |
| 34 | + if (!(FolderManager::folderExistsName($sName, $iParentID))) { | |
| 34 | 35 | $sql = new Owl_DB(); |
| 35 | 36 | $result = $sql->query("INSERT INTO " . $default->owl_folders_table . " (name, description, parent_id, creator_id, document_type_id, unit_id, is_public) " . |
| 36 | - "VALUES (" . $sName . . $sDescription . . $iParentID . . $iCreatorID .. $iDocumentTypeID .. $UnitID .. $bIsPublice")"); | |
| 37 | + "VALUES ('" . $sName . "', '" . $sDescription . "', " . $iParentID . ", " . $iCreatorID . ", " . $iDocumentTypeID . ", " . $iUnitID . ", " . $bIsPublic . ")"); | |
| 37 | 38 | if (!$result) { |
| 38 | 39 | $_SESSION["errorMessage"] = $lang_err_database; |
| 39 | 40 | return false; |
| ... | ... | @@ -55,7 +56,7 @@ class FolderManager { |
| 55 | 56 | function deleteFolder($iFolderID) { |
| 56 | 57 | global $default,$lang_err_folder_not_exist; |
| 57 | 58 | //if the folder exists |
| 58 | - if (folderExistsID($iFolderID)) { | |
| 59 | + if (FolderManager::folderExistsID($iFolderID)) { | |
| 59 | 60 | $sql = new Owl_DB(); |
| 60 | 61 | $result = $sql->query("DELETE FROM " . $default->owl_folders_table . " WHERE id = " . $iFolderID); |
| 61 | 62 | if (!$result) { |
| ... | ... | @@ -118,19 +119,15 @@ class FolderManager { |
| 118 | 119 | */ |
| 119 | 120 | function getFolderID($sName, $iParentID) { |
| 120 | 121 | $sName = addslashes($sName); |
| 121 | - gobal $default, $lang_err_folder_exist; | |
| 122 | + global $default, $lang_err_folder_exist; | |
| 122 | 123 | $sql = new Owl_DB(); |
| 123 | - $sql->query("SELECT id FROM " . $default->owl_folders_table . " WHERE name = '" . $sName . "' AND parent_id = " $iParentID); | |
| 124 | + $sql->query("SELECT id FROM " . $default->owl_folders_table . " WHERE name = '" . $sName . "' AND parent_id = " . $iParentID); | |
| 124 | 125 | if ($sql->next_record()) { |
| 125 | 126 | return $sql->f("id"); |
| 126 | 127 | } |
| 127 | 128 | $_SESSION["errorMessage"] = $lang_err_folder_exist . $sName; |
| 128 | 129 | return false; |
| 129 | 130 | } |
| 130 | - | |
| 131 | - | |
| 132 | - | |
| 133 | 131 | } |
| 134 | - | |
| 135 | 132 | ?> |
| 136 | 133 | ... | ... |