Bugzilla – Attachment 138638 Details for
Bug 30874
Simplify patron category handling in memberentry
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30874: Reduce number of category fetches
Bug-30874-Reduce-number-of-category-fetches.patch (text/plain), 3.28 KB, created by
Marcel de Rooy
on 2022-08-05 06:51:27 UTC
(
hide
)
Description:
Bug 30874: Reduce number of category fetches
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-08-05 06:51:27 UTC
Size:
3.28 KB
patch
obsolete
>From 9f0bf44011c63fa5f745c37d2ddfd8fa3614e59a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 1 Jun 2022 09:59:31 +0200 >Subject: [PATCH] Bug 30874: Reduce number of category fetches >Content-Type: text/plain; charset=utf-8 > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > members/memberentry.pl | 19 +++++++++---------- > 1 file changed, 9 insertions(+), 10 deletions(-) > >diff --git a/members/memberentry.pl b/members/memberentry.pl >index f849986a63..3cb9df80a5 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -177,14 +177,14 @@ if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) { > > my $categorycode = $input->param('categorycode') || $borrower_data->{'categorycode'}; > my $category_type = $input->param('category_type') || ''; >-my $category; >-if ( !$category_type && $categorycode ) { >- $category = Koha::Patron::Categories->find($categorycode); >- $category_type = $category->category_type; >- $template->param( patron_category => $category ); >-} >+ >+my $category = Koha::Patron::Categories->find($categorycode); >+$category_type ||= $category && $category->category_type; >+ > $category_type="A" unless $category_type; # FIXME we should display a error message instead of a 500 error ! > >+$template->param( patron_category => $category ); >+ > # if a add or modify is requested => check validity of data. > %data = %$borrower_data if ($borrower_data); > >@@ -354,8 +354,7 @@ if ($op eq 'save' || $op eq 'insert'){ > if ( $dateofbirth ) { > my $patron = Koha::Patron->new({ dateofbirth => $dateofbirth }); > my $age = $patron->get_age; >- my $borrowercategory = Koha::Patron::Categories->find($categorycode); >- my ($low,$high) = ($borrowercategory->dateofbirthrequired, $borrowercategory->upperagelimit); >+ my ($low,$high) = ($category->dateofbirthrequired, $category->upperagelimit); > if (($high && ($age > $high)) or ($age < $low)) { > push @errors, 'ERROR_age_limitations'; > $template->param( age_low => $low); >@@ -385,7 +384,7 @@ if ($op eq 'save' || $op eq 'insert'){ > push @errors, "ERROR_password_mismatch" if ( $password ne $password2 ); > > if ( $password and $password ne '****' ) { >- my ( $is_valid, $error ) = Koha::AuthUtils::is_password_valid( $password, Koha::Patron::Categories->find($categorycode) ); >+ my ( $is_valid, $error ) = Koha::AuthUtils::is_password_valid( $password, $category ); > unless ( $is_valid ) { > push @errors, 'ERROR_password_too_short' if $error eq 'too_short'; > push @errors, 'ERROR_password_too_weak' if $error eq 'too_weak'; >@@ -823,7 +822,7 @@ if (C4::Context->preference('EnhancedMessagingPreferences')) { > } > > $template->param( borrower_data => \%data ); >-$template->param( "show_guarantor" => $categorycode ? Koha::Patron::Categories->find($categorycode)->can_be_guarantee : 1); # associate with step to know where you are >+$template->param( "show_guarantor" => $category ? $category->can_be_guarantee : 1); # associate with step to know where you are > $template->param( "step_$step" => 1) if $step; # associate with step to know where u are > $template->param( step => $step ) if $step; # associate with step to know where u are > >-- >2.20.1
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 30874
:
135524
|
135525
|
135526
|
135527
|
135528
|
135529
|
138443
|
138444
|
138445
|
138446
|
138447
|
138545
|
138546
|
138547
|
138548
|
138549
|
138637
| 138638 |
138639
|
138640
|
138641