Bug 16889: Remove C4::Members::columns and use Koha::Patrons->columns instead
Test plan: Import some patrons (tools/import_borrowers.pl) and make sure it imports the patrons correctly. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
5eba0ab027
commit
c97e04e8e7
3 changed files with 2 additions and 60 deletions
|
@ -551,41 +551,6 @@ sub GetMemberIssuesAndFines {
|
|||
}
|
||||
|
||||
|
||||
=head2 columns
|
||||
|
||||
my @columns = C4::Member::columns();
|
||||
|
||||
Returns an array of borrowers' table columns on success,
|
||||
and an empty array on failure.
|
||||
|
||||
=cut
|
||||
|
||||
sub columns {
|
||||
|
||||
# Pure ANSI SQL goodness.
|
||||
my $sql = 'SELECT * FROM borrowers WHERE 1=0;';
|
||||
|
||||
# Get the database handle.
|
||||
my $dbh = C4::Context->dbh;
|
||||
|
||||
# Run the SQL statement to load STH's readonly properties.
|
||||
my $sth = $dbh->prepare($sql);
|
||||
my $rv = $sth->execute();
|
||||
|
||||
# This only fails if the table doesn't exist.
|
||||
# This will always be called AFTER an install or upgrade,
|
||||
# so borrowers will exist!
|
||||
my @data;
|
||||
if ($sth->{NUM_OF_FIELDS}>0) {
|
||||
@data = @{$sth->{NAME}};
|
||||
}
|
||||
else {
|
||||
@data = ();
|
||||
}
|
||||
return @data;
|
||||
}
|
||||
|
||||
|
||||
=head2 ModMember
|
||||
|
||||
my $success = ModMember(borrowernumber => $borrowernumber,
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
#
|
||||
# This is to test C4/Members
|
||||
# It requires a working Koha database with the sample data
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 2;
|
||||
|
||||
BEGIN {
|
||||
use_ok('C4::Members');
|
||||
}
|
||||
|
||||
my @borrowers_columns = C4::Members::columns;
|
||||
ok(
|
||||
$#borrowers_columns > 1,
|
||||
'C4::Member->column returned a reasonable number of columns ('
|
||||
. ( $#borrowers_columns + 1 ) . ')'
|
||||
)
|
||||
or diag(
|
||||
'WARNING: Check that the borrowers table exists and has the correct fields defined.'
|
||||
);
|
||||
|
||||
exit;
|
|
@ -48,6 +48,7 @@ use C4::Members::Messaging;
|
|||
use C4::Reports::Guided;
|
||||
use C4::Templates;
|
||||
use Koha::Patron::Debarments;
|
||||
use Koha::Patrons;
|
||||
use Koha::DateUtils;
|
||||
|
||||
use Text::CSV;
|
||||
|
@ -61,7 +62,7 @@ use CGI qw ( -utf8 );
|
|||
my (@errors, @feedback);
|
||||
my $extended = C4::Context->preference('ExtendedPatronAttributes');
|
||||
my $set_messaging_prefs = C4::Context->preference('EnhancedMessagingPreferences');
|
||||
my @columnkeys = C4::Members::columns();
|
||||
my @columnkeys = Koha::Patrons->columns();
|
||||
@columnkeys = map { $_ ne 'borrowernumber' ? $_ : () } @columnkeys;
|
||||
if ($extended) {
|
||||
push @columnkeys, 'patron_attributes';
|
||||
|
|
Loading…
Reference in a new issue