From 687946bd9b48ed9e1c9b6663961463ef1913ae88 Mon Sep 17 00:00:00 2001 From: Mason James Date: Wed, 20 Sep 2017 15:58:54 +1200 Subject: [PATCH] Revert "Bug 17249: GetKohaAuthorisedValuesFromField - rm GetAuthValCodeFromField" This reverts commit 286b6f4e3e8db593fbe218ab08c622e5491ac44d. --- C4/Koha.pm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/C4/Koha.pm b/C4/Koha.pm index f7fe9cbfcd..8889c665af 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -972,6 +972,30 @@ sub GetAuthValCode { return $authvalcode; } +=head2 GetAuthValCodeFromField + + $authvalcode = GetAuthValCodeFromField($field,$subfield,$frameworkcode); + +C<$subfield> can be undefined + +=cut + +sub GetAuthValCodeFromField { + my ($field,$subfield,$fwcode) = @_; + my $dbh = C4::Context->dbh; + $fwcode='' unless $fwcode; + my $sth; + if (defined $subfield) { + $sth = $dbh->prepare('select authorised_value from marc_subfield_structure where tagfield=? and tagsubfield=? and frameworkcode=?'); + $sth->execute($field,$subfield,$fwcode); + } else { + $sth = $dbh->prepare('select authorised_value from marc_tag_structure where tagfield=? and frameworkcode=?'); + $sth->execute($field,$fwcode); + } + my ($authvalcode) = $sth->fetchrow_array; + return $authvalcode; +} + =head2 GetAuthorisedValues $authvalues = GetAuthorisedValues([$category]); -- 2.39.5