Bugzilla – Attachment 72902 Details for
Bug 12159
Duplicate borrower_add_additional_fields function
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12159: Move borrower_add_additional_fields to Koha::Patron
Bug-12159-Move-borroweraddadditionalfields-to-Koha.patch (text/plain), 4.52 KB, created by
Mark Tompsett
on 2018-03-15 02:09:42 UTC
(
hide
)
Description:
Bug 12159: Move borrower_add_additional_fields to Koha::Patron
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2018-03-15 02:09:42 UTC
Size:
4.52 KB
patch
obsolete
>From f35b120f9bade997d315f76253e0e5b9e55e0ec9 Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Thu, 15 Mar 2018 02:00:23 +0000 >Subject: [PATCH] Bug 12159: Move borrower_add_additional_fields to > Koha::Patron > >The same function was effectively coded twice. >It was removed from members/pay.pl and members/paycollect.pl >and placed in Koha/Patron.pm instead. >--- > Koha/Patron.pm | 29 +++++++++++++++++++++++++++++ > members/pay.pl | 24 +----------------------- > members/paycollect.pl | 21 +-------------------- > 3 files changed, 31 insertions(+), 43 deletions(-) > >diff --git a/Koha/Patron.pm b/Koha/Patron.pm >index d0be998..c2d3fec 100644 >--- a/Koha/Patron.pm >+++ b/Koha/Patron.pm >@@ -831,6 +831,35 @@ sub is_child { > return $self->category->category_type eq 'C' ? 1 : 0; > } > >+=head3 >+ >+foobar >+ >+=cut >+ >+sub borrower_add_additional_fields { >+ my ( $self, $template ) = @_; >+ >+# some borrower info is not returned in the standard call despite being assumed >+# in a number of templates. It should not be the business of this script but in lieu of >+# a revised api here it is ... >+ if ( $self->is_child ) { >+ my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']} ); >+ $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >+ $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >+ } >+ >+ if (C4::Context->preference('ExtendedPatronAttributes')) { >+ my $b_ref = $self->unblessed; >+ $b_ref->{extendedattributes} = GetBorrowerAttributes($self->borrowernumber); >+ $template->param( >+ ExtendedPatronAttributes => 1, >+ ); >+ } >+ >+ return; >+} >+ > =head3 type > > =cut >diff --git a/members/pay.pl b/members/pay.pl >index 05b73e5..624d712 100755 >--- a/members/pay.pl >+++ b/members/pay.pl >@@ -138,7 +138,7 @@ sub add_accounts_to_template { > } > push @accounts, $account_line; > } >- borrower_add_additional_fields($patron->unblessed); >+ $patron->borrower_add_additional_fields($template); > > $template->param( > patron => $patron, >@@ -215,28 +215,6 @@ sub writeoff_all { > return; > } > >-sub borrower_add_additional_fields { >- my $b_ref = shift; >- >-# some borrower info is not returned in the standard call despite being assumed >-# in a number of templates. It should not be the business of this script but in lieu of >-# a revised api here it is ... >- if ( $b_ref->{category_type} eq 'C' ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >- } >- >- if (C4::Context->preference('ExtendedPatronAttributes')) { >- $b_ref->{extendedattributes} = GetBorrowerAttributes($borrowernumber); >- $template->param( >- ExtendedPatronAttributes => 1, >- ); >- } >- >- return; >-} >- > sub payselected { > my @params = @_; > my $amt = 0; >diff --git a/members/paycollect.pl b/members/paycollect.pl >index 7c16a0a..ea96c13 100755 >--- a/members/paycollect.pl >+++ b/members/paycollect.pl >@@ -170,7 +170,7 @@ if ( $total_paid and $total_paid ne '0.00' ) { > $total_paid = '0.00'; #TODO not right with pay_individual > } > >-borrower_add_additional_fields($borrower, $template); >+$patron->borrower_add_additional_fields($template); > > $template->param(%$borrower); > >@@ -184,22 +184,3 @@ $template->param( > ); > > output_html_with_http_headers $input, $cookie, $template->output; >- >-sub borrower_add_additional_fields { >- my ( $b_ref, $template ) = @_; >- >-# some borrower info is not returned in the standard call despite being assumed >-# in a number of templates. It should not be the business of this script but in lieu of >-# a revised api here it is ... >- if ( $b_ref->{category_type} eq 'C' ) { >- my $patron_categories = Koha::Patron::Categories->search_limited({ category_type => 'A' }, {order_by => ['categorycode']}); >- $template->param( 'CATCODE_MULTI' => 1) if $patron_categories->count > 1; >- $template->param( 'catcode' => $patron_categories->next->categorycode ) if $patron_categories->count == 1; >- } >- >- if (C4::Context->preference('ExtendedPatronAttributes')) { >- $b_ref->{extendedattributes} = GetBorrowerAttributes($b_ref->{borrowernumber}); >- } >- >- return; >-} >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12159
:
72902
|
73018
|
73019
|
74781
|
74782
|
74791
|
74792
|
75811
|
75812
|
75822
|
76945
|
76946
|
76947
|
77050
|
77051
|
77052
|
86166
|
86167
|
86168
|
86882
|
86883
|
86884
|
86885