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

(-)a/Koha/Account.pm (-1 / +4 lines)
Lines 441-446 $debit_type can be any of: Link Here
441
  - lost_item
441
  - lost_item
442
  - new_card
442
  - new_card
443
  - account
443
  - account
444
  - account_renew
444
  - sundry
445
  - sundry
445
  - processing
446
  - processing
446
  - rent
447
  - rent
Lines 708-713 our $offset_type = { Link Here
708
    'payment'          => 'Payment',
709
    'payment'          => 'Payment',
709
    'writeoff'         => 'Writeoff',
710
    'writeoff'         => 'Writeoff',
710
    'account'          => 'Account Fee',
711
    'account'          => 'Account Fee',
712
    'account_renew'    => 'Account Fee',
711
    'reserve'          => 'Reserve Fee',
713
    'reserve'          => 'Reserve Fee',
712
    'processing'       => 'Processing Fee',
714
    'processing'       => 'Processing Fee',
713
    'lost_item'        => 'Lost Item',
715
    'lost_item'        => 'Lost Item',
Lines 737-743 our $account_type_credit = { Link Here
737
=cut
739
=cut
738
740
739
our $account_type_debit = {
741
our $account_type_debit = {
740
    'account'          => 'A',
742
    'account'          => 'ACCOUNT',
743
    'account_renew'    => 'ACCOUNT_RENEW',
741
    'overdue'          => 'OVERDUE',
744
    'overdue'          => 'OVERDUE',
742
    'lost_item'        => 'LOST',
745
    'lost_item'        => 'LOST',
743
    'new_card'         => 'N',
746
    'new_card'         => 'N',
(-)a/Koha/Patron.pm (-6 / +9 lines)
Lines 235-241 sub store { Link Here
235
235
236
                $self = $self->SUPER::store;
236
                $self = $self->SUPER::store;
237
237
238
                $self->add_enrolment_fee_if_needed;
238
                $self->add_enrolment_fee_if_needed(0);
239
239
240
                logaction( "MEMBERS", "CREATE", $self->borrowernumber, "" )
240
                logaction( "MEMBERS", "CREATE", $self->borrowernumber, "" )
241
                  if C4::Context->preference("BorrowersLog");
241
                  if C4::Context->preference("BorrowersLog");
Lines 257-263 sub store { Link Here
257
                    and $self->category->categorycode ne
257
                    and $self->category->categorycode ne
258
                    $self_from_storage->category->categorycode )
258
                    $self_from_storage->category->categorycode )
259
                {
259
                {
260
                    $self->add_enrolment_fee_if_needed;
260
                    $self->add_enrolment_fee_if_needed(1);
261
                }
261
                }
262
262
263
                # Actionlogs
263
                # Actionlogs
Lines 723-729 sub renew_account { Link Here
723
    $self->date_renewed( dt_from_string() );
723
    $self->date_renewed( dt_from_string() );
724
    $self->store();
724
    $self->store();
725
725
726
    $self->add_enrolment_fee_if_needed;
726
    $self->add_enrolment_fee_if_needed(1);
727
727
728
    logaction( "MEMBERS", "RENEW", $self->borrowernumber, "Membership renewed" ) if C4::Context->preference("BorrowersLog");
728
    logaction( "MEMBERS", "RENEW", $self->borrowernumber, "Membership renewed" ) if C4::Context->preference("BorrowersLog");
729
    return dt_from_string( $expiry_date )->truncate( to => 'day' );
729
    return dt_from_string( $expiry_date )->truncate( to => 'day' );
Lines 847-869 sub article_requests_finished { Link Here
847
847
848
=head3 add_enrolment_fee_if_needed
848
=head3 add_enrolment_fee_if_needed
849
849
850
my $enrolment_fee = $patron->add_enrolment_fee_if_needed;
850
my $enrolment_fee = $patron->add_enrolment_fee_if_needed($renewal);
851
851
852
Add enrolment fee for a patron if needed.
852
Add enrolment fee for a patron if needed.
853
853
854
$renewal - boolean denoting whether this is an account renewal or not
855
854
=cut
856
=cut
855
857
856
sub add_enrolment_fee_if_needed {
858
sub add_enrolment_fee_if_needed {
857
    my ($self) = @_;
859
    my ($self, $renewal) = @_;
858
    my $enrolment_fee = $self->category->enrolmentfee;
860
    my $enrolment_fee = $self->category->enrolmentfee;
859
    if ( $enrolment_fee && $enrolment_fee > 0 ) {
861
    if ( $enrolment_fee && $enrolment_fee > 0 ) {
862
        my $type = $renewal ? 'account_renew' : 'account';
860
        $self->account->add_debit(
863
        $self->account->add_debit(
861
            {
864
            {
862
                amount     => $enrolment_fee,
865
                amount     => $enrolment_fee,
863
                user_id    => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
866
                user_id    => C4::Context->userenv ? C4::Context->userenv->{'number'} : undef,
864
                interface  => C4::Context->interface,
867
                interface  => C4::Context->interface,
865
                library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
868
                library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
866
                type       => 'account'
869
                type       => $type
867
            }
870
            }
868
        );
871
        );
869
    }
872
    }
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/accounts.inc (-1 / +2 lines)
Lines 6-12 Link Here
6
        [%- CASE 'Pay02'            -%]<span>Payment (credit card via SIP2)
6
        [%- CASE 'Pay02'            -%]<span>Payment (credit card via SIP2)
7
        [%- CASE 'N'                -%]<span>New card
7
        [%- CASE 'N'                -%]<span>New card
8
        [%- CASE 'OVERDUE'          -%]<span>Fine
8
        [%- CASE 'OVERDUE'          -%]<span>Fine
9
        [%- CASE 'A'                -%]<span>Account management fee
9
        [%- CASE 'ACCOUNT'          -%]<span>Account creation fee
10
        [%- CASE 'ACCOUNT_RENEW'    -%]<span>Account renewal fee
10
        [%- CASE 'M'                -%]<span>Sundry
11
        [%- CASE 'M'                -%]<span>Sundry
11
        [%- CASE 'LOST'             -%]<span>Lost item
12
        [%- CASE 'LOST'             -%]<span>Lost item
12
        [%- CASE 'W'                -%]<span>Writeoff
13
        [%- CASE 'W'                -%]<span>Writeoff
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/maninvoice.tt (-1 / +1 lines)
Lines 79-85 Link Here
79
    [% INCLUDE 'str/members-menu.inc' %]
79
    [% INCLUDE 'str/members-menu.inc' %]
80
    [% Asset.js("js/members-menu.js") | $raw %]
80
    [% Asset.js("js/members-menu.js") | $raw %]
81
    <script>
81
    <script>
82
        var type_fees = {'LOST':'','OVERDUE':'','A':'','N':'','M':''};
82
        var type_fees = {'LOST':'','OVERDUE':'','ACCOUNT':'','ACCOUNT_RENEW':'','N':'','M':''};
83
        [% FOREACH invoice_types_loo IN invoice_types_loop %]
83
        [% FOREACH invoice_types_loo IN invoice_types_loop %]
84
            type_fees['[% invoice_types_loo.authorised_value | html %]'] = "[% invoice_types_loo.lib | html %]";
84
            type_fees['[% invoice_types_loo.authorised_value | html %]'] = "[% invoice_types_loo.lib | html %]";
85
        [% END %]
85
        [% END %]
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/account-table.inc (-2 / +2 lines)
Lines 125-131 Link Here
125
        [%- CASE 'VOID'             -%]<span>Voided
125
        [%- CASE 'VOID'             -%]<span>Voided
126
        [%- CASE 'N'                -%]<span>New card
126
        [%- CASE 'N'                -%]<span>New card
127
        [%- CASE 'OVERDUE'          -%]<span>Fine
127
        [%- CASE 'OVERDUE'          -%]<span>Fine
128
        [%- CASE 'A'                -%]<span>Account management fee
128
        [%- CASE 'ACCOUNT'          -%]<span>Account creation fee
129
        [%- CASE 'ACCOUNT_RENEW'    -%]<span>Account renewal fee
129
        [%- CASE 'M'                -%]<span>Sundry
130
        [%- CASE 'M'                -%]<span>Sundry
130
        [%- CASE 'LOST'             -%]<span>Lost item
131
        [%- CASE 'LOST'             -%]<span>Lost item
131
        [%- CASE 'W'                -%]<span>Writeoff
132
        [%- CASE 'W'                -%]<span>Writeoff
132
- 

Return to bug 6759