View | Details | Raw Unified | Return to bug 20603
Collapse All | Expand All

(-)a/C4/Accounts.pm (-51 lines)
Lines 41-49 BEGIN { Link Here
41
      &manualinvoice
41
      &manualinvoice
42
      &getnextacctno
42
      &getnextacctno
43
      &getcharges
43
      &getcharges
44
      &ModNote
45
      &getcredits
46
      &getrefunds
47
      &chargelostitem
44
      &chargelostitem
48
      &ReversePayment
45
      &ReversePayment
49
      &purge_zero_balance_fees
46
      &purge_zero_balance_fees
Lines 332-385 sub getcharges { Link Here
332
    return (@results);
329
    return (@results);
333
}
330
}
334
331
335
sub ModNote {
336
    my ( $accountlines_id, $note ) = @_;
337
    my $dbh = C4::Context->dbh;
338
    my $sth = $dbh->prepare('UPDATE accountlines SET note = ? WHERE accountlines_id = ?');
339
    $sth->execute( $note, $accountlines_id );
340
}
341
342
sub getcredits {
343
	my ( $date, $date2 ) = @_;
344
	my $dbh = C4::Context->dbh;
345
	my $sth = $dbh->prepare(
346
			        "SELECT * FROM accountlines,borrowers
347
      WHERE amount < 0 AND accounttype not like 'Pay%' AND accountlines.borrowernumber = borrowers.borrowernumber
348
	  AND timestamp >=TIMESTAMP(?) AND timestamp < TIMESTAMP(?)"
349
      );  
350
351
    $sth->execute( $date, $date2 );
352
    my @results;          
353
    while ( my $data = $sth->fetchrow_hashref ) {
354
		$data->{'date'} = $data->{'timestamp'};
355
		push @results,$data;
356
	}
357
    return (@results);
358
} 
359
360
361
sub getrefunds {
362
	my ( $date, $date2 ) = @_;
363
	my $dbh = C4::Context->dbh;
364
	
365
	my $sth = $dbh->prepare(
366
			        "SELECT *,timestamp AS datetime                                                                                      
367
                  FROM accountlines,borrowers
368
                  WHERE (accounttype = 'REF'
369
					  AND accountlines.borrowernumber = borrowers.borrowernumber
370
					                  AND date  >=?  AND date  <?)"
371
    );
372
373
    $sth->execute( $date, $date2 );
374
375
    my @results;
376
    while ( my $data = $sth->fetchrow_hashref ) {
377
		push @results,$data;
378
		
379
	}
380
    return (@results);
381
}
382
383
#FIXME: ReversePayment should be replaced with a Void Payment feature
332
#FIXME: ReversePayment should be replaced with a Void Payment feature
384
sub ReversePayment {
333
sub ReversePayment {
385
    my ($accountlines_id) = @_;
334
    my ($accountlines_id) = @_;
(-)a/t/db_dependent/Accounts.t (-4 lines)
Lines 43-51 can_ok( 'C4::Accounts', Link Here
43
        chargelostitem
43
        chargelostitem
44
        manualinvoice
44
        manualinvoice
45
        getcharges
45
        getcharges
46
        ModNote
47
        getcredits
48
        getrefunds
49
        ReversePayment
46
        ReversePayment
50
        purge_zero_balance_fees )
47
        purge_zero_balance_fees )
51
);
48
);
52
- 

Return to bug 20603