Bug 21015: fix performance issue with C4::Members
loading Koha::Schema ("use Koha::Schema;") takes significantly time as
it loads almost a couple hundred classes. Koha::Database has done that
already once and we can use it to get the ResultSet "Borrower" as
well, so let's use that. This also make the code more unified because
Koha::Database is used throughout the code instead of Koha::Schema.
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 83e0765f44)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit f130fd6ec9)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
aac9f41bc3
commit
f504fbfcbc
|
|
@ -44,7 +44,6 @@ use Koha::Holds;
|
|||
use Koha::List::Patron;
|
||||
use Koha::Patrons;
|
||||
use Koha::Patron::Categories;
|
||||
use Koha::Schema;
|
||||
|
||||
our (@ISA,@EXPORT,@EXPORT_OK,$debug);
|
||||
|
||||
|
|
@ -899,7 +898,7 @@ database column.
|
|||
=cut
|
||||
|
||||
sub get_cardnumber_length {
|
||||
my $borrower = Koha::Schema->resultset('Borrower');
|
||||
my $borrower = Koha::Database->new->schema->resultset('Borrower');
|
||||
my $field_size = $borrower->result_source->column_info('cardnumber')->{size};
|
||||
my ( $min, $max ) = ( 0, $field_size ); # borrowers.cardnumber is a nullable varchar(20)
|
||||
$min = 1 if C4::Context->preference('BorrowerMandatoryField') =~ /cardnumber/;
|
||||
|
|
|
|||
Loading…
Reference in New Issue