bug 2459: fix module depedency error blocking SIP2

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.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
This commit is contained in:
Galen Charlton 2008-08-04 10:15:23 -05:00 committed by Joshua Ferraro
parent 639a3cf88d
commit 0bf4cdba9a
2 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -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);