Bugzilla – Attachment 71794 Details for
Bug 19936
Move Check_userid and Generate_Userid to Koha::Patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19936: Replace Generate_Userid - Update the occurrences
Bug-19936-Replace-GenerateUserid---Update-the-occu.patch (text/plain), 2.98 KB, created by
Jonathan Druart
on 2018-02-16 14:34:36 UTC
(
hide
)
Description:
Bug 19936: Replace Generate_Userid - Update the occurrences
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2018-02-16 14:34:36 UTC
Size:
2.98 KB
patch
obsolete
>From b3b3d5e684f285b2e74bc3467693e4c891f43f52 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 8 Jan 2018 18:44:25 -0300 >Subject: [PATCH] Bug 19936: Replace Generate_Userid - Update the occurrences > >Test plan: >Same test plan as previous patch: >add/update/import patrons and watch the userid >--- > C4/Members.pm | 4 ++-- > members/memberentry.pl | 11 +++++++++-- > 2 files changed, 11 insertions(+), 4 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index c3e5f5b34a..d5759e908f 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -397,9 +397,9 @@ sub AddMember { > } > } > >- my $p = Koha::Patron->new( { userid => $data{userid} } ); >+ my $p = Koha::Patron->new( { userid => $data{userid}, firstname => $data{firstname}, surname => $data{surname} } ); > # generate a proper login if none provided >- $data{'userid'} = Generate_Userid( $data{'borrowernumber'}, $data{'firstname'}, $data{'surname'} ) >+ $data{'userid'} = $p->generate_userid > if ( $data{'userid'} eq '' || ! $p->has_valid_userid ); > > # add expiration date if it isn't already there >diff --git a/members/memberentry.pl b/members/memberentry.pl >index 644f9e4d6f..d500959a57 100755 >--- a/members/memberentry.pl >+++ b/members/memberentry.pl >@@ -159,6 +159,8 @@ if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) { > > $borrower_data = $patron->unblessed; > $borrower_data->{category_type} = $patron->category->category_type; >+} else { >+ $patron = Koha::Patron->new; > } > my $categorycode = $input->param('categorycode') || $borrower_data->{'categorycode'}; > my $category_type = $input->param('category_type') || ''; >@@ -280,12 +282,17 @@ $newdata{'lang'} = $input->param('lang') if defined($input->param('lang')) > if ( ( defined $newdata{'userid'} && $newdata{'userid'} eq '' ) || $check_BorrowerUnwantedField =~ /userid/ ) { > if ( ( defined $newdata{'firstname'} ) && ( defined $newdata{'surname'} ) ) { > # Full page edit, firstname and surname input zones are present >- $newdata{'userid'} = Generate_Userid( $borrowernumber, $newdata{'firstname'}, $newdata{'surname'} ); >+ $patron->firstname($newdata{firstname}); >+ $patron->surname($newdata{surname}); >+ $newdata{'userid'} = $patron->generate_userid; > } > elsif ( ( defined $data{'firstname'} ) && ( defined $data{'surname'} ) ) { > # Partial page edit (access through "Details"/"Library details" tab), firstname and surname input zones are not used > # Still, if the userid field is erased, we can create a new userid with available firstname and surname >- $newdata{'userid'} = Generate_Userid( $borrowernumber, $data{'firstname'}, $data{'surname'} ); >+ # FIXME clean thiscode newdata vs data is very confusing >+ $patron->firstname($data{firstname}); >+ $patron->surname($data{surname}); >+ $newdata{'userid'} = $patron->generate_userid; > } > else { > $newdata{'userid'} = $data{'userid'}; >-- >2.11.0
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 19936
:
70365
|
70366
|
70367
|
70368
|
70369
|
70370
|
70371
|
70372
|
70373
|
70374
|
71787
|
71788
|
71789
|
71790
|
71791
|
71792
|
71793
|
71794
|
71795
|
71796
|
72129
|
72130
|
72131
|
72132
|
72133
|
72134
|
72135
|
72136
|
72137
|
72138
|
72139
|
72140
|
72141
|
72142
|
72143
|
72144
|
72145
|
72146
|
72147
|
72148
|
72149
|
72150
|
72151
|
72152
|
73630
|
73631
|
73632
|
73633
|
73634
|
73635
|
73636
|
73637
|
73638
|
73639
|
73640
|
73641
|
73963
|
73964
|
73965
|
73966
|
73967
|
73968
|
73969
|
73970
|
73971
|
73972
|
73973
|
73974
|
74071
|
74072
|
74073
|
74074
|
74075
|
74076
|
74077
|
74078
|
74079
|
74080
|
74081
|
74082