Bugzilla – Attachment 71757 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: Update code to use new modules
Bug-12598-Update-code-to-use-new-modules.patch (text/plain), 4.42 KB, created by
Kyle M Hall (khall)
on 2018-02-16 13:46:03 UTC
(
hide
)
Description:
Bug 12598: Update code to use new modules
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2018-02-16 13:46:03 UTC
Size:
4.42 KB
patch
obsolete
>From 49deb6ace30f43652bb770fa9ee83d66bfd979ea Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 1 Jun 2017 10:12:48 -0300 >Subject: [PATCH] Bug 12598: Update code to use new modules > >Signed-off-by: Colin Campbell <colin.campbell@ptfs-europe.com> >--- > Koha/Patrons/Import.pm | 12 +++++++----- > .../prog/en/modules/tools/import_borrowers.tt | 14 ++++---------- > t/db_dependent/Koha/Patrons/Import.t | 6 ++++-- > 3 files changed, 15 insertions(+), 17 deletions(-) > >diff --git a/Koha/Patrons/Import.pm b/Koha/Patrons/Import.pm >index 6b53c4b..9155c36 100644 >--- a/Koha/Patrons/Import.pm >+++ b/Koha/Patrons/Import.pm >@@ -23,10 +23,12 @@ use Carp; > use Text::CSV; > > use C4::Members; >-use C4::Branch; > use C4::Members::Attributes qw(:all); > use C4::Members::AttributeTypes; > >+use Koha::Libraries; >+use Koha::Patrons; >+use Koha::Patron::Categories; > use Koha::DateUtils; > > =head1 NAME >@@ -401,7 +403,7 @@ Returns an array of borrowers' table columns. > sub set_column_keys { > my ($self, $extended) = @_; > >- my @columnkeys = map { $_ ne 'borrowernumber' ? $_ : () } C4::Members::columns(); >+ my @columnkeys = map { $_ ne 'borrowernumber' ? $_ : () } Koha::Patrons->columns(); > push( @columnkeys, 'patron_attributes' ) if $extended; > > return @columnkeys; >@@ -450,8 +452,8 @@ sub check_branch_code { > } > > # look for branch code >- my $branch_name = GetBranchName( $branchcode ); >- unless( $branch_name ) { >+ my $library = Koha::Libraries->find( $branchcode ); >+ unless( $library ) { > push (@$missing_criticals, { key => 'branchcode', line => $line_number, lineraw => $borrowerline, > value => $branchcode, branch_map => 1, }); > } >@@ -475,7 +477,7 @@ sub check_borrower_category { > } > > # Looking for borrower category >- my $category = GetBorrowercategory( $categorycode ); >+ my $category = Koha::Patron::Categories->find($categorycode); > unless( $category ) { > push (@$missing_criticals, { key => 'categorycode', line => $line_number, lineraw => $borrowerline, > value => $categorycode, category_map => 1, }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >index 7c53da8..9989414 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/import_borrowers.tt >@@ -233,7 +233,10 @@ > </fieldset> > [% END %] > >- <fieldset class="action"><input type="submit" value="Import" /></fieldset> >+ <fieldset class="action"> >+ <input type="hidden" name="csrf_token" value="[% csrf_token %]" /> >+ <input type="submit" value="Import" /> >+ </fieldset> > </form> > [% END %] > >@@ -274,15 +277,6 @@ > you can supply dates in ISO format (e.g., '2010-10-28'). > </li> > </ul> >- </fieldset> >- [% END %] >- <fieldset class="action"> >- <input type="hidden" name="csrf_token" value="[% csrf_token %]" /> >- <input type="submit" value="Import" /> >- </fieldset> >-</form> >-[% END %] >- > </div> > </div> > </div> >diff --git a/t/db_dependent/Koha/Patrons/Import.t b/t/db_dependent/Koha/Patrons/Import.t >index 3c46ce2..4e4bde4 100644 >--- a/t/db_dependent/Koha/Patrons/Import.t >+++ b/t/db_dependent/Koha/Patrons/Import.t >@@ -392,17 +392,19 @@ subtest 'test_set_column_keys' => sub { > subtest 'test_set_column_keys' => sub { > plan tests => 2; > >+ my @columns = Koha::Patrons->columns; > # Given ... nothing at all > # When ... Then ... > my @columnkeys_0 = $patrons_import->set_column_keys(undef); >- is(scalar @columnkeys_0, 66, 'Got the expected array size from set column keys with undef extended'); >+ # -1 because we do not want the borrowernumber column >+ is(scalar @columnkeys_0, @columns - 1, 'Got the expected array size from set column keys with undef extended'); > > # Given ... extended. > my $extended = 1; > > # When ... Then ... > my @columnkeys_1 = $patrons_import->set_column_keys($extended); >- is(scalar @columnkeys_1, 67, 'Got the expected array size from set column keys with extended'); >+ is(scalar @columnkeys_1, @columns - 1 + $extended, 'Got the expected array size from set column keys with extended'); > }; > > subtest 'test_set_patron_attributes' => sub { >-- >2.10.2
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