@@ -, +, @@
---
.../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(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt
@@ -122,10 +122,14 @@
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt
+++ a/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
--- a/tools/batchedit.pl
+++ a/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);
}
--