From a0a3306d1edf5aff2a23c3067175001b1b069574 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Fri, 5 Aug 2011 15:36:48 +0200 Subject: [PATCH 2/2] Bug 5725 follow-up Fixes adresses comments 28 and 29 (from Owen) * add a link to tools-home * display the biblios before defining rules * add some help/change some wording * fixes result "Status" column (was a H:T:P => T:T glitch) and put the message on the top I also removed an unused variable --- .../prog/en/modules/tools/batchedit.tt | 123 +++++++++++--------- .../prog/en/modules/tools/tools-home.tt | 5 + tools/batchedit.pl | 15 +-- 3 files changed, 80 insertions(+), 63 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt index 981e995..8e0d80e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt @@ -122,10 +122,14 @@
-[% IF ( inputform ) %] +[% IF ( moddone ) %] +
All operations processed
+[% END %] + +[% UNLESS ( bib_list ) %]

Batch records modification

- Use a file + Use a file of biblionumbers
@@ -134,10 +138,11 @@ Or enter records one by one
  1. - +
+

Reminder: you can also add biblios to your cart and reach this page from the cart

[% ELSE %]

List of records:

@@ -152,15 +157,17 @@ [% biblioinfo.biblionumber %] [% biblioinfo.title %] [% biblioinfo.author %] - [% IF ( biblioinfo.moddone ) %] + [% IF ( moddone ) %] [% IF ( biblioinfo.OK ) %] [% ELSE %] [% END %] [% IF ( biblioinfo.OK ) %]OK[% END %] - [% IF ( No_Actions ) %]Nothing done[% END %] - [% IF ( biblioinfo.Actions_Failed ) %]Some Actions failed. List Follow :
    [% FOREACH failed_action IN biblioinfo.failed_actions %]
  • [% failed_action.action %]
  • [% END %]
[% END %] + [% IF ( biblioinfo.No_Actions ) %]Nothing done[% END %] + [% IF ( biblioinfo.Actions_Failed ) %] + Some actions failed. List follow :
    [% FOREACH failed_action IN biblioinfo.failed_actions %]
  • [% failed_action.action %]
  • [% END %]
+ [% END %] [% END %] @@ -168,56 +175,62 @@ [% END %] -[% IF ( moddone ) %] -
All operations processed
-[% ELSE %] -
-

Modification rules:

- - - - - - - - - - - - - - - - - - +[% UNLESS ( moddone ) %] + + [% IF ( bib_list ) %] +
+

Modification rules:

+ + + +
FieldSubfieldActionCondition ValueValue 
- - - - - - - - All - - -
+ + + + + + + +
FieldSubfieldActionCondition ValueValue 
+ + +
- -
-
+ + + + + + + + All + + + + + + + + + + + (don't forget to click "Add" button on the right of the previous form before submitting) + + + [% ELSE %] + + + + [% END %] [% END %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt index 10f1d6d..f218202 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt @@ -103,6 +103,11 @@
Modify items in a batch
[% END %] + [% IF ( CAN_user_tools_batchedit ) %] +
Batch biblio modification
+
Modify biblios in a batch
+ [% END %] + [% IF ( CAN_user_tools_export_catalog ) %]
Export bibliographic and holdings
Export bibliographic and holdings data
diff --git a/tools/batchedit.pl b/tools/batchedit.pl index 0f666b1..73609b9 100755 --- a/tools/batchedit.pl +++ b/tools/batchedit.pl @@ -37,6 +37,7 @@ my $recordslist = $input->param('recordslist'); my $bib_list = $input->param('bib_list'); my @biblionumbers; +#retrieve the list of biblionumber, from a file, a list entered manually or the basket if ($filefh) { while ( my $biblionumber = <$filefh> ) { $biblionumber =~ s/[\r\n]*$//g; @@ -55,6 +56,7 @@ my $frameworkcode=""; my $tagslib = &GetMarcStructure(1,$frameworkcode); my %report_actions; +# if this script is called by ajax, buid an ajax/xml answer if($input->param('field') and not defined $op){ ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "acqui/ajax.tmpl", @@ -136,6 +138,7 @@ if($input->param('field') and not defined $op){ output_html_with_http_headers $input, $cookie, $template->output; exit; }else{ +# standard call (via web browser) ($template, $loggedinuser, $cookie) = get_template_and_user({template_name => "tools/batchedit.tmpl", query => $input, @@ -144,8 +147,8 @@ if($input->param('field') and not defined $op){ flagsrequired => { tools => "batchedit" }, }); - $template->param( inputform => 1, ) unless @biblionumbers; - + $template->param( bib_list => join('/', @biblionumbers)); + # if no $op, just display the form if(!defined $op) { my @modifiablefields; @@ -161,9 +164,7 @@ if($input->param('field') and not defined $op){ push @modifiablefields, \%subfield_data; } } - - $template->param( marcfields => \@modifiablefields, - bib_list => $input->param('bib_list'), + $template->param(marcfields => \@modifiablefields, ); }else{ @@ -176,7 +177,6 @@ if($input->param('field') and not defined $op){ foreach my $biblionumber ( @biblionumbers ){ my $record = GetMarcBiblio($biblionumber); my ($count, $biblio) = GetBiblio($biblionumber); - my $report = 0; my @failed_actions; for(my $i = 0 ; $i < scalar(@fields) ; $i++ ){ my $field = $fields[$i]; @@ -185,7 +185,6 @@ if($input->param('field') and not defined $op){ my $condval = $condvals[$i]; my $nocond = $nocondvals[$i]; my $repval = $repvals[$i]; - my ($result,$record) = BatchModField($record, $field, $subfield, $action, $condval, $nocond, $repval); push @failed_actions, {action=>"$field $subfield $action ".($nocond eq "true"?"all":$condval)." $repval"} if ($result<=0); } @@ -199,7 +198,7 @@ if($input->param('field') and not defined $op){ elsif (@failed_actions == 0){ $report_actions{$biblionumber}->{status}="OK"; } - ModBiblio($record, $biblionumber, $biblio->{frameworkcode}) unless ($report); + ModBiblio($record, $biblionumber, $biblio->{frameworkcode}); } $template->param('moddone' => 1); } -- 1.7.4.1