|
Lines 242-247
sub SearchMember {
Link Here
|
| 242 |
my @results; |
242 |
my @results; |
| 243 |
$data = $sth->fetchall_arrayref({}); |
243 |
$data = $sth->fetchall_arrayref({}); |
| 244 |
|
244 |
|
|
|
245 |
$sth->finish; |
| 246 |
|
| 247 |
$query = "SELECT borrowers.*, categories.* FROM borrowers |
| 248 |
LEFT JOIN categories ON borrowers.categorycode=categories.categorycode |
| 249 |
LEFT JOIN statistics ON borrowers.borrowernumber = statistics.borrowernumber |
| 250 |
WHERE statistics.type = 'card_replaced' AND statistics.other = ? GROUP BY statistics.other"; |
| 251 |
$sth = $dbh->prepare( $query ); |
| 252 |
$sth->execute( $searchstring ); |
| 253 |
my $prevcards_data = $sth->fetchall_arrayref({}); |
| 254 |
foreach my $row ( @$prevcards_data ) { |
| 255 |
$row->{'PreviousCardnumber'} = 1; |
| 256 |
} |
| 257 |
|
| 258 |
$data = [ @$prevcards_data, @$data ]; |
| 259 |
|
| 245 |
return ( scalar(@$data), $data ); |
260 |
return ( scalar(@$data), $data ); |
| 246 |
} |
261 |
} |
| 247 |
|
262 |
|
|
Lines 705-710
true on success, or false on failure
Link Here
|
| 705 |
|
720 |
|
| 706 |
sub ModMember { |
721 |
sub ModMember { |
| 707 |
my (%data) = @_; |
722 |
my (%data) = @_; |
|
|
723 |
my $dbh = C4::Context->dbh; |
| 724 |
|
| 725 |
my $member = GetMemberDetails( $data{'borrowernumber'} ); |
| 726 |
|
| 727 |
if ( $member->{'cardnumber'} ne $data{'cardnumber'} ) { |
| 728 |
C4::Stats::UpdateStats( C4::Context->userenv->{branch}, 'card_replaced', '', $member->{'cardnumber'}, '', '', $data{'borrowernumber'} ); |
| 729 |
} |
| 730 |
|
| 731 |
my $iso_re = C4::Dates->new()->regexp('iso'); |
| 732 |
foreach (qw(dateofbirth dateexpiry dateenrolled)) { |
| 733 |
if (my $tempdate = $data{$_}) { # assignment, not comparison |
| 734 |
($tempdate =~ /$iso_re/) and next; # Congatulations, you sent a valid ISO date. |
| 735 |
warn "ModMember given $_ not in ISO format ($tempdate)"; |
| 736 |
my $tempdate2 = format_date_in_iso($tempdate); |
| 737 |
if (!$tempdate2 or $tempdate2 eq '0000-00-00') { |
| 738 |
warn "ModMember cannot convert '$tempdate' (from syspref to ISO)"; |
| 739 |
next; |
| 740 |
} |
| 741 |
$data{$_} = $tempdate2; |
| 742 |
} |
| 743 |
} |
| 744 |
if (!$data{'dateofbirth'}){ |
| 745 |
delete $data{'dateofbirth'}; |
| 746 |
} |
| 747 |
my @columns = &columns; |
| 748 |
my %hashborrowerfields = (map {$_=>1} @columns); |
| 749 |
my $query = "UPDATE borrowers SET \n"; |
| 750 |
my $sth; |
| 751 |
my @parameters; |
| 752 |
|
| 708 |
# test to know if you must update or not the borrower password |
753 |
# test to know if you must update or not the borrower password |
| 709 |
if (exists $data{password}) { |
754 |
if (exists $data{password}) { |
| 710 |
if ($data{password} eq '****' or $data{password} eq '') { |
755 |
if ($data{password} eq '****' or $data{password} eq '') { |