View | Details | Raw Unified | Return to bug 5725
Collapse All | Expand All

(-)a/C4/Biblio.pm (+90 lines)
Lines 128-133 BEGIN { Link Here
128
      &TransformHtmlToXml
128
      &TransformHtmlToXml
129
      &PrepareItemrecordDisplay
129
      &PrepareItemrecordDisplay
130
      &GetNoZebraIndexes
130
      &GetNoZebraIndexes
131
      &BatchModField
131
    );
132
    );
132
}
133
}
133
134
Lines 3681-3686 sub get_biblio_authorised_values { Link Here
3681
    return $authorised_values;
3682
    return $authorised_values;
3682
}
3683
}
3683
3684
3685
=head3 BatchModField
3686
3687
  Mod subfields in field record
3688
3689
  returns 1,$record if succeed
3690
  returns 0,$record if Action was not processed
3691
  returns -1 if no record
3692
  returns -2 if no action done on record
3693
3694
=cut
3695
3696
sub BatchModField {
3697
    my ( $record, $field, $subfield, $action, $condval, $nocond, $repval ) = @_;
3698
3699
    return -1 unless $record;
3700
    $condval=NormalizeString($condval);
3701
    my $condition=qr/$condval/;
3702
3703
    if($action eq "add"){
3704
        for my $rfield ($record->field($field)){
3705
            $rfield->add_subfields( $subfield => $repval );
3706
        }
3707
        return 1;
3708
    }elsif($action eq "addfield"){
3709
        my $new_field = MARC::Field->new($field,'','',
3710
                                         $subfield => $repval);
3711
        $record->insert_fields_ordered($new_field);
3712
        return 1;
3713
    } else {
3714
        my $done=0;
3715
        for my $rfield ($record->field($field)) {
3716
            if ($subfield && $subfield ne "@"){
3717
                my @subfields = $rfield->subfields();
3718
                my @subfields_to_add;
3719
            foreach my $subf (@subfields) {
3720
                    if ($subf->[0] eq $subfield){
3721
                        $subf->[1]=NormalizeString($subf->[1]);
3722
                        if ( $action eq "mod" ) {
3723
                            if ( $nocond ne "true" && $subf->[1] =~ s/$condition/$repval/) {
3724
                                $done=1;
3725
                            }
3726
                            if ($nocond eq "true"){
3727
                                $subf->[1] = $repval;
3728
                                $done=1;
3729
                    }
3730
                } elsif ( $action eq "del" ) {
3731
                            if ( $subf->[1] =~ m/$condition/ || $nocond eq "true" ) {
3732
                                $done=1;
3733
                                next;
3734
                            }
3735
                        }
3736
                    }
3737
                    push @subfields_to_add,@$subf;
3738
        }
3739
                if ($done){
3740
                    if (@subfields_to_add){
3741
                        $rfield->replace_with(MARC::Field->new($rfield->tag,$rfield->indicator(1),$rfield->indicator(2),@subfields_to_add));
3742
    }
3743
                    else {
3744
                        my $count= $record->delete_field($rfield);
3745
                    }
3746
                }
3747
            }
3748
            else {
3749
                if ($action eq "del"){
3750
                    my $count=$record->delete_field($rfield);
3751
                    $done=1;
3752
                }
3753
                else {
3754
                    if ($field < 10){
3755
                       my $value=$record->field($field)->data();
3756
                       if ($value=~ s/$condition/$repval/){
3757
                        $record->field($field)->update($value);
3758
                        $done=1;
3759
3760
                       }
3761
                       if ( $nocond eq 'true'){
3762
                        $record->field($field)->update($repval);
3763
                        $done=1;
3764
                       }
3765
                    }
3766
                }
3767
            }
3768
        }
3769
        return ($done,$record);
3770
    }
3771
    return -2;
3772
}
3773
3684
1;
3774
1;
3685
3775
3686
__END__
3776
__END__
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +9 lines)
Lines 4365-4375 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4365
4365
4366
$DBversion = "3.05.00.004";
4366
$DBversion = "3.05.00.004";
4367
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4367
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4368
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC',NULL,'YesNo');");
4368
    $dbh->do("INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('ShowReviewerPhoto',1,'If ON, photo of reviewer will be shown beside comments in OPAC',NULL,'YesNo')");
