koha-devel
[Top][All Lists]
Advanced

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

[Koha-devel] CVS: koha/C4 Stats.pm,1.1.1.1,1.2 Accounts2.pm,1.1.1.1,1.2


From: Chris Cormack
Subject: [Koha-devel] CVS: koha/C4 Stats.pm,1.1.1.1,1.2 Accounts2.pm,1.1.1.1,1.2
Date: Tue, 27 Mar 2001 13:43:39 -0800

Update of /cvsroot/koha/koha/C4
In directory usw-pr-cvs1:/tmp/cvs-serv4889/C4

Modified Files:
        Stats.pm Accounts2.pm 
Log Message:
Modified the update stats routine to store borrowernumbers also
Passing borrowernumbers to update stats from Account routines


Index: Stats.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Stats.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Stats.pm    2000/12/19 23:45:55     1.1.1.1
--- Stats.pm    2001/03/27 21:43:37     1.2
***************
*** 54,65 ****
  sub UpdateStats {
    #module to insert stats data into stats table
!   my ($env,$branch,$type,$amount,$other,$itemnum,$itemtype)address@hidden;
    my $dbh=C4Connect();
    my $branch=$env->{'branchcode'};
    my $user = $env->{'usercode'};
    my $sth=$dbh->prepare("Insert into statistics
!      (datetime,branch,type,usercode,value,other,itemnumber,itemtype) 
!      values (now(),'$branch',
!      '$type','$user','$amount','$other','$itemnum','$itemtype')");
    $sth->execute;
    $sth->finish;
--- 54,67 ----
  sub UpdateStats {
    #module to insert stats data into stats table
!   my 
($env,$branch,$type,$amount,$other,$itemnum,$itemtype,$borrowernumber)address@hidden;
    my $dbh=C4Connect();
    my $branch=$env->{'branchcode'};
    my $user = $env->{'usercode'};
+   print $borrowernumber;
    my $sth=$dbh->prepare("Insert into statistics
!   (datetime,branch,type,usercode,value,
!   other,itemnumber,itemtype,borrowernumber) 
!   values (now(),'$branch','$type','$user','$amount',
!   '$other','$itemnum','$itemtype','$borrowernumber')");
    $sth->execute;
    $sth->finish;
***************
*** 146,157 ****
    my ($time)address@hidden;
    my $dbh=C4Connect;
!   my $query="Select * from accountlines,borrowers where accounttype = 'Pay' 
!   and accountlines.borrowernumber = borrowers.borrowernumber";
    if ($time eq 'today'){
!     $query=$query." and date = now()";
    } else {
!     $query.=" and date='$time'";
    }
  #  $query.=" order by timestamp";
    my $sth=$dbh->prepare($query);
    $sth->execute;
--- 148,161 ----
    my ($time)address@hidden;
    my $dbh=C4Connect;
!   my $query="Select * from statistics,borrowers
!   where statistics.borrowernumber= borrowers.borrowernumber
!   and (statistics.type='payment' or statistics.type='writeoff')";
    if ($time eq 'today'){
!     $query=$query." and datetime = now()";
    } else {
!     $query.=" and datetime > '$time'";
    }
  #  $query.=" order by timestamp";
+   print $query;
    my $sth=$dbh->prepare($query);
    $sth->execute;
***************
*** 173,188 ****
    my $timestamp2=$timestamp-1;
    my $query="Select * from accountlines where borrowernumber=$borrowerno
!   and timestamp <= '$timestamp' and accounttype <> 'Pay' and
    accounttype <> 'W'";
    my $sth=$dbh->prepare($query);
! #  print $query,"<br>";
    $sth->execute;
    my $i=0;
    my @results;
    while (my $data=$sth->fetchrow_hashref){
!     if ($data->{'timestamp'} == $timestamp){
        $results[$i]=$data;
        $i++;
!     }
    }
    $dbh->disconnect;
--- 177,192 ----
    my $timestamp2=$timestamp-1;
    my $query="Select * from accountlines where borrowernumber=$borrowerno
!   and timestamp = '$timestamp' and accounttype <> 'Pay' and
    accounttype <> 'W'";
    my $sth=$dbh->prepare($query);
!   print $query,"<br>";
    $sth->execute;
    my $i=0;
    my @results;
    while (my $data=$sth->fetchrow_hashref){
! #    if ($data->{'timestamp'} == $timestamp){
        $results[$i]=$data;
        $i++;
! #    }
    }
    $dbh->disconnect;

Index: Accounts2.pm
===================================================================
RCS file: /cvsroot/koha/koha/C4/Accounts2.pm,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** Accounts2.pm        2000/12/19 23:45:54     1.1.1.1
--- Accounts2.pm        2001/03/27 21:43:37     1.2
***************
*** 101,105 ****
    $usth->execute;
    $usth->finish;
!   UpdateStats($env,'branch','payment',$data);
    $sth->finish;
    $dbh->disconnect;
--- 101,105 ----
    $usth->execute;
    $usth->finish;
!   UpdateStats($env,'branch','payment',$data,'','','',$bornumber);
    $sth->finish;
    $dbh->disconnect;
***************
*** 134,138 ****
    $usth->execute;
    $usth->finish;
!   UpdateStats($env,$user,'payment',$amount);
    $sth->finish;
    $dbh->disconnect;
--- 134,138 ----
    $usth->execute;
    $usth->finish;
!   UpdateStats($env,$user,'payment',$amount,'','','',$bornumber);
    $sth->finish;
    $dbh->disconnect;




reply via email to

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