From 817a855838074a1c05b3eec4d4ee9e83e403d59b Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Thu, 13 Apr 2017 10:21:50 -0400 Subject: [PATCH] [SIGNED OFF ]Bug 18201 - Export data -Fix "Remove non-local items" option and add "Removes non-local records" option for existing functionality It turns out the modules had the option expected built in, we just didn't call it. This patch set expands the options for passing to the export. To test: 1 - Go to Tools->Export data 2 - Perform an export and check 'Remove non-local items' 3 - Note that file contains only 'local' records, but includes all items on those records 4 - Apply patch 5 - Note Tools->Export data has a new option to remove records not owned by logged in branch 6 - Export as before checking records option, file should be as before 7 - Now check 'Remove items not owned by logged in branch' 8 - File should now only have local items (may have empty records) 9 - Check both boxes and recieve only 'local' records and items Works as described. Signed-off-by: Christopher Brannon --- koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt | 6 +++++- tools/export.pl | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt index cfa252c..b7c0d52 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt @@ -151,7 +151,11 @@ $(document).ready(function() {
  • - + + +
  • +
  • +
  • diff --git a/tools/export.pl b/tools/export.pl index 1ed7b1a..753c350 100755 --- a/tools/export.pl +++ b/tools/export.pl @@ -87,13 +87,15 @@ if ( $op eq "export" ) { my $export_remove_fields = $query->param("export_remove_fields") || q||; my @biblionumbers = $query->multi_param("biblionumbers"); my @itemnumbers = $query->multi_param("itemnumbers"); + my $strip_nonlocal_records = $query->param('strip_nonlocal_records'); my $strip_nonlocal_items = $query->param('strip_nonlocal_items'); my @sql_params; my $sql_query; - my $libraries = $strip_nonlocal_items + my $libraries = $strip_nonlocal_records ? [ Koha::Libraries->find(C4::Context->userenv->{branch})->unblessed ] : Koha::Libraries->search_filtered->unblessed; + my $only_export_items_for_branch = $strip_nonlocal_items ? Koha::Libraries->find(C4::Context->userenv->{branch})->branchcode : undef; my @branchcodes; for my $branchcode ( @branch ) { if ( grep { $_->{branchcode} eq $branchcode } @$libraries ) { @@ -209,6 +211,7 @@ if ( $op eq "export" ) { dont_export_fields => $export_remove_fields, csv_profile_id => $csv_profile_id, export_items => (not $dont_export_items), + only_export_items_for_branch => $only_export_items_for_branch, } ); } -- 2.1.4