Bugzilla – Attachment 58173 Details for
Bug 6782
Move auto member cardnumber generation to occur when record is "Saved" (avoid collisions)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6782 - Move auto member cardnumber generation to occur when record is "Saved" (avoid collisions).
Bug-6782---Move-auto-member-cardnumber-generation-.patch (text/plain), 6.37 KB, created by
Jonathan Druart
on 2016-12-14 12:43:36 UTC
(
hide
)
Description:
Bug 6782 - Move auto member cardnumber generation to occur when record is "Saved" (avoid collisions).
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2016-12-14 12:43:36 UTC
Size:
6.37 KB
patch
obsolete
>From 69c447b8261082d0bcb126752207559cc92f1f38 Mon Sep 17 00:00:00 2001 >From: "Meenakshi.R" <meenakshi.r@osslabs.biz> >Date: Wed, 6 Jun 2012 16:46:15 +0530 >Subject: [PATCH] Bug 6782 - Move auto member cardnumber generation to occur > when record is "Saved" (avoid collisions). >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >Currently the card number is generated when the user enters the patron creation form. This creates a problem of concurrency - when two or more simulataneous users are registering members, the error "card no. in use" can occur. > >This change moves the card number generation to occur after the "Save" button is pressed. > >Changes: >-C4/Members.pm: >Added code to fixup_cardnumber,If the cardnumber is blank and "autoMemberNum" ON. >-koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt: >Added code to display "leave blank for auto calc during registration" in cardnumber label in patron registration form only if "autoMemberNum" ON. >-members/memberentry.pl: >Added code to get weather or not "autoMemberNum" is on or off and removed fixup_cardnumber generation. > >Test cases: >-If "autoMemberNum" ON: >->In blank case, must generate auto card number in simulataneous users. >->If user entered, check for unique card number. > >-If "autoMemberNum" OFF: >Must work normal. > >Followed test plan, works as expected. >Note: Syspref PorrowerMandatoryField must not include cardnumber, otherwise > you can not save. Maybe that should be mentioned in the comment for > syspref autoMemberNum. >Signed-off-by: Marc Véron <veron@veron.ch> >--- > C4/Members.pm | 6 ++++++ > .../prog/en/modules/members/memberentrygen.tt | 16 ++++++++++------ > members/memberentry.pl | 7 ++++++- > 3 files changed, 22 insertions(+), 7 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 57d1fbd..f17b4c1 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -604,6 +604,12 @@ sub AddMember { > $data{'dateenrolled'} = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ); > } > >+ if ( C4::Context->preference("autoMemberNum") ) { >+ if ( not exists $data{cardnumber} or not defined $data{cardnumber} or $data{cardnumber} eq '' ) { >+ $data{cardnumber} = fixup_cardnumber( $data{cardnumber}, C4::Context->userenv->{'branch'}, $data{categorycode} ); >+ } >+ } >+ > my $patron_category = $schema->resultset('Category')->find( $data{'categorycode'} ); > $data{'privacy'} = > $patron_category->default_privacy() eq 'default' ? 1 >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 a66826d..54fd902 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -600,27 +600,31 @@ $(document).ready(function() { > <legend id="library_management_lgd">Library management</legend><ol> > [% UNLESS nocardnumber %] > <li> >- [% IF ( mandatorycardnumber ) %] >+ [% IF mandatorycardnumber and not Koha.Preference('autoMemberNum') %] > <label for="cardnumber" class="required"> > [% ELSE %] > <label for="cardnumber" class="validated"> > [% END %] >- Card number: </label> >+ [% IF Koha.Preference('autoMemberNum') %] >+ Card number<br>(<u>leave blank for auto calc during registration</u>): </label> >+ [% ELSE %] >+ Card number: </label> >+ [% END %] > [% IF minlength_cardnumber == maxlength_cardnumber %] > <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" minlength="[% minlength_cardnumber %]" maxlength="[% maxlength_cardnumber %]" /> >- [% IF ( mandatorycardnumber ) %]<span class="required">Required</span>[% END %] >+ [% IF mandatorycardnumber and not Koha.Preference('autoMemberNum') %]<span class="required">Required</span>[% END %] > <div class="hint">Card number must be exactly [% minlength_cardnumber %] characters.</div> > [% ELSIF minlength_cardnumber && maxlength_cardnumber %] > <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" minlength="[% minlength_cardnumber %]" maxlength="[% maxlength_cardnumber %]" /> >- [% IF ( mandatorycardnumber ) %]<span class="required">Required</span>[% END %] >+ [% IF mandatorycardnumber and not Koha.Preference('autoMemberNum') %]<span class="required">Required</span>[% END %] > <div class="hint">Card number must be between [% minlength_cardnumber %] and [% maxlength_cardnumber %] characters.</div> > [% ELSIF maxlength_cardnumber %] > <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" maxlength="[% maxlength_cardnumber %]" /> >- [% IF ( mandatorycardnumber ) %]<span class="required">Required</span>[% END %] >+ [% IF mandatorycardnumber and not Koha.Preference('autoMemberNum') %]<span class="required">Required</span>[% END %] > <div class="hint">Card number can be up to [% maxlength_cardnumber %] characters.</div> > [% ELSE %] > <input type="text" id="cardnumber" name="cardnumber" size="20" value="[% cardnumber | html %]" /> >- [% IF ( mandatorycardnumber ) %]<span class="required">Required</span>[% END %] >+ [% IF mandatorycardnumber and not Koha.Preference('autoMemberNum') %]<span class="required">Required</span>[% END %] > <div class="hint">There is no minimum or maximum character length.</div> > [% END %] > </li> >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 61ebed9..27582e4 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -560,7 +560,12 @@ if ( $op eq "duplicate" ) { > $data{'cardnumber'} = ""; > } > >-$data{'cardnumber'}=fixup_cardnumber($data{'cardnumber'}) if ( ( $op eq 'add' ) or ( $op eq 'duplicate' ) ); >+if (C4::Context->preference("autoMemberNum")) { >+ $template->param( autoMemberNum => 1); >+} else { >+ $template->param( autoMemberNum => 0); >+} >+ > if(!defined($data{'sex'})){ > $template->param( none => 1); > } elsif($data{'sex'} eq 'F'){ >-- >2.9.3
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 6782
:
9945
|
10625
|
55952
|
55964
|
58173
|
58544
|
58545
|
59002