From a418e53208885127f78313023f4b8df70a76d380 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Mon, 28 Aug 2023 04:58:26 +0000 Subject: [PATCH] Bug 32256: WIP Not ready for testing --- .../bootstrap/en/modules/sco/sco-main.tt | 16 +++++++----- opac/sco/sco-main.pl | 26 ++++++++++++++----- 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt index 003c792402f..68a7c4eb9d7 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/sco/sco-main.tt @@ -118,7 +118,7 @@

Please confirm the checkout:

[% IF ( confirm_renew_issue ) %] -

This item is already checked out to you.

+

This item is already checked out to you: [% confirm | html %] ([% barcode | html %])

[% END %] [% IF ( renew && Koha.Preference('SCOAllowCheckin') ) %] @@ -193,15 +193,19 @@ [% END %] [% IF ( issued ) %] + [% FOREACH barcode IN newissues.split(',') %]
-

Item checked out

+

Item checked out ([% barcode | html %])

+ [% END %] [% ELSIF ( renewed ) %] + [% FOREACH barcode IN newissues.split(',') %]
-

Item renewed

+

Item renewed ([% barcode | html %])

+ [% END %] [% ELSIF ( renewed == 0) %]
@@ -215,7 +219,7 @@ [% ELSIF ( returned == 1 ) %]
-

Item checked in

+

Item checked in ([% barcode | html %])

[% END %] @@ -251,10 +255,10 @@
- +
- +
diff --git a/opac/sco/sco-main.pl b/opac/sco/sco-main.pl index 9f70a415cc4..688101572f3 100755 --- a/opac/sco/sco-main.pl +++ b/opac/sco/sco-main.pl @@ -93,7 +93,7 @@ if (defined C4::Context->preference('SCOAllowCheckin')) { } my $issuerid = $loggedinuser; -my ($op, $patronlogin, $patronpw, $barcode, $confirmed, $newissues) = ( +my ($op, $patronlogin, $patronpw, $barcodestr, $confirmed, $newissues) = ( $query->param("op") || '', $query->param("patronlogin")|| '', $query->param("patronpw") || '', @@ -109,7 +109,11 @@ if ($op eq "logout") { undef $jwt; } -$barcode = barcodedecode( $barcode ) if $barcode; +my $barcodes = []; +if ( $barcodestr ) { + push @$barcodes, split( /\s\n/, $barcodestr ); + $barcodes = [ map { $_ =~ /^\s*$/ ? () : barcodedecode( $_ ) } @$barcodes ]; +} my @newissueslist = split /,/, $newissues; my $issuenoconfirm = 1; #don't need to confirm on issue. @@ -142,7 +146,7 @@ my $return_only = 0; if ( $patron && $op eq "returnbook" && $allowselfcheckreturns ) { my $success = 1; - + foreach my $barcode ( @$barcodes ) { my $item = Koha::Items->find( { barcode => $barcode } ); if ( $success && C4::Context->preference("CircConfirmItemParts") ) { if ( defined($item) @@ -162,10 +166,14 @@ if ( $patron && $op eq "returnbook" && $allowselfcheckreturns ) { ($success) = AddReturn( $barcode, $branch ) } - $template->param( returned => $success ); + $template->param( + returned => $success, + barcode => $barcode + ); + } # foreach barcode in barcodes } elsif ( $patron && ( $op eq 'checkout' ) ) { - + foreach my $barcode ( @$barcodes ) { my $item = Koha::Items->find( { barcode => $barcode } ); my $impossible = {}; my $needconfirm = {}; @@ -208,14 +216,16 @@ elsif ( $patron && ( $op eq 'checkout' ) ) { barcode => $barcode, ); } + last; } elsif ( $needconfirm->{RENEW_ISSUE} ){ $template->param( renew => 1, barcode => $barcode, - confirm => 1, + confirm => $item->biblio->title, confirm_renew_issue => 1, hide_main => 1, ); + last; } elsif ( $confirm_required && !$confirmed ) { $template->param( impossible => 1, @@ -225,6 +235,7 @@ elsif ( $patron && ( $op eq 'checkout' ) ) { if ($issue_error eq 'DEBT') { $template->param(DEBT => $needconfirm->{DEBT}); } + last; } else { if ( $confirmed || $issuenoconfirm ) { # we'll want to call getpatroninfo again to get updated issues. my ( $hold_existed, $item ); @@ -273,9 +284,11 @@ elsif ( $patron && ( $op eq 'checkout' ) ) { ); } } + } # foreach barcode in barcodes } # $op if ( $patron && ( $op eq 'renew' ) ) { + foreach my $barcode ( @$barcodes ) { my $item = Koha::Items->find({ barcode => $barcode }); if ( $patron->checkouts->find( { itemnumber => $item->itemnumber } ) ) { @@ -294,6 +307,7 @@ if ( $patron && ( $op eq 'renew' ) ) { } else { $template->param( renewed => 0 ); } + } # foreach barcode in barcodes } if ( $patron) { -- 2.30.2