Commit 4743a543cc55682445fa41f7bce12d7912f6f79f
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
Showing
2 changed files
with
8 additions
and
8 deletions
presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/listGroupsBL.php
| @@ -42,7 +42,7 @@ if (checkSession()) { | @@ -42,7 +42,7 @@ if (checkSession()) { | ||
| 42 | $aUnitIDs = User::getUnitIDs($_SESSION["userID"]); | 42 | $aUnitIDs = User::getUnitIDs($_SESSION["userID"]); |
| 43 | $oPatternCustom->setHtml(getPage($aUnitIDs)); | 43 | $oPatternCustom->setHtml(getPage($aUnitIDs)); |
| 44 | } else { | 44 | } else { |
| 45 | - $oPatternCustom->setHtml(getPage($fUnitID)); | 45 | + $oPatternCustom->setHtml(getPage(array($fUnitID))); |
| 46 | } | 46 | } |
| 47 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 47 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 48 | $main->setCentralPayload($oPatternCustom); | 48 | $main->setCentralPayload($oPatternCustom); |
presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/listGroupsUI.inc
| @@ -26,14 +26,13 @@ | @@ -26,14 +26,13 @@ | ||
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | // display the listbox initially ..then just display the text | 28 | // display the listbox initially ..then just display the text |
| 29 | -function getUnitDisplay($aUnitIDs) { | 29 | +function getUnitDisplay($iUnitID) { |
| 30 | global $default; | 30 | global $default; |
| 31 | 31 | ||
| 32 | // #3519 only allow unit filters for system administrators | 32 | // #3519 only allow unit filters for system administrators |
| 33 | // unit administrators only see their units. | 33 | // unit administrators only see their units. |
| 34 | if (Permission::userIsSystemAdministrator()) { | 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 | $oPatternListBox->setPostBackOnChange(true); | 36 | $oPatternListBox->setPostBackOnChange(true); |
| 38 | if ($iUnitID != 0) { | 37 | if ($iUnitID != 0) { |
| 39 | $oPatternListBox->setSelectedValue($iUnitID); | 38 | $oPatternListBox->setSelectedValue($iUnitID); |
| @@ -50,9 +49,10 @@ function getGroups($aUnitIDs) { | @@ -50,9 +49,10 @@ function getGroups($aUnitIDs) { | ||
| 50 | "LEFT JOIN $default->units_table UL ON UL.id = GUL.unit_id "; | 49 | "LEFT JOIN $default->units_table UL ON UL.id = GUL.unit_id "; |
| 51 | 50 | ||
| 52 | // #2978 don't display system admin groups if you're not a sys admin | 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 | // #2978 don't display sys admin groups if you're not a sysadmin | 57 | // #2978 don't display sys admin groups if you're not a sysadmin |
| 58 | if (!Permission::userIsSystemAdministrator()) { | 58 | if (!Permission::userIsSystemAdministrator()) { |
| @@ -87,7 +87,7 @@ function getPage($aUnitIDs) { | @@ -87,7 +87,7 @@ function getPage($aUnitIDs) { | ||
| 87 | $sToRender .= renderHeading("Group Management"); | 87 | $sToRender .= renderHeading("Group Management"); |
| 88 | 88 | ||
| 89 | $sToRender .= getAddLink("addGroup", "Add A Group"); | 89 | $sToRender .= getAddLink("addGroup", "Add A Group"); |
| 90 | - $sToRender .= getUnitDisplay($aUnitIDs); | 90 | + $sToRender .= getUnitDisplay($aUnitIDs[0]); |
| 91 | $sToRender .= getGroups($aUnitIDs); | 91 | $sToRender .= getGroups($aUnitIDs); |
| 92 | return $sToRender; | 92 | return $sToRender; |
| 93 | } | 93 | } |