Browse Source

Bug 13970: Remove category_type related code

Working on bug 13497 and bug 9314, I run into some Koha vestiges.
The category_type parameter should not be passed to memberentry.
On creating a new patron, the categorycode should be passed, and on
editing, it's useless. We can work with the borrowernumber and retrieve
these values.

Details of the changes:
- members-toolbar.inc: Remove the category_type parameter passed to
memberentry.pl
- memberentrygen.tt: Just remove the useless category_type parameter on
  editing a patron. Also remove the unused one passed to
  guarantor_search.pl.
- tables/members_results.tt: the borrowernumber is enough to edit a
  patron.
- memberentry.pl: check_categorytype is never used in the template, all
  the process to calculate/retrieve it is unnecessary.
- members/nl-search.tt: The borrowernumber is enough to edit a patron.

Test plan:
Try to create and edit patrons and verify that
- the guarantor search still work
- the form (memberentry) behave as before

Edit a patron from the nl-search.pl script (Magnus?)

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

On top of 9314 (13497 already pushed)

No evident regressions found, add/edit patron works,
search/set guarantor works.

Cant test nl-patron.pl save for exec it.
prove -v t/NorwegianPatronDB.t runs

No koha-qa errors

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
3.22.x
Jonathan Druart 9 years ago
committed by Tomas Cohen Arazi
parent
commit
c345694808
  1. 22
      koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc
  2. 10
      koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt
  3. 8
      koha-tmpl/intranet-tmpl/prog/en/modules/members/nl-search.tt
  4. 2
      koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt
  5. 9
      members/memberentry.pl

22
koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc

@ -130,30 +130,22 @@ function searchToHold(){
<div id="toolbar" class="btn-toolbar">
[% IF ( CAN_user_borrowers ) %]
[% IF ( category_type ) %]
[% IF ( guarantor ) %]
<a id="editpatron" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;guarantorid=[% guarantorborrowernumber %]&amp;category_type=[% category_type %]">
[% ELSE %]
<a id="editpatron" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;category_type=[% category_type %]">
[% END %]
<i class="icon-pencil"></i> Edit</a>
[% ELSE %] <!-- try with categorycode if no category_type -->
[% IF ( categorycode ) %]
<a id="editpatron" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]"><i class="icon-pencil"></i> Edit</a>
[% ELSE %] <!-- if no categorycode, set category_type to A by default -->
<a id="editpatron" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;category_type=A"><i class="icon-pencil"></i> Edit</a>
[% END %]
[% IF ( guarantor ) %]
<a id="editpatron" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;guarantorid=[% guarantorborrowernumber %]&amp;categorycode=[% categorycode %]">
[% ELSE %]
<a id="editpatron" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]">
[% END %]
<i class="icon-pencil"></i> Edit</a>
[% END %]
[% IF ( CAN_user_borrowers ) %]
[% IF ( adultborrower AND activeBorrowerRelationship ) %]
<a id="addchild" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]&amp;category_type=C"><i class="icon-plus"></i> Add child</a>
<a id="addchild" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=add&amp;guarantorid=[% borrowernumber %]"><i class="icon-plus"></i> Add child</a>
[% END %]
[% IF ( CAN_user_borrowers ) %]
<a id="changepassword" class="btn btn-small" href="/cgi-bin/koha/members/member-password.pl?member=[% borrowernumber %]"><i class="icon-lock"></i> Change password</a>
[% END %]
<a id="duplicate" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=duplicate&amp;borrowernumber=[% borrowernumber %]&amp;category_type=[% category_type %]"><i class="icon-copy"></i>Duplicate</a>
<a id="duplicate" class="btn btn-small" href="/cgi-bin/koha/members/memberentry.pl?op=duplicate&amp;borrowernumber=[% borrowernumber %]&amp;categorycode=[% categorycode %]"><i class="icon-copy"></i>Duplicate</a>
[% END %]
<div class="btn-group">

10
koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt

