diff --git a/lib/documentmanagement/Document.inc b/lib/documentmanagement/Document.inc index 0fd48b8..13725dd 100644 --- a/lib/documentmanagement/Document.inc +++ b/lib/documentmanagement/Document.inc @@ -713,7 +713,7 @@ class Document extends KTEntity { $sQuery = array("SELECT field_id FROM $default->document_type_fields_table DTFL " . /*ok*/ "INNER JOIN $default->document_fields_table AS DF ON DF.id = DTFL.field_id " . "WHERE DTFL.document_type_id = ? " . - "AND DF.is_generic = 0", $this->iDocumentTypeID); + "AND DF.is_generic = ?", array($this->iDocumentTypeID, false)); $sql = $default->db; $sql->query($sQuery); $aFieldIDs = array(); diff --git a/lib/documentmanagement/DocumentCollaboration.inc b/lib/documentmanagement/DocumentCollaboration.inc index 6132036..edec697 100644 --- a/lib/documentmanagement/DocumentCollaboration.inc +++ b/lib/documentmanagement/DocumentCollaboration.inc @@ -34,8 +34,8 @@ class DocumentCollaboration { function documentCollaborationStarted($iDocumentID) { global $default; $sql = $default->db; - $sQuery = "SELECT id FROM $default->folders_user_roles_table WHERE document_id = ? AND (active = 1 OR done = 1)";/*ok*/ - $aParams = array($iDocumentID); + $sQuery = "SELECT id FROM $default->folders_user_roles_table WHERE document_id = ? AND (active = ? OR done = ?)";/*ok*/ + $aParams = array($iDocumentID, true, true); $sql->query(array($sQuery, $aParams)); if ($sql->next_record()) { return true; @@ -46,8 +46,8 @@ class DocumentCollaboration { function documentCollaborationDone($iDocumentID) { global $default; $sql = $default->db; - $sQuery = "SELECT id FROM $default->folders_user_roles_table WHERE document_id = ? AND done = 0";/*ok*/ - $aParams = array($iDocumentID); + $sQuery = "SELECT id FROM $default->folders_user_roles_table WHERE document_id = ? AND done = ?";/*ok*/ + $aParams = array($iDocumentID, false); $sql->query(array($sQuery, $aParams)); if ($sql->num_rows() > 0) { return false; @@ -64,8 +64,8 @@ class DocumentCollaboration { function userIsPerformingCurrentCollaborationStep($iDocumentID) { global $default; $sql = $default->db; - $sQuery = "SELECT id FROM $default->folders_user_roles_table WHERE document_id = ? AND active = 1 AND user_id = ?";/*ok*/ - $aParams = array($iDocumentID, $_SESSION["userID"]); + $sQuery = "SELECT id FROM $default->folders_user_roles_table WHERE document_id = ? AND active = ? AND user_id = ?";/*ok*/ + $aParams = array($iDocumentID, true, $_SESSION["userID"]); $sql->query(array($sQuery, $aParams)); if ($sql->next_record()) { return true; @@ -274,9 +274,9 @@ class DocumentCollaboration { "INNER JOIN $default->groups_folders_approval_table AS GFAT ON FURL.group_folder_approval_id = GFAT.id " . "WHERE FURL.document_id = ? " . "AND FURL.user_id = ? " . - "AND FURL.active = 1 " . + "AND FURL.active = ? " . "ORDER BY GFAT.precedence ASC"; - $aParams = array($iDocumentID, $_SESSION["userID"]); + $aParams = array($iDocumentID, $_SESSION["userID"], true); $sql = $default->db; $sql->query(array($sQuery, $aParams)); diff --git a/lib/foldermanagement/Folder.inc b/lib/foldermanagement/Folder.inc index 8b4ed26..59c32be 100644 --- a/lib/foldermanagement/Folder.inc +++ b/lib/foldermanagement/Folder.inc @@ -709,8 +709,9 @@ class Folder extends KTEntity { $aDocumentIDs = split(',', $sDocumentIDs); $sQms = DBUtil::paramArray($aDocumentIDs); - $sQuery = "SELECT * FROM folders_users_roles_link WHERE document_id in ($sQms) AND (active = 1)";/*ok*/ + $sQuery = "SELECT * FROM folders_users_roles_link WHERE document_id in ($sQms) AND (active = ?)";/*ok*/ $aParams = $aDocumentIDs; + $aParams[] = true; $sql = $default->db; $sql->query(array($sQuery, $aParams)); if ($sql->next_record()) { diff --git a/lib/security/Permission.inc b/lib/security/Permission.inc index 7d23ffa..d3cc007 100644 --- a/lib/security/Permission.inc +++ b/lib/security/Permission.inc @@ -168,8 +168,8 @@ class Permission { "FROM $default->groups_folders_table AS GFL INNER JOIN $default->users_groups_table AS UGL ON GFL.group_id = UGL.group_id " . "WHERE UGL.user_id = ? " . "AND GFL.folder_id = ? " . - "AND GFL.can_write = 1 "; - $aParams = array($_SESSION["userID"], $oFolder->getPermissionFolderID()); + "AND GFL.can_write = ? "; + $aParams = array($_SESSION["userID"], $oFolder->getPermissionFolderID(), true); $res = DBUtil::runQuery(array($sQuery, $aParams)); @@ -230,8 +230,8 @@ class Permission { "FROM $default->groups_folders_table AS GFL INNER JOIN $default->users_groups_table AS UGL ON GFL.group_id = UGL.group_id " . "WHERE UGL.user_id = ? " . "AND GFL.folder_id = ? " . - "AND GFL.can_read = 1 "; - $aParams = array($_SESSION["userID"], $oFolder->getPermissionFolderID()); + "AND GFL.can_read = ? "; + $aParams = array($_SESSION["userID"], $oFolder->getPermissionFolderID(), true); //$sql->query(array($sQuery, $aParams)); $res = DBUtil::runQuery(array($sQuery, $aParams)); @@ -306,9 +306,9 @@ class Permission { "INNER JOIN $default->roles_table AS R ON GFAL.role_id = R.id " . "WHERE FURL.user_id = ? " . "AND FURL.document_id = ? " . - "AND R.can_write = 1 " . - "AND R.active = 1"; - $aParams = array($_SESSION["userID"], $oDocument->getID()); + "AND R.can_write = ? " . + "AND R.active = ?"; + $aParams = array($_SESSION["userID"], $oDocument->getID(), true, true); $sql->query(array($sQuery, $aParams)); if ($sql->next_record()) { return true; @@ -331,8 +331,8 @@ class Permission { "INNER JOIN $default->roles_table AS R ON GFAL.role_id = R.id " . "WHERE FURL.user_id = ? " . "AND FURL.document_id = ? " . - "AND R.can_read = 1"; - $aParams = array($_SESSION["userID"], $oDocument->getID()); + "AND R.can_read = ?"; + $aParams = array($_SESSION["userID"], $oDocument->getID(), true); $sql->query(array($sQuery, $aParams)); if ($sql->next_record()) { return true; diff --git a/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/editDocTypeFieldsUI.inc b/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/editDocTypeFieldsUI.inc index 559386d..004b778 100644 --- a/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/editDocTypeFieldsUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/administration/doctypemanagement/editDocTypeFieldsUI.inc @@ -125,7 +125,7 @@ function getFailurePage($sMessage, $iDocTypeID) { function getGenericFieldsList() { global $default; - $aGenericDocumentFields = DocumentField::getList("is_generic=1");/*ok*/ + $aGenericDocumentFields = DocumentField::getList(array("is_generic=?"), array(true)));/*ok*/ for($i = 0; $i < count($aGenericDocumentFields); $i++) { $sToRender .= "