From 5b858039d802584b92c0f530a5ac7e2b927c818b Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Wed, 18 Apr 2018 10:25:19 +0000 Subject: [PATCH] Bug 20603: Remove ModNote, getcredits and getrefunds from C4::Accounts 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 --- C4/Accounts.pm | 51 ----------------------------------------------- t/db_dependent/Accounts.t | 3 --- 2 files changed, 54 deletions(-) diff --git a/C4/Accounts.pm b/C4/Accounts.pm index 1adf8d4..eef9766 100644 --- a/C4/Accounts.pm +++ b/C4/Accounts.pm @@ -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 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) = @_; diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t index 9da6f59..5a6fe7b 100644 --- a/t/db_dependent/Accounts.t +++ b/t/db_dependent/Accounts.t @@ -43,9 +43,6 @@ can_ok( 'C4::Accounts', chargelostitem manualinvoice getcharges - ModNote - getcredits - getrefunds ReversePayment purge_zero_balance_fees ) ); -- 2.1.4