Lines 695-704
sub GetMemberIssuesAndFines {
Link Here
|
695 |
return ($overdue_count, $issue_count, $total_fines); |
695 |
return ($overdue_count, $issue_count, $total_fines); |
696 |
} |
696 |
} |
697 |
|
697 |
|
698 |
sub columns(;$) { |
698 |
|
699 |
return @{C4::Context->dbh->selectcol_arrayref("SHOW columns from borrowers")}; |
699 |
=head2 columns |
|
|
700 |
|
701 |
C4::Member->columns |
702 |
|
703 |
=head3 USAGE |
704 |
|
705 |
use C4::Member; |
706 |
my @borrower_columns = C4::Member->columns; |
707 |
|
708 |
=head3 RETURNS |
709 |
|
710 |
The array of borrowers' table columns on success. |
711 |
An empty array on failure. |
712 |
|
713 |
=head3 NOTES |
714 |
|
715 |
This runs significantly faster than the previous code while |
716 |
being mostly SQL-agnostic. |
717 |
|
718 |
=cut |
719 |
|
720 |
sub columns { |
721 |
|
722 |
# Pure ANSI SQL goodness. |
723 |
my $sql = 'SELECT * FROM borrowers WHERE 1=0;'; |
724 |
|
725 |
# Get the database handle. |
726 |
my $dbh = C4::Context->dbh; |
727 |
|
728 |
# Run the SQL statement to load STH's readonly properties. |
729 |
my $sth = $dbh->prepare($sql); |
730 |
my $rv = $sth->execute(); |
731 |
|
732 |
# This only fails if the table doesn't exist. |
733 |
# This will always be called AFTER an install or upgrade, |
734 |
# so borrowers will exist! |
735 |
my @data; |
736 |
if ($sth->{NUM_OF_FIELDS}>0) { |
737 |
@data = @{$sth->{NAME}}; |
738 |
} |
739 |
else { |
740 |
@data = (); |
741 |
} |
742 |
return @data; |
700 |
} |
743 |
} |
701 |
|
744 |
|
|
|
745 |
|
702 |
=head2 ModMember |
746 |
=head2 ModMember |
703 |
|
747 |
|
704 |
my $success = ModMember(borrowernumber => $borrowernumber, |
748 |
my $success = ModMember(borrowernumber => $borrowernumber, |