Bug 25942: Fix batch report operations for cardnumbers and biblionumbers

This patch moves the processing for these to a block and adds a comment
in place of whitespace and uses template directives to chomp newlines to improve readability

To test:
 1 - Create a report like:
    SELECT biblionumber FROM biblio
 2 - Run it
 3 - Try the various options from the 'Batch operations' button
    (You will need to define a marc modification template)
 4 - The operations don't find the biblios
 5 - Create a report like:
    SELECT cardnumber FROM borrowers
 6 - Run it
 7 - Test the batch operations
 8 - They fail
 9 - Apply patch
10 - Run each report again and test batch operations
11 - They work!

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Bug 25942: (follow-up) fix filters

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Nick Clemens 2020-11-18 13:29:33 +00:00 committed by Jonathan Druart
parent 03f15d13c5
commit 443c004bc6

View file

@ -869,14 +869,18 @@
<input type="hidden" name="recordtype" value="biblio" />
<input type="hidden" name="op" value="list" />
[% # Preserve the whitespace of the following textarea in order to format the values correctly %]
<textarea style="display:none" name="recordnumber_list" id="recordnumber_list">[% FOREACH result IN results %][% FOREACH cells IN result.cells %][% place = loop.index %][% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %][% cells.cell | html %][% END %][% END %][% END %]</textarea>
<textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
[%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
</textarea>
</form>
<form method="POST" action="/cgi-bin/koha/tools/batch_delete_records.pl" id="batch_record_deletion">
<input type="hidden" name="recordtype" value="biblio" />
<input type="hidden" name="op" value="list" />
[% # Preserve the whitespace of the following textarea in order to format the values correctly %]
<textarea style="display:none" name="recordnumber_list" id="recordnumber_list">[% FOREACH result IN results %][% FOREACH cells IN result.cells %][% place = loop.index %][% IF header_row.$place.cell == 'biblionumber' || header_types.item(header_row.$place.cell) == 'biblionumber' %][% cells.cell | html %][% END %][% END %][% END %]</textarea>
<textarea style="display:none" name="recordnumber_list" id="recordnumber_list">
[%- recordnumbers = PROCESS batch_list results=results batch_type='biblionumber' | trim | html %][% IF recordnumbers %][% SET batch_biblionumbers = 1 %][% recordnumbers | html %][% END -%]
</textarea>
</form>
<form method="POST" action="/cgi-bin/koha/tools/batchMod.pl" id="batch_item_modification">
@ -927,9 +931,21 @@
<form method="POST" action="/cgi-bin/koha/tools/modborrowers.pl" id="batch_patron_modification">
<input type="hidden" name="op" value="show" />
[% # Preserve the whitespace of the following textarea in order to format the values correctly %]
<textarea style="display:none" name="cardnumberlist" id="cardnumberlist">[% FOREACH result IN results %][% FOREACH cells IN result.cells %][% place = loop.index %][% IF header_row.$place.cell == 'cardnumber' || header_types.item(header_row.$place.cell) == 'cardnumber' %][% SET batch_cardnumbers = 1 %][% cells.cell | html %][% END %][% END %][% END %]</textarea>
<textarea style="display:none" name="cardnumberlist" id="cardnumberlist">
[%- cardnumbers = PROCESS batch_list results=results batch_type='cardnumber' | trim | html %][% IF cardnumbers %][% SET batch_cardnumbers = 1 %][% cardnumbers | html %][% END -%]
</textarea>
</form>
[% BLOCK batch_list %]
[%- FOREACH result IN results %]
[%- FOREACH cells IN result.cells %]
[%- place = loop.index %]
[%- IF header_row.$place.cell == $batch_type || header_types.item(header_row.$place.cell) == $batch_type %]
[%# We must not add whitespace to the cardnumbers %][% cells.cell | html %]
[%- END %]
[%- END %]
[%- END -%]
[% END %]
[% IF ( batch_biblionumbers || batch_itemnumbers || batch_cardnumbers ) %]
<p>
<div class="btn-group">