@@ -, +, @@
---
Koha/Template/Plugin/Registers.pm | 8 +++--
.../prog/en/includes/html_helpers.inc | 2 +-
.../prog/en/modules/members/paycollect.tt | 30 +++++++------------
members/paycollect.pl | 28 +----------------
4 files changed, 18 insertions(+), 50 deletions(-)
--- a/Koha/Template/Plugin/Registers.pm
+++ a/Koha/Template/Plugin/Registers.pm
@@ -44,7 +44,7 @@ sub session_register_name {
=head2
[% SET registers = Registers.all() %]
- [% SET registers = Registers.all( { branch => branchcode } );
+ [% SET registers = Registers.all( { filters => { current_branch => 1 } } );
Returns a list of all cash registers available that adhere to the passed filters.
@@ -53,7 +53,11 @@ Returns a list of all cash registers available that adhere to the passed filters
sub all {
my ( $self, $params ) = @_;
- my $registers = Koha::Cash::Registers->search()->unblessed();
+ my $filters = $params->{filters};
+ my $where;
+ $where->{branch} = C4::Context->userenv->{'branch'}
+ if $filters->{current_branch};
+ my $registers = Koha::Cash::Registers->search($where)->unblessed();
for my $register ( @{$registers} ) {
$register->{selected} = ( defined( $self->session_register_id )
&& $register->{id} == $self->session_register_id ) ? 1 : 0;
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc
+++ a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc
@@ -27,7 +27,7 @@
[% FOREACH r IN registers %]
- [% IF r.branch == branch %]
+ [% IF r.branch == Branches.GetLoggedInBranchcode %]
[% IF r.selected %]
[% ELSE %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/members/paycollect.tt
@@ -2,11 +2,13 @@
[% USE Asset %]
[% USE Koha %]
[% USE Branches %]
+[% USE Registers %]
[% USE Price %]
[% SET footerjs = 1 %]
[% PROCESS 'payments.inc' %]
[% PROCESS 'accounts.inc' %]
[% INCLUDE 'doc-head-open.inc' %]
+[% SET registers = Registers.all( filters => { current_branch => 1 } ) %]
Koha › Patrons ›
[% IF type == 'WRITEOFF' %]
Write off an amount for [% patron.firstname | html %] [% patron.surname | html %]
@@ -73,7 +75,7 @@
[% END %]
[% IF ( pay_individual ) %]
- [% IF ( error_registers ) %]
+ [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) %]
You must have at least one cash register associated with this branch before you can record payments.
@@ -140,15 +142,9 @@
[% IF Koha.Preference('UseCashRegisters') %]
-
-
[% END %]
@@ -214,7 +210,7 @@
[% ELSE %]
- [% IF ( error_registers && type != 'writeoff' ) %]
+ [% IF Koha.Preference('UseCashRegisters') && ( registers.size == 0 ) && ( type != 'writeoff' ) %]
You must have at least one cash register associated with this branch before you can record payments.
@@ -278,15 +274,9 @@
[% IF Koha.Preference('UseCashRegisters') %]
-
-
- [% FOREACH register IN registers %]
- [% IF register.id == registerid %]
-
- [% ELSE %]
-
- [% END %]
- [% END %]
+
+
+ [% PROCESS options_for_registers register_required => 1 %]