From a171035f1d13d83e518a89750ee959278d918356 Mon Sep 17 00:00:00 2001 From: hdl Date: Wed, 25 Apr 2007 14:07:34 +0000 Subject: [PATCH] GetBorrowerIssues is deleted from C4::Circulation Use GetPendingIssues from C4::Members instead. --- C4/Circulation.pm | 8 +++----- C4/Members.pm | 25 ++++++++++++++++++------- circ/circulation.pl | 2 +- members/deletemem.pl | 3 +-- opac/opac-user.pl | 2 +- 5 files changed, 24 insertions(+), 16 deletions(-) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 3a3f998668..9b0a50a435 100755 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -694,7 +694,7 @@ sub CanBookBeIssued { # DEBTS my ($amount) = - GetBorrowerAcctRecord( $borrower->{'borrowernumber'}, $duedate ); + GetMemberAccountRecords( $borrower->{'borrowernumber'}, $duedate ); if ( C4::Context->preference("IssuingInProcess") ) { my $amountlimit = C4::Context->preference("noissuescharge"); if ( $amount > $amountlimit && !$inprocess ) { @@ -1425,7 +1425,7 @@ sub FixAccountForLostAndReturned { =head2 GetItemIssue -$issues = &GetBorrowerIssue($itemnumber); +$issues = &GetItemIssue($itemnumber); Returns patrons currently having a book. nothing if item is not issued atm @@ -1462,7 +1462,7 @@ sub GetItemIssue { =head2 GetItemIssues -$issues = &GetBorrowerIssues($itemnumber, $history); +$issues = &GetItemIssues($itemnumber, $history); Returns patrons that have issued a book @@ -1542,8 +1542,6 @@ sub GetBorrowerIssues { if ( $datedue < $today ) { $data->{'overdue'} = 1; } - my $itemnumber = $data->{'itemnumber'}; - push @GetBorrowerIssues, $data; } $sth->finish; diff --git a/C4/Members.pm b/C4/Members.pm index 3c95f88379..8a5b33f746 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -86,7 +86,6 @@ push @EXPORT, qw( &GetBorrowersWhoHaveNotBorrowedSince &GetBorrowersWhoHaveNeverBorrowed &GetBorrowersWithIssuesHistoryOlderThan - &GetMembersFromSurname &GetExpiryDate ); @@ -994,14 +993,28 @@ C<$issues>. sub GetPendingIssues { my ($borrowernumber) = @_; my $dbh = C4::Context->dbh; + my $sth = $dbh->prepare( - "Select * from issues,biblio,items where borrowernumber=? - and items.itemnumber=issues.itemnumber - and items.biblionumber=biblio.biblionumber - and issues.returndate is NULL order by date_due" + "SELECT * FROM issues + LEFT JOIN items ON issues.itemnumber=items.itemnumber + LEFT JOIN biblio ON items.biblionumber=biblio.biblionumber + LEFT JOIN biblioitems ON items.biblioitemnumber=biblioitems.biblioitemnumber + WHERE + borrowernumber=? + AND returndate IS NULL + ORDER BY issues.date_due" ); $sth->execute($borrowernumber); my $data = $sth->fetchall_arrayref({}); + my $today = POSIX::strftime("%Y%m%d", localtime); + foreach( @$data ) { + my $datedue = $_->{'date_due'}; + $datedue =~ s/-//g; + if ( $datedue < $today ) { + $_->{'overdue'} = 1; + } + } + $sth->finish; return ( scalar(@$data), $data ); } @@ -1484,8 +1497,6 @@ sub add_member_orgs { } # sub add_member_orgs -=head2 GetMembersFromSurname - =head2 GetCities (OUEST-PROVENCE) ($id_cityarrayref, $city_hashref) = &GetCities(); diff --git a/circ/circulation.pl b/circ/circulation.pl index 4277ae1068..6b3ec94dcb 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -368,7 +368,7 @@ if ($borrower) { # get each issue of the borrower & separate them in todayissues & previous issues my @todaysissues; my @previousissues; - my $issueslist = GetBorrowerIssues($borrower); + my ($countissues,$issueslist) = GetPendingIssues($borrower->{'borrowernumber'}); # split in 2 arrays for today & previous my $dbh = C4::Context->dbh; diff --git a/members/deletemem.pl b/members/deletemem.pl index 2a4b3c1986..429b99d04f 100755 --- a/members/deletemem.pl +++ b/members/deletemem.pl @@ -29,7 +29,6 @@ use strict; use CGI; use C4::Context; use C4::Output; -use C4::Circulation; use C4::Auth; use C4::Members; @@ -46,7 +45,7 @@ my ($loggedinuser, $cookie, $sessionID) = checkauth($input, 0, $flagsrequired); my $member=$input->param('member'); my %member2; $member2{'borrowernumber'}=$member; -my $issues=GetBorrowerIssues(\%member2); +my ($countissues,$issues)=GetPendingIssues($member); my $i=0; foreach (sort keys %$issues) { $i++; diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 225b075529..07dfe9af45 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -76,7 +76,7 @@ $template->param( BORROWER_INFO => \@bordat ); $template->param( borrowernumber => $borrowernumber ); #get issued items .... -my $issues = GetBorrowerIssues($borr); +my ($countissues,$issues) = GetPendingIssues($borrowernumber); my $count = 0; my $overdues_count = 0; -- 2.39.5