Bugzilla – Attachment 52328 Details for
Bug 12598
New misc/import_borrowers.pl command line tool
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12598 - Fix merge to master. Backport 3 updates from latest import_borrowers.pl
Bug-12598---Fix-merge-to-master-Backport-3-updates.patch (text/plain), 3.11 KB, created by
Kyle M Hall (khall)
on 2016-06-13 16:14:38 UTC
(
hide
)
Description:
Bug 12598 - Fix merge to master. Backport 3 updates from latest import_borrowers.pl
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-06-13 16:14:38 UTC
Size:
3.11 KB
patch
obsolete
>From 7faf3ebbb1f681703fbba254090edbdedef9fab3 Mon Sep 17 00:00:00 2001 >From: Florent Mara <florent.mara@gmail.com> >Date: Tue, 5 Apr 2016 17:06:03 +1200 >Subject: [PATCH] Bug 12598 - Fix merge to master. Backport 3 updates from > latest import_borrowers.pl > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Patrons/Import.pm | 23 +++++++++++++---------- > 1 file changed, 13 insertions(+), 10 deletions(-) > >diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm >index 1041262..6094eac 100644 >--- a/Koha/Patrons/Import.pm >+++ b/Koha/Patrons/Import.pm >@@ -22,6 +22,7 @@ use Text::CSV; > > use C4::Members; > use C4::Branch; >+use Koha::DateUtils; > > sub import_patrons { > my ($params) = @_; >@@ -71,11 +72,9 @@ sub import_patrons { > } > > push @feedback, { feedback => 1, name => 'headerrow', value => join( ', ', @csvcolumns ) }; >- my $today_iso = C4::Dates->new()->output('iso'); >+ my $today_iso = output_pref( { dt => dt_from_string, dateonly => 1, dateformat => 'iso' } ); > my @criticals = qw(surname branchcode categorycode); # there probably should be others > my @bad_dates; # I've had a few. >- my $date_re = C4::Dates->new->regexp('syspref'); >- my $iso_re = C4::Dates->new->regexp('iso'); > LINE: while ( my $borrowerline = <$handle> ) { > my %borrower; > my @missing_criticals; >@@ -168,13 +167,10 @@ sub import_patrons { > # Popular spreadsheet applications make it difficult to force date outputs to be zero-padded, but we require it. > foreach (qw(dateofbirth dateenrolled dateexpiry)) { > my $tempdate = $borrower{$_} or next; >- if ( $tempdate =~ /$date_re/ ) { >- $borrower{$_} = format_date_in_iso($tempdate); >- } >- elsif ( $tempdate =~ /$iso_re/ ) { >+ $tempdate = eval { output_pref( { dt => dt_from_string( $tempdate ), dateonly => 1, dateformat => 'iso' } ); }; >+ if ($tempdate) { > $borrower{$_} = $tempdate; >- } >- else { >+ } else { > $borrower{$_} = ''; > push @missing_criticals, { key => $_, line => $., lineraw => $borrowerline, bad_date => 1 }; > } >@@ -213,6 +209,13 @@ sub import_patrons { > next; > } > >+ # generate a proper login if none provided >+ if ( $borrower{userid} eq '' || !Check_Userid( $borrower{userid} ) ) { >+ push @errors, { duplicate_userid => 1, userid => $borrower{userid} }; >+ $invalid++; >+ next LINE; >+ } >+ > if ($borrowernumber) { > > # borrower exists >@@ -280,7 +283,7 @@ sub import_patrons { > $patron_attributes = extended_attributes_merge( $old_attributes, $patron_attributes ); > } > push @errors, { unknown_error => 1 } >- unless SetBorrowerAttributes( $borrower{'borrowernumber'}, $patron_attributes ); >+ unless SetBorrowerAttributes( $borrower{'borrowernumber'}, $patron_attributes, 'no_branch_limit' ); > } > $overwritten++; > push( >-- >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 12598
:
29807
|
29808
|
29809
|
29939
|
30755
|
30780
|
35557
|
35558
|
35559
|
35560
|
35848
|
35849
|
35850
|
35851
|
35964
|
36684
|
36685
|
36687
|
36688
|
36690
|
36692
|
36693
|
36694
|
36695
|
36696
|
39124
|
39125
|
39126
|
39127
|
39128
|
41790
|
41791
|
41792
|
41793
|
41794
|
44065
|
44066
|
44067
|
44068
|
44069
|
48753
|
48754
|
48755
|
48756
|
48757
|
50693
|
50694
|
50695
|
50696
|
50697
|
50698
|
50699
|
50700
|
50704
|
51122
|
51357
|
51358
|
51359
|
51360
|
51361
|
51362
|
51363
|
51364
|
51365
|
51366
|
51367
|
51368
|
51369
|
51370
|
51371
|
51372
|
52323
|
52324
|
52325
|
52326
|
52327
|
52328
|
52329
|
52330
|
52331
|
52332
|
52333
|
52540
|
64437
|
64438
|
64855
|
65214
|
65215
|
65216
|
65217
|
65218
|
65819
|
65820
|
65821
|
65822
|
65823
|
65824
|
66353
|
66354
|
66355
|
66356
|
66357
|
66358
|
66359
|
66575
|
66576
|
66577
|
66578
|
66579
|
66580
|
66581
|
66582
|
67276
|
67277
|
70265
|
70266
|
71755
|
71756
|
71757
|
71758
|
71759
|
71760
|
71761
|
71762
|
71763
|
71764
|
71765
|
71766