Bug 34478: patroncards/edit-batch: Fix for removing patrons
Added a form for delete link from patron table. Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
d8909a5eb9
commit
18ff295923
|
|
@ -124,7 +124,7 @@
|
|||
[% FOREACH text_field IN table_loo.text_fields %]
|
||||
[% IF ( text_field.select_field ) %]
|
||||
<td>
|
||||
<a class="btn btn-default btn-xs delete" href="/cgi-bin/koha/patroncards/edit-batch.pl?op=remove&batch_id=[% batch_id | html %]&label_id=[% text_field.field_value | html %]"><i class="fa fa-trash-can"></i> Delete</a>
|
||||
<a class="btn btn-default btn-xs delete" href="#" data-batch-id="[% batch_id | html %]" data-label-id="[% text_field.field_value | html %]"><i class="fa fa-trash-can"></i> Delete</a>
|
||||
<a class="btn btn-default btn-xs export" href="#" data-batch-id="[% batch_id | html %]" data-label-id="[% text_field.field_value | html %]"><i class="fa-solid fa-share-from-square"></i> Export</a>
|
||||
</td>
|
||||
<td><input type="checkbox" name="action" value="[% text_field.field_value | html %]" /></td>
|
||||
|
|
@ -139,6 +139,12 @@
|
|||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<form id="remove_patron_form" action="/cgi-bin/koha/patroncards/edit-batch.pl" method="post">
|
||||
[% INCLUDE 'csrf-token.inc' %]
|
||||
<input type="hidden" name="op" value="cud-remove" />
|
||||
<input type="hidden" name="batch_id" value="" />
|
||||
<input type="hidden" name="label_id" value="" />
|
||||
</form>
|
||||
[% ELSE %]
|
||||
<fieldset class="rows" style="border-bottom: 0px; border: 0px;">
|
||||
<ol><li>
|
||||
|
|
@ -316,7 +322,11 @@
|
|||
return false;
|
||||
});
|
||||
$(".delete").on("click", function(){
|
||||
return confirmDelete( _("Are you sure you want to delete this patron from the card batch?") );
|
||||
if( confirmDelete( _("Are you sure you want to delete this patron from the card batch?") ) ) {
|
||||
$('#remove_patron_form input[name="batch_id"]').val($(this).data('batch-id'));
|
||||
$('#remove_patron_form input[name="label_id"]').val($(this).data('label-id'));
|
||||
$('#remove_patron_form').submit();
|
||||
}
|
||||
});
|
||||
$(".export").on("click", function(e){
|
||||
e.preventDefault();
|
||||
|
|
|
|||
|
|
@ -68,10 +68,10 @@ foreach my $param (@errors) {
|
|||
if $error;
|
||||
}
|
||||
|
||||
if ($op eq 'remove') {
|
||||
if ( $op eq 'cud-remove' ) {
|
||||
$batch = C4::Patroncards::Batch->retrieve(batch_id => $batch_id);
|
||||
foreach my $label_id (@label_ids) {
|
||||
$err = $batch->remove_item($label_id);
|
||||
$err = $batch->remove_item($label_id);
|
||||
}
|
||||
if ($err) {
|
||||
print $cgi->redirect("edit-batch.pl?op=edit&batch_id=$batch_id&error=403"); # this allows us to avoid problems with the user hitting their refresh button
|
||||
|
|
@ -123,7 +123,7 @@ elsif ($op eq 'de_duplicate') {
|
|||
exit;
|
||||
}
|
||||
}
|
||||
elsif ($op eq 'cud-edit') {
|
||||
elsif ($op eq 'edit') { #FIXME edit_form actually
|
||||
$batch = C4::Patroncards::Batch->retrieve(batch_id => $batch_id);
|
||||
$template->param( description => $batch->{'description'} );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue