Lines 77-91
sub search {
Link Here
|
77 |
} |
77 |
} |
78 |
} |
78 |
} |
79 |
|
79 |
|
80 |
my $select = "SELECT |
80 |
my @columns = qw( borrowernumber surname firstname othernames flags streetnumber streettype address address2 city state zipcode country cardnumber dateexpiry borrowernotes branchcode email userid dateofbirth categorycode phone phonepro mobile fax email emailpro); |
81 |
borrowers.borrowernumber, borrowers.surname, borrowers.firstname, |
81 |
|
82 |
borrowers.othernames, |
82 |
my $prefillguarantorfields = C4::Context->preference("PrefillGuaranteeField"); |
83 |
borrowers.flags, |
83 |
my @prefill_fields = split(/\,/,$prefillguarantorfields); |
84 |
borrowers.streetnumber, borrowers.streettype, borrowers.address, |
84 |
if ( @prefill_fields ) { |
85 |
borrowers.address2, borrowers.city, borrowers.state, borrowers.zipcode, |
85 |
foreach my $field (@prefill_fields) { |
86 |
borrowers.country, cardnumber, borrowers.dateexpiry, |
86 |
if (! grep {$_ eq $field} @columns) { |
87 |
borrowers.borrowernotes, borrowers.branchcode, borrowers.email, |
87 |
push @columns, $field; |
88 |
borrowers.userid, borrowers.dateofbirth, borrowers.categorycode, |
88 |
} |
|
|
89 |
} |
90 |
}; |
91 |
|
92 |
my $borrowers_columns = ""; |
93 |
foreach my $item (@columns) { |
94 |
$borrowers_columns .= "borrowers." . $item . ", "; |
95 |
} |
96 |
|
97 |
my $select = "SELECT " . $borrowers_columns . " |
89 |
categories.description AS category_description, categories.category_type, |
98 |
categories.description AS category_description, categories.category_type, |
90 |
branches.branchname, borrowers.phone"; |
99 |
branches.branchname, borrowers.phone"; |
91 |
my $from = "FROM borrowers |
100 |
my $from = "FROM borrowers |