Bug 34478: op=modify should be op=add_form - memberentry.pl
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
fc781b238e
commit
6870eb5329
|
|
@ -6,7 +6,7 @@
|
|||
[% USE scalar %]
|
||||
<div id="toolbar" class="btn-toolbar">
|
||||
[% IF CAN_user_borrowers_edit_borrowers %]
|
||||
<a id="editpatron" class="btn btn-default" href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=[% patron.borrowernumber | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
|
||||
<a id="editpatron" class="btn btn-default" href="/cgi-bin/koha/members/memberentry.pl?op=add_form&destination=circ&borrowernumber=[% patron.borrowernumber | html %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a>
|
||||
[% END %]
|
||||
|
||||
[% IF CAN_user_borrowers_edit_borrowers %]
|
||||
|
|
|
|||
|
|
@ -600,7 +600,7 @@
|
|||
[% CASE 'add' %]
|
||||
action_node += '<a href="#" class="btn btn-default btn-xs add_user" data-borrowernumber="' + patron_id + '">' + _("Add") + '</a>';
|
||||
[% CASE 'edit' %]
|
||||
action_node += '<a href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=' + patron_id + '" class="btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + _("Edit") + '</a>';
|
||||
action_node += '<a href="/cgi-bin/koha/members/memberentry.pl?op=add_form&destination=circ&borrowernumber=' + patron_id + '" class="btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> ' + _("Edit") + '</a>';
|
||||
[% CASE 'checkout' %]
|
||||
[% IF CAN_user_circulate_circulate_remaining_permissions %]
|
||||
action_node += '<a class="btn btn-default btn-xs" href="/cgi-bin/koha/circ/circulation.pl?borrowernumber=' + patron_id + '"><i class="fa fa-barcode"></i> ' + _("Check out") + '</a>';
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
<li class="warndeparture">
|
||||
<span class="circ-hlt">Expiration:</span>
|
||||
<span>Patron's card expires on [% patron.dateexpiry | $KohaDates %].</span>
|
||||
<a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&destination=circ&reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=[% patron.borrowernumber | html %]">Edit details</a>
|
||||
<a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&destination=circ&reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=add_form&destination=circ&borrowernumber=[% patron.borrowernumber | html %]">Edit details</a>
|
||||
</li>
|
||||
[% END %]
|
||||
|
||||
|
|
@ -39,7 +39,7 @@
|
|||
[% IF ( expiry ) %]
|
||||
<span>Patron's card expired on [% expiry | $KohaDates %]</span>
|
||||
[% END %]
|
||||
<a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&destination=circ&reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber=[% patron.borrowernumber | html %]">Edit details</a>
|
||||
<a href="/cgi-bin/koha/members/setstatus.pl?borrowernumber=[% patron.borrowernumber | uri %]&destination=circ&reregistration=y">Renew</a> or <a href="/cgi-bin/koha/members/memberentry.pl?op=add_form&destination=circ&borrowernumber=[% patron.borrowernumber | html %]">Edit details</a>
|
||||
</li>
|
||||
[% END %]
|
||||
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
<li class="invalid_age">
|
||||
<span class="circ-hlt">Patron's age is incorrect for their category.</span>
|
||||
Ages allowed are [% age_low | html %]-[% age_high | html %].
|
||||
<a href="/cgi-bin/koha/members/memberentry.pl?op=modify&borrowernumber=[% patron.borrowernumber | uri %]&step=3" class="btn btn-default btn-xs">Change category</a>
|
||||
<a href="/cgi-bin/koha/members/memberentry.pl?op=add_form&borrowernumber=[% patron.borrowernumber | uri %]&step=3" class="btn btn-default btn-xs">Change category</a>
|
||||
</li>
|
||||
[% END %]
|
||||
|
||||
|
|
|
|||
|
|
@ -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=modify&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=add_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=modify&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=add_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=modify&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=add_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=modify&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=add_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=modify&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=add_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=modify&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=add_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=modify&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=add_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=modify&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=add_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=modify&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=add_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=modify&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=add_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=modify&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=add_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=modify&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=add_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=modify&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=add_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=modify&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=add_form&borrowernumber=[% patron.borrowernumber | html %]&step=2"><i class="fa fa-plus"></i> Add</a>
|
||||
</div>
|
||||
[% END %]
|
||||
</div> [% # /div#patron-alternative-contact %]
|
||||
|
|
|
|||
|
|
@ -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=modify&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=add_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>
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ my $nodouble = $input->param('nodouble');
|
|||
my $duplicate = $input->param('duplicate');
|
||||
my $quickadd = $input->param('quickadd');
|
||||
|
||||
$nodouble = 1 if ($op eq 'modify' or $op eq 'duplicate'); # FIXME hack to represent fact that if we're
|
||||
$nodouble = 1 if ($op eq 'add_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.
|
||||
|
|
@ -167,7 +167,7 @@ $template->param( "cud-add" => 1 ) if ( $op eq 'cud-add' );
|
|||
$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 'modify' or $op eq 'cud-save' or $op eq 'duplicate' ) {
|
||||
if ( $op eq 'add_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 'modify' || $op eq 'cud-save' || $op eq 'duplicate' ) {
|
||||
if ( $op eq 'cud-insert' || $op eq 'add_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 'modify' || $op eq 'cud-insert' || $op eq 'cud-save'|| $op eq 'duplicate') and ($step == 0 or $step == 3 )){
|
||||
if ( ($op eq 'add_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;
|
||||
}
|
||||
|
|
@ -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 = "modify";
|
||||
$op = 'add_form';
|
||||
};
|
||||
|
||||
if ( $success ) {
|
||||
|
|
@ -597,8 +597,8 @@ if ($delete){
|
|||
}
|
||||
|
||||
if ($nok or !$nodouble){
|
||||
$op="cud-add" if ($op eq "cud-insert");
|
||||
$op="modify" if ($op eq "cud-save");
|
||||
$op = 'cud-add' if ( $op eq 'cud-insert' );
|
||||
$op = 'add_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!
|
||||
unless ($step){
|
||||
|
|
@ -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 "modify") {
|
||||
if ($op eq 'add_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 'modify' || $op eq 'duplicate' || ( $op eq 'cud-add' && $category->category_type eq 'C' ) )) {
|
||||
if (defined ($data{'branchcode'}) and ( $op eq 'add_form' || $op eq 'duplicate' || ( $op eq 'cud-add' && $category->category_type eq 'C' ) )) {
|
||||
$userbranch = $data{'branchcode'};
|
||||
}
|
||||
$template->param( userbranch => $userbranch );
|
||||
|
|
|
|||
|
|
@ -240,7 +240,7 @@ subtest 'Search patrons' => sub {
|
|||
);
|
||||
|
||||
$driver->find_element(
|
||||
'//a[@href="/cgi-bin/koha/members/memberentry.pl?op=modify&destination=circ&borrowernumber='
|
||||
'//a[@href="/cgi-bin/koha/members/memberentry.pl?op=add_form&destination=circ&borrowernumber='
|
||||
. $first_patron->borrowernumber
|
||||
. '"]' )->click;
|
||||
is(
|
||||
|
|
|
|||
Loading…
Reference in New Issue