Commit 5352c4a41187ce6f99df504d212dead987b072e9

Authored by michael
1 parent 05975721

fixed collaboration bugs (added documentID to queries, fixed listbox operation- …

…catching unassigning users case)


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1461 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/collaborationBL.php
@@ -48,10 +48,10 @@ if (checkSession()) { @@ -48,10 +48,10 @@ if (checkSession()) {
48 } 48 }
49 if (isset($fForStore)) { 49 if (isset($fForStore)) {
50 //if we are storing, get the folder collaboration entry from the database 50 //if we are storing, get the folder collaboration entry from the database
51 - $oFolderCollaboration = & FolderCollaboration::get($fFolderCollaborationID);  
52 - if (isset($fUserID) & ($fUserID != -1)) { 51 + $oFolderCollaboration = & FolderCollaboration::get($fFolderCollaborationID);
  52 + if (isset($fUserID) && ($fUserID != "")) {
53 //if a user has been selected, then set up the folders_users_roles_link database entry 53 //if a user has been selected, then set up the folders_users_roles_link database entry
54 - $oFolderUserRole = & FolderUserRole::getFromFolderCollaboration($fFolderCollaborationID); 54 + $oFolderUserRole = & FolderUserRole::getFromFolderCollaboration($fFolderCollaborationID, $fDocumentID);
55 if (!($oFolderUserRole === false)) { 55 if (!($oFolderUserRole === false)) {
56 //if we have an entry, just update it 56 //if we have an entry, just update it
57 if ($oFolderUserRole->getUserID() != $fUserID) { 57 if ($oFolderUserRole->getUserID() != $fUserID) {
@@ -86,7 +86,7 @@ if (checkSession()) { @@ -86,7 +86,7 @@ if (checkSession()) {
86 } else { 86 } else {
87 //the may have been unassigned and no new user assigned 87 //the may have been unassigned and no new user assigned
88 //if this is true, delete the folder_user_role_link 88 //if this is true, delete the folder_user_role_link
89 - $oFolderUserRole = & FolderUserRole::getFromFolderCollaboration($fFolderCollaborationID); 89 + $oFolderUserRole = & FolderUserRole::getFromFolderCollaboration($fFolderCollaborationID, $fDocumentID);
90 if (!($oFolderUserRole === false)) { 90 if (!($oFolderUserRole === false)) {
91 $oFolderUserRole->delete(); 91 $oFolderUserRole->delete();
92 } 92 }
@@ -98,10 +98,10 @@ if (checkSession()) { @@ -98,10 +98,10 @@ if (checkSession()) {
98 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); 98 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
99 $oPatternCustom = & new PatternCustom(); 99 $oPatternCustom = & new PatternCustom();
100 100
101 - $aFolderCollaborationArray = getFolderCollaborationArray($fFolderCollaborationID); 101 + $aFolderCollaborationArray = getFolderCollaborationArray($fFolderCollaborationID, $fDocumentID);
102 $oPatternCustom->setHtml(getDocumentRoutingPage($aFolderCollaborationArray["group_id"],$aFolderCollaborationArray["user_id"], $aFolderCollaborationArray["role_id"], $aFolderCollaborationArray["sequence"], $fDocumentID)); 102 $oPatternCustom->setHtml(getDocumentRoutingPage($aFolderCollaborationArray["group_id"],$aFolderCollaborationArray["user_id"], $aFolderCollaborationArray["role_id"], $aFolderCollaborationArray["sequence"], $fDocumentID));
103 $main->setCentralPayload($oPatternCustom); 103 $main->setCentralPayload($oPatternCustom);
104 - $main->setFormAction($_SEVER["PHP_SELF"] . "?fFolderCollaborationID=$fFolderCollaborationID&fDocumentID=$fDocumentID&fForStore=1"); 104 + $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderCollaborationID=$fFolderCollaborationID&fDocumentID=$fDocumentID&fForStore=1");
105 $main->render(); 105 $main->render();
106 } 106 }
107 } else { 107 } else {
@@ -124,13 +124,12 @@ if (checkSession()) { @@ -124,13 +124,12 @@ if (checkSession()) {
124 } 124 }
125 } 125 }
126 126
127 -function getFolderCollaborationArray($fFolderCollaborationID) { 127 +function getFolderCollaborationArray($fFolderCollaborationID, $fDocumentID) {
128 global $default; 128 global $default;
129 $sQuery = "SELECT GFL.group_id AS group_id, GFL.folder_id AS folder_id, GFL.precedence AS precedence, GFL.role_id, U.id AS user_id " . 129 $sQuery = "SELECT GFL.group_id AS group_id, GFL.folder_id AS folder_id, GFL.precedence AS precedence, GFL.role_id, U.id AS user_id " .
130 - "FROM $default->owl_groups_folders_approval_table AS GFL LEFT OUTER JOIN folders_users_roles_link AS FURL ON FURL.group_folder_approval_id = GFL.id " . 130 + "FROM $default->owl_groups_folders_approval_table AS GFL LEFT OUTER JOIN folders_users_roles_link AS FURL ON FURL.group_folder_approval_id = GFL.id AND FURL.document_id = $fDocumentID " .
131 "LEFT OUTER JOIN users AS U ON FURL.user_id = U.id " . 131 "LEFT OUTER JOIN users AS U ON FURL.user_id = U.id " .
132 "WHERE GFL.id = $fFolderCollaborationID"; 132 "WHERE GFL.id = $fFolderCollaborationID";
133 -  
134 $sql = $default->db; 133 $sql = $default->db;
135 $sql->query($sQuery); 134 $sql->query($sQuery);
136 if ($sql->next_record()) { 135 if ($sql->next_record()) {