4369
    print "Upgrade to $DBversion done (Add syspref ShowReviewerPhoto)\n";
4369
    print "Upgrade to $DBversion done (Add syspref ShowReviewerPhoto)\n";
4370
    SetVersion($DBversion);
4370
    SetVersion($DBversion);
4371
}
4371
}
4372
4372
4373
$DBversion = "3.05.00.005";
4374
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4375
    $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ( 13, 'batchedit', 'Batch editing biblios')");
4376
    print "Upgrade to $DBversion done (batch edit permission)\n";
4377
    SetVersion($DBversion);
4378
}
4379
4380
4373
=head1 FUNCTIONS
4381
=head1 FUNCTIONS
4374
4382
4375
=head2 DropAllForeignKeys($table)
4383
=head2 DropAllForeignKeys($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/js/basket.js (+6 lines)
Lines 433-436 $(document).ready(function(){ Link Here
433
	if(basketcount){ updateBasket(basketcount); }
433
	if(basketcount){ updateBasket(basketcount); }
434
});
434
});
435
435
436
function batchEdit(){
437
    var valCookie = readCookie(nameCookie);
438
    var strCookie = nameParam + "=" + valCookie;
436
439
440
    var loc = CGIBIN + "tools/batchedit.pl?" + strCookie;
441
    window.opener.location = loc;
442
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/basket/basket.tt (+7 lines)
Lines 86-91 function placeHold () { Link Here
86
		[% IF ( verbose ) %]<a href="basket.pl" class="brief" onclick="showLess(); return false;">Brief Display</a>[% ELSE %]<a href="basket.pl" class="detail" onclick="showMore(); return false;">More Details</a>[% END %]
86
		[% IF ( verbose ) %]<a href="basket.pl" class="brief" onclick="showLess(); return false;">Brief Display</a>[% ELSE %]<a href="basket.pl" class="detail" onclick="showMore(); return false;">More Details</a>[% END %]
87
	    </span></span>
87
	    </span></span>
88
	</li>
88
	</li>
89
    [% IF ( CAN_user_tools_batchedit ) %]
90
    <li>
91
        <span id="batchedit" class="yui-button yui-link-button"><span class="first-child">
92
        <a class="batchedit" href="basket.pl" onclick="batchEdit(); return false;">Batch Edit</a>
93
        </span></span>
94
    </li>
95
    [% END %]
89
	<li>
96
	<li>
90
	    <span id="receive" class="yui-button yui-link-button"><span class="first-child">
97
	    <span id="receive" class="yui-button yui-link-button"><span class="first-child">
91
		<a class="send" href="basket.pl" onclick="sendBasket(); return false;">Send</a>
98
		<a class="send" href="basket.pl" onclick="sendBasket(); return false;">Send</a>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/batchedit.tt (+227 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Tools &rsaquo; Batch Deletion of Items</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
5
[% UNLESS ( modsuccess ) %]
6
<script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.tablesorter.min.js"></script>
7
<script type="text/JavaScript" language="JavaScript">
8
//<![CDATA[
9
     var CGIBIN = "/cgi-bin/koha/";
10
11
     function fieldChanged(){
12
        var field = $('#fieldchoice').val();
13
        $.ajax({
14
		url: CGIBIN + 'tools/batchedit.pl?field=' + field,
15
		dataType: 'json',
16
            success: function(data){
17
		$("#subfieldchoice option").remove();
18
19
		    var subfield = $('#subfieldchoice');
20
			$("<option>").attr("value", "@")
21
                                 .text( _('Whole field'))
22
                                 .appendTo('#subfieldchoice');
23
                for( var i=0; i < data.length ; i++){
24
			$("<option>").attr("value", data[i].subfield)
25
                                 .text(data[i].subfield)
26
                                 .appendTo('#subfieldchoice');
27
                }
28
                subfieldChanged();
29
            }
30
        });
31
     }
32
33
     function subfieldChanged(){
34
        var field    = $('#fieldchoice').val();
35
        var subfield = $('#subfieldchoice').val();
36
        $.ajax({
37
		url: CGIBIN + 'tools/batchedit.pl?field=' + field + '&subfield=' + subfield,
38
		dataType: 'json',
39
            success: function(data){
40
41
		    if( data.length > 0) {
42
			$("#condvaltd").html('<select name="condvalchoice" id="condvalchoice" />');
43
			$("<option>").attr("value", "")
44
                        .text("")
45
                        .appendTo('#condvalchoice');
46
			$("#repvaltd" ).html('<select name="repvalchoice" id="repvalchoice" />'  );
47
                    $("<option>").attr("value", "")
48
                        .text("")
49
                        .appendTo('#repvalchoice');
50
51
                    for( var i=0; i < data.length ; i++){
52
			$("<option>").attr("value", data[i].code)
53
                            .text(data[i].value)
54
                            .appendTo('#repvalchoice');
55
			$("<option>").attr("value", data[i].code)
56
                            .text(data[i].value)
57
                            .appendTo('#condvalchoice');
58
                    }
59
		    }else{
60
                    $("#condvaltd").html('<input type="text" name="condvalchoice" id="condvalchoice" />');
61
                    $("#repvaltd").html('<input type="text" name="repvalchoice"  id="repvalchoice" />');
62
		    }
63
                $('<input type="checkbox" id="nocond" name="nocond" value="nocond" onClick="$(\'#condvalchoice\').attr(\'disabled\', ! $(\'#condvalchoice\').attr(\'disabled\') ) ">All</input>').appendTo("#condvaltd");
64
            }
65
        });
66
67
     }
68
69
     function addRule(){
70
        var actionlabel = {
71
                mod: _('Modify'),
72
                del: _('Delete'),
73
                add: _('Create')
74
                };
75
        var repvallabel  = $('#repvalchoice :selected').text()  || $("#repvalchoice").val();
76
77
        var field    = $('#fieldchoice').val();
78
        var subfield = $('#subfieldchoice').val();
79
        var action   = $('#actionchoice').val();
80
        var nocond   = $('#nocond').attr('checked')||(! $('#condvalchoice').val().length);
81
82
        if( ! nocond ) {
83
            var condval  = $('#condvalchoice').val();
84
            var condvallabel = $('#condvalchoice :selected').text() || $("#condvalchoice").val();
85
        }else{
86
            var condvallabel = _("No condition");
87
        }
88
        var repval   = $('#repvalchoice').val();
89
90
        var tmpl = "<tr>"
91
                + '<td><input type="hidden" name="field" value="'    + field + '" />'    + field               + '</td>'
92
                + '<td><input type="hidden" name="subfield" value="' + subfield + '" />' + subfield            + '</td>'
93
                + '<td><input type="hidden" name="action" value="'   + action + '" />'   + actionlabel[action] + '</td>'
94
                + '<td><input type="hidden" name="condval" value="'  + condval + '" />'
95
                    + condvallabel
96
                    + '<input type="hidden" name="nocondval" value="' + nocond + '" />'
97
                + '</td>'
98
99
                + '<td><input type="hidden" name="repval" value="'   + repval + '" />'   + repvallabel         + '</td>'
100
                + '<td><input type="button" value="Delete" onclick="deleteRule(this)" /></td>'
101
            + '</tr>';
102
        $('#rulestable').append(tmpl);
103
104
     }
105
106
     function deleteRule(button){
107
        $(button).parent().parent().remove();
108
        return false;
109
     }
110
111
112
//]]>
113
</script>
114
[% END %]
115
</head>
116
<body>
117
[% INCLUDE 'header.inc' %]
118
[% INCLUDE 'cat-search.inc' %]
119
<div id="doc3" class="yui-t2">
120
    <div id="bd">
121
        <div id="yui-main">
122
            <div class="yui-b">
123
124
<form method="post" enctype="multipart/form-data">
125
[% IF ( inputform ) %]
126
    <h2>Batch records modification</h2>
127
    <fieldset class="rows">
128
	<legend>Use a file</legend>
129
	<ol>
130
	    <li><label for="uploadfile">File: </label> <input type="file" id="uploadfile" name="uploadfile" /></li>
131
	</ol>
132
    </fieldset>
133
    <fieldset class="rows">
134
	<legend>Or enter records one by one</legend>
135
	<ol>
136
	    <li>
137
		<label for="recordslist">Records numbers list (one number per line): </label>
138
		<textarea rows="10" cols="30" id="recordslist" name="recordslist"></textarea>
139
	    </li>
140
	</ol>
141
    </fieldset>
142
[% ELSE %]
143
    <h2>List of records:</h2>
144
    <table id="bibliolist">
145
        <thead>
146
            <tr>
147
                <th>Biblionumber</th><th>Title</th><th>Author</th>[% IF ( moddone ) %] <th>Status</th>[% END %]
148
            </tr>
149
        </thead>
150
        [% FOREACH biblioinfo IN biblioinfos %]
151
            <tr>
152
                <td>[% biblioinfo.biblionumber %]</td>
153
                <td>[% biblioinfo.title %]</td>
154
                <td>[% biblioinfo.author %]</td>
155
                [% IF ( biblioinfo.moddone ) %]
156
                    [% IF ( biblioinfo.OK ) %]
157
                        <td>
158
                    [% ELSE %]
159
                        <td class="problem">
160
                    [% END %]
161
                    [% IF ( biblioinfo.OK ) %]OK[% END %]
162
                    [% IF ( No_Actions ) %]Nothing done[% END %]
163
                    [% IF ( biblioinfo.Actions_Failed ) %]Some Actions failed. List Follow : <ul>[% FOREACH failed_action IN biblioinfo.failed_actions %]<li>[% failed_action.action %]</li>[% END %]</ul>[% END %]
164
                    </td>
165
                [% END %]
166
            </tr>
167
        [% END %]
168
    </table>
169
[% END %]
170
171
[% IF ( moddone ) %]
172
    <div class="dialog alert">All operations processed</div>
173
[% ELSE %]
174
    <fieldset class="rows">
175
    <h2>Modification rules:</h2>
176
    <input type="submit" value="Submit" />
177
    <input type="hidden" name="op" value="do" />
178
    <input type="hidden" name="bib_list" value="[% bib_list %]" />
179
    <table id="rulestable">
180
        <thead>
181
            <tr>
182
                <th>Field</th><th>Subfield</th><th>Action</th><th>Condition Value</th><th>Value</th><th>&nbsp;</th>
183
            </tr>
184
        </thead>
185
            <tr>
186
                <td>
187
                    <select name="fieldchoice" id="fieldchoice" onchange="fieldChanged();">
188
                    [% FOREACH marcfield IN marcfields %]
189
                        <option value="[% marcfield.tag %]">[% marcfield.tag %]</option>
190
                    [% END %]
191
                    </select>
192
                </td>
193
                <td>
194
                    <select name="subfieldchoice" id="subfieldchoice" onchange="subfieldChanged();">
195
196
                    </select>
197
                </td>
198
                <td>
199
                    <select name="actionchoice" id="actionchoice">
200
                        <option value="mod">Modify subfield</option>
201
                        <option value="add">Create subfield</option>
202
                        <option value="addfield">Create field and subfield</option>
203
                        <option value="del">Delete subfield</option>
204
                    </select>
205
                </td>
206
                <td id="condvaltd">
207
                    <input type="text" name="condvalchoice" id="condvalchoice" />
208
                    <input type="checkbox" id="nocond" name="nocond" value="nocond" onClick="$('#condvalchoice').attr('disabled', ! $('#condvalchoice').attr('disabled') ) ">All</input>
209
                </td>
210
                <td id="repvaltd">
211
                    <input type="text" name="repvalchoice" id="repvalchoice" />
212
                </td>
213
                <td><input type="button" value="Add" onclick="addRule();" /></td>
214
            </tr>
215
        </thead>
216
217
    </table>
218
    <input type="submit" value="Submit" />
219
    </fieldset>
220
    </form>
221
[% END %]
222
            </div>
223
        </div>
224
    </div>
225
</div>
226
</body>
227
</html>
(-)a/kohaversion.pl (-1 / +1 lines)
Lines 16-22 the kohaversion is divided in 4 parts : Link Here
16
use strict;
16
use strict;
17
17
18
sub kohaversion {
18
sub kohaversion {
19
    our $VERSION = '3.05.00.004';
19
    our $VERSION = '3.05.00.005';
20
    # version needs to be set this way
20
    # version needs to be set this way
21
    # so that it can be picked up by Makefile.PL
21
    # so that it can be picked up by Makefile.PL
22
    # during install
22
    # during install
(-)a/tools/batchedit.pl (-1 / +222 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
4
# Copyright 2010 SARL BibLibre
5
#
6
# This file is part of Koha.
7
#
8
# Koha is free software; you can redistribute it and/or modify it under the
9
# terms of the GNU General Public License as published by the Free Software
10
# Foundation; either version 2 of the License, or (at your option) any later
11
# version.
12
#
13
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License along with
18
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19
# Suite 330, Boston, MA  02111-1307 USA
20
21
use CGI;
22
use strict;
23
use C4::Output;
24
use C4::Auth;
25
use C4::Branch;
26
use C4::Koha;
27
use C4::Biblio;
28
use C4::Context;
29
use C4::Debug;
30
use JSON;
31
32
my $input = new CGI;
33
my $dbh = C4::Context->dbh;
34
35
my $filefh = $input->param('uploadfile');
36
my $recordslist = $input->param('recordslist');
37
my $bib_list = $input->param('bib_list');
38
my @biblionumbers;
39
40
if ($filefh) {
41
    while ( my $biblionumber = <$filefh> ) {
42
        $biblionumber =~ s/[\r\n]*$//g;
43
        push @biblionumbers, $biblionumber if $biblionumber;
44
    }
45
} elsif ($recordslist) {
46
    push @biblionumbers, split( /\s\n/, $recordslist );
47
} elsif ($bib_list) {
48
    push @biblionumbers, split('/', $bib_list);
49
}
50
51
my $op            = $input->param('op');
52
my ($template, $loggedinuser, $cookie);
53
54
my $frameworkcode="";
55
my $tagslib = &GetMarcStructure(1,$frameworkcode);
56
my %report_actions;
57
58
if($input->param('field') and not defined $op){
59
    ($template, $loggedinuser, $cookie)
60
        = get_template_and_user({template_name => "acqui/ajax.tmpl",
61
                 query => $input,
62
                 type => "intranet",
63
                 authnotrequired => 0,
64
                 flagsrequired => { tools => "batchedit" },
65
        });
66
67
68
    my $tag      = $input->param('field');
69
    my $subfield = $input->param('subfield');
70
71
    if($input->param('subfield')){
72
        my $branches = GetBranchesLoop();
73
74
        my @authorised_values;
75
        if ( $tagslib->{$tag}->{$subfield}->{authorised_value} ) {
76
             if ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "branches" ) {
77
                foreach my $thisbranch (@$branches) {
78
                    push @authorised_values, {
79
                            code => $thisbranch->{value},
80
                            value => $thisbranch->{branchname},
81
                        };
82
                    # $value = $thisbranch->{value} if $thisbranch->{selected};
83
                }
84
             }elsif ( $tagslib->{$tag}->{$subfield}->{authorised_value} eq "itemtypes" ) {
85
                 my $sth = $dbh->prepare("SELECT itemtype,description FROM itemtypes ORDER BY description");
86
                 $sth->execute();
87
                 while ( my ( $itemtype, $description ) = $sth->fetchrow_array ) {
88
                    push @authorised_values, {
89
                        code => $itemtype,
90
                        value => $description,
91
                    };
92
                 }
93
94
            }else {
95
                  # Getting the fields where the item location is
96
                  my ($location_field, $location_subfield) = GetMarcFromKohaField('items.location', $frameworkcode);
97
98
                  # Getting the name of the authorised values' category for item location
99
                  my $item_location_category = $tagslib->{$location_field}->{$location_subfield}->{'authorised_value'};
100
		      # Are we dealing with item location ?
101
                  my $item_location = ($tagslib->{$tag}->{$subfield}->{authorised_value} eq $item_location_category) ? 1 : 0;
102
103
                  # If so, we sort by authorised_value, else by libelle
104
                  my $orderby = $item_location ? 'authorised_value' : 'lib';
105
106
                  my $authorised_values_sth = $dbh->prepare("SELECT authorised_value,lib FROM authorised_values WHERE category=? ORDER BY $orderby");
107
108
                  $authorised_values_sth->execute( $tagslib->{$tag}->{$subfield}->{authorised_value});
109
110
111
                  while ( my ( $value, $lib ) = $authorised_values_sth->fetchrow_array ) {
112
                    push @authorised_values, {
113
                        code => $value,
114
                        value => ($item_location) ? $value . " - " . $lib : $lib,
115
                    };
116
117
                  }
118
            }
119
        }
120
      $template->param('return' => to_json(\@authorised_values));
121
    }else{
122
        my @modifiablesubf;
123
124
        foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
125
            next if subfield_is_koha_internal_p($subfield);
126
            next if $subfield eq "@";
127
            next if ($tagslib->{$tag}->{$subfield}->{'tab'} eq "10");
128
            my %subfield_data;
129
            $subfield_data{subfield} = $subfield;
130
            push @modifiablesubf, \%subfield_data;
131
        }
132
        $template->param('return' => to_json(\@modifiablesubf));
133
    }
134
135
136
    output_html_with_http_headers $input, $cookie, $template->output;
137
    exit;
138
}else{
139
    ($template, $loggedinuser, $cookie)
140
            = get_template_and_user({template_name => "tools/batchedit.tmpl",
141
                     query => $input,
142
                     type => "intranet",
143
                     authnotrequired => 0,
144
                     flagsrequired => { tools => "batchedit" },
145
                     });
146
147
    $template->param( inputform => 1, ) unless @biblionumbers;
148
149
    if(!defined $op) {
150
        my @modifiablefields;
151
152
        foreach my $tag (sort keys %{$tagslib}) {
153
            my %subfield_data;
154
            foreach my $subfield (sort keys %{$tagslib->{$tag}}) {
155
                next if $subfield_data{tag};
156
                next if subfield_is_koha_internal_p($subfield);
157
                next if ($tagslib->{$tag}->{$subfield}->{'tab'} eq "10");
158
159
                $subfield_data{tag}      = $tag;
160
161
                push @modifiablefields, \%subfield_data;
162
            }
163
        }
164
165
        $template->param( marcfields  => \@modifiablefields,
166
                          bib_list    => $input->param('bib_list'),
167
                         );
168
169
    }else{
170
        my @fields     = $input->param('field');
171
        my @subfields  = $input->param('subfield');
172
        my @actions    = $input->param('action');
173
        my @condvals   = $input->param('condval');
174
        my @nocondvals = $input->param('nocondval');
175
        my @repvals    = $input->param('repval');
176
        foreach my $biblionumber ( @biblionumbers ){
177
            my $record = GetMarcBiblio($biblionumber);
178
            my ($count, $biblio) = GetBiblio($biblionumber);
179
            my $report = 0;
180
            my @failed_actions;
181
            for(my $i = 0 ; $i < scalar(@fields) ; $i++ ){
182
                my $field    = $fields[$i];
183
                my $subfield = $subfields[$i];
184
                my $action   = $actions[$i];
185
                my $condval  = $condvals[$i];
186
                my $nocond   = $nocondvals[$i];
187
                my $repval   = $repvals[$i];
188
189
                my ($result,$record)   = BatchModField($record, $field, $subfield, $action, $condval, $nocond, $repval);
190
                push @failed_actions, {action=>"$field $subfield $action ".($nocond eq "true"?"all":$condval)." $repval"} if ($result<=0);
191
            }
192
            if (@failed_actions == scalar(@fields)){
193
                $report_actions{$biblionumber}->{status}="No_Actions";
194
            }
195
            elsif (@failed_actions>0 and @failed_actions < scalar(@fields)){
196
                $report_actions{$biblionumber}->{status}="Actions_Failed";
197
                $report_actions{$biblionumber}->{failed_actions}=\@failed_actions;
198
            }
199
            elsif (@failed_actions == 0){
200
                $report_actions{$biblionumber}->{status}="OK";
201
            }
202
            ModBiblio($record, $biblionumber, $biblio->{frameworkcode}) unless ($report);
203
        }
204
        $template->param('moddone' => 1);
205
    }
206
207
}
208
209
my @biblioinfos;
210
211
for my $biblionumber (@biblionumbers){
212
    my ($count,$biblio) = GetBiblio($biblionumber);
213
    if (defined $op){
214
        $biblio->{$report_actions{$biblionumber}->{status}}=1;
215
        $biblio->{failed_actions}=$report_actions{$biblionumber}->{failed_actions};
216
    }
217
    push @biblioinfos, $biblio;
218
}
219
220
$template->param(biblioinfos => \@biblioinfos);
221
output_html_with_http_headers $input, $cookie, $template->output;
222
exit;

Return to bug 5725