Bugzilla – Attachment 41735 Details for
Bug 11759
Batch checkout
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 11759: Batch checkout - prepare the ground
Bug-11759-Batch-checkout---prepare-the-ground.patch (text/plain), 7.96 KB, created by
Marcel de Rooy
on 2015-08-20 13:50:41 UTC
(
hide
)
Description:
Bug 11759: Batch checkout - prepare the ground
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2015-08-20 13:50:41 UTC
Size:
7.96 KB
patch
obsolete
>From 1bcacfc42ac0b783ee0cfd2993401411ba4f8474 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Fri, 14 Feb 2014 12:57:47 +0100 >Subject: [PATCH] Bug 11759: Batch checkout - prepare the ground >Content-Type: text/plain; charset=utf-8 > >This patch does not introduce any changes. >It prepares the circulation script to accept several barcodes in >parameter. >A loop is done on all barcodes (until now, only 1) to generate a >structure to sent to the template. >At the end, only the first generated data is sent. > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > circ/circulation.pl | 82 +++++++++++++++++++++++++++++++-------------------- > 1 file changed, 50 insertions(+), 32 deletions(-) > >diff --git a/circ/circulation.pl b/circ/circulation.pl >index 8b2d8d8..b3f1950 100755 >--- a/circ/circulation.pl >+++ b/circ/circulation.pl >@@ -89,6 +89,11 @@ if (!C4::Context->userenv && !$branch){ > } > } > >+my $barcodes = []; >+if ( my $barcode = $query->param('barcode') ) { >+ $barcodes = [ $barcode ]; >+} >+ > my ( $template, $loggedinuser, $cookie ) = get_template_and_user ( > { > template_name => 'circ/circulation.tt', >@@ -133,10 +138,12 @@ if (C4::Context->preference("DisplayClearScreenButton")) { > $template->param(DisplayClearScreenButton => 1); > } > >-my $barcode = $query->param('barcode') || q{}; >-$barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace >+for my $barcode ( @$barcodes ) { >+ $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace >+ $barcode = barcodedecode($barcode) >+ if( $barcode && C4::Context->preference('itemBarcodeInputFilter')); >+} > >-$barcode = barcodedecode($barcode) if( $barcode && C4::Context->preference('itemBarcodeInputFilter')); > my $stickyduedate = $query->param('stickyduedate') || $session->param('stickyduedate'); > my $duedatespec = $query->param('duedatespec') || $session->param('stickyduedate'); > my $issueconfirmed = $query->param('issueconfirmed'); >@@ -146,7 +153,7 @@ my $debt_confirmed = $query->param('debt_confirmed') || 0; # Don't show the debt > my $charges = $query->param('charges') || q{}; > > # Check if stickyduedate is turned off >-if ( $barcode ) { >+if ( @$barcodes ) { > # was stickyduedate loaded from session? > if ( $stickyduedate && ! $query->param("stickyduedate") ) { > $session->clear( 'stickyduedate' ); >@@ -179,12 +186,12 @@ if( $onsite_checkout && !$duedatespec_allow ) { > our $todaysdate = C4::Dates->new->output('iso'); > > # check and see if we should print >-if ( $barcode eq '' && $print eq 'maybe' ) { >+if ( @$barcodes == 0 && $print eq 'maybe' ) { > $print = 'yes'; > } > >-my $inprocess = ($barcode eq '') ? '' : $query->param('inprocess'); >-if ( $barcode eq '' && $charges eq 'yes' ) { >+my $inprocess = (@$barcodes == 0) ? '' : $query->param('inprocess'); >+if ( @$barcodes == 0 && $charges eq 'yes' ) { > $template->param( > PAYCHARGES => 'yes', > borrowernumber => $borrowernumber >@@ -298,25 +305,29 @@ if ($borrowernumber) { > # STEP 3 : ISSUING > # > # >-if ($barcode) { >+if (@$barcodes) { >+ my $checkout_infos; >+ for my $barcode ( @$barcodes ) { >+ my $template_params = { barcode => $barcode }; > # always check for blockers on issuing > my ( $error, $question, $alerts ) = > CanBookBeIssued( $borrower, $barcode, $datedue , $inprocess ); > my $blocker = $invalidduedate ? 1 : 0; > >- $template->param( alert => $alerts ); >+ $template_params->{alert} = $alerts; > > # Get the item title for more information > my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode); >- $template->param( >- authvalcode_notforloan => C4::Koha::GetAuthValCode('items.notforloan', $getmessageiteminfo->{'frameworkcode'}), >- ); >+ $template_params->{authvalcode_notforloan} = >+ C4::Koha::GetAuthValCode('items.notforloan', $getmessageiteminfo->{'frameworkcode'}); >+ > # Fix for bug 7494: optional checkout-time fallback search for a book > > if ( $error->{'UNKNOWN_BARCODE'} >- && C4::Context->preference("itemBarcodeFallbackSearch") ) >+ && C4::Context->preference("itemBarcodeFallbackSearch") >+ ) > { >- $template->param( FALLBACK => 1 ); >+ $template_params->{FALLBACK} = 1; > > my $query = "kw=" . $barcode; > my ( $searcherror, $results, $total_hits ) = SimpleSearch($query); >@@ -338,37 +349,33 @@ if ($barcode) { > } > } > } >- $template->param( options => \@options ); >+ $template_params->{options} = \@options; > } > } > > unless( $onsite_checkout and C4::Context->preference("OnSiteCheckoutsForce") ) { > delete $question->{'DEBT'} if ($debt_confirmed); > foreach my $impossible ( keys %$error ) { >- $template->param( >- $impossible => $$error{$impossible}, >- IMPOSSIBLE => 1 >- ); >+ $template_params->{$impossible} = $$error{$impossible}; >+ $template_params->{IMPOSSIBLE} = 1; > $blocker = 1; > } > } >+ my $iteminfo = GetBiblioFromItemNumber(undef, $barcode); > if( !$blocker || $force_allow_issue ){ > my $confirm_required = 0; > unless($issueconfirmed){ > # Get the item title for more information >- my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode); >- $template->{VARS}->{'additional_materials'} = $getmessageiteminfo->{'materials'}; >- $template->param( itemhomebranch => $getmessageiteminfo->{'homebranch'} ); >+ $template_params->{additional_materials} = $iteminfo->{'materials'}; >+ $template_params->{itemhomebranch} = $iteminfo->{'homebranch'}; > > # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed. > foreach my $needsconfirmation ( keys %$question ) { >- $template->param( >- $needsconfirmation => $$question{$needsconfirmation}, >- getTitleMessageIteminfo => $getmessageiteminfo->{'title'}, >- getBarcodeMessageIteminfo => $getmessageiteminfo->{'barcode'}, >- NEEDSCONFIRMATION => 1, >- onsite_checkout => $onsite_checkout, >- ); >+ $template_params->{$needsconfirmation} = $$question{$needsconfirmation}; >+ $template_params->{getTitleMessageIteminfo} = $iteminfo->{'title'}; >+ $template_params->{getBarcodeMessageIteminfo} = $iteminfo->{'barcode'}; >+ $template_params->{NEEDSCONFIRMATION} = 1; >+ $template_params->{onsite_checkout} => $onsite_checkout, > $confirm_required = 1; > } > } >@@ -379,9 +386,8 @@ if ($barcode) { > $inprocess = 1; > } > } >- >+ > my ( $od, $issue, $fines ) = GetMemberIssuesAndFines($borrowernumber); >- $template->param( issuecount => $issue ); > > if ($question->{RESERVE_WAITING} or $question->{RESERVED}){ > $template->param( >@@ -389,6 +395,18 @@ if ($barcode) { > itembiblionumber => $getmessageiteminfo->{'biblionumber'} > ); > } >+ >+ $template_params->{issuecount} = $issue; >+ >+ if ( $iteminfo ) { >+ $iteminfo->{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($iteminfo->{biblionumber}), GetFrameworkCode($iteminfo->{biblionumber})); >+ $template_params->{item} = $iteminfo; >+ } >+ push @$checkout_infos, $template_params; >+ } >+ >+ $template->param( %{$checkout_infos->[0]} ); >+ $template->param( barcode => $barcodes->[0] ); > } > > # reload the borrower info for the sake of reseting the flags..... >@@ -534,7 +552,7 @@ $template->param( > expiry => format_date($borrower->{'dateexpiry'}), > roadtype => $roadtype, > amountold => $amountold, >- barcode => $barcode, >+ barcodes => $barcodes, > stickyduedate => $stickyduedate, > duedatespec => $duedatespec, > message => $message, >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 11759
:
25255
|
25256
|
25257
|
25258
|
25260
|
25620
|
26442
|
26455
|
26806
|
26807
|
26808
|
26809
|
26810
|
26811
|
26813
|
26814
|
26815
|
26833
|
26854
|
27613
|
37603
|
37604
|
37605
|
37606
|
37607
|
37608
|
37609
|
37610
|
37611
|
37612
|
37613
|
37614
|
37650
|
37653
|
41692
|
41693
|
41694
|
41695
|
41696
|
41697
|
41698
| 41735 |
41736
|
41737
|
41738
|
41739
|
41740
|
41741
|
43626
|
43627