@ -184,7 +184,11 @@
<div class="dialog alert">
<h3>Duplicate patron record?</h3>
<p><a class="popup" href="javascript:Dopop('moremember.pl?print=brief&amp;borrowernumber=[% check_member %]');" >View existing record</a></p>
<form action="/cgi-bin/koha/members/memberentry.pl" method="get"><input type="hidden" name="op" value="modify" /><input type="hidden" name="borrowernumber" value="[% check_member %]" /><input type="hidden" name="category_type" value="[% check_categorytype %]" /><input class="edit" type="submit" value="It is a duplicate. Edit existing record" /></form>
<form action="/cgi-bin/koha/members/memberentry.pl" method="get">
<input type="hidden" name="op" value="modify" />
<input type="hidden" name="borrowernumber" value="[% check_member %]" />
<input class="edit" type="submit" value="It is a duplicate. Edit existing record" />
</form>
<form name="form_double" action="/cgi-bin/koha/members/memberentry.pl" method="post" autocomplete="off">
<input type="hidden" name="nodouble" value="1" />
@ -459,9 +463,9 @@
<li>
<span class="label">&nbsp;</span>
[% IF ( guarantorid ) %]
<input id="guarantorsearch" type="button" value="Change" onclick="Dopopguarantor('guarantor_search.pl?category_type=[% category_type %]');" />
<input id="guarantorsearch" type="button" value="Change" onclick="Dopopguarantor('guarantor_search.pl');" />
[% ELSE %]
<input id="guarantorsearch" type="button" value="Set to patron" onclick="Dopopguarantor('guarantor_search.pl?category_type=[% category_type %]');" />
<input id="guarantorsearch" type="button" value="Set to patron" onclick="Dopopguarantor('guarantor_search.pl');" />
[% END %]
<input id="guarantordelete" type="button" value="Delete" />
</li>

8
koha-tmpl/intranet-tmpl/prog/en/modules/members/nl-search.tt

@ -32,15 +32,9 @@
<h3>Existing patrons</h3>
<ul>
[% FOREACH patron IN local_result %]
[%# Find the category_type %]
[% FOREACH category IN categories %]
[% IF category.categorycode == patron.categorycode %]
[% patron.category_type = category.category_type %]
[% END %]
[% END %]
<li>[% patron.firstname %] [% patron.surname %] [% patron.cardnumber %] |
<a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% patron.borrowernumber %]">Details</a> |
<a href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=[% patron.borrowernumber %]&category_type=[% patron.category_type %]">Edit</a> |
<a href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=[% patron.borrowernumber %]">Edit</a> |
<a href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% patron.borrowernumber %]">Check out</a>
</li>
[% END %]

2
koha-tmpl/intranet-tmpl/prog/en/modules/members/tables/members_results.tt

@ -28,7 +28,7 @@
"dt_borrowernotes":
"[% data.borrowernotes.replace('\\\\' , '\\\\') |html |html_line_break |collapse %]",
"dt_action":
"[% IF data.category_type %]<a href='/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% data.borrowernumber %]&amp;category_type=[% data.category_type %]'>Edit</a>[% ELSE %][% IF data.categorycode %]<a href='/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% data.borrowernumber %]&amp;categorycode=[% data.categorycode %]'>Edit</a>[% ELSE %]<a href='/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% data.borrowernumber %]&amp;category_type=A'>Edit</a>[% END %][% END %]",
"<a href='/cgi-bin/koha/members/memberentry.pl?op=modify&amp;destination=circ&amp;borrowernumber=[% data.borrowernumber %]'>Edit</a>",
"borrowernumber":
"[% data.borrowernumber %]"
}[% UNLESS loop.last %],[% END %]

9
members/memberentry.pl

@ -90,8 +90,6 @@ my $guarantorinfo = $input->param('guarantorinfo');
my $step = $input->param('step') || 0;
my @errors;
my $default_city;
# $check_categorytype contains the value of duplicate borrowers category type to redirect in good template in step =2
my $check_categorytype=$input->param('check_categorytype');
# NOTE: Alert for ethnicity and ethnotes fields, they are invalid in all borrowers form
my $borrower_data;
my $NoUpdateLogin;
@ -237,12 +235,6 @@ if ( ( $op eq 'insert' ) and !$nodouble ) {
if ( !$check_member ) {
$nodouble = 1;
}
# recover the category type if the borrowers is a doublon
if ($check_category) {
my $tmpborrowercategory = GetBorrowercategory($check_category);
$check_categorytype = $tmpborrowercategory->{'category_type'};
}
}
#recover all data from guarantor address phone ,fax...
@ -711,7 +703,6 @@ $template->param(
borrotitlepopup => $borrotitlepopup,
guarantorinfo => $guarantorinfo,
flagloop => \@flagdata,
check_categorytype =>$check_categorytype,#to recover the category type with checkcategorytype function
category_type =>$category_type,
modify => $modify,
nok => $nok,#flag to konw if an error

Loading…
Cancel
Save