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

(-)a/Koha/Template/Plugin/Registers.pm (-2 / +6 lines)
Lines 44-50 sub session_register_name { Link Here
44
=head2
44
=head2
45
45
46
    [% SET registers = Registers.all() %]
46
    [% SET registers = Registers.all() %]
47
    [% SET registers = Registers.all( { branch => branchcode } );
47
    [% SET registers = Registers.all( { filters => { current_branch => 1 } } );
48
48
49
Returns a list of all cash registers available that adhere to the passed filters.
49
Returns a list of all cash registers available that adhere to the passed filters.
50
50
Lines 53-59 Returns a list of all cash registers available that adhere to the passed filters Link Here
53
sub all {
53
sub all {
54
    my ( $self, $params ) = @_;
54
    my ( $self, $params ) = @_;
55
55
56
    my $registers = Koha::Cash::Registers->search()->unblessed();
56
    my $filters = $params->{filters};
57
    my $where;
58
    $where->{branch} = C4::Context->userenv->{'branch'}
59
      if $filters->{current_branch};
60
    my $registers = Koha::Cash::Registers->search($where)->unblessed();
57
    for my $register ( @{$registers} ) {
61
    for my $register ( @{$registers} ) {
58
        $register->{selected} = ( defined( $self->session_register )
62
        $register->{selected} = ( defined( $self->session_register )
59
              && $register->{id} == $self->session_register ) ? 1 : 0;
63
              && $register->{id} == $self->session_register ) ? 1 : 0;
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc (-1 / +1 lines)
Lines 12-18 Link Here
12
    <!-- <option hidden disabled selected value> -- select an option -- </option> -->
12
    <!-- <option hidden disabled selected value> -- select an option -- </option> -->
13
    <option id="noregister"[% IF register_required %] disabled selected [% END %] value="">-- None --</option>
13
    <option id="noregister"[% IF register_required %] disabled selected [% END %] value="">-- None --</option>
14
    [% FOREACH r IN registers %]
14
    [% FOREACH r IN registers %]
15
        [% IF r.branch == branch %]
15
        [% IF r.branch == Branches.GetLoggedInBranchcode %]
16
            [% IF r.selected %]
16
            [% IF r.selected %]
17
                <option class="[% r.branch | html %] [% IF r.branch_default %]default[% END %]" value="[% r.id | html %]" selected="selected">[% r.name | html %]</option>
17
                <option class="[% r.branch | html %] [% IF r.branch_default %]default[% END %]" value="[% r.id | html %]" selected="selected">[% r.name | html %]</option>
18
            [% ELSE %]
18
            [% ELSE %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt (-20 / +10 lines)
Lines 2-12 Link Here
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Koha %]
3
[% USE Koha %]
4
[% USE Branches %]
4
[% USE Branches %]
5
[% USE Registers %]
5
[% USE Price %]
6
[% USE Price %]
6
[% SET footerjs = 1 %]
7
[% SET footerjs = 1 %]
7
[% PROCESS 'payments.inc' %]
8
[% PROCESS 'payments.inc' %]
8
[% PROCESS 'accounts.inc' %]
9
[% PROCESS 'accounts.inc' %]
9
[% INCLUDE 'doc-head-open.inc' %]
10
[% INCLUDE 'doc-head-open.inc' %]
11
[% SET registers = Registers.all( filters => { current_branch => 1 } ) %]
10
<title>Koha &rsaquo; Patrons &rsaquo;
12
<title>Koha &rsaquo; Patrons &rsaquo;
11
    [% IF type == 'WRITEOFF' %]
13
    [% IF type == 'WRITEOFF' %]
12
        Write off an amount for [% patron.firstname | html %] [% patron.surname | html %]
14
        Write off an amount for [% patron.firstname | html %] [% patron.surname | html %]
Lines 73-79 Link Here
73
[% END %]
75
[% END %]
74
76
75
[% IF ( pay_individual ) %]
77
[% IF ( pay_individual ) %]
76
    [% IF ( error_registers ) %]
78
    [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
77
    <div id="error_message" class="dialog alert">
79
    <div id="error_message" class="dialog alert">
78
        You must have at least one cash register associated with this branch before you can record payments.
80
        You must have at least one cash register associated with this branch before you can record payments.
79
    </div>
81
    </div>
Lines 135-149 Link Here
135
137
136
    [% IF Koha.Preference('UseCashRegisters') %]
138
    [% IF Koha.Preference('UseCashRegisters') %]
137
    <li>
139
    <li>
138
        <label for="cash_register">Cash register: </label>
140
        <label for="registerid">Cash register: </label>
139
        <select name="cash_register" id="cash_register">
141
        <select name="registerid" id="registerid">
140
            [% FOREACH register IN registers %]
142
            [% PROCESS options_for_registers register_required => 1 %]
141
              [% IF register.id == registerid %]
142
            <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
143
              [% ELSE %]
144
            <option value="[% register.id | html %]">[% register.name | html %]</option>
145
              [% END %]
146
            [% END %]
147
        </select>
143
        </select>
148
    </li>
144
    </li>
149
    [% END %]
145
    [% END %]
Lines 204-210 Link Here
204
        </div>
200
        </div>
205
    </form>
201
    </form>
206
[% ELSE %]
202
[% ELSE %]
207
    [% IF ( error_registers && type != 'writeoff' ) %]
203
    [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) && ( type != 'writeoff' ) %]
208
    <div id="error_message" class="dialog alert">
204
    <div id="error_message" class="dialog alert">
209
        You must have at least one cash register associated with this branch before you can record payments.
205
        You must have at least one cash register associated with this branch before you can record payments.
210
    </div>
206
    </div>
Lines 256-270 Link Here
256
252
257
    [% IF Koha.Preference('UseCashRegisters') %]
253
    [% IF Koha.Preference('UseCashRegisters') %]
258
    <li>
254
    <li>
259
        <label for="cash_register">Cash register: </label>
255
        <label for="registerid">Cash register: </label>
260
        <select name="cash_register" id="cash_register">
256
        <select name="registerid" id="registerid">
261
            [% FOREACH register IN registers %]
257
            [% PROCESS options_for_registers register_required => 1 %]
262
              [% IF register.id == registerid %]
263
            <option value="[% register.id | html %]" selected="selected">[% register.name | html %]</option>
264
              [% ELSE %]
265
            <option value="[% register.id | html %]">[% register.name | html %]</option>
266
              [% END %]
267
            [% END %]
268
        </select>
258
        </select>
269
    </li>
259
    </li>
270
    [% END %]
260
    [% END %]
(-)a/members/paycollect.pl (-28 / +1 lines)
Lines 78-110 my $payment_note = uri_unescape scalar $input->param('payment_note'); Link Here
78
my $payment_type = scalar $input->param('payment_type');
78
my $payment_type = scalar $input->param('payment_type');
79
my $accountlines_id;
79
my $accountlines_id;
80
80
81
my $registerid;
81
my $registerid = $input->param('registerid');
82
if ( C4::Context->preference('UseCashRegisters') ) {
83
    $registerid = $input->param('registerid');
84
    my $registers  = Koha::Cash::Registers->search(
85
        { branch   => $library_id, archived => 0 },
86
        { order_by => { '-asc' => 'name' } }
87
    );
88
89
    if ( !$registers->count ) {
90
        $template->param( error_registers => 1 );
91
    }
92
    else {
93
94
        if ( !$registerid ) {
95
            my $default_register = Koha::Cash::Registers->find(
96
                { branch => $library_id, branch_default => 1 } );
97
            $registerid = $default_register->id if $default_register;
98
        }
99
        $registerid = $registers->next->id if !$registerid;
100
101
        $template->param(
102
            registerid => $registerid,
103
            registers  => $registers,
104
        );
105
    }
106
}
107
108
if ( $pay_individual || $writeoff_individual ) {
82
if ( $pay_individual || $writeoff_individual ) {
109
    if ($pay_individual) {
83
    if ($pay_individual) {
110
        $template->param( pay_individual => 1 );
84
        $template->param( pay_individual => 1 );
111
- 

Return to bug 24786