From fff32393cf19fb5ef0a22979bb84a47fa27cc949 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Tue, 1 Nov 2011 09:21:51 -0400 Subject: [PATCH] Fix for Bug 7123 - barcode should be one word Other fixes thrown in for good measure: - Adding data to the results table to match output of returns - Better checking of error codes in the script to control output of error messages (don't show error box when there are no errors). - Move some errors/messages from the right column onto the top of the page to match Koha's established pattern. Signed-off-by: Chris Cormack Signed-off-by: Paul Poulain --- circ/branchtransfers.pl | 92 ++++++++++-------- .../prog/en/modules/circ/branchtransfers.tt | 97 ++++++++++--------- 2 files changed, 103 insertions(+), 86 deletions(-) diff --git a/circ/branchtransfers.pl b/circ/branchtransfers.pl index 7e0cb75678..ad7aa9afd5 100755 --- a/circ/branchtransfers.pl +++ b/circ/branchtransfers.pl @@ -118,13 +118,16 @@ if ($barcode) { my %item; my $frbranchcd = C4::Context->userenv->{'branch'}; # if ( not($found) ) { - $item{'biblionumber'} = $iteminformation->{'biblionumber'}; - $item{'title'} = $iteminformation->{'title'}; - $item{'author'} = $iteminformation->{'author'}; - $item{'itemtype'} = $iteminformation->{'itemtype'}; - $item{'ccode'} = $iteminformation->{'ccode'}; - $item{'frbrname'} = $branches->{$frbranchcd}->{'branchname'}; - $item{'tobrname'} = $branches->{$tobranchcd}->{'branchname'}; + $item{'biblionumber'} = $iteminformation->{'biblionumber'}; + $item{'itemnumber'} = $iteminformation->{'itemnumber'}; + $item{'title'} = $iteminformation->{'title'}; + $item{'author'} = $iteminformation->{'author'}; + $item{'itemtype'} = $iteminformation->{'itemtype'}; + $item{'ccode'} = $iteminformation->{'ccode'}; + $item{'itemcallnumber'} = $iteminformation->{'itemcallnumber'}; + $item{'location'} = GetKohaAuthorisedValueLib("LOC",$iteminformation->{'location'}); + $item{'frbrname'} = $branches->{$frbranchcd}->{'branchname'}; + $item{'tobrname'} = $branches->{$tobranchcd}->{'branchname'}; # } $item{counter} = 0; $item{barcode} = $barcode; @@ -148,13 +151,16 @@ foreach ( $query->param ) { $item{frombrcd} = $frbcd; $item{tobrcd} = $tobcd; my ($iteminformation) = GetBiblioFromItemNumber( GetItemnumberFromBarcode($bc) ); - $item{'biblionumber'} = $iteminformation->{'biblionumber'}; - $item{'title'} = $iteminformation->{'title'}; - $item{'author'} = $iteminformation->{'author'}; - $item{'itemtype'} = $iteminformation->{'itemtype'}; - $item{'ccode'} = $iteminformation->{'ccode'}; - $item{'frbrname'} = $branches->{$frbcd}->{'branchname'}; - $item{'tobrname'} = $branches->{$tobcd}->{'branchname'}; + $item{'biblionumber'} = $iteminformation->{'biblionumber'}; + $item{'itemnumber'} = $iteminformation->{'itemnumber'}; + $item{'title'} = $iteminformation->{'title'}; + $item{'author'} = $iteminformation->{'author'}; + $item{'itemtype'} = $iteminformation->{'itemtype'}; + $item{'ccode'} = $iteminformation->{'ccode'}; + $item{'itemcallnumber'} = $iteminformation->{'itemcallnumber'}; + $item{'location'} = GetKohaAuthorisedValueLib("LOC",$iteminformation->{'location'}); + $item{'frbrname'} = $branches->{$frbcd}->{'branchname'}; + $item{'tobrname'} = $branches->{$tobcd}->{'branchname'}; push( @trsfitemloop, \%item ); } @@ -187,35 +193,37 @@ if ( $codeType eq 'itemtype' ) { my @errmsgloop; foreach my $code ( keys %$messages ) { - my %err; - if ( $code eq 'BadBarcode' ) { - $err{msg} = $messages->{'BadBarcode'}; - $err{errbadcode} = 1; + if ( $code ne 'WasTransfered' ) { + my %err; + if ( $code eq 'BadBarcode' ) { + $err{msg} = $messages->{'BadBarcode'}; + $err{errbadcode} = 1; + } + elsif ( $code eq "NotAllowed" ) { + warn "NotAllowed: $messages->{'NotAllowed'} to " . $branches->{ $messages->{'NotAllowed'} }->{'branchname'}; + # Do we really want a error log message here? --atz + $err{errnotallowed} = 1; + my ( $tbr, $typecode ) = split( /::/, $messages->{'NotAllowed'} ); + $err{tbr} = $branches->{ $tbr }->{'branchname'}; + $err{code} = $typecode; + $err{codeType} = $codeTypeDescription; + } + elsif ( $code eq 'IsPermanent' ) { + $err{errispermanent} = 1; + $err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'}; + } + elsif ( $code eq 'WasReturned' ) { + $err{errwasreturned} = 1; + $err{borrowernumber} = $messages->{'WasReturned'}; + my $borrower = GetMember('borrowernumber'=>$messages->{'WasReturned'}); + $err{title} = $borrower->{'title'}; + $err{firstname} = $borrower->{'firstname'}; + $err{surname} = $borrower->{'surname'}; + $err{cardnumber} = $borrower->{'cardnumber'}; + } + $err{errdesteqholding} = ( $code eq 'DestinationEqualsHolding' ); + push( @errmsgloop, \%err ); } - elsif ( $code eq "NotAllowed" ) { - warn "NotAllowed: $messages->{'NotAllowed'} to " . $branches->{ $messages->{'NotAllowed'} }->{'branchname'}; - # Do we really want a error log message here? --atz - $err{errnotallowed} = 1; - my ( $tbr, $typecode ) = split( /::/, $messages->{'NotAllowed'} ); - $err{tbr} = $branches->{ $tbr }->{'branchname'}; - $err{code} = $typecode; - $err{codeType} = $codeTypeDescription; - } - elsif ( $code eq 'IsPermanent' ) { - $err{errispermanent} = 1; - $err{msg} = $branches->{ $messages->{'IsPermanent'} }->{'branchname'}; - } - elsif ( $code eq 'WasReturned' ) { - $err{errwasreturned} = 1; - $err{borrowernumber} = $messages->{'WasReturned'}; - my $borrower = GetMember('borrowernumber'=>$messages->{'WasReturned'}); - $err{title} = $borrower->{'title'}; - $err{firstname} = $borrower->{'firstname'}; - $err{surname} = $borrower->{'surname'}; - $err{cardnumber} = $borrower->{'cardnumber'}; - } - $err{errdesteqholding} = ( $code eq 'DestinationEqualsHolding' ); - push( @errmsgloop, \%err ); } # use Data::Dumper; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt index 026a265ae1..097089af2c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/branchtransfers.tt @@ -86,8 +86,46 @@ [% ELSE %] -
-
+ [% IF ( reqmessage ) %] +
+
    + [% IF ( cancelled ) %] +
  • Reserve cancelled
  • + [% END %] + [% IF ( setwaiting ) %] +
  • Item should now be waiting at library: [% reqbrchname %]
  • + [% END %] +
+
+ [% END %] + + [% IF ( errmsgloop ) %] +
+
    + [% FOREACH errmsgloo IN errmsgloop %] + [% IF ( errmsgloo.errbadcode ) %] +
  • No Item with barcode: [% errmsgloo.msg %]
  • + [% END %] + [% IF ( errmsgloo.errispermanent ) %] +
  • Please return item to home library: [% errmsgloo.msg %]
  • + [% END %] + [% IF ( errmsgloo.errnotallowed ) %] +
  • You cannot transfer items of [% errmsgloo.codeType %] [% errmsgloo.code %] to [% errmsgloo.tbr %]
  • + [% END %] + [% IF ( errmsgloo.errdesteqholding ) %] +
  • Item is already at destination library.
  • + [% END %] + [% IF ( errmsgloo.errwasreturned ) %] +
  • Item was on loan to + [% errmsgloo.firstname %] [% errmsgloo.surname %] + ([% errmsgloo.cardnumber %]) and has been returned.
  • + [% END %] + [% END %] +
+
+ [% END %] + +
Transfer @@ -119,58 +157,29 @@ [% END %]
- -

Messages

-
    - [% IF ( reqmessage ) %] - [% IF ( cancelled ) %] -
  • Reserve Cancelled
  • - [% END %] - [% IF ( setwaiting ) %] -
  • Item should now be waiting at library: [% reqbrchname %]
  • - [% END %] - [% END %] - [% FOREACH errmsgloo IN errmsgloop %] - [% IF ( errmsgloo.errbadcode ) %] -
  • No Item with barcode: [% errmsgloo.msg %]
  • - [% END %] - [% IF ( errmsgloo.errispermanent ) %] -
  • Please return item to home library: [% errmsgloo.msg %]
  • - [% END %] - [% IF ( errmsgloo.errnotallowed ) %] -
  • You cannot transfer items of [% errmsgloo.codeType %] [% errmsgloo.code %] to [% errmsgloo.tbr %]
  • - [% END %] - [% IF ( errmsgloo.errdesteqholding ) %] -
  • Item is already at destination library.
  • - [% END %] - [% IF ( errmsgloo.errwasreturned ) %] -
  • Item was on loan to -[% errmsgloo.firstname %] [% errmsgloo.surname %] -([% errmsgloo.cardnumber %]) and has been returned.
  • - [% END %] - [% END %] -
-
-
- +
+ [% IF ( trsfitemloop ) %]
- + + + + + [% FOREACH trsfitemloo IN trsfitemloop %] - - + + + + + + [% END %] -- 2.39.5
Transferred Items
Bar Code TitleAuthorBarcodeShelving locationCall numberType To
- [% trsfitemloo.barcode %] - -

[% trsfitemloo.title |html %] ([% trsfitemloo.author %])

-

[% trsfitemloo.ccode %]

-
[% trsfitemloo.title |html %][% trsfitemloo.author %][% trsfitemloo.barcode %][% trsfitemloo.location %][% trsfitemloo.itemcallnumber %][% trsfitemloo.ccode %] [% trsfitemloo.tobrname %]