Bug 20603: Remove ModNote, getcredits and getrefunds from C4::Accounts
authorJosef Moravec <josef.moravec@gmail.com>
Wed, 18 Apr 2018 10:25:19 +0000 (10:25 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 20 Apr 2018 15:24:00 +0000 (12:24 -0300)
Test plan:
0) Do not apply the patch
1) Run these 3 commands
    git grep ModNote
    git grep getcredits
    git grep getrefunds
all should return occurances only in C4/Accounts.pm - the sub definition
and in t/db_dependent/Accounts.t
2) Apply the patch
3) Run commands from 1) again, now there should be no occurence
4) prove t/db_dependent/Accounts.t
    should return green

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

C4/Accounts.pm
t/db_dependent/Accounts.t

index 1adf8d4..eef9766 100644 (file)
@@ -41,9 +41,6 @@ BEGIN {
       &manualinvoice
       &getnextacctno
       &getcharges
-      &ModNote
-      &getcredits
-      &getrefunds
       &chargelostitem
       &ReversePayment
       &purge_zero_balance_fees
@@ -332,54 +329,6 @@ sub getcharges {
     return (@results);
 }
 
-sub ModNote {
-    my ( $accountlines_id, $note ) = @_;
-    my $dbh = C4::Context->dbh;
-    my $sth = $dbh->prepare('UPDATE accountlines SET note = ? WHERE accountlines_id = ?');
-    $sth->execute( $note, $accountlines_id );
-}
-
-sub getcredits {
-       my ( $date, $date2 ) = @_;
-       my $dbh = C4::Context->dbh;
-       my $sth = $dbh->prepare(
-                               "SELECT * FROM accountlines,borrowers
-      WHERE amount < 0 AND accounttype not like 'Pay%' AND accountlines.borrowernumber = borrowers.borrowernumber
-         AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)"
-      );  
-
-    $sth->execute( $date, $date2 );
-    my @results;          
-    while ( my $data = $sth->fetchrow_hashref ) {
-               $data->{'date'} = $data->{'timestamp'};
-               push @results,$data;
-       }
-    return (@results);
-} 
-
-
-sub getrefunds {
-       my ( $date, $date2 ) = @_;
-       my $dbh = C4::Context->dbh;
-       
-       my $sth = $dbh->prepare(
-                               "SELECT *,timestamp AS datetime                                                                                      
-                  FROM accountlines,borrowers
-                  WHERE (accounttype = 'REF'
-                                         AND accountlines.borrowernumber = borrowers.borrowernumber
-                                                         AND date  >=?  AND date  <?)"
-    );
-
-    $sth->execute( $date, $date2 );
-
-    my @results;
-    while ( my $data = $sth->fetchrow_hashref ) {
-               push @results,$data;
-               
-       }
-    return (@results);
-}
-
 #FIXME: ReversePayment should be replaced with a Void Payment feature
 sub ReversePayment {
     my ($accountlines_id) = @_;
index 2aba51e..e4ac8e9 100644 (file)
@@ -43,9 +43,6 @@ can_ok( 'C4::Accounts',
         chargelostitem
         manualinvoice
         getcharges
-        ModNote
-        getcredits
-        getrefunds
         ReversePayment
         purge_zero_balance_fees )
 );