Bugzilla – Attachment 66412 Details for
Bug 18201
Export data -Fix "Remove non-local items" option and add "Removes non-local records" option for existing functionality
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18201 - Followup
Bug-18201---Followup.patch (text/plain), 5.00 KB, created by
Nick Clemens (kidclamp)
on 2017-08-24 11:48:46 UTC
(
hide
)
Description:
Bug 18201 - Followup
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-08-24 11:48:46 UTC
Size:
5.00 KB
patch
obsolete
>From 72e8017466832475304155c0063d2381ca4b2929 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 24 Aug 2017 11:44:53 +0000 >Subject: [PATCH] Bug 18201 - Followup > >--- > Koha/Exporter/Record.pm | 7 ++++--- > koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt | 10 +++------- > tools/export.pl | 11 ++++------- > 3 files changed, 11 insertions(+), 17 deletions(-) > >diff --git a/Koha/Exporter/Record.pm b/Koha/Exporter/Record.pm >index 193f87e..999500c 100644 >--- a/Koha/Exporter/Record.pm >+++ b/Koha/Exporter/Record.pm >@@ -63,7 +63,7 @@ sub _get_biblio_for_export { > my $biblionumber = $params->{biblionumber}; > my $itemnumbers = $params->{itemnumbers}; > my $export_items = $params->{export_items} // 1; >- my $only_export_items_for_branch = $params->{only_export_items_for_branch}; >+ my $only_export_items_for_branches = $params->{only_export_items_for_branches}; > > my $record = eval { C4::Biblio::GetMarcBiblio($biblionumber); }; > >@@ -71,12 +71,13 @@ sub _get_biblio_for_export { > > if ($export_items) { > C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber, $itemnumbers ); >- if ($only_export_items_for_branch) { >+ if (@$only_export_items_for_branches) { >+ my %export_items_for_branches = map { $_ => 1 } @$only_export_items_for_branches; > my ( $homebranchfield, $homebranchsubfield ) = GetMarcFromKohaField( 'items.homebranch', '' ); # Should be GetFrameworkCode( $biblionumber )? > > for my $itemfield ( $record->field($homebranchfield) ) { > my $homebranch = $itemfield->subfield($homebranchsubfield); >- if ( $only_export_items_for_branch ne $homebranch ) { >+ unless ( $export_items_for_branches{$homebranch} ) { > $record->delete_field($itemfield); > } > } >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 aa23e35..a9ab3fe 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/export.tt >@@ -96,7 +96,7 @@ $(document).ready(function() { > </li> > > <li> >- <label>Library: </label> >+ <label>With items owned by the following libraries: </label> > [% INCLUDE 'branch-selector.inc' branches = libraries %] > </li> > </ol> >@@ -146,12 +146,8 @@ $(document).ready(function() { > <input id="dont_export_item" type="checkbox" name="dont_export_item" /> > </li> > <li> >- <label for="strip_nonlocal_records">Remove records not owned by logged in library:</label> >- <input id="strip_nonlocal_records" type="checkbox" name="strip_nonlocal_records" /> >- </li> >- <li> >- <label for="strip_nonlocal_items">Remove items not owned by logged in library:</label> >- <input id="strip_nonlocal_items" type="checkbox" name="strip_nonlocal_items" /> >+ <label for="strip_items_not_from_libraries">Remove items not owned by selected libraries:</label> >+ <input id="strip_items_not_from_libraries" type="checkbox" name="strip_items_not_from_libraries" /> > </li> > <li> > <label for="export_remove_fields">Don't export fields:</label> >diff --git a/tools/export.pl b/tools/export.pl >index 052ba4e..0704b57 100755 >--- a/tools/export.pl >+++ b/tools/export.pl >@@ -87,15 +87,12 @@ 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 $strip_items_not_from_libraries = $query->param('strip_items_not_from_libraries'); > my @sql_params; > my $sql_query; > >- 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 $libraries = Koha::Libraries->search_filtered->unblessed; >+ my $only_export_items_for_branches = $strip_items_not_from_libraries ? \@branch : undef; > my @branchcodes; > for my $branchcode ( @branch ) { > if ( grep { $_->{branchcode} eq $branchcode } @$libraries ) { >@@ -211,7 +208,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, >+ only_export_items_for_branches => $only_export_items_for_branches, > } > ); > } >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18201
:
62149
|
62152
|
66412
|
67596
|
67597
|
68499
|
68500
|
70002
|
70003
|
70058