From 0b3f4be3d5fed0df9a46ed23c90c48fb28379314 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Wed, 15 Feb 2017 22:52:45 +0000 Subject: [PATCH] Bug 12759: Use a list (shelf) for batch record modification and deletion To test: 1) Create a list, add a record to it by its barcode that you don't mind deleting 2) Go to Tools -> Batch record modification 3) Select the list from the dropdown, select a modification template, Continue 4) Confirm all of the records in that list show on the page. Click Modify selected records. Confirm this is successful. 5) Go to Batch record deletion 6) Select the list from the dropdown and click Continue 7) Confirm all of the records in that list show on the page. Click Delete selected records. Confirm this is successful. 8) Go back to your lists. The list should still exist but it will now be empty. Sponsored-by: Catalyst IT --- .../prog/en/modules/tools/batch_delete_records.tt | 15 +++++++++++++++ .../prog/en/modules/tools/batch_record_modification.tt | 15 +++++++++++++++ tools/batch_delete_records.pl | 11 +++++++++++ tools/batch_record_modification.pl | 11 +++++++++++ 4 files changed, 52 insertions(+) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt index 7962a9f..5501cc3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_delete_records.tt @@ -135,6 +135,21 @@ $(document).ready(function() {
+ Or select a list of records +
    +
  1. + + +
  2. +
+
+
Or enter a list of record numbers
  1. diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt index 32034a5..c6dc515 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batch_record_modification.tt @@ -143,6 +143,21 @@ $(document).ready(function() {
+ Or select a list of records +
    +
  1. + + +
  2. +
+
+
Or enter a list of record numbers
  1. diff --git a/tools/batch_delete_records.pl b/tools/batch_delete_records.pl index 2c2d32e..a979112 100755 --- a/tools/batch_delete_records.pl +++ b/tools/batch_delete_records.pl @@ -27,6 +27,7 @@ use C4::Auth; use C4::Output; use C4::AuthoritiesMarc; use C4::Biblio; +use Koha::Virtualshelves; my $input = new CGI; my $dbh = C4::Context->dbh; @@ -41,6 +42,9 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user({ flagsrequired => { tools => 'records_batchdel' }, }); +my @lists = Koha::Virtualshelves->search({}); +$template->param( lists => \@lists ); + my @records; my @messages; if ( $op eq 'form' ) { @@ -60,6 +64,13 @@ if ( $op eq 'form' ) { $content =~ s/[\r\n]*$//; push @record_ids, $content if $content; } + } elsif ( my $shelf_number = $input->param('shelf_number') ) { + my $shelf = Koha::Virtualshelves->find($shelf_number); + my $contents = $shelf->get_contents; + while ( my $content = $contents->next ) { + my $biblionumber = $content->biblionumber; + push @record_ids, $biblionumber; + } } else { # The user enters manually the list of id push @record_ids, split( /\s\n/, $input->param('recordnumber_list') ); diff --git a/tools/batch_record_modification.pl b/tools/batch_record_modification.pl index 6ea0317..bce71f8 100755 --- a/tools/batch_record_modification.pl +++ b/tools/batch_record_modification.pl @@ -30,6 +30,7 @@ use C4::BackgroundJob; use C4::Biblio qw( GetMarcBiblio ModBiblio ); use C4::MarcModificationTemplates qw( GetModificationTemplateActions GetModificationTemplates ModifyRecordWithTemplate ); use Koha::MetadataRecord::Authority; +use Koha::Virtualshelves; my $input = new CGI; our $dbh = C4::Context->dbh; @@ -66,6 +67,9 @@ if ( $completedJobID ) { exit; } +my @lists = Koha::Virtualshelves->search({}); +$template->param( lists => \@lists ); + my @templates = GetModificationTemplates( $mmtid ); unless ( @templates ) { $op = 'error'; @@ -108,6 +112,13 @@ if ( $op eq 'form' ) { $content =~ s/[\r\n]*$//; push @record_ids, $content if $content; } + } elsif ( my $shelf_number = $input->param('shelf_number') ) { + my $shelf = Koha::Virtualshelves->find($shelf_number); + my $contents = $shelf->get_contents; + while ( my $content = $contents->next ) { + my $biblionumber = $content->biblionumber; + push @record_ids, $biblionumber; + } } else { # The user enters manually the list of id push @record_ids, split( /\s\n/, $input->param('recordnumber_list') ); -- 2.1.4