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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/register.tt (+12 lines)
Lines 28-33 Link Here
28
            </div>
28
            </div>
29
            [% ELSE %]
29
            [% ELSE %]
30
30
31
            [% IF ( error_cashup_permission ) %]
32
            <div id="error_message" class="dialog alert">
33
                You do not have permission to perform cashup actions.
34
            </div>
35
            [% END %]
36
            
37
            [% IF ( error_refund_permission ) %]
38
            <div id="error_message" class="dialog alert">
39
                You do not have permission to perform refund actions.
40
            </div>
41
            [% END %]
42
31
            [% IF ( CAN_user_cash_management_cashup ) %]
43
            [% IF ( CAN_user_cash_management_cashup ) %]
32
            <div id="toolbar" class="btn-toolbar">
44
            <div id="toolbar" class="btn-toolbar">
33
                <button id="pos_cashup" type="button" class="btn btn-default" data-toggle="modal" data-target="#confirmCashupModal" ><i class="fa fa-money"></i> Record cashup</button>
45
                <button id="pos_cashup" type="button" class="btn btn-default" data-toggle="modal" data-target="#confirmCashupModal" ><i class="fa fa-money"></i> Record cashup</button>
(-)a/pos/register.pl (-38 / +47 lines)
Lines 102-146 else { Link Here
102
102
103
    my $op = $input->param('op') // '';
103
    my $op = $input->param('op') // '';
104
    if ( $op eq 'cashup' ) {
104
    if ( $op eq 'cashup' ) {
105
        $cash_register->add_cashup(
105
        if ( $logged_in_user->has_permission( { cash_management => 'cashup' } ) ) {
106
            {
106
            $cash_register->add_cashup(
107
                manager_id => $logged_in_user->id,
107
                {
108
                amount     => $cash_register->outstanding_accountlines->total
108
                    manager_id => $logged_in_user->id,
109
            }
109
                    amount     => $cash_register->outstanding_accountlines->total
110
        );
110
                }
111
            );
112
        }
113
        else {
114
            $template->param( error_cashup_permission => 1 );
115
        }
111
    }
116
    }
112
    elsif ( $op eq 'refund' ) {
117
    elsif ( $op eq 'refund' ) {
113
        my $amount           = $input->param('amount');
118
        if ( $logged_in_user->has_permission( { cash_management => 'anonymous_refund' } ) ) {
114
        my $quantity         = $input->param('quantity');
119
            my $amount           = $input->param('amount');
115
        my $accountline_id   = $input->param('accountline');
120
            my $quantity         = $input->param('quantity');
116
        my $transaction_type = $input->param('transaction_type');
121
            my $accountline_id   = $input->param('accountline');
117
122
            my $transaction_type = $input->param('transaction_type');
118
        my $accountline = Koha::Account::Lines->find($accountline_id);
123
    
119
        $schema->txn_do(
124
            my $accountline = Koha::Account::Lines->find($accountline_id);
120
            sub {
125
            $schema->txn_do(
121
126
                sub {
122
                my $refund = $accountline->reduce(
127
    
123
                    {
128
                    my $refund = $accountline->reduce(
124
                        reduction_type => 'Refund',
129
                        {
125
                        branch         => $library_id,
130
                            reduction_type => 'Refund',
126
                        staff_id       => $logged_in_user->id,
131
                            branch         => $library_id,
127
                        interface      => 'intranet',
132
                            staff_id       => $logged_in_user->id,
128
                        amount         => $amount
133
                            interface      => 'intranet',
129
                    }
134
                            amount         => $amount
130
                );
135
                        }
131
                my $payout = $refund->payout(
136
                    );
132
                    {
137
                    my $payout = $refund->payout(
133
                        payout_type   => $transaction_type,
138
                        {
134
                        branch        => $library_id,
139
                            payout_type   => $transaction_type,
135
                        staff_id      => $logged_in_user->id,
140
                            branch        => $library_id,
136
                        cash_register => $cash_register->id,
141
                            staff_id      => $logged_in_user->id,
137
                        interface     => 'intranet',
142
                            cash_register => $cash_register->id,
138
                        amount        => $amount
143
                            interface     => 'intranet',
139
                    }
144
                            amount        => $amount
140
                );
145
                        }
141
146
                    );
142
            }
147
    
143
        );
148
                }
149
            );
150
        }
151
        else {
152
            $template->param( error_refund_permission => 1 );
153
        }
144
    }
154
    }
145
}
155
}
146
156
147
- 

Return to bug 26023