From 0ca82e846deaa3b8fce34ca59fd92304a9cddb42 Mon Sep 17 00:00:00 2001 From: Amit Gupta Date: Tue, 10 Apr 2012 11:11:30 +0530 Subject: [PATCH] Bug 7739 - Batch edit items of a title A new option - Edit items in batch - is made available under the menu - Edit - in the catalog detail page. When this option is selected the tool batch item modification is called with all items under this biblio passed as parameters. User can then edit all items of this biblio in batch. Once changes are saved the "done" link takes the user back to the catalog detail page of this biblio. To test: Navigate to catalog detail page of any biblio with one or more item records. Use the option "Edit items in batch" from the "Edit" menu. Mod ify the items in batch, say the collction code or lost status. Press "Save", verify that changes have been effected in the confirmation screen. Use the "Done" link to navigate back to the catalog detail page. --- .../intranet-tmpl/prog/en/includes/cat-toolbar.inc | 1 + .../prog/en/modules/tools/batchMod-edit.tt | 6 ++++- tools/batchMod.pl | 22 ++++++++++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc index be2f74f..51e59a7 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc @@ -110,6 +110,7 @@ function confirm_items_deletion() { var editmenu = [ [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]{ text: _("Edit Record"), url: "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% biblionumber %]&frameworkcode=&op=" },[% END %] [% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Edit Items"), url: "/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% biblionumber %]" },[% END %] + [% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Edit Items In Batch"), url: "/cgi-bin/koha/tools/batchMod.pl?op=show&biblionumber=[% biblionumber %]&src=CATALOGUING" },[% END %] [% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Attach Item"), url: "/cgi-bin/koha/cataloguing/moveitem.pl?biblionumber=[% biblionumber %]" },[% END %] [% IF ( EasyAnalyticalRecords ) %][% IF ( CAN_user_editcatalogue_edit_items ) %]{ text: _("Link to Host Item"), url: "/cgi-bin/koha/cataloguing/linkitem.pl?biblionumber=[% biblionumber %]" },[% END %][% END %] [% IF ( LocalCoverImages || OPACLocalCoverImages) %][% IF ( CAN_user_tools_upload_local_cover_images ) %]{ text: _("Upload Image"), url: "/cgi-bin/koha/tools/upload-cover-image.pl?biblionumber=[% biblionumber %]&filetype=image" },[% END %][% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt index a1b63d9..48b9f9c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchMod-edit.tt @@ -86,7 +86,7 @@ $("input[name='disable_input']").click(function() { - + [% IF ( item_loop ) %] [% IF ( show ) %]
Select All | Clear All
[% ELSE %][% END %]
@@ -173,7 +173,11 @@ $("input[name='disable_input']").click(function() {
[% ELSE %]
+[% IF ( src == 'CATALOGUING') %] + Done +[% ELSE %] Done +[% END %]
[% END %] diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 9d59e3a..c3a147e 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -39,12 +39,13 @@ my $input = new CGI; my $dbh = C4::Context->dbh; my $error = $input->param('error'); my @itemnumbers = $input->param('itemnumber'); +my $biblionumber = $input->param('biblionumber'); my $op = $input->param('op'); my $del = $input->param('del'); my $del_records = $input->param('del_records'); my $completedJobID = $input->param('completedJobID'); my $runinbackground = $input->param('runinbackground'); - +my $src = $input->param('src'); my $template_name; my $template_flag; @@ -229,9 +230,19 @@ if ($op eq "show"){ @itemnumbers = @contentlist; } } else { - if ( my $list=$input->param('barcodelist')){ - push my @barcodelist, split(/\s\n/, $list); - + my @items; + my @barcodelist; + if (defined $biblionumber){ + my @all_items = GetItemsInfo( $biblionumber ); + foreach my $itm (@all_items) { + push @items, $itm->{barcode}; + } + @barcodelist=@items; + } else { + if ( my $list=$input->param('barcodelist')){ + push @barcodelist, split(/\s\n/, $list); + } + } foreach my $barcode (@barcodelist) { my $itemnumber = GetItemnumberFromBarcode($barcode); @@ -241,8 +252,6 @@ if ($op eq "show"){ push @notfoundbarcodes, $barcode; } } - - } } # Flag to tell the template there are valid results, hidden or not @@ -453,6 +462,7 @@ if ($op eq "action") { foreach my $error (@errors) { $template->param($error => 1); } +$template->param(src => $src); output_html_with_http_headers $input, $cookie, $template->output; exit; -- 1.6.4.2