using new bo_merge static function to check for is_export_limit_excepted; fixing an off but vone error regarding the limit of rows returned

This commit is contained in:
Klaus Leithoff 2011-08-29 15:02:00 +00:00
parent d6b70f4578
commit 6a2d5d8b36
4 changed files with 7 additions and 12 deletions

View File

@ -38,8 +38,7 @@ class importexport_admin_prefs_sidebox_hooks
), ),
); );
$config = config::read('phpgwapi'); $config = config::read('phpgwapi');
$limit_exception = count(@array_intersect(array($GLOBALS['egw_info']['user']['account_id']) + $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'],true), unserialize($GLOBALS['egw_info']['server']['export_limit_excepted']))) > 0; if($GLOBALS['egw_info']['user']['apps']['admin'] || bo_merge::is_export_limit_excepted() || $config['export_limit'] !== 'no')
if($GLOBALS['egw_info']['user']['apps']['admin'] || $limit_exception || $config['export_limit'] !== 'no')
{ {
$file[] = array( $file[] = array(
'text' => 'Export', 'text' => 'Export',
@ -123,8 +122,7 @@ class importexport_admin_prefs_sidebox_hooks
} }
} }
$config = config::read('phpgwapi'); $config = config::read('phpgwapi');
$limit_exception = count(@array_intersect(array($GLOBALS['egw_info']['user']['account_id']) + $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'],true), unserialize($GLOBALS['egw_info']['server']['export_limit_excepted']))) > 0; if (($GLOBALS['egw_info']['user']['apps']['admin'] || bo_merge::is_export_limit_excepted() || !$config['export_limit'] || $config['export_limit'] > 0) && $cache[$appname]['export'])
if (($GLOBALS['egw_info']['user']['apps']['admin'] || $limit_exception || !$config['export_limit'] || $config['export_limit'] > 0) && $cache[$appname]['export'])
{ {
$file['Export CSV'] = array('link' => "javascript:egw_openWindowCentered2('". $file['Export CSV'] = array('link' => "javascript:egw_openWindowCentered2('".
egw::link('/index.php',array( egw::link('/index.php',array(

View File

@ -85,10 +85,9 @@ class importexport_definitions_ui
$filter[] = '(owner=0 OR owner IS NULL OR allowed_users IS NOT NULL OR owner = ' . $GLOBALS['egw_info']['user']['account_id'] . ')'; $filter[] = '(owner=0 OR owner IS NULL OR allowed_users IS NOT NULL OR owner = ' . $GLOBALS['egw_info']['user']['account_id'] . ')';
} else { } else {
// Filter private definitions // Filter private definitions
$limit_exception = count(array_intersect(array($GLOBALS['egw_info']['user']['account_id']) + $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'],true), unserialize($GLOBALS['egw_info']['server']['export_limit_excepted']))) > 0;
$filter['owner'] = $GLOBALS['egw_info']['user']['account_id']; $filter['owner'] = $GLOBALS['egw_info']['user']['account_id'];
$config = config::read('phpgwapi'); $config = config::read('phpgwapi');
if($config['export_limit'] == 'no' && !$limit_exception) { if($config['export_limit'] == 'no' && !bo_merge::is_export_limit_excepted()) {
$filter['type'] = 'import'; $filter['type'] = 'import';
} }
} }

View File

@ -101,8 +101,7 @@ class importexport_export_csv implements importexport_iface_export_record
$this->csv_options = array_merge( $this->csv_options, $_options ); $this->csv_options = array_merge( $this->csv_options, $_options );
} }
$limit_exception = count(array_intersect(array($GLOBALS['egw_info']['user']['account_id']) + $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'],true), unserialize($GLOBALS['egw_info']['server']['export_limit_excepted']))) > 0; if(!($GLOBALS['egw_info']['user']['apps']['admin'] || bo_merge::is_export_limit_excepted())) {
if(!($GLOBALS['egw_info']['user']['apps']['admin'] || $limit_exception)) {
$config = config::read('phpgwapi'); $config = config::read('phpgwapi');
if($config['export_limit'] == 'no') throw new egw_exception_no_permission_admin('Export disabled'); if($config['export_limit'] == 'no') throw new egw_exception_no_permission_admin('Export disabled');
$this->export_limit = (int)$config['export_limit']; $this->export_limit = (int)$config['export_limit'];
@ -165,7 +164,7 @@ class importexport_export_csv implements importexport_iface_export_record
} }
// Check for limit // Check for limit
if($this->export_limit && $this->num_of_records > $this->export_limit) { if($this->export_limit && $this->num_of_records >= $this->export_limit) {
return; return;
} }

View File

@ -19,7 +19,7 @@ class importexport_export_ui {
public $public_functions = array( public $public_functions = array(
'export_dialog' => true, 'export_dialog' => true,
'download' => true, 'download' => true,
); );
private $js; private $js;
@ -49,8 +49,7 @@ class importexport_export_ui {
$preserv = array(); $preserv = array();
// Check global setting // Check global setting
$limit_exception = count(@array_intersect(array($GLOBALS['egw_info']['user']['account_id']) + $GLOBALS['egw']->accounts->memberships($GLOBALS['egw_info']['user']['account_id'],true), unserialize($GLOBALS['egw_info']['server']['export_limit_excepted']))) > 0; if(!($GLOBALS['egw_info']['user']['apps']['admin'] || bo_merge::is_export_limit_excepted())) {
if(!($GLOBALS['egw_info']['user']['apps']['admin'] || $limit_exception)) {
$config = config::read('phpgwapi'); $config = config::read('phpgwapi');
if($config['export_limit'] == 'no') { if($config['export_limit'] == 'no') {
die(lang('Admin disabled exporting')); die(lang('Admin disabled exporting'));