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

(-)a/Koha/Accounts.pm (-14 / +17 lines)
Lines 198-204 sub DebitLostItem { Link Here
198
        $params->{amount}     = $item->replacementprice();
198
        $params->{amount}     = $item->replacementprice();
199
        $params->{itemnumber} = $item->itemnumber();
199
        $params->{itemnumber} = $item->itemnumber();
200
        $params->{issue_id}   = $issue->issue_id();
200
        $params->{issue_id}   = $issue->issue_id();
201
	$params->{description} = "Lost Item " . $issue->item()->biblio()->title() . " " . $issue->item()->barcode();
201
        $params->{description} =
202
            "Lost Item "
203
          . $issue->item()->biblio()->title() . " "
204
          . $issue->item()->barcode();
202
205
203
        #TODO: Shouldn't we have a default replacement price as a syspref?
206
        #TODO: Shouldn't we have a default replacement price as a syspref?
204
        if ( $params->{amount} ) {
207
        if ( $params->{amount} ) {
Lines 442-448 sub RecalculateAccountBalance { Link Here
442
    my $debits =
445
    my $debits =
443
      Koha::Database->new()->schema->resultset('AccountDebit')
446
      Koha::Database->new()->schema->resultset('AccountDebit')
444
      ->search( { borrowernumber => $borrower->borrowernumber() } );
447
      ->search( { borrowernumber => $borrower->borrowernumber() } );
445
    my $amount_outstanding = $debits->get_column('amount_outstanding')->sum() || 0;
448
    my $amount_outstanding = $debits->get_column('amount_outstanding')->sum()
449
      || 0;
446
450
447
    my $credits =
451
    my $credits =
448
      Koha::Database->new()->schema->resultset('AccountCredit')
452
      Koha::Database->new()->schema->resultset('AccountCredit')
Lines 475-487 sub VoidCredit { Link Here
475
    my $credit = $schema->resultset('AccountCredit')->find($id);
479
    my $credit = $schema->resultset('AccountCredit')->find($id);
476
480
477
    foreach my $offset ( $credit->account_offsets() ) {
481
    foreach my $offset ( $credit->account_offsets() ) {
478
          my $debit = $offset->debit();
482
        my $debit = $offset->debit();
479
483
480
          $debit->amount_outstanding( $debit->amount_outstanding() - $offset->amount() );
484
        $debit->amount_outstanding(
481
          $debit->updated_on( get_timestamp() );
485
            $debit->amount_outstanding() - $offset->amount() );
482
          $debit->update();
486
        $debit->updated_on( get_timestamp() );
487
        $debit->update();
483
488
484
          Koha::Database->new()->schema->resultset('AccountOffset')->create(
489
        Koha::Database->new()->schema->resultset('AccountOffset')->create(
485
            {
490
            {
486
                amount     => $offset->amount() * -1,
491
                amount     => $offset->amount() * -1,
487
                debit_id   => $debit->id(),
492
                debit_id   => $debit->id(),
Lines 489-495 sub VoidCredit { Link Here
489
                created_on => get_timestamp(),
494
                created_on => get_timestamp(),
490
                type       => Koha::Accounts::OffsetTypes::Void(),
495
                type       => Koha::Accounts::OffsetTypes::Void(),
491
            }
496
            }
492
          );
497
        );
493
    }
498
    }
494
499
495
    $credit->amount_voided( $credit->amount_paid );
500
    $credit->amount_voided( $credit->amount_paid );
Lines 520-540 sub NormalizeBalances { Link Here
520
525
521
    my $schema = Koha::Database->new()->schema();
526
    my $schema = Koha::Database->new()->schema();
522
527
523
    my @credits =
528
    my @credits = $schema->resultset('AccountCredit')->search(
524
      $schema->resultset('AccountCredit')->search(
525
        {
529
        {
526
            borrowernumber   => $borrower->borrowernumber(),
530
            borrowernumber   => $borrower->borrowernumber(),
527
            amount_remaining => { '>' => '0' }
531
            amount_remaining => { '>' => '0' }
528
        }
532
        }
529
      );
533
    );
530
534
531
    my @debits =
535
    my @debits = $schema->resultset('AccountDebit')->search(
532
      $schema->resultset('AccountDebit')->search(
533
        {
536
        {
534
            borrowernumber     => $borrower->borrowernumber(),
537
            borrowernumber     => $borrower->borrowernumber(),
535
            amount_outstanding => { '>' => '0' }
538
            amount_outstanding => { '>' => '0' }
536
        }
539
        }
537
      );
540
    );
538
541
539
    foreach my $credit (@credits) {
542
    foreach my $credit (@credits) {
540
        foreach my $debit (@debits) {
543
        foreach my $debit (@debits) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/account.tt (-2 / +2 lines)
Lines 36-42 $(document).ready(function() { Link Here
36
    var debitsTable = $('#debits-table').dataTable( {
36
    var debitsTable = $('#debits-table').dataTable( {
37
        "sDom": "<'row-fluid'<'span6'T><'span6'>r>t<'row-fluid'><'top pager'ilpf>t<'bottom pager'ip>",
37
        "sDom": "<'row-fluid'<'span6'T><'span6'>r>t<'row-fluid'><'top pager'ilpf>t<'bottom pager'ip>",
38
        "oTableTools": {
38
        "oTableTools": {
39
            "sSwfPath": "/intranet-tmpl/lib/jquery/plugins/TableTools/media/swf/copy_csv_xls_pdf.swf",
39
            "sSwfPath": "[% interface %]/lib/jquery/plugins/TableTools/media/swf/copy_csv_xls_pdf.swf",
40
            "aButtons": [
40
            "aButtons": [
41
                {
41
                {
42
                    "sExtends": "print",
42
                    "sExtends": "print",
Lines 141-147 $(document).ready(function() { Link Here
141
    var creditsTable = $('#credits-table').dataTable( {
141
    var creditsTable = $('#credits-table').dataTable( {
142
        "sDom": "<'row-fluid'<'span6'T><'span6'>r>t<'row-fluid'><'top pager'ilpf>t<'bottom pager'ip>",
142
        "sDom": "<'row-fluid'<'span6'T><'span6'>r>t<'row-fluid'><'top pager'ilpf>t<'bottom pager'ip>",
143
        "oTableTools": {
143
        "oTableTools": {
144
            "sSwfPath": "/intranet-tmpl/lib/jquery/plugins/TableTools/media/swf/copy_csv_xls_pdf.swf",
144
            "sSwfPath": "[% interface %]/lib/jquery/plugins/TableTools/media/swf/copy_csv_xls_pdf.swf",
145
            "aButtons": [
145
            "aButtons": [
146
                {
146
                {
147
                    "sExtends": "print",
147
                    "sExtends": "print",
(-)a/misc/cronjobs/recalculate_account_balances.pl (-2 / +1 lines)
Lines 6-12 Link Here
6
#
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
9
# Foundation; either version 3 of the License, or (at your option) any later
10
# version.
10
# version.
11
#
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
- 

Return to bug 6427