From 4db9374817742ff8c50d229fd69e2acd992db7aa Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 13 Nov 2015 14:34:31 +0000 Subject: [PATCH] [SIGNED-OFF]Bug 15182: Continue to consider Crypt::GCrypt optional Caused by commit f25fe6ddb4a340f12613784dc841ab5bfd672d6b Date: Fri Nov 6 11:21:56 2015 -0300 Bug 15151: Avoid DB access to load C4::Members Make Koha::NorwegianPatronDB requires on loading C4::Members. But Koha::NorwegianPatronDB uses Crypt::GCrypt which is marked as optional in the deps list. This patch suggest to load the module only if it can be loaded and does not explode otherwise. Another solution would be to surround the require with an eval, to avoid to load Module::Load when C4::Members is used. Test plan: uninstall Crypt::GCrypt and try to access the staff interface. Without this patch, you will get a software error. Signed-off-by: Hector Castro Works as advertised. No software error without optional module. --- C4/Members.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/C4/Members.pm b/C4/Members.pm index 2616598..e62e19b 100644 --- a/C4/Members.pm +++ b/C4/Members.pm @@ -40,7 +40,11 @@ use Koha::Borrower::Debarments qw(IsDebarred); use Text::Unaccent qw( unac_string ); use Koha::AuthUtils qw(hash_password); use Koha::Database; -require Koha::NorwegianPatronDB; + +use Module::Load::Conditional qw( can_load ); +if ( can_load( modules => { 'Koha::NorwegianPatronDB' => undef } ) ) { + load Koha::NorwegianPatronDB, qw( NLUpdateHashedPIN NLEncryptPIN NLSync ); +} our ($VERSION,@ISA,@EXPORT,@EXPORT_OK,$debug); -- 1.7.10.4