Bugzilla – Attachment 55964 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.34 KB, created by
Marc Véron
on 2016-09-30 20:32:24 UTC
(
hide
)
Description:
Bug 6782 - Move auto member cardnumber generation to occur when record is "Saved" (avoid collisions).
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2016-09-30 20:32:24 UTC
Size:
6.34 KB
patch
obsolete
>From f8e4591f12b60a26501a992dc32257c238e79f4a 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 4b2d7ff..bc130c1 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -659,6 +659,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 82418ff..62b13a0 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 %]" 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 %]" 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 %]" 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 %]" /> >- [% 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 1b100b0..8215af7 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -505,7 +505,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.1.4
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