From e883a0f065d166db1e42fee3b67369a056569ba6 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Wed, 26 Sep 2012 16:33:15 -0400 Subject: [PATCH] Bug 8829: Fix authority importing A subroutine was not being imported by C4::ImportBatch (ironic, no?) so this patch makes the call fully-qualified. This patch also cleans up two warnings in C4::Auth that are raised when logged in as the database user. Signed-off-by: Nicole C. Engard Signed-off-by: Paul Poulain --- C4/Auth.pm | 10 ++++++++-- C4/ImportBatch.pm | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/C4/Auth.pm b/C4/Auth.pm index 02fbacca6a..4a8e955586 100644 --- a/C4/Auth.pm +++ b/C4/Auth.pm @@ -657,7 +657,7 @@ sub checkauth { $ip = $session->param('ip'); $lasttime = $session->param('lasttime'); $userid = $session->param('id'); - $sessiontype = $session->param('sessiontype'); + $sessiontype = $session->param('sessiontype') || ''; } if ( ( ($query->param('koha_login_context')) && ($query->param('userid') ne $session->param('id')) ) || ( $cas && $query->param('ticket') ) ) { @@ -1495,7 +1495,13 @@ sub getuserflags { my $userid = shift; my $dbh = @_ ? shift : C4::Context->dbh; my $userflags; - $flags = 0 unless $flags; + { + # I don't want to do this, but if someone logs in as the database + # user, it would be preferable not to spam them to death with + # numeric warnings. So, we make $flags numeric. + no warnings 'numeric'; + $flags += 0; + } my $sth = $dbh->prepare("SELECT bit, flag, defaulton FROM userflags"); $sth->execute; diff --git a/C4/ImportBatch.pm b/C4/ImportBatch.pm index a655f29614..648d96e734 100644 --- a/C4/ImportBatch.pm +++ b/C4/ImportBatch.pm @@ -1306,7 +1306,7 @@ sub GetImportRecordMatches { $sth->execute(); while (my $row = $sth->fetchrow_hashref) { if ($row->{'record_type'} eq 'auth') { - $row->{'authorized_heading'} = GetAuthorizedHeading( { authid => $row->{'candidate_match_id'} } ); + $row->{'authorized_heading'} = C4::AuthoritiesMarc::GetAuthorizedHeading( { authid => $row->{'candidate_match_id'} } ); } next if ($row->{'record_type'} eq 'biblio' && not $row->{'biblionumber'}); push @$results, $row; @@ -1375,7 +1375,7 @@ sub _add_auth_fields { if ($marc_record->field('001')) { $controlnumber = $marc_record->field('001')->data(); } - my $authorized_heading = GetAuthorizedHeading({ record => $marc_record }); + my $authorized_heading = C4::AuthoritiesMarc::GetAuthorizedHeading({ record => $marc_record }); my $dbh = C4::Context->dbh; my $sth = $dbh->prepare("INSERT INTO import_auths (import_record_id, control_number, authorized_heading) VALUES (?, ?, ?)"); $sth->execute($import_record_id, $controlnumber, $authorized_heading); -- 2.39.5