koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha/C4 Members.pm [rel_3_0]


From: Bruno Toumi
Subject: [Koha-cvs] koha/C4 Members.pm [rel_3_0]
Date: Thu, 12 Oct 2006 10:08:23 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     Bruno Toumi <btoumi>    06/10/12 10:08:23

Modified files:
        C4             : Members.pm 

Log message:
        add function GetBorNotifyAcctRecord return all accountlines per 
borrowers , per file number

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/C4/Members.pm?cvsroot=koha&only_with_tag=rel_3_0&r1=1.32.2.4&r2=1.32.2.5

Patches:
Index: Members.pm
===================================================================
RCS file: /sources/koha/koha/C4/Members.pm,v
retrieving revision 1.32.2.4
retrieving revision 1.32.2.5
diff -u -b -r1.32.2.4 -r1.32.2.5
--- Members.pm  25 Sep 2006 15:00:05 -0000      1.32.2.4
+++ Members.pm  12 Oct 2006 10:08:22 -0000      1.32.2.5
@@ -19,7 +19,7 @@
 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
 # Suite 330, Boston, MA  02111-1307 USA
 
-# $Id: Members.pm,v 1.32.2.4 2006/09/25 15:00:05 btoumi Exp $
+# $Id: Members.pm,v 1.32.2.5 2006/10/12 10:08:22 btoumi Exp $
 
 use strict;
 require Exporter;
@@ -31,7 +31,7 @@
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
 
-$VERSION = do { my @v = '$Revision: 1.32.2.4 $' =~ /\d+/g; shift(@v) . "." . 
join( "_", map { sprintf "%03d", $_ } @v ); };
+$VERSION = do { my @v = '$Revision: 1.32.2.5 $' =~ /\d+/g; shift(@v) . "." . 
join( "_", map { sprintf "%03d", $_ } @v ); };
 
 =head1 NAME
 
@@ -65,7 +65,7 @@
   &ethnicitycategories get_institutions add_member_orgs
   &get_age &GetBorrowersFromSurname &GetBranchCodeFromBorrowers
   &GetFlagsAndBranchFromBorrower
- &GetCities &GetRoadTypes
+ &GetCities &GetRoadTypes &GetBorNotifyAcctRecord
 );
 
 
@@ -591,8 +591,7 @@
         # It looks like the $i is only being returned to handle walking through
         # the array, which is probably better done as a foreach loop.
         #
-        my $guaquery =
-"update borrowers set 
streetaddress='$data{'address'}',faxnumber='$data{'faxnumber'}',
+         my $guaquery ="update borrowers set 
streetaddress='$data{'address'}',faxnumber='$data{'faxnumber'}',
                
streetcity='$data{'streetcity'}',phoneday='$data{'phoneday'}',city='$data{'city'}',area='$data{'area'}',phone='$data{'phone'}'
                ,streetaddress='$data{'address'}'
                where borrowernumber='$guarantees->[$i]->{'borrowernumber'}'";
@@ -969,7 +968,7 @@
 
 #'
 sub getboracctrecord {
-    my ( $env, $params ) = @_;
+    my ( $env, $params) = @_;
     my $dbh = C4::Context->dbh;
     my @acctlines;
     my $numlines = 0;
@@ -977,7 +976,6 @@
         "Select * from accountlines where
 borrowernumber=? order by date desc,timestamp desc"
     );
-
     #   print $query;
     $sth->execute( $params->{'borrowernumber'} );
     my $total = 0;
@@ -1001,6 +999,56 @@
     return ( $numlines, address@hidden, $total );
 }
 
+
+
+=head2 GetBorNotifyAcctRecord
+
+  ($count, $acctlines, $total) = &GetBorNotifyAcctRecord($env, 
$params,$notifyid);
+
+Looks up accounting data for the patron with the given borrowernumber per file 
number.
+
+C<$env> is ignored.
+
+(FIXME - I'm not at all sure what this is about.)
+
+C<&GetBorNotifyAcctRecord> returns a three-element array. C<$acctlines> is a
+reference-to-array, where each element is a reference-to-hash; the
+keys are the fields of the C<accountlines> table in the Koha database.
+C<$count> is the number of elements in C<$acctlines>. C<$total> is the
+total amount outstanding for all of the account lines.
+=cut
+
+sub GetBorNotifyAcctRecord {
+    my ( $env, $params , $notifyid) = @_;
+    my $dbh = C4::Context->dbh;
+    my @acctlines;
+    my $numlines = 0;
+    my $query  =  qq|  SELECT * 
+                       FROM accountlines 
+                       WHERE borrowernumber=? 
+                       AND notify_id=? 
+                       AND (accounttype='FU' OR accounttype='IP' OR 
accounttype='CH' OR accounttype='RE' OR accounttype='RL')
+                       AND amountoutstanding != '0' 
+                       ORDER BY notify_id,accounttype
+               |;
+    my $sth = $dbh->prepare($query);
+    #   print $query;
+    $sth->execute( $params->{'borrowernumber'},$notifyid );
+    my $total = 0;
+    while ( my $data = $sth->fetchrow_hashref ) {
+        $acctlines[$numlines] = $data;
+        $numlines++;
+        $total += $data->{'amountoutstanding'};
+    }
+    $sth->finish;
+    return ( $numlines, address@hidden, $total );
+}
+
+
+
+
+
+
 =head2 checkuniquemember (OUEST-PROVENCE)
 
   $result = 
&checkuniquemember($collectivity,$surname,$categorycode,$firstname,$dateofbirth);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]