- Hide buyable & prize fields from import|export

- Hide customfields column if no customfields defined
- Fix export all breaks list view
This commit is contained in:
Nathan Gray 2013-01-02 17:32:30 +00:00
parent c09a9aa61c
commit 5564217b0c
6 changed files with 21 additions and 7 deletions

View File

@ -86,7 +86,10 @@ class resources_bo
*/ */
function get_rows($query,&$rows,&$readonlys) function get_rows($query,&$rows,&$readonlys)
{ {
$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$query); if(!$query['csv_export'])
{
$GLOBALS['egw']->session->appsession('session_data','resources_index_nm',$query);
}
if ($query['store_state']) // request to store state in session and filter in prefs? if ($query['store_state']) // request to store state in session and filter in prefs?
{ {
egw_cache::setSession('resources',$query['store_state'],$query); egw_cache::setSession('resources',$query['store_state'],$query);
@ -245,6 +248,11 @@ class resources_bo
} }
$rows[$num]['admin'] = $this->acl->get_cat_admin($resource['cat_id']); $rows[$num]['admin'] = $this->acl->get_cat_admin($resource['cat_id']);
} }
if(!config::get_customfields('resources'))
{
$rows['no_customfields'] = true;
}
return $nr; return $nr;
} }

View File

@ -40,6 +40,7 @@ class resources_export_csv implements importexport_iface_export_plugin {
'filter2' => -3, // Accessories & resources 'filter2' => -3, // Accessories & resources
'csv_export' => true, // so get_rows method _can_ produce different content or not store state in the session 'csv_export' => true, // so get_rows method _can_ produce different content or not store state in the session
); // all ); // all
unset($query['store_state']);
$bo->get_rows($query,$selection,$readonlys); $bo->get_rows($query,$selection,$readonlys);
} else { } else {
$selection = explode(',',$options['selection']); $selection = explode(',',$options['selection']);

View File

@ -18,6 +18,10 @@ class resources_wizard_export_csv extends importexport_wizard_basic_export_csv
// Field mapping // Field mapping
$this->export_fields = resources_bo::$field2label; $this->export_fields = resources_bo::$field2label;
// Fields deprecated, but still in DB
unset($this->export_fields['buyable']);
unset($this->export_fields['prize']);
// Custom fields // Custom fields
$custom = config::get_customfields('resources', true); $custom = config::get_customfields('resources', true);
foreach($custom as $name => $data) { foreach($custom as $name => $data) {

View File

@ -36,8 +36,9 @@ class resources_wizard_import_csv extends importexport_wizard_basic_import_csv
'location' => lang('Location'), 'location' => lang('Location'),
'storage_info' => lang('Storage'), 'storage_info' => lang('Storage'),
'bookable' => lang('Bookable'), 'bookable' => lang('Bookable'),
'buyable' => lang('Buyable'), // Deprecated, but still in DB
'prize' => lang('Prize'), //'buyable' => lang('Buyable'),
//'prize' => lang('Prize'),
'long_description' => lang('Long description'), 'long_description' => lang('Long description'),
'inventory_number' => lang('inventory number'), 'inventory_number' => lang('inventory number'),
'accessory_of' => lang('Accessory of') 'accessory_of' => lang('Accessory of')

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,7 @@
<column/> <column/>
<column/> <column/>
<column/> <column/>
<column/> <column disabled="@no_customfields"/>
<column width="5%"/> <column width="5%"/>
</columns> </columns>
<rows> <rows>
@ -54,7 +54,7 @@
</hbox> </hbox>
</row> </row>
<row class="nmr $row_cont[class]" valign="top"> <row class="nmr $row_cont[class]" valign="top">
<button align="center" id="${row}[picture_thumb]" onclick="window.open(egw::link('/index.php','menuaction=resources.resources_ui.show&amp;res_id=$row_cont[res_id]'),'','dependent=yes,width=800,height=600,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes');return false;" image="$row_cont[picture_thumb]"/> <button align="center" id="${row}[picture_thumb]" onclick="window.open(egw::link('/index.php','menuaction=resources.resources_ui.show&amp;res_id=$row_cont[res_id]'),'','dependent=yes,width=800,height=600,location=no,menubar=no,toolbar=no,scrollbars=yes,status=yes');return false;" image="$row_cont[picture_thumb]" class="thumb"/>
<vbox> <vbox>
<description id="${row}[name]" no_lang="1"/> <description id="${row}[name]" no_lang="1"/>
<description id="${row}[short_description]" no_lang="1"/> <description id="${row}[short_description]" no_lang="1"/>