Bug 15479 Make ILS cardnumber comparison case insensitive
The borrowers table is defined COLLATE=utf8_unicode_ci which means
that cardnumbers may be saved in either lowercase or uppercase and
these are considered equivalent.
The server was performing a case sensitive comparison between
the incoming patron identifier and that retrieved from the db
As a result some renewals were rejected as being on loan to
another borrower if the stored cardnumber differed in case.
Make code comparison comply with db.
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
(cherry picked from commit 203659ee60)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
parent
1e682f6ad9
commit
619060799d
|
|
@ -146,8 +146,7 @@ sub checkout {
|
|||
# holds checked inside do_checkout
|
||||
# } elsif ($item->hold_queue && @{$item->hold_queue} && ! $item->barcode_is_borrowernumber($patron_id, $item->hold_queue->[0]->{borrowernumber})) {
|
||||
# $circ->screen_msg("Item on Hold for Another User");
|
||||
} elsif ($item->{patron} && ($item->{patron} ne $patron_id)) {
|
||||
# I can't deal with this right now
|
||||
} elsif ($item->{patron} && !_ci_cardnumber_cmp($item->{patron},$patron_id)) {
|
||||
$circ->screen_msg("Item checked out to another patron");
|
||||
} else {
|
||||
$circ->do_checkout();
|
||||
|
|
@ -155,7 +154,7 @@ sub checkout {
|
|||
$debug and warn "circ is ok";
|
||||
# If the item is already associated with this patron, then
|
||||
# we're renewing it.
|
||||
$circ->renew_ok($item->{patron} && ($item->{patron} eq $patron_id));
|
||||
$circ->renew_ok($item->{patron} && _ci_cardnumber_cmp($item->{patron}, $patron_id));
|
||||
|
||||
$item->{patron} = $patron_id;
|
||||
$item->{due_date} = $circ->{due};
|
||||
|
|
@ -174,6 +173,13 @@ sub checkout {
|
|||
return $circ;
|
||||
}
|
||||
|
||||
sub _ci_cardnumber_cmp {
|
||||
my ( $s1, $s2) = @_;
|
||||
# As the database is case insensitive we need to normalize two strings
|
||||
# before comparing them
|
||||
return ( uc($s1) eq uc($s2) );
|
||||
}
|
||||
|
||||
sub checkin {
|
||||
my ( $self, $item_id, $trans_date, $return_date, $current_loc, $item_props, $cancel, $checked_in_ok ) = @_;
|
||||
my ( $patron, $item, $circ );
|
||||
|
|
|
|||
Loading…
Reference in New Issue