$custom_access['Quotes'] = getSharingRuleList('Quotes'); //Purchase Order Sharing $custom_access['PurchaseOrder'] = getSharingRuleList('PurchaseOrder'); //Sales Order Sharing $custom_access['SalesOrder'] = getSharingRuleList('SalesOrder'); //Invoice Sharing $custom_access['Invoice'] = getSharingRuleList('Invoice'); //Document Sharing $custom_access['Documents'] = getSharingRuleList('Documents'); // Look up for modules for which sharing access is enabled. // NOTE: Accounts and Contacts has been couple, so we need to elimiate Contacts also $othermodules = getSharingModuleList(array('Contacts')); if (!empty($othermodules)) { foreach ($othermodules as $moduleresname) { if (!isset($custom_access[$moduleresname])) { $custom_access[$moduleresname] = getSharingRuleList($moduleresname); } } } uksort($custom_access, function ($a, $b) { return strtolower(getTranslatedString($a, $a)) < strtolower(getTranslatedString($b, $b)) ? -1 : 1; }); $smarty->assign("MODSHARING", $custom_access); /** returns the list of sharing rules for the specified module * @param $module -- Module Name:: Type varchar * @returns $access_permission -- sharing rules list info array:: Type array * */ function getSharingRuleList($module) { global $adb, $mod_strings;
$custom_access['Quotes'] = getSharingRuleList('Quotes'); //Purchase Order Sharing $custom_access['PurchaseOrder'] = getSharingRuleList('PurchaseOrder'); //Sales Order Sharing $custom_access['SalesOrder'] = getSharingRuleList('SalesOrder'); //Invoice Sharing $custom_access['Invoice'] = getSharingRuleList('Invoice'); //Document Sharing $custom_access['Documents'] = getSharingRuleList('Documents'); // Look up for modules for which sharing access is enabled. // NOTE: Accounts and Contacts has been couple, so we need to elimiate Contacts also $othermodules = getSharingModuleList(array('Contacts')); if (!empty($othermodules)) { foreach ($othermodules as $moduleresname) { if (!isset($custom_access[$moduleresname])) { $sr4module = getSharingRuleList($moduleresname); if (isset($_REQUEST['sortrulesby'])) { usort($sr4module, function ($a, $b) { $sba = substr($a[$_REQUEST['sortrulesby']], strpos($a[$_REQUEST['sortrulesby']], '>')); $sbb = substr($b[$_REQUEST['sortrulesby']], strpos($b[$_REQUEST['sortrulesby']], '>')); return $sba < $sbb ? -1 : 1; }); } $custom_access[$moduleresname] = $sr4module; } } } uksort($custom_access, function ($a, $b) { return strtolower(getTranslatedString($a, $a)) < strtolower(getTranslatedString($b, $b)) ? -1 : 1; }); $smarty->assign("MODSHARING", $custom_access);