From dd5f3701ce670395e7bf7493a99cc36ea480278a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 31 Jan 2024 08:44:24 +0100 Subject: [PATCH] Bug 34478: op modify=>edit_form, add=>add_form - memberentry.pl Bug 34478: TO SQUASH op modify=>edit_form, add=>add_form ( pass opadd to template )- memberentry.pl The template expects opadd when showing the form - along the way it was changed to 'add' and broke new patron entry Bug 34478: TO SQUASH op modify=>edit_form, add=>add_form ( pass op to template )- memberentry.pl Signed-off-by: Jonathan Druart --- .../prog/en/includes/members-toolbar.inc | 4 +- .../prog/en/includes/patron-search.inc | 2 +- .../prog/en/includes/patron-toolbar.inc | 4 +- .../prog/en/includes/patron_messages.inc | 6 +- .../prog/en/modules/members/memberentrygen.tt | 92 +++++++++---------- .../prog/en/modules/members/moremember.tt | 28 +++--- .../modules/reports/guided_reports_start.tt | 2 +- members/memberentry.pl | 30 +++--- t/db_dependent/selenium/basic_workflow.t | 2 +- t/db_dependent/selenium/patrons_search.t | 2 +- 10 files changed, 86 insertions(+), 86 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc index 47a47a3c80..792661e5f3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/members-toolbar.inc @@ -6,12 +6,12 @@ [% USE scalar %]
[% IF CAN_user_borrowers_edit_borrowers %] - Edit + Edit [% END %] [% IF CAN_user_borrowers_edit_borrowers %] [% IF patron.is_adult AND Koha.Preference("borrowerRelationship") %] - Add guarantee + Add guarantee [% END %] Change password Duplicate diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc index a62e5e7270..e11c0cdc34 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc @@ -600,7 +600,7 @@ [% CASE 'add' %] action_node += '' + _("Add") + ''; [% CASE 'edit' %] - action_node += ' ' + _("Edit") + ''; + action_node += ' ' + _("Edit") + ''; [% CASE 'checkout' %] [% IF CAN_user_circulate_circulate_remaining_permissions %] action_node += ' ' + _("Check out") + ''; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc index 8b6abc7bc1..f4c2295483 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron-toolbar.inc @@ -7,14 +7,14 @@
[% IF Koha.Preference('PatronQuickAddFields') || Koha.Preference('BorrowerMandatoryField') %]
[% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc index 910d3883af..8ac6e6a1c2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc @@ -22,7 +22,7 @@
  • Expiration: Patron's card expires on [% patron.dateexpiry | $KohaDates %]. - Renew or Edit details + Renew or Edit details
  • [% END %] @@ -39,7 +39,7 @@ [% IF ( expiry ) %] Patron's card expired on [% expiry | $KohaDates %] [% END %] - Renew or Edit details + Renew or Edit details [% END %] @@ -93,7 +93,7 @@
  • Patron's age is incorrect for their category. Ages allowed are [% age_low | html %]-[% age_high | html %]. - Change category + Change category
  • [% END %] 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 a9315c95ef..14f40da9ef 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt @@ -13,7 +13,7 @@ [% INCLUDE 'doc-head-open.inc' %] [% FILTER collapse %] [% UNLESS blocking_error %] - [% IF ( opadd ) %] + [% IF ( op == 'add_form' ) %] [% t("Add patron") | html %] [% ELSE %] [% t("Modify patron") | html %] @@ -43,7 +43,7 @@ legend:hover { <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> [% END %] [% UNLESS blocking_error %] - [% UNLESS opadd %] + [% UNLESS op == 'add_form' %] [% IF (borrower_data.firstname || borrower_data.surname ) %] [% WRAPPER breadcrumb_item %] <a href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | uri %]"> @@ -54,7 +54,7 @@ legend:hover { [% END %] [% END %] [% WRAPPER breadcrumb_item bc_active= 1 %] - [% IF ( opadd ) %] + [% IF ( op == 'add_form' ) %] <span>Add patron</span> [% ELSE %] <span>Modify patron</span> @@ -79,7 +79,7 @@ legend:hover { [% END %] [% END %] [% END %] - [% IF ( opadd ) %] + [% IF ( op == 'add_form' ) %] <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2"> [% ELSE %] <div class="col-sm-10 col-sm-push-2"> @@ -102,9 +102,9 @@ legend:hover { [% UNLESS ( no_add ) %] <h1> - [% IF ( opadd ) %] + [% IF ( op == 'add_form' ) %] <span>Add patron</span> - [% ELSIF ( opduplicate ) %] + [% ELSIF ( op == 'duplicate' ) %] <span>Duplicate patron</span> [% ELSE %] <span>Modify patron</span> @@ -113,7 +113,7 @@ legend:hover { [% IF patron_category %]([% patron_category.description | html %])[% END %] </h1> - [% IF quickadd && opadd && !check_member %] + [% IF quickadd && op == 'add_form' && !check_member %] <a href="#" class="toggle_quick_add"><i class="fa fa-plus-square"></i> Show full form</a> <a href="#" class="toggle_quick_add" style="display:none"><i class="fa fa-minus-square"></i> Show brief form</a> [% END %] @@ -224,11 +224,11 @@ legend:hover { [% UNLESS ( check_member ) %] <div id="toolbar" class="btn-toolbar"> - [% IF quickadd && opadd %] + [% IF quickadd && op == 'add_form' %] <button class="btn btn-primary toggler" id="save_quick_add" name="save"><i class="fa fa-save"></i> Save</button> [% END %] <button class="btn btn-primary toggler" id="saverecord" name="save" ><i class="fa fa-save"></i> Save</button> - [% IF opadd %] + [% IF op == 'add_form' %] <a class="btn btn-link" href="/cgi-bin/koha/members/member.pl" class="toggler save_entryform"> [% ELSE %] <a class="btn btn-link" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% borrowernumber | html %]"> @@ -247,15 +247,15 @@ legend:hover { <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 %]" /> - <input type="hidden" name="borrowernumber" value="[% borrowernumber | html UNLESS opduplicate %]" /> - <input type="hidden" name="nodouble" value="[% nodouble | html UNLESS opduplicate %]" /> + <input type="hidden" name="borrowernumber" value="[% borrowernumber | html UNLESS op == 'duplicate' %]" /> + <input type="hidden" name="nodouble" value="[% nodouble | html UNLESS op == 'duplicate' %]" /> [% INCLUDE 'csrf-token.inc' %] [% IF ( step ) %] <input type="hidden" name="step" value="[% step | html %]" /> [% END %] - [% IF ( opadd ) %] + [% IF ( op == 'add_form' ) %] <input type="hidden" name="op" value="cud-insert" /> - [% ELSIF ( opduplicate ) %] + [% ELSIF ( op == 'duplicate' ) %] <input type="hidden" name="op" value="cud-insert" /> [% ELSE %] <input type="hidden" name="op" value="cud-save" /> @@ -336,7 +336,7 @@ legend:hover { [% END %] First name: </label> - <input type="text" id="firstname" name="firstname" size="20" value="[% borrower_data.firstname | html UNLESS opduplicate %]" /> + <input type="text" id="firstname" name="firstname" size="20" value="[% borrower_data.firstname | html UNLESS op == 'duplicate' %]" /> [% IF ( mandatoryfirstname ) %] <span class="required">Required</span> [% END %] @@ -351,7 +351,7 @@ legend:hover { [% END %] Middle name: </label> - <input type="text" id="middle_name" name="middle_name" size="20" value="[% borrower_data.middle_name | html UNLESS opduplicate %]" /> + <input type="text" id="middle_name" name="middle_name" size="20" value="[% borrower_data.middle_name | html UNLESS op == 'duplicate' %]" /> [% IF ( mandatorymiddle_name ) %] <span class="required">Required</span> [% END %] @@ -366,7 +366,7 @@ legend:hover { [% END %] Date of birth: </label> - <input type="text" id="dateofbirth" name="dateofbirth" size="20" value="[% borrower_data.dateofbirth | html UNLESS opduplicate %]" class="flatpickr" data-flatpickr-pastinclusive="true" /> + <input type="text" id="dateofbirth" name="dateofbirth" size="20" value="[% borrower_data.dateofbirth | html UNLESS op == 'duplicate' %]" class="flatpickr" data-flatpickr-pastinclusive="true" /> [% IF ( mandatorydateofbirth ) %] <span class="required">Required</span> [% END %] @@ -385,7 +385,7 @@ legend:hover { [% END %] Initials: </label> - <input type="text" id="initials" name="initials" size="20" value="[% borrower_data.initials | html UNLESS opduplicate %]" /> + <input type="text" id="initials" name="initials" size="20" value="[% borrower_data.initials | html UNLESS op == 'duplicate' %]" /> [% IF ( mandatoryinitials ) %] <span class="required">Required</span> [% END %] @@ -400,7 +400,7 @@ legend:hover { [% END %] Pronouns: </label> - <input type="text" id="pronouns" name="pronouns" size="20" value="[% borrower_data.pronouns | html UNLESS opduplicate %]" /> + <input type="text" id="pronouns" name="pronouns" size="20" value="[% borrower_data.pronouns | html UNLESS op == 'duplicate' %]" /> [% IF ( mandatorypronouns ) %] <span class="required">Required</span> [% END %] @@ -416,7 +416,7 @@ legend:hover { [% END %] Other name: </label> - <input type="text" id="othernames" name="othernames" size="20" value="[% borrower_data.othernames | html UNLESS opduplicate %]" /> + <input type="text" id="othernames" name="othernames" size="20" value="[% borrower_data.othernames | html UNLESS op == 'duplicate' %]" /> [% IF ( mandatoryothernames ) %] <span class="required">Required</span> [% END %] @@ -427,7 +427,7 @@ legend:hover { [% UNLESS ( patron_category.category_type == 'I' ) %] [% UNLESS nosex %] <li class="radio"> - [% UNLESS ( opduplicate ) %] + [% UNLESS ( op == 'duplicate' ) %] [% IF ( female ) %] <label for="sex-female"><input type="radio" name="sex" id="sex-female" value="F" checked="checked" /><span class="patronsex-female"> Female</span></label> [% ELSE %] @@ -453,7 +453,7 @@ legend:hover { <label for="sex-male"><span class="patronsex-male">Male </span></label><input type="radio" name="sex" id="sex-male" value="M" /> <label for="sex-other"><span class="patronsex-other">Other </span></label><input type="radio" name="sex" id="sex-other" value="O" /> <label for="sex-none"><span class="patronsex-none">None specified </span></label><input type="radio" name="sex" id="sex-none" value="" checked="checked" /> - [% END # /UNLESS ( opduplicate )%] + [% END # /UNLESS ( op == 'duplicate' )%] </li> [% END # /UNLESS nosex %] [% END # /UNLESS ( I ) %] @@ -1015,7 +1015,7 @@ legend:hover { <label for="yes-autorenew_checkouts"> Allow auto-renewal of items: </label> - [% IF ( borrower_data.autorenew_checkouts || opadd ) %] + [% IF ( borrower_data.autorenew_checkouts || op == 'add_form' ) %] <label for="yes-autorenew_checkouts"> Yes <input type="radio" id="yes-autorenew_checkouts" name="autorenew_checkouts" value="1" checked="checked" /> @@ -1144,8 +1144,8 @@ legend:hover { [% END %] Expiry date (leave blank for auto calc): </label> - [% UNLESS ( opadd ) %] - <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" value="[% borrower_data.dateexpiry | html UNLESS opduplicate %]" class="flatpickr" /> + [% UNLESS ( op == 'add_form' ) %] + <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" value="[% borrower_data.dateexpiry | html UNLESS op == 'duplicate' %]" class="flatpickr" /> [% ELSE %] <input type="text" id="to" name="dateexpiry" maxlength="10" size="10" value="[% borrower_data.dateexpiry | html %]" class="flatpickr" /> [% END %] @@ -1167,7 +1167,7 @@ legend:hover { [% END %] OPAC note: </label> - <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% borrower_data.opacnote | html UNLESS opduplicate %]</textarea> + <textarea id="opacnote" name="opacnote" cols="55" rows="5">[% borrower_data.opacnote | html UNLESS op == 'duplicate' %]</textarea> <div class="hint">This message appears on this patron's user page in the OPAC</div> [% IF ( mandatoryopacnote ) %] <span class="required">Required</span> @@ -1184,7 +1184,7 @@ legend:hover { [% END %] Circulation note: </label> - <textarea id="borrowernotes" name="borrowernotes" cols="55" rows="5">[% borrower_data.borrowernotes | $raw UNLESS opduplicate %]</textarea> + <textarea id="borrowernotes" name="borrowernotes" cols="55" rows="5">[% borrower_data.borrowernotes | $raw UNLESS op == 'duplicate' %]</textarea> <div class="hint">This message displays when checking out to this patron</div> [% IF ( mandatoryborrowernotes ) %] <span class="required">Required</span> @@ -1210,13 +1210,13 @@ legend:hover { </label> [% IF ( NoUpdateLogin ) %] - [% IF ( opduplicate ) %] + [% IF ( op == 'duplicate' ) %] <input type="text" id="userid" name="userid" size="20" disabled="disabled" /> [% ELSE %] <input type="text" id="userid" name="userid" size="20" disabled="disabled" value="[% borrower_data.userid | html %]" /> [% END %] [% ELSE %] - [% IF ( opduplicate ) %] + [% IF ( op == 'duplicate' ) %] <input type="text" id="userid" name="userid" size="20" value="" /> [% ELSE %] <input type="text" id="userid" name="userid" size="20" value="[% borrower_data.userid | html %]" /> @@ -1241,27 +1241,27 @@ legend:hover { [% END %] Password: </label> - [% IF ( opadd ) %] + [% IF ( op == 'add_form' ) %] [% IF ( NoUpdateLogin ) %] - [% IF ( opduplicate ) %] + [% IF ( op == 'duplicate' ) %] <input type="password" id="password" name="password" size="20" disabled="disabled" /> [% ELSE %] <input type="password" id="password" name="password" size="20" disabled="disabled" value="[% borrower_data.password | html %]" /> [% END %] [% ELSE %] - [% IF ( opduplicate ) %] + [% IF ( op == 'duplicate' ) %] <input type="password" id="password" name="password" size="20" autocomplete="new-password" /> [% ELSE %] <input type="password" id="password" name="password" size="20" autocomplete="new-password" value="[% borrower_data.password | html %]" /> [% END %] [% END # /IF ( NoUpdateLogin ) %] - [% ELSE # IF ( opadd ) %] + [% ELSE # IF ( op == 'add_form' ) %] [% IF ( borrower_data.password ) %] [% IF ( NoUpdateLogin ) %] <input type="password" id="password" name="password" size="20" disabled="disabled" value="****" /> [% ELSE %] - [% IF ( opduplicate ) %] + [% IF ( op == 'duplicate' ) %] <input type="password" id="password" name="password" autocomplete="new-password" size="20" /> [% ELSE %] <input type="password" id="password" name="password" size="20" value="****" /> @@ -1274,7 +1274,7 @@ legend:hover { <input type="password" id="password" name="password" size="20" autocomplete="new-password" value="" /> [% END %] [% END # /IF ( password ) %] - [% END # /IF ( opadd ) %] + [% END # /IF ( op == 'add_form' ) %] [% IF ( mandatorypassword ) %] <span class="required">Required</span> [% END %] @@ -1298,26 +1298,26 @@ legend:hover { [% END %] Confirm password: </label> - [% IF ( opadd ) %] + [% IF ( op == 'add_form' ) %] [% IF ( NoUpdateLogin ) %] - [% IF ( opduplicate ) %] + [% IF ( op == 'duplicate' ) %] <input type="password" id="password2" name="password2" size="20" disabled="disabled" /> [% ELSE %] <input type="password" id="password2" name="password2" size="20" disabled="disabled" value="[% borrower_data.password | html %]" /> [% END %] [% ELSE %] - [% IF ( opduplicate ) %] + [% IF ( op == 'duplicate' ) %] <input type="password" id="password2" name="password2" size="20" /> [% ELSE %] <input type="password" id="password2" name="password2" size="20" value="[% borrower_data.password | html %]" /> [% END %] [% END %] - [% ELSE # IF ( opadd ) %] + [% ELSE # IF ( op == 'add_form' ) %] [% IF ( borrower_data.password ) %] [% IF ( NoUpdateLogin ) %] <input type="password" id="password2" name="password2" size="20" disabled="disabled" value="****" /> [% ELSE %] - [% IF ( opduplicate ) %] + [% IF ( op == 'duplicate' ) %] <input type="password" id="password2" name="password2" size="20" /> [% ELSE %] <input type="password" id="password2" name="password2" size="20" value="****" /> @@ -1330,7 +1330,7 @@ legend:hover { <input type="password" id="password2" name="password2" size="20" value="" /> [% END %] [% END %] - [% END # /IF ( opadd ) %] + [% END # /IF ( op == 'add_form' ) %] [% IF ( mandatorypassword ) %] <span class="required">Required</span> @@ -1351,7 +1351,7 @@ legend:hover { [% END # UNLESS nouserid && nopassword && !CanUpdatePasswordExpiration %] <!--this zones are not necessary in modif mode --> - [% UNLESS ( opadd || opduplicate || ( nogonenoaddress && nolost ) ) %] + [% UNLESS ( op == 'add_form' || op == 'duplicate' || ( nogonenoaddress && nolost ) ) %] <fieldset class="rows" id="memberentry_account_flags"> <legend id="account_flags_lgd">Patron account flags</legend> <p>Setting a value here will prevent patron from circulating materials and placing holds on the OPAC</p> @@ -1654,7 +1654,7 @@ legend:hover { [% END # /IF step_5 %] </form> <!-- /#entryform --> - [% IF quickadd && opadd && !check_member %] + [% IF quickadd && op == 'add_form' && !check_member %] <form method="get" id="quick_add_form" class="toggler"> <fieldset class="rows quick_add"><legend>Quick add</legend> <ol id="quick_add_list"> @@ -1667,7 +1667,7 @@ legend:hover { </main> </div> <!-- /.col-sm-10.col-sm-push-2 --> - [% UNLESS ( opadd ) %] + [% UNLESS ( op == 'add_form' ) %] <div class="col-sm-2 col-sm-pull-10"> <aside> [% INCLUDE 'circ-menu.inc' %] @@ -1736,7 +1736,7 @@ legend:hover { $("#memberentry_userid").find('legend').nextAll().toggle(); [% END %] [% END %] - [% UNLESS ( opadd || opduplicate ) %] + [% UNLESS ( op == 'add_form' || op == 'duplicate' ) %] [% IF fieldstohide.match('flags') %] $("#memberentry_account_flags").find('legend').nextAll().toggle(); [% END %] @@ -1863,7 +1863,7 @@ legend:hover { }); $('#duplicate').on('click', function() { - $("input[name='op']").val('modify'); + $("input[name='op']").val('edit_form'); $("input[name='borrowernumber']").val('[% check_member | html %]'); $("input[name='check_member']").val(''); $('#entryform').submit(); @@ -1918,7 +1918,7 @@ legend:hover { }); - [% IF quickadd && opadd && !check_member %] + [% IF quickadd && op == 'add_form' && !check_member %] $(document).ready(function () { $("#entryform,#saverecord").hide(); diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt index feb55effa6..bd98741056 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember.tt @@ -117,9 +117,9 @@ <div class="patroninfo-heading"> <h3>Contact information</h3> [% IF ( guarantor.borrowernumber ) %] - <a class="btn btn-default btn-xs" href="memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]&step=1&guarantorid=[% guarantor.borrowernumber | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> + <a class="btn btn-default btn-xs" href="memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]&step=1&guarantorid=[% guarantor.borrowernumber | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> [% ELSE %] - <a class="btn btn-default btn-xs" href="memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]&step=1"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> + <a class="btn btn-default btn-xs" href="memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]&step=1"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> [% END %] </div> @@ -277,7 +277,7 @@ [% IF ( housebound_role.housebound_chooser == 1 OR housebound_role.housebound_deliverer == 1 ) %] <div class="patroninfo-heading"> <h3>Housebound roles</h3> - <a class="btn btn-default btn-xs" href="memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]&step=7"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> + <a class="btn btn-default btn-xs" href="memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]&step=7"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> </div> <div class="rows"> <ol> @@ -302,7 +302,7 @@ [% ELSE %] <div class="patroninfo-heading"> <h3>Housebound roles</h3> - <a class="btn btn-default btn-xs" href="memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]&step=7"><i class="fa fa-plus"></i> Add</a> + <a class="btn btn-default btn-xs" href="memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]&step=7"><i class="fa fa-plus"></i> Add</a> </div> [% END %] </div> [% #/ div#houseboundroles %] @@ -314,7 +314,7 @@ [% IF ( attributes_loop ) %] <div class="patroninfo-heading"> <h3>Additional attributes and identifiers</h3> - <a class="btn btn-default btn-xs" href="memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]&step=4"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> + <a class="btn btn-default btn-xs" href="memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]&step=4"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> </div> [% FOREACH attribute IN attributes_loop %] [% IF attribute.class %] @@ -338,7 +338,7 @@ [% ELSE %] <div class="patroninfo-heading"> <h3>Additional attributes and identifiers</h3> - <a class="btn btn-default btn-xs" href="memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]&step=4"><i class="fa fa-plus"></i> Add</a> + <a class="btn btn-default btn-xs" href="memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]&step=4"><i class="fa fa-plus"></i> Add</a> </div> [% END %] </div> [% # /div#patron-extended-attributes %] @@ -349,7 +349,7 @@ <div id="patron-messaging-prefs" class="patroninfo-section"> <div class="patroninfo-heading"> <h3>Patron messaging preferences</h3> - <a class="btn btn-default btn-xs" href="memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]&step=5"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> + <a class="btn btn-default btn-xs" href="memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]&step=5"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> </div> [% INCLUDE 'messaging-preference-form.inc' %] [% IF Koha.Preference('SMSSendDriver') %] @@ -379,7 +379,7 @@ <div id="patron-library-details" class="patroninfo-section"> <div class="patroninfo-heading"> <h3>Library use</h3> - <a class="btn btn-default btn-xs" href="memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]&step=3"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> + <a class="btn btn-default btn-xs" href="memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]&step=3"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> </div> <div class="rows"> <ol> @@ -415,12 +415,12 @@ <span class="blocker"> [% patron.dateexpiry | $KohaDates %] <strong><em>Expired</em></strong> - <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]">Edit details</a> + <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]">Edit details</a> </span> [% ELSIF ( patron.is_going_to_expire ) %] [% patron.dateexpiry | $KohaDates %] <strong><em>Patron expires soon</em></strong> - <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]">Edit details</a> + <a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]">Edit details</a> [% ELSE %] [% patron.dateexpiry | $KohaDates %] [% END %] @@ -529,7 +529,7 @@ [% IF ( patron.B_phone || patron.B_email || patron.contactnote || patron.B_address || patron.B_address2 || patron.B_city || patron.B_zipcode || patron.B_country ) %] <div class="patroninfo-heading"> <h3>Alternate address</h3> - <a class="btn btn-default btn-xs" href="memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]&step=6"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> + <a class="btn btn-default btn-xs" href="memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]&step=6"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> </div> <div class="address"> <ul> @@ -563,7 +563,7 @@ [% ELSE %] <div class="patroninfo-heading"> <h3 class="inline">Alternate address</h3> - <a class="btn btn-default btn-xs" href="memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]&step=6"><i class="fa fa-plus"></i> Add</a> + <a class="btn btn-default btn-xs" href="memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]&step=6"><i class="fa fa-plus"></i> Add</a> </div> [% END %] </div> [% # /div#patron-alternate-address %] @@ -572,7 +572,7 @@ [% IF ( patron.altcontactsurname || patron.altcontactfirstname || patron.altcontactaddress1 || patron.altcontactaddress2 || patron.altcontactaddress3 || patron.altcontactstate || patron.altcontactzipcode || patron.altcontactcountry || patron.altcontactphone ) %] <div class="patroninfo-heading"> <h3>Alternative contact</h3> - <a class="btn btn-default btn-xs" href="memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]&step=2"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> + <a class="btn btn-default btn-xs" href="memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]&step=2"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> </div> <div class="rows"> <ol> @@ -636,7 +636,7 @@ [% ELSE %] <div class="patroninfo-heading"> <h3>Alternative contact</h3> - <a class="btn btn-default btn-xs" href="memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | html %]&step=2"><i class="fa fa-plus"></i> Add</a> + <a class="btn btn-default btn-xs" href="memberentry.pl?op=edit_form&borrowernumber=[% patron.borrowernumber | html %]&step=2"><i class="fa fa-plus"></i> Add</a> </div> [% END %] </div> [% # /div#patron-alternative-contact %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index 0cbf7106cf..fa57b9ed3b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -1210,7 +1210,7 @@ <ul class="dropdown-menu pull-right" role="menu"> <li><a target="_blank" href="/cgi-bin/koha/members/moremember.pl?borrowernumber=[% cells.cell | $raw %]"><i class="fa-solid fa-eye"></i> View patron</a></li> <li role="separator" class="divider"></li> - <li><a target="_blank" href="/cgi-bin/koha/members/memberentry.pl?op=add_form&borrowernumber=[% cells.cell | $raw %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit patron</a></li> + <li><a target="_blank" href="/cgi-bin/koha/members/memberentry.pl?op=edit_form&borrowernumber=[% cells.cell | $raw %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit patron</a></li> <li role="separator" class="divider"></li> <li><a target="_blank" href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=[% cells.cell | $raw %]"><i class="fa fa-barcode"></i> Check out</a></li> </ul> diff --git a/members/memberentry.pl b/members/memberentry.pl index 68e1777d99..a076218447 100755 --- a/members/memberentry.pl +++ b/members/memberentry.pl @@ -83,7 +83,7 @@ my $nodouble = $input->param('nodouble'); my $duplicate = $input->param('duplicate'); my $quickadd = $input->param('quickadd'); -$nodouble = 1 if ($op eq 'add_form' or $op eq 'duplicate'); # FIXME hack to represent fact that if we're +$nodouble = 1 if ($op eq 'edit_form' or $op eq 'duplicate'); # FIXME hack to represent fact that if we're # modifying an existing patron, it ipso facto # isn't a duplicate. Marking FIXME because this # script needs to be refactored. @@ -163,11 +163,11 @@ foreach (@field_check) { next unless m/\w/o; $template->param( "no$_" => 1 ); } -$template->param( "cud-add" => 1 ) if ( $op eq 'cud-add' ); +$template->param( "op" => $op ); $template->param( "quickadd" => 1 ) if ( $quickadd ); $template->param( "duplicate" => 1 ) if ( $op eq 'duplicate' ); $template->param( "checked" => 1 ) if ( defined($nodouble) && $nodouble eq 1 ); -if ( $op eq 'add_form' or $op eq 'cud-save' or $op eq 'duplicate' ) { +if ( $op eq 'edit_form' or $op eq 'cud-save' or $op eq 'duplicate' ) { my $logged_in_user = Koha::Patrons->find( $loggedinuser ); output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); @@ -191,7 +191,7 @@ $template->param( patron_category => $category ); # initialize %newdata my %newdata; # comes from $input->param() -if ( $op eq 'cud-insert' || $op eq 'add_form' || $op eq 'cud-save' || $op eq 'duplicate' ) { +if ( $op eq 'cud-insert' || $op eq 'edit_form' || $op eq 'cud-save' || $op eq 'duplicate' ) { my @names = ( $borrower_data && $op ne 'cud-save' ) ? keys %$borrower_data : $input->param(); foreach my $key (@names) { if (defined $input->param($key)) { @@ -400,7 +400,7 @@ elsif ( $borrowernumber ) { $extended_patron_attributes = Koha::Patrons->find($borrowernumber)->extended_attributes->unblessed; } -if ( ($op eq 'add_form' || $op eq 'cud-insert' || $op eq 'cud-save'|| $op eq 'duplicate') and ($step == 0 or $step == 3 )){ +if ( ($op eq 'edit_form' || $op eq 'cud-insert' || $op eq 'cud-save'|| $op eq 'duplicate') and ($step == 0 or $step == 3 )){ unless ($newdata{'dateexpiry'}){ $newdata{'dateexpiry'} = $category->get_expiry_date( $newdata{dateenrolled} ) if $category; } @@ -433,7 +433,7 @@ if ((!$nok) and $nodouble and ($op eq 'cud-insert' or $op eq 'cud-save')){ warn "Patron creation failed! - $@"; # Maybe we must die instead of just warn push @messages, {error => 'error_on_insert_patron'}; } - $op = "cud-add"; + $op = "add_form"; return; }; @@ -527,7 +527,7 @@ if ((!$nok) and $nodouble and ($op eq 'cud-insert' or $op eq 'cud-save')){ warn "Patron modification failed! - $@"; # Maybe we must die instead of just warn push @messages, {error => 'error_on_update_patron'}; } - $op = 'add_form'; + $op = 'edit_form'; }; if ( $success ) { @@ -597,10 +597,10 @@ if ($delete){ } if ($nok or !$nodouble){ - $op = 'cud-add' if ( $op eq 'cud-insert' ); - $op = 'add_form' if ( $op eq 'cud-save' ); + $op = 'add_form' if ( $op eq 'cud-insert' ); + $op = 'edit_form' if ( $op eq 'cud-save' ); %data=%newdata; - $template->param( updtype => ($op eq 'cud-add' ?'I':'M')); # used to check for $op eq "cud-insert"... but we just changed $op! + $template->param( updtype => ($op eq 'add' ?'I':'M')); # used to check for $op eq "cud-insert"... but we just changed $op! unless ($step){ $template->param( step_1 => 1,step_2 => 1,step_3 => 1, step_4 => 1, step_5 => 1, step_6 => 1, step_7 => 1 ); } @@ -619,7 +619,7 @@ if (C4::Context->preference("IndependentBranches")) { my $prefillguarantorfields=C4::Context->preference("PrefillGuaranteeField"); my @prefill_fields=split(/\,/,$prefillguarantorfields); -if ($op eq 'cud-add'){ +if ($op eq 'add_form'){ if ($guarantor_id) { foreach (@prefill_fields) { $newdata{$_} = $guarantor->$_; @@ -627,7 +627,7 @@ if ($op eq 'cud-add'){ } $template->param( updtype => 'I', step_1=>1, step_2=>1, step_3=>1, step_4=>1, step_5 => 1, step_6 => 1, step_7 => 1); } -if ($op eq 'add_form') { +if ($op eq 'edit_form') { $template->param( updtype => 'M',modify => 1 ); $template->param( step_1=>1, step_2=>1, step_3=>1, step_4=>1, step_5 => 1, step_6 => 1, step_7 => 1) unless $step; if ( $step == 4 ) { @@ -708,7 +708,7 @@ if (C4::Context->userenv && C4::Context->userenv->{'branch'}) { $userbranch = C4::Context->userenv->{'branch'}; } -if (defined ($data{'branchcode'}) and ( $op eq 'add_form' || $op eq 'duplicate' || ( $op eq 'cud-add' && $category->category_type eq 'C' ) )) { +if (defined ($data{'branchcode'}) and ( $op eq 'edit_form' || $op eq 'duplicate' || ( $op eq 'add_form' && $category->category_type eq 'C' ) )) { $userbranch = $data{'branchcode'}; } $template->param( userbranch => $userbranch ); @@ -768,7 +768,7 @@ if ( C4::Context->preference('ExtendedPatronAttributes') ) { } if (C4::Context->preference('EnhancedMessagingPreferences')) { - if ($op eq 'cud-add') { + if ($op eq 'add_form') { C4::Form::MessagingPreferences::set_form_values({ categorycode => $categorycode }, $template); } else { C4::Form::MessagingPreferences::set_form_values({ borrowernumber => $borrowernumber }, $template); @@ -787,7 +787,7 @@ $template->param( BorrowerMandatoryField => C4::Context->preference("BorrowerMandatoryField"),#field to test with javascript 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); +); $template->param( patron => $patron ? $patron : \%newdata, # Used by address include templates now diff --git a/t/db_dependent/selenium/basic_workflow.t b/t/db_dependent/selenium/basic_workflow.t index d8a181d15a..03c9f13c9d 100755 --- a/t/db_dependent/selenium/basic_workflow.t +++ b/t/db_dependent/selenium/basic_workflow.t @@ -115,7 +115,7 @@ SKIP: { $driver->find_element('//fieldset[@class="action"]/input[@type="submit"]')->click; time_diff("add patron category"); - $driver->get($base_url.'/members/memberentry.pl?op=add&categorycode='.$sample_data->{category}{categorycode}); + $driver->get($base_url.'/members/memberentry.pl?op=add_form&categorycode='.$sample_data->{category}{categorycode}); like( $driver->get_title(), qr(Add .*$sample_data->{category}{description}), ); $s->fill_form( $sample_data->{patron} ); $driver->find_element('//button[@id="saverecord"]')->click; diff --git a/t/db_dependent/selenium/patrons_search.t b/t/db_dependent/selenium/patrons_search.t index f4f663e918..2bc73fa034 100755 --- a/t/db_dependent/selenium/patrons_search.t +++ b/t/db_dependent/selenium/patrons_search.t @@ -240,7 +240,7 @@ subtest 'Search patrons' => sub { ); $driver->find_element( - '//a[@href="/cgi-bin/koha/members/memberentry.pl?op=add_form&destination=circ&borrowernumber=' + '//a[@href="/cgi-bin/koha/members/memberentry.pl?op=edit_form&destination=circ&borrowernumber=' . $first_patron->borrowernumber . '"]' )->click; is( -- 2.39.5