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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt (-1 / +15 lines)
Lines 25-30 Link Here
25
                        can record payments.
25
                        can record payments.
26
                    </div>
26
                    </div>
27
                    [% ELSE %]
27
                    [% ELSE %]
28
                    [% IF ( error_cashup_permission ) %]
29
                    <div id="error_message" class="dialog alert">
30
                        You do not have permission to perform cashup actions.
31
                    </div>
32
                    [% END %]
28
                    <div id="toolbar" class="btn-toolbar">
33
                    <div id="toolbar" class="btn-toolbar">
29
                        <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button>
34
                        <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button>
30
                    </div>
35
                    </div>
Lines 47-53 Link Here
47
                            <th>Bankable</th>
52
                            <th>Bankable</th>
48
                            <th>Income (cash)</th>
53
                            <th>Income (cash)</th>
49
                            <th>Outgoing (cash)</th>
54
                            <th>Outgoing (cash)</th>
55
                            [% IF CAN_user_cash_management_cashup %]
50
                            <th>Actions</th>
56
                            <th>Actions</th>
57
                            [% END %]
51
                        </thead>
58
                        </thead>
52
                        <tbody>
59
                        <tbody>
53
                            [% SET bankable = 0, ctotal = 0, dtotal = 0, cctotal = 0, cdtotal = 0 %]
60
                            [% SET bankable = 0, ctotal = 0, dtotal = 0, cctotal = 0, cdtotal = 0 %]
Lines 81-89 Link Here
81
                                    [% rdtotal | $Price %] ([% rcdtotal | $Price %])
88
                                    [% rdtotal | $Price %] ([% rcdtotal | $Price %])
82
                                    [% SET dtotal = dtotal + rdtotal %]
89
                                    [% SET dtotal = dtotal + rdtotal %]
83
                                    [% SET cdtotal = cdtotal + rcdtotal %]
90
                                    [% SET cdtotal = cdtotal + rcdtotal %]
91
                                </td>
92
                                [% IF CAN_user_cash_management_cashup %]
84
                                <td>
93
                                <td>
85
                                    <button type="button" class="cashup_individual btn btn-default" data-toggle="modal" data-target="#confirmCashupModal" data-register="[% register.description | html %]" data-bankable="[% rbankable | $Price %]" data-float="[% register.starting_float | $Price %]" data-registerid="[% register.id | html %]"><i class="fa fa-money"></i> Record cashup</button>
94
                                    <button type="button" class="cashup_individual btn btn-default" data-toggle="modal" data-target="#confirmCashupModal" data-register="[% register.description | html %]" data-bankable="[% rbankable | $Price %]" data-float="[% register.starting_float | $Price %]" data-registerid="[% register.id | html %]"><i class="fa fa-money"></i> Record cashup</button>
86
                                </td>
95
                                </td>
96
                                [% END %]
87
                            </tr>
97
                            </tr>
88
                            [% END %]
98
                            [% END %]
89
                        </tbody>
99
                        </tbody>
Lines 93-99 Link Here
93
                                <td>[% bankable | $Price %]</td>
103
                                <td>[% bankable | $Price %]</td>
94
                                <td>[% ctotal | $Price %] ([% cctotal | $Price %])</td>
104
                                <td>[% ctotal | $Price %] ([% cctotal | $Price %])</td>
95
                                <td>[% dtotal | $Price %] ([% cdtotal | $Price %])</td>
105
                                <td>[% dtotal | $Price %] ([% cdtotal | $Price %])</td>
96
                                <td><button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button></td>
106
                                [% IF CAN_user_cash_management_cashup %]
107
                                <td>
108
                                    <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button>
109
                                </td>
110
                                [% END %]
97
                            </tr>
111
                            </tr>
98
                        </tfoot>
112
                        </tfoot>
99
                    </table>
113
                    </table>
(-)a/pos/registers.pl (-13 / +17 lines)
Lines 55-72 else { Link Here
55
55
56
my $op = $input->param('op') // '';
56
my $op = $input->param('op') // '';
57
if ( $op eq 'cashup' ) {
57
if ( $op eq 'cashup' ) {
58
    my $registerid = $input->param('registerid');
58
    if ( $logged_in_user->has_permission( { cash_management => 'cashup' } ) ) {
59
    if ($registerid) {
59
        my $registerid = $input->param('registerid');
60
        my $register = Koha::Cash::Registers->find( { id => $registerid } );
60
        if ($registerid) {
61
        $register->add_cashup(
61
            my $register = Koha::Cash::Registers->find( { id => $registerid } );
62
            {
63
                manager_id => $logged_in_user->id,
64
                amount     => $register->outstanding_accountlines->total
65
            }
66
        );
67
    }
68
    else {
69
        for my $register ( $registers->as_list ) {
70
            $register->add_cashup(
62
            $register->add_cashup(
71
                {
63
                {
72
                    manager_id => $logged_in_user->id,
64
                    manager_id => $logged_in_user->id,
Lines 74-79 if ( $op eq 'cashup' ) { Link Here
74
                }
66
                }
75
            );
67
            );
76
        }
68
        }
69
        else {
70
            for my $register ( $registers->as_list ) {
71
                $register->add_cashup(
72
                    {
73
                        manager_id => $logged_in_user->id,
74
                        amount     => $register->outstanding_accountlines->total
75
                    }
76
                );
77
            }
78
        }
79
    }
80
    else {
81
        $template->param( error_cashup_permission => 1 );
77
    }
82
    }
78
}
83
}
79
84
80
- 

Return to bug 26023