Bugzilla – Attachment 138641 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: Remove category_type
Bug-30874-Remove-categorytype.patch (text/plain), 10.19 KB, created by
Marcel de Rooy
on 2022-08-05 06:51:39 UTC
(
hide
)
Description:
Bug 30874: Remove category_type
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-08-05 06:51:39 UTC
Size:
10.19 KB
patch
obsolete
>From cb580aa60bc9e91777d644ce2110da4f8ab552d6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 1 Jun 2022 10:28:20 +0200 >Subject: [PATCH] Bug 30874: Remove category_type >Content-Type: text/plain; charset=utf-8 > >In which case do we pass category_type to this script? Am I missing >something? > >Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > .../prog/en/modules/members/memberentrygen.tt | 15 +++++++-------- > members/memberentry.pl | 19 ++++--------------- > 2 files changed, 11 insertions(+), 23 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >index fa3b4b88dd..9eb5f1605a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -242,7 +242,6 @@ legend:hover { > [% END %] > <!-- field always hidden in different form (1,2,3) --> > <input type="hidden" name="BorrowerMandatoryField" value="[% BorrowerMandatoryField | html %]" /> >- <input type="hidden" name="category_type" value="[% category_type | html %]" /> > <input type="hidden" name="updtype" value="[% updtype | html %]" /> > <input type="hidden" name="destination" value="[% destination | html %]" /> > <input type="hidden" name="check_member" value="[% check_member | html %]" /> >@@ -269,9 +268,9 @@ legend:hover { > [% IF ( step_1 ) %] > [% UNLESS notitle && nosurname && nofirstname && nomiddle_name && nodateofbirth && noinitials && noothernames &&nosex %] > <fieldset class="rows" id="memberentry_identity"> >- <legend id="identity_lgd">[% IF ( I ) %]<span>Organization</span> [% ELSE %]<span>Patron</span> [% END %]<span>identity</span></legend> >+ <legend id="identity_lgd">[% IF ( patron_category.category_type == 'I' ) %]<span>Organization</span> [% ELSE %]<span>Patron</span> [% END %]<span>identity</span></legend> > <ol> >- [% UNLESS ( I ) %] >+ [% UNLESS ( patron_category.category_type == 'I' ) %] > [% UNLESS notitle %] > [% IF Koha.Preference('BorrowersTitles') %] > <li> >@@ -301,7 +300,7 @@ legend:hover { > > [% UNLESS nosurname %] > <li> >- [% IF ( I ) %] >+ [% IF ( patron_category.category_type == 'I' ) %] > <label for="surname" class="required"> > Name: > </label> >@@ -325,7 +324,7 @@ legend:hover { > </li> > [% END # /UNLESS nosurname %] > >- [% UNLESS ( I ) %] >+ [% UNLESS ( patron_category.category_type == 'I' ) %] > [% UNLESS nofirstname %] > <li> > [% IF ( mandatoryfirstname ) %] >@@ -404,11 +403,11 @@ legend:hover { > [% IF ( mandatoryothernames ) %] > <span class="required">Required</span> > [% END %] >- [% IF ( I ) %]<input type="hidden" name="sex" value="N" />[% END %] >+ [% IF ( patron_category.category_type == 'I' ) %]<input type="hidden" name="sex" value="N" />[% END %] > </li> > [% END #/UNLESS noothernames %] > >- [% UNLESS ( I ) %] >+ [% UNLESS ( patron_category.category_type == 'I' ) %] > [% UNLESS nosex %] > <li class="radio"> > [% UNLESS ( opduplicate ) %] >@@ -455,7 +454,7 @@ legend:hover { > [% FOREACH r IN relationships %] > <fieldset> > <ol> >- [% IF category_type == 'I' %] >+ [% IF patron_category.category_type == 'I' %] > <li class="guarantor-details" data-borrowernumber="[% r.guarantor_id | $raw %]"> > <span class="label">Organization:</span> > [% INCLUDE 'patron-title.inc' patron=r.guarantor hide_patron_infos_if_needed=1 %] >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 7703edfa08..ee44ea6874 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -172,17 +172,10 @@ if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) { > } > > $borrower_data = $patron->unblessed; >- $borrower_data->{category_type} = $patron->category->category_type; > } > > my $categorycode = $input->param('categorycode') || $borrower_data->{'categorycode'}; >-my $category_type = $input->param('category_type') || ''; >- > 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. >@@ -212,7 +205,7 @@ if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) > } > > # check permission to modify login info. >- if (ref($borrower_data) && ($borrower_data->{'category_type'} eq 'S') && ! (C4::Auth::haspermission($userenv->{'id'},{'staffaccess'=>1})) ) { >+ if (ref($borrower_data) && ($category->category_type eq 'S') && ! (C4::Auth::haspermission($userenv->{'id'},{'staffaccess'=>1})) ) { > $NoUpdateLogin = 1; > } > } >@@ -222,7 +215,6 @@ if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' ) > my @keys_to_delete = ( > qr/^(borrowernumber|date_renewed|debarred|debarredcomment|flags|privacy|updated_on|lastseen|login_attempts|overdrive_auth_token|anonymized)$/, # Bug 28935 > qr/^BorrowerMandatoryField$/, >- qr/^category_type$/, > qr/^check_member$/, > qr/^destination$/, > qr/^nodouble$/, >@@ -297,14 +289,14 @@ $newdata{'lang'} = $input->param('lang') if defined($input->param('lang')) > if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ && !defined $data{'userid'} ) { > my $fake_patron = Koha::Patron->new; > $fake_patron->userid($patron->userid) if $patron; # editing >- if ( ( defined $newdata{'firstname'} || $category_type eq 'I' ) && ( defined $newdata{'surname'} ) ) { >+ if ( ( defined $newdata{'firstname'} || $category->category_type eq 'I' ) && ( defined $newdata{'surname'} ) ) { > # Full page edit, firstname and surname input zones are present > $fake_patron->firstname($newdata{firstname}); > $fake_patron->surname($newdata{surname}); > $fake_patron->generate_userid; > $newdata{'userid'} = $fake_patron->userid; > } >- elsif ( ( defined $data{'firstname'} || $category_type eq 'I' ) && ( defined $data{'surname'} ) ) { >+ elsif ( ( defined $data{'firstname'} || $category->category_type eq 'I' ) && ( defined $data{'surname'} ) ) { > # Partial page edit (access through "Details"/"Library details" tab), firstname and surname input zones are not used > # Still, if the userid field is erased, we can create a new userid with available firstname and surname > # FIXME clean thiscode newdata vs data is very confusing >@@ -738,7 +730,7 @@ if (C4::Context->userenv && C4::Context->userenv->{'branch'}) { > $userbranch = C4::Context->userenv->{'branch'}; > } > >-if (defined ($data{'branchcode'}) and ( $op eq 'modify' || $op eq 'duplicate' || ( $op eq 'add' && $category_type eq 'C' ) )) { >+if (defined ($data{'branchcode'}) and ( $op eq 'modify' || $op eq 'duplicate' || ( $op eq 'add' && $category->category_type eq 'C' ) )) { > $userbranch = $data{'branchcode'}; > } > $template->param( userbranch => $userbranch ); >@@ -809,8 +801,6 @@ $template->param( step => $step ) if $step; # associate with step to know wh > > $template->param( > BorrowerMandatoryField => C4::Context->preference("BorrowerMandatoryField"),#field to test with javascript >- category_type => $category_type,#to know the category type of the borrower >- "$category_type" => 1,# associate with step to know where u are > destination => $destination,#to know where u come from and where u must go in redirect > check_member => $check_member,#to know if the borrower already exist(=>1) or not (=>0) > "op$op" => 1); >@@ -822,7 +812,6 @@ $template->param( > relshiploop => \@relshipdata, > btitle=> $default_borrowertitle, > flagloop => \@flagdata, >- category_type =>$category_type, > modify => $modify, > nok => $nok,#flag to know if an error > NoUpdateLogin => $NoUpdateLogin, >-- >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