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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/registers.tt (-1 / +19 lines)
Lines 32-40 Link Here
32
                            [% END %]
32
                            [% END %]
33
                        </div>
33
                        </div>
34
                    [% ELSE %]
34
                    [% ELSE %]
35
36
                    [% IF ( error_cashup_permission ) %]
37
                    <div id="error_message" class="dialog alert">
38
                        You do not have permission to perform cashup actions.
39
                    </div>
40
                    [% END %]
41
42
                    [% IF CAN_user_cash_management_cashup %]
35
                    <div id="toolbar" class="btn-toolbar">
43
                    <div id="toolbar" class="btn-toolbar">
36
                        <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button>
44
                        <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button>
37
                    </div>
45
                    </div>
46
                    [% END %]
38
47
39
                    <h1>Library transaction details for [% library.branchname | html %]</h1>
48
                    <h1>Library transaction details for [% library.branchname | html %]</h1>
40
49
Lines 54-60 Link Here
54
                            <th>Bankable</th>
63
                            <th>Bankable</th>
55
                            <th>Income (cash)</th>
64
                            <th>Income (cash)</th>
56
                            <th>Outgoing (cash)</th>
65
                            <th>Outgoing (cash)</th>
66
                            [% IF CAN_user_cash_management_cashup %]
57
                            <th>Actions</th>
67
                            <th>Actions</th>
68
                            [% END %]
58
                        </thead>
69
                        </thead>
59
                        <tbody>
70
                        <tbody>
60
                            [% SET bankable = 0, ctotal = 0, dtotal = 0, cctotal = 0, cdtotal = 0 %]
71
                            [% SET bankable = 0, ctotal = 0, dtotal = 0, cctotal = 0, cdtotal = 0 %]
Lines 88-96 Link Here
88
                                    [% rdtotal | $Price %] ([% rcdtotal | $Price %])
99
                                    [% rdtotal | $Price %] ([% rcdtotal | $Price %])
89
                                    [% SET dtotal = dtotal + rdtotal %]
100
                                    [% SET dtotal = dtotal + rdtotal %]
90
                                    [% SET cdtotal = cdtotal + rcdtotal %]
101
                                    [% SET cdtotal = cdtotal + rcdtotal %]
102
                                </td>
103
                                [% IF CAN_user_cash_management_cashup %]
91
                                <td>
104
                                <td>
92
                                    <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>
105
                                    <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>
93
                                </td>
106
                                </td>
107
                                [% END %]
94
                            </tr>
108
                            </tr>
95
                            [% END %]
109
                            [% END %]
96
                        </tbody>
110
                        </tbody>
Lines 100-106 Link Here
100
                                <td>[% bankable | $Price %]</td>
114
                                <td>[% bankable | $Price %]</td>
101
                                <td>[% ctotal | $Price %] ([% cctotal | $Price %])</td>
115
                                <td>[% ctotal | $Price %] ([% cctotal | $Price %])</td>
102
                                <td>[% dtotal | $Price %] ([% cdtotal | $Price %])</td>
116
                                <td>[% dtotal | $Price %] ([% cdtotal | $Price %])</td>
103
                                <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>
117
                                [% IF CAN_user_cash_management_cashup %]
118
                                <td>
119
                                    <button type="button" class="cashup_all btn btn-default" data-toggle="modal" data-target="#confirmCashupAllModal"><i class="fa fa-money"></i> Cashup all</button>
120
                                </td>
121
                                [% END %]
104
                            </tr>
122
                            </tr>
105
                        </tfoot>
123
                        </tfoot>
106
                    </table>
124
                    </table>
(-)a/pos/registers.pl (-13 / +17 lines)
Lines 56-73 else { Link Here
56
56
57
my $op = $input->param('op') // '';
57
my $op = $input->param('op') // '';
58
if ( $op eq 'cashup' ) {
58
if ( $op eq 'cashup' ) {
59
    my $registerid = $input->param('registerid');
59
    if ( $logged_in_user->has_permission( { cash_management => 'cashup' } ) ) {
60
    if ($registerid) {
60
        my $registerid = $input->param('registerid');
61
        my $register = Koha::Cash::Registers->find( { id => $registerid } );
61
        if ($registerid) {
62
        $register->add_cashup(
62
            my $register = Koha::Cash::Registers->find( { id => $registerid } );
63
            {
64
                manager_id => $logged_in_user->id,
65
                amount     => $register->outstanding_accountlines->total
66
            }
67
        );
68
    }
69
    else {
70
        for my $register ( $registers->as_list ) {
71
            $register->add_cashup(
63
            $register->add_cashup(
72
                {
64
                {
73
                    manager_id => $logged_in_user->id,
65
                    manager_id => $logged_in_user->id,
Lines 75-80 if ( $op eq 'cashup' ) { Link Here
75
                }
67
                }
76
            );
68
            );
77
        }
69
        }
70
        else {
71
            for my $register ( $registers->as_list ) {
72
                $register->add_cashup(
73
                    {
74
                        manager_id => $logged_in_user->id,
75
                        amount     => $register->outstanding_accountlines->total
76
                    }
77
                );
78
            }
79
        }
80
    }
81
    else {
82
        $template->param( error_cashup_permission => 1 );
78
    }
83
    }
79
}
84
}
80
85
81
- 

Return to bug 26023