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 <chrisc@catalyst.net.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
This commit is contained in:
Owen Leonard 2011-11-01 09:21:51 -04:00 committed by Paul Poulain
parent e65dc43af7
commit fff32393cf
2 changed files with 103 additions and 86 deletions

View File

@ -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;

View File

@ -86,8 +86,46 @@
</table></div>
[% ELSE %]
<div class="yui-ge">
<div class="yui-u first">
[% IF ( reqmessage ) %]
<div class="dialog message">
<ul>
[% IF ( cancelled ) %]
<li>Reserve cancelled</li>
[% END %]
[% IF ( setwaiting ) %]
<li>Item should now be waiting at library: [% reqbrchname %]</li>
[% END %]
</ul>
</div>
[% END %]
[% IF ( errmsgloop ) %]
<div class="dialog message">
<ul>
[% FOREACH errmsgloo IN errmsgloop %]
[% IF ( errmsgloo.errbadcode ) %]
<li>No Item with barcode: [% errmsgloo.msg %]</li>
[% END %]
[% IF ( errmsgloo.errispermanent ) %]
<li>Please return item to home library: [% errmsgloo.msg %]</li>
[% END %]
[% IF ( errmsgloo.errnotallowed ) %]
<li>You cannot transfer items of [% errmsgloo.codeType %] <b>[% errmsgloo.code %]</b> to <b>[% errmsgloo.tbr %]</b></li>
[% END %]
[% IF ( errmsgloo.errdesteqholding ) %]
<li>Item is already at destination library.</li>
[% END %]
[% IF ( errmsgloo.errwasreturned ) %]
<li>Item was on loan to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% errmsgloo.borrowernumber %]">
[% errmsgloo.firstname %] [% errmsgloo.surname %]
([% errmsgloo.cardnumber %])</a> and has been returned.</li>
[% END %]
[% END %]
</ul>
</div>
[% END %]
<div id="branchtransfers">
<form method="post" name="mainform" id="mainform" action="/cgi-bin/koha/circ/branchtransfers.pl">
<fieldset class="brief">
<legend>Transfer</legend>
@ -119,58 +157,29 @@
<input type="hidden" name="tb-[% trsfitemloo.counter %]" value="[% trsfitemloo.tobrcd %]" />
[% END %]
</form></div>
<div class="yui-u"><h4>Messages</h4>
<ul>
[% IF ( reqmessage ) %]
[% IF ( cancelled ) %]
<li>Reserve Cancelled</li>
[% END %]
[% IF ( setwaiting ) %]
<li>Item should now be waiting at library: [% reqbrchname %]</li>
[% END %]
[% END %]
[% FOREACH errmsgloo IN errmsgloop %]
[% IF ( errmsgloo.errbadcode ) %]
<li>No Item with barcode: [% errmsgloo.msg %]</li>
[% END %]
[% IF ( errmsgloo.errispermanent ) %]
<li>Please return item to home library: [% errmsgloo.msg %]</li>
[% END %]
[% IF ( errmsgloo.errnotallowed ) %]
<li>You cannot transfer items of [% errmsgloo.codeType %] <b>[% errmsgloo.code %]</b> to <b>[% errmsgloo.tbr %]</b></li>
[% END %]
[% IF ( errmsgloo.errdesteqholding ) %]
<li>Item is already at destination library.</li>
[% END %]
[% IF ( errmsgloo.errwasreturned ) %]
<li>Item was on loan to <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% errmsgloo.borrowernumber %]">
[% errmsgloo.firstname %] [% errmsgloo.surname %]
([% errmsgloo.cardnumber %])</a> and has been returned.</li>
[% END %]
[% END %]
</ul>
</div><!-- /yui-u -->
</div><!-- /yui-ge -->
</div>
[% IF ( trsfitemloop ) %]
<div class="yui-g">
<table>
<caption>Transferred Items</caption>
<tr>
<th>Bar Code</th>
<th>Title</th>
<th>Author</th>
<th>Barcode</th>
<th>Shelving location</th>
<th>Call number</th>
<th>Type</th>
<th>To</th>
</tr>
[% FOREACH trsfitemloo IN trsfitemloop %]
<tr>
<td>
<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% trsfitemloo.biblionumber %]">[% trsfitemloo.barcode %]</a>
</td>
<td>
<p>[% trsfitemloo.title |html %] ([% trsfitemloo.author %])</p>
<p>[% trsfitemloo.ccode %]</p>
</td>
<td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% trsfitemloo.biblionumber %]">[% trsfitemloo.title |html %]</a></td>
<td>[% trsfitemloo.author %]</td>
<td><a href="/cgi-bin/koha/catalogue/moredetail.pl?biblionumber=[% trsfitemloo.biblionumber %]&amp;itemnumber=[% trsfitemloo.itemnumber %]#item[% trsfitemloo.itemnumber %]">[% trsfitemloo.barcode %]</a></td>
<td>[% trsfitemloo.location %]</td>
<td>[% trsfitemloo.itemcallnumber %]</td>
<td>[% trsfitemloo.ccode %]</td>
<td>[% trsfitemloo.tobrname %]</td>
</tr>
[% END %]