Bugzilla – Attachment 10625 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]
[SIGNED-OFF] Bug 6782 - Move auto member cardnumber generation to occur when record is "Saved" (avoid collisions).
SIGNED-OFF-Bug-6782---Move-auto-member-cardnumber-.patch (text/plain), 3.67 KB, created by
Gaetan Boisson
on 2012-07-03 12:45:21 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 6782 - Move auto member cardnumber generation to occur when record is "Saved" (avoid collisions).
Filename:
MIME Type:
Creator:
Gaetan Boisson
Created:
2012-07-03 12:45:21 UTC
Size:
3.67 KB
patch
obsolete
>From caa492221ce6a499236ba8b45cf7677d6b61fd57 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] [SIGNED-OFF] Bug 6782 - Move auto member cardnumber > generation to occur when record is "Saved" (avoid > collisions). > >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. > >Signed-off-by: Gaetan Boisson <gaetan.boisson@biblibre.com> >--- > C4/Members.pm | 5 +++++ > .../prog/en/modules/members/memberentrygen.tt | 8 ++++++-- > members/memberentry.pl | 6 +++++- > 3 files changed, 16 insertions(+), 3 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index f7dc841..f3577c8 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -749,6 +749,11 @@ Returns as undef upon any db error without further processing > sub AddMember { > my (%data) = @_; > my $dbh = C4::Context->dbh; >+ if(C4::Context->preference("autoMemberNum")) { >+ if ($data{'cardnumber'} eq '') { >+ $data{'cardnumber'}= fixup_cardnumber($data{'cardnumber'},C4::Context->userenv->{'branch'}, $data{'categorycode'}); >+ } >+ } > # generate a proper login if none provided > $data{'userid'} = Generate_Userid($data{'borrowernumber'}, $data{'firstname'}, $data{'surname'}) if $data{'userid'} eq ''; > # create a disabled account if no password provided >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 41ce66d..66691e3 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt >@@ -1006,8 +1006,12 @@ > <label for="cardnumber" class="required"> > [% ELSE %] > <label for="cardnumber"> >- [% END %] >- Card number: </label> >+ [% END %] >+ [% IF ( autoMemberNum ) %] >+ Card number<br>(<u>leave blank for auto calc during registration</u>): </label> >+ [% ELSE %] >+ Card number: </label> >+ [% END %] > [% IF ( opduplicate ) %] > <input type="text" id="cardnumber" name="cardnumber" size="20" /> > [% ELSE %] >diff --git a/members/memberentry.pl b/members/memberentry.pl >index c8a6be1..51df40e 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -433,7 +433,11 @@ if ( $op eq "duplicate" ) { > $template->param( step_1 => 1, step_2 => 1, step_3 => 1, step_4 => 1, step_5 => 1, step_6 => 1 ) unless $step; > } > >-$data{'cardnumber'}=fixup_cardnumber($data{'cardnumber'}) if $op eq 'add'; >+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'){ >-- >1.7.9.5
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