Commit 17aae85a42ee0a6f4fdc2e09186b836601263d64

Authored by Neil Blakey-Milner
1 parent 68f26be8

Rename Folder View to Folder Details


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@5526 c91229c3-7414-0410-bfa2-8a42b809f60b
lib/upgrades/UpgradeFunctions.inc.php
... ... @@ -38,7 +38,7 @@ class UpgradeFunctions {
38 38 "3.0.1.3" => array('addTransactionTypes3013'),
39 39 "3.0.1.4" => array('createWorkflowPermission'),
40 40 "3.0.2" => array("fixDocumentRoleAllocation"),
41   - "3.0.3.2" => array("createFolderViewPermission"),
  41 + "3.0.3.2" => array("createFolderDetailsPermission"),
42 42 );
43 43  
44 44 var $descriptions = array(
... ... @@ -53,7 +53,7 @@ class UpgradeFunctions {
53 53 'addTransactionTypes3013' => 'Add new folder transaction types',
54 54 'createWorkflowPermission' => 'Create the Core: Manage Workflow',
55 55 'fixDocumentRoleAllocation' => 'Fix the document role allocation upgrade from 3.0.1',
56   - 'createFolderViewPermission' => 'Create the Core: Folder View permission',
  56 + 'createFolderDetailsPermission' => 'Create the Core: Folder Details permission',
57 57 );
58 58 var $phases = array(
59 59 "setPermissionFolder" => 1,
... ... @@ -651,20 +651,25 @@ class UpgradeFunctions {
651 651 }
652 652 // }}}
653 653  
654   - // {{{ createFolderViewPermission
655   - function createFolderViewPermission() {
656   - DBUtil::startTransaction();
  654 + // {{{ createFolderDetailsPermission
  655 + function createFolderDetailsPermission() {
657 656 $sPermissionsTable = KTUtil::getTableName('permissions');
  657 + $bExists = DBUtil::getOneResultKey("SELECT COUNT(id) AS cnt FROM $sPermissionsTable WHERE name = 'ktcore.permissions.folder_details'", 'cnt');
  658 + if ($bExists) {
  659 + return;
  660 + }
  661 +
  662 + DBUtil::startTransaction();
658 663 $aPermissionInfo = array(
659   - 'human_name' => 'Core: Folder View',
660   - 'name' => 'ktcore.permissions.folder_view',
  664 + 'human_name' => 'Core: Folder Details',
  665 + 'name' => 'ktcore.permissions.folder_details',
661 666 'built_in' => true,
662 667 );
663 668 $res = DBUtil::autoInsert($sPermissionsTable, $aPermissionInfo);
664 669 if (PEAR::isError($res)) {
665 670 return $res;
666 671 }
667   - $iFolderViewPermissionId = $res;
  672 + $iFolderDetailsPermissionId = $res;
668 673  
669 674 $sQuery = "SELECT id FROM $sPermissionsTable WHERE name = ?";
670 675 $aParams = array("ktcore.permissions.read");
... ... @@ -675,7 +680,7 @@ class UpgradeFunctions {
675 680 $aParams = array($iReadPermissionId);
676 681 $aRows = DBUtil::getResultArray(array($sQuery, $aParams));
677 682 foreach ($aRows as $aRow) {
678   - $aRow['permission_id'] = $iFolderViewPermissionId;
  683 + $aRow['permission_id'] = $iFolderDetailsPermissionId;
679 684 DBUtil::autoInsert($sPermissionAssignmentsTable, $aRow);
680 685 }
681 686 $sDocumentTable = KTUtil::getTableName('documents');
... ...