Bug 22417: Restore the 'add to list' feature

This feature has been added recently by bug 18127.

It highlights the need of a post processing hook.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: David Cook <dcook@prosentient.com.au>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Jonathan Druart 2020-06-11 12:40:03 +02:00
parent bd385809cd
commit c79aee3e7f
4 changed files with 29 additions and 35 deletions

View File

@ -24,8 +24,8 @@ use C4::Context;
use C4::Auth;
use C4::Output;
use Koha::BackgroundJob;
use Koha::BackgroundJobs;
use Koha::Virtualshelves;
my $input = new CGI;
my $op = $input->param('op') || 'list';
@ -50,6 +50,8 @@ if ( $op eq 'view' ) {
$template->param(
job => $job,
);
$template->param( lists => scalar Koha::Virtualshelves->search([{ category => 1, owner => $loggedinuser }, { category => 2 }]) )
if $job->type eq 'batch_biblio_record_modification';
} else {
$op = 'list';
}

View File

@ -51,6 +51,16 @@
[% IF report.total_records == report.total_success %]
<div class="dialog message">
All records have successfully been modified! <a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
[% IF lists.count %]
<br />
Add modified records to the following list:
<select name="add_bibs_to_list" id="add_bibs_to_list">
<option value="">Select a list</option>
[% FOREACH list IN lists %]
<option class="shelf" value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
[% END %]
</select>
[% END %]
</div>
[% ELSE %]
<div class="dialog message">
@ -95,21 +105,6 @@
Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.biblionumber | uri %]">[% m.biblionumber | html %]</a> has not been modified. An error occurred on modifying it.[% IF m.error %] ([% m.error %])[% END %].
[% CASE 'biblio_modified' %]
Bibliographic record <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% m.biblionumber | uri %]">[% m.biblionumber | html %]</a> has successfully been modified.
<h3>Next steps</h3>
<ul>
<li><a href="/cgi-bin/koha/tools/batch_record_modification.pl" title="New batch record modification">New batch record modification</a>
[% IF lists.count %]
<li>
<label for="add_bibs_to_list">Add modified records to the following list: </label>
<select name="add_bibs_to_list" id="add_bibs_to_list">
<option value="">Select a list</option>
[% FOREACH list IN lists %]
<option class="shelf" value="[% list.shelfnumber | html %]">[% list.shelfname | html %]</option>
[% END %]
</select>
</li>
[% END %]
</ul>
[% END %]
</div>
[% END %]
@ -224,6 +219,22 @@
"iDisplayLength": 10,
"sPaginationType": "full_numbers"
}));
$("#add_bibs_to_list").change(function(){
var selected = $("#add_bibs_to_list").find("option:selected");
if ( selected.attr("class") == "shelf" ){
var shelfnumber = selected.attr("value");
var bibs = new Array();
[% FOREACH message IN job.messages %]
[% IF message.code == 'biblio_modified' %]
bibs.push("biblionumber="+[% message.biblionumber | html %]);
[% END %]
[% END %]
var bibstring = bibs.join("&");
window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&'+bibstring, 'popup', 'width=500,height=500,toolbar=false,scrollbars=yes,resizeable=yes');
return false;
}
});
});
</script>
[% END %]

View File

@ -363,23 +363,6 @@
$("#marcPreviewLabel").html("");
$("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
});
$("#add_bibs_to_list").change(function(){
var selected = $("#add_bibs_to_list").find("option:selected");
if ( selected.attr("class") == "shelf" ){
var shelfnumber = selected.attr("value");
var bibs = new Array();
[% FOREACH message IN messages %]
[% IF message.code == 'biblio_modified' %]
bibs.push("biblionumber="+[% message.biblionumber | html %]);
[% END %]
[% END %]
var bibstring = bibs.join("&");
window.open('/cgi-bin/koha/virtualshelves/addbybiblionumber.pl?shelfnumber='+shelfnumber+'&confirm=1&'+bibstring, 'popup', 'width=500,height=500,toolbar=false,scrollbars=yes,resizeable=yes');
return false;
}
});
});
</script>
[% END %]

View File

@ -52,8 +52,6 @@ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
flagsrequired => { tools => 'records_batchmod' },
});
$template->param( lists => scalar Koha::Virtualshelves->search([{ category => 1, owner => $loggedinuser }, { category => 2 }]) );
my $sessionID = $input->cookie("CGISESSID");
my @templates = GetModificationTemplates( $mmtid );