[Koha-patches] [PATCH] bug 2459: fix module depedency error blocking SIP2

Galen Charlton galen.charlton at liblime.com
Mon Aug 4 17:15:23 CEST 2008


Ror a poorly understood (by me) reason, use of 'use
UNIVERSAL' and 'use C4::Auth' in the SIP2 code is resulting
in a compilation error, thus blocking SIP2 from working.

The error (prior to this patch) could be reproduced as follows:

cd C4/SIP
perl -I. -wc Sip/MsgType.pm
"get_session" is not exported by the C4::Auth module
Can't continue after import errors at /home/gmc/koha/dev/C4/VirtualShelves.pm
line 51
BEGIN failed--compilation aborted at /home/gmc/koha/dev/C4/VirtualShelves.pm
line 51.
Compilation failed in require at /home/gmc/koha/dev/C4/Auth.pm line 34.
BEGIN failed--compilation aborted at /home/gmc/koha/dev/C4/Auth.pm line 34.
Compilation failed in require at Sip/MsgType.pm line 21.
BEGIN failed--compilation aborted at Sip/MsgType.pm line 21.

or more minimally

perl -ce 'use UNIVERSAL; use C4::Auth;'

This patch works around the problem by making C4::Auth
and C4::VirtualShelves not import any symbols
from each other.
---
 C4/Auth.pm           |    8 ++++----
 C4/VirtualShelves.pm |    4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/C4/Auth.pm b/C4/Auth.pm
index 8bc8572..029a957 100755
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -31,7 +31,7 @@ use C4::Output;    # to get the template
 use C4::Members;
 use C4::Koha;
 use C4::Branch; # GetBranches
-use C4::VirtualShelves qw/GetRecentShelves/;
+use C4::VirtualShelves;
 
 # use utf8;
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS $debug $ldap);
@@ -711,9 +711,9 @@ sub checkauth {
 				# and the number of lists to be displayed of each type in the 'Lists' button drop down
 				my $row_count = 10; # FIXME:This probably should be a syspref
 				my ($total, $totshelves, $barshelves, $pubshelves);
-				($barshelves, $totshelves) = GetRecentShelves(1, $row_count, $borrowernumber);
+				($barshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(1, $row_count, $borrowernumber);
 				$total->{'bartotal'} = $totshelves;
-				($pubshelves, $totshelves) = GetRecentShelves(2, $row_count, undef);
+				($pubshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(2, $row_count, undef);
 				$total->{'pubtotal'} = $totshelves;
 				$session->param('barshelves', $barshelves->[0]);
 				$session->param('pubshelves', $pubshelves->[0]);
@@ -738,7 +738,7 @@ sub checkauth {
 			# Grab the public shelves and add to the session...
 			my $row_count = 20; # FIXME:This probably should be a syspref
 			my ($total, $totshelves, $pubshelves);
-			($pubshelves, $totshelves) = GetRecentShelves(2, $row_count, undef);
+			($pubshelves, $totshelves) = C4::VirtualShelves::GetRecentShelves(2, $row_count, undef);
 			$total->{'pubtotal'} = $totshelves;
 			$session->param('pubshelves', $pubshelves->[0]);
 			$session->param('totshelves', $total);
diff --git a/C4/VirtualShelves.pm b/C4/VirtualShelves.pm
index eaebb54..3a9efd0 100644
--- a/C4/VirtualShelves.pm
+++ b/C4/VirtualShelves.pm
@@ -27,6 +27,7 @@ use C4::Context;
 use C4::Circulation;
 use C4::Debug;
 use C4::Members;
+require C4::Auth;
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
 
@@ -48,7 +49,6 @@ BEGIN {
         );
 }
 
-use C4::Auth qw(get_session);
 
 my $dbh = C4::Context->dbh;
 
@@ -544,7 +544,7 @@ This function is used in conjunction with the 'Lists' button in masthead.inc.
 sub RefreshShelvesSummary ($$$) {
 	
 	my ($sessionID, $loggedinuser, $row_count) = @_;
-	my $session = get_session($sessionID);
+	my $session = C4::Auth::get_session($sessionID);
 	my ($total, $totshelves, $barshelves, $pubshelves);
 
 	($barshelves, $totshelves) = GetRecentShelves(1, $row_count, $loggedinuser);
-- 
1.5.5.GIT




More information about the Koha-patches mailing list