Commit 4743a543cc55682445fa41f7bce12d7912f6f79f

Authored by Michael Joseph
1 parent f5a17a6c

Corrected multiple unit administration bug for system administrator.


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2918 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/listGroupsBL.php
... ... @@ -42,7 +42,7 @@ if (checkSession()) {
42 42 $aUnitIDs = User::getUnitIDs($_SESSION["userID"]);
43 43 $oPatternCustom->setHtml(getPage($aUnitIDs));
44 44 } else {
45   - $oPatternCustom->setHtml(getPage($fUnitID));
  45 + $oPatternCustom->setHtml(getPage(array($fUnitID)));
46 46 }
47 47 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
48 48 $main->setCentralPayload($oPatternCustom);
... ...
presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/listGroupsUI.inc
... ... @@ -26,14 +26,13 @@
26 26 */
27 27  
28 28 // display the listbox initially ..then just display the text
29   -function getUnitDisplay($aUnitIDs) {
  29 +function getUnitDisplay($iUnitID) {
30 30 global $default;
31 31  
32 32 // #3519 only allow unit filters for system administrators
33 33 // unit administrators only see their units.
34 34 if (Permission::userIsSystemAdministrator()) {
35   - $oPatternListBox = & new PatternListBox($default->units_table, "name", "id", "fUnitID");
36   - $oPatternListBox->setWhereClause("ST.unit_id IN (" . implode(",", $aUnitIDs) . ")");
  35 + $oPatternListBox = & new PatternListBox($default->units_table, "name", "id", "fUnitID");
37 36 $oPatternListBox->setPostBackOnChange(true);
38 37 if ($iUnitID != 0) {
39 38 $oPatternListBox->setSelectedValue($iUnitID);
... ... @@ -50,9 +49,10 @@ function getGroups($aUnitIDs) {
50 49 "LEFT JOIN $default->units_table UL ON UL.id = GUL.unit_id ";
51 50  
52 51 // #2978 don't display system admin groups if you're not a sys admin
53   - // filter by unit
54   - if ($aUnitIDs) {
55   - $sWhereClause = "WHERE GUL.unit_id IN (" . implode(",", $aUnitIDs) . ") ";
  52 + // filter by unit
  53 + $sUnitIDs = implode(",", $aUnitIDs);
  54 + if ($sUnitIDs <> "") {
  55 + $sWhereClause = "WHERE GUL.unit_id IN (" . $sUnitIDs . ") ";
56 56 }
57 57 // #2978 don't display sys admin groups if you're not a sysadmin
58 58 if (!Permission::userIsSystemAdministrator()) {
... ... @@ -87,7 +87,7 @@ function getPage($aUnitIDs) {
87 87 $sToRender .= renderHeading("Group Management");
88 88  
89 89 $sToRender .= getAddLink("addGroup", "Add A Group");
90   - $sToRender .= getUnitDisplay($aUnitIDs);
  90 + $sToRender .= getUnitDisplay($aUnitIDs[0]);
91 91 $sToRender .= getGroups($aUnitIDs);
92 92 return $sToRender;
93 93 }
... ...