my $record = GetMarcBiblio({
biblionumber => $biblionumber,
embed_items => $embeditems,
- opac => $opac });
+ opac => $opac,
+ borcat => $patron_category });
Returns MARC::Record representing a biblio record, or C<undef> if the
biblionumber doesn't exist.
set to true to make the result suited for OPAC view. This causes things like
OpacHiddenItems to be applied.
+=item C<$borcat>
+
+If the OpacHiddenItemsExceptions system preference is set, this patron category
+can be used to make visible OPAC items which would be normally hidden.
+It only makes sense in combination both embed_items and opac values true.
+
=back
=cut
my $biblionumber = $params->{biblionumber};
my $embeditems = $params->{embed_items} || 0;
my $opac = $params->{opac} || 0;
+ my $borcat = $params->{borcat} // q{};
if (not defined $biblionumber) {
carp 'GetMarcBiblio called with undefined biblionumber';
C4::Biblio::_koha_marc_update_bib_ids( $record, $frameworkcode, $biblionumber,
$biblioitemnumber );
- C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber, undef, $opac )
+ C4::Biblio::EmbedItemsInMarcBiblio({
+ marc_record => $record,
+ biblionumber => $biblionumber,
+ opac => $opac,
+ borcat => $borcat })
if ($embeditems);
return $record;
=head2 EmbedItemsInMarcBiblio
- EmbedItemsInMarcBiblio($marc, $biblionumber, $itemnumbers, $opac);
+ EmbedItemsInMarcBiblio({
+ marc_record => $marc,
+ biblionumber => $biblionumber,
+ item_numbers => $itemnumbers,
+ opac => $opac });
Given a MARC::Record object containing a bib record,
modify it to include the items attached to it as 9XX
If $opac is true, then opac-relevant suppressions are included.
+If opac filtering will be done, borcat should be passed to properly
+override if necessary.
+
=cut
sub EmbedItemsInMarcBiblio {
- my ($marc, $biblionumber, $itemnumbers, $opac) = @_;
+ my ($params) = @_;
+ my ($marc, $biblionumber, $itemnumbers, $opac, $borcat);
+ $marc = $params->{marc_record};
if ( !$marc ) {
carp 'EmbedItemsInMarcBiblio: No MARC record passed';
return;
}
+ $biblionumber = $params->{biblionumber};
+ $itemnumbers = $params->{item_numbers};
+ $opac = $params->{opac};
+ $borcat = $params->{borcat} // q{};
$itemnumbers = [] unless defined $itemnumbers;
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("SELECT itemnumber FROM items WHERE biblionumber = ?");
$sth->execute($biblionumber);
- my @item_fields;
my ( $itemtag, $itemsubfield ) = GetMarcFromKohaField( "items.itemnumber", $frameworkcode );
- my @items;
+
+ my @item_fields; # Array holding the actual MARC data for items to be included.
+ my @items; # Array holding items which are both in the list (sitenumbers)
+ # and on this biblionumber
+
+ # Flag indicating if there is potential hiding.
my $opachiddenitems = $opac
&& ( C4::Context->preference('OpacHiddenItems') !~ /^\s*$/ );
+
require C4::Items;
while ( my ($itemnumber) = $sth->fetchrow_array ) {
next if @$itemnumbers and not grep { $_ == $itemnumber } @$itemnumbers;
my $i = $opachiddenitems ? C4::Items::GetItem($itemnumber) : undef;
push @items, { itemnumber => $itemnumber, item => $i };
}
+ my @items2pass = map { $_->{item} } @items;
my @hiddenitems =
$opachiddenitems
- ? C4::Items::GetHiddenItemnumbers( map { $_->{item} } @items )
+ ? C4::Items::GetHiddenItemnumbers({
+ items => \@items2pass,
+ borcat => $borcat })
: ();
# Convert to a hash for quick searching
my %hiddenitems = map { $_ => 1 } @hiddenitems;
# Getting the record
my $record = GetMarcBiblio({ biblionumber => $biblio });
return unless $record;
- C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblio, $itemnumbers );
+ C4::Biblio::EmbedItemsInMarcBiblio({
+ marc_record => $record,
+ biblionumber => $biblio,
+ item_numbers => $itemnumbers });
# Getting the framework
my $frameworkcode = GetFrameworkCode($biblio);
my ($bibliotag,$bibliosubf)=GetMarcFromKohaField('biblio.biblionumber','');
# set stuff for XSLT processing here once, not later again for every record we retrieved
- my $interface = $search_context eq 'opac' ? 'OPAC' : '';
+ my $interface = $is_opac ? 'OPAC' : '';
my $xslsyspref = $interface . "XSLTResultsDisplay";
my $xslfile = C4::Context->preference($xslsyspref);
my $lang = $xslfile ? C4::Languages::getlanguage() : undef;
$other_items->{$key}->{intransit} = ( $transfertwhen ne '' ) ? 1 : 0;
$other_items->{$key}->{onhold} = ($reservestatus) ? 1 : 0;
$other_items->{$key}->{notforloan} = GetAuthorisedValueDesc('','',$item->{notforloan},'','',$notforloan_authorised_value) if $notforloan_authorised_value and $item->{notforloan};
- $other_items->{$key}->{count}++ if $item->{$hbranch};
- $other_items->{$key}->{location} = $shelflocations->{ $item->{location} };
- $other_items->{$key}->{description} = $item->{description};
+ $other_items->{$key}->{count}++ if $item->{$hbranch};
+ $other_items->{$key}->{location} = $shelflocations->{ $item->{location} };
+ $other_items->{$key}->{description} = $item->{description};
$other_items->{$key}->{imageurl} = getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $item->{itype} }->{imageurl} );
}
# item is available
$available_count++;
$available_items->{$prefix}->{count}++ if $item->{$hbranch};
foreach (qw(branchname itemcallnumber description)) {
- $available_items->{$prefix}->{$_} = $item->{$_};
- }
- $available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} };
+ $available_items->{$prefix}->{$_} = $item->{$_};
+ }
+ $available_items->{$prefix}->{location} = $shelflocations->{ $item->{location} };
$available_items->{$prefix}->{imageurl} = getitemtypeimagelocation( $search_context->{'interface'}, $itemtypes{ $item->{itype} }->{imageurl} );
}
}
if ( !defined($bibnum) );
# TODO this should really be in Koha::BiblioUtils or something similar.
- C4::Biblio::EmbedItemsInMarcBiblio( $marc, $bibnum );
+ C4::Biblio::EmbedItemsInMarcBiblio({
+ marc_record => $marc,
+ biblionumber => $bibnum });
}
if (wantarray) {
return if $@ or not defined $record;
if ($export_items) {
- C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber, $itemnumbers );
+ C4::Biblio::EmbedItemsInMarcBiblio({
+ marc_record => $record,
+ biblionumber => $biblionumber,
+ item_numbers => $itemnumbers });
if ($only_export_items_for_branches && @$only_export_items_for_branches) {
my %export_items_for_branches = map { $_ => 1 } @$only_export_items_for_branches;
my ( $homebranchfield, $homebranchsubfield ) = GetMarcFromKohaField( 'items.homebranch', '' ); # Should be GetFrameworkCode( $biblionumber )?
#---- finds where items.itemnumber is stored
my ( $itemtagfield, $itemtagsubfield) = &GetMarcFromKohaField("items.itemnumber", $frameworkcode);
my ($branchtagfield, $branchtagsubfield) = &GetMarcFromKohaField("items.homebranch", $frameworkcode);
-C4::Biblio::EmbedItemsInMarcBiblio($temp, $biblionumber);
+C4::Biblio::EmbedItemsInMarcBiblio({
+ marc_record => $temp,
+ biblionumber => $biblionumber });
my @fields = $temp->fields();
<thead><tr><th> </th><th>Term</th><th>Title</th><th>Date added</th></tr></thead>
<tbody>
[% FOREACH MY_TAG IN MY_TAGS %]
+ [% IF MY_TAG.visible %]
<tr>
<td>
<input type="checkbox" name="del[% MY_TAG.tag_id | html %]" value="del[% MY_TAG.tag_id | html %]">
</span>
</td>
</tr>
+ [% END %]
[% END %]
</tbody>
</table>
next;
}
if($embed_items) {
- C4::Biblio::EmbedItemsInMarcBiblio($record, $biblionumber);
+ C4::Biblio::EmbedItemsInMarcBiblio({
+ marc_record => $record,
+ biblionumber => $biblionumber });
}
my @biblio_sets = CalcOAISetsBiblio($record, $mappings);
use Koha::Biblios;
my $query = CGI->new();
+my $biblionumber = $query->param('biblionumber');
+if ( !$biblionumber ) {
+ print $query->redirect('/cgi-bin/koha/errors/404.pl');
+ exit;
+}
+$biblionumber = int($biblionumber);
+
+#open template
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
{
template_name => "opac-ISBDdetail.tt",
}
);
-my $biblionumber = $query->param('biblionumber');
-$biblionumber = int($biblionumber);
-
-# get biblionumbers stored in the cart
-if(my $cart_list = $query->cookie("bib_list")){
- my @cart_list = split(/\//, $cart_list);
- if ( grep {$_ eq $biblionumber} @cart_list) {
- $template->param( incart => 1 );
- }
-}
-
-my $marcflavour = C4::Context->preference("marcflavour");
-
-my @items = GetItemsInfo($biblionumber);
-if (scalar @items >= 1) {
- my $borcat;
- if ( C4::Context->preference('OpacHiddenItemsExceptions') ) {
-
- # we need to fetch the borrower info here, so we can pass the category
- my $borrower = GetMember( borrowernumber => $borrowernumber );
- $borcat = $borrower->{categorycode};
- }
-
- my @hiddenitems = GetHiddenItemnumbers( { items => \@items, borcat => $borcat });
-
- if (scalar @hiddenitems == scalar @items ) {
- print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
- exit;
- }
+my $borcat = q{};
+if ( C4::Context->preference('OpacHiddenItemsExceptions') ) {
+ # we need to fetch the borrower info here, so we can pass the category
+ my $patron = Koha::Patrons->find( { borrowernumber => $loggedinuser } );
+ $borcat = $patron ? $patron->categorycode : $borcat;
}
my $record = GetMarcBiblio({
biblionumber => $biblionumber,
- embed_items => 1 });
+ embed_items => 1,
+ opac => 1,
+ borcat => $borcat });
if ( ! $record ) {
print $query->redirect("/cgi-bin/koha/errors/404.pl");
exit;
}
+my @all_items = GetItemsInfo($biblionumber);
my $biblio = Koha::Biblios->find( $biblionumber );
+my $framework = $biblio ? $biblio->frameworkcode : q{};
+my ($tag_itemnumber, $subtag_itemnumber) = &GetMarcFromKohaField('items.itemnumber',$framework);
+my @nonhiddenitems = $record->field($tag_itemnumber);
+if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) {
+ print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early
+ exit;
+}
-my $framework = GetFrameworkCode( $biblionumber );
my $record_processor = Koha::RecordProcessor->new({
filters => 'ViewPolicy',
options => {
});
$record_processor->process($record);
+# get biblionumbers stored in the cart
+if(my $cart_list = $query->cookie("bib_list")){
+ my @cart_list = split(/\//, $cart_list);
+ if ( grep {$_ eq $biblionumber} @cart_list) {
+ $template->param( incart => 1 );
+ }
+}
+
+my $marcflavour = C4::Context->preference("marcflavour");
+
# some useful variables for enhanced content;
# in each case, we're grabbing the first value we find in
# the record and normalizing it
#coping with subscriptions
my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
-my $dbh = C4::Context->dbh;
my $dat = TransformMarcToKoha( $record );
my @subscriptions = SearchSubscriptions({ biblionumber => $biblionumber, orderby => 'title' });
my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } };
my $patron = Koha::Patrons->find( $loggedinuser );
-for my $itm (@items) {
+for my $itm (@all_items) {
my $item = Koha::Items->find( $itm->{itemnumber} );
$norequests = 0
if $norequests
use Koha::Patrons;
use Koha::RecordProcessor;
-my $query = new CGI;
-
-my $dbh = C4::Context->dbh;
+my $query = CGI->new();
my $biblionumber = $query->param('biblionumber');
if ( ! $biblionumber ) {
print $query->redirect("/cgi-bin/koha/errors/404.pl");
exit;
}
+$biblionumber = int($biblionumber);
+
+# open template
+my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
+ {
+ template_name => "opac-MARCdetail.tt",
+ query => $query,
+ type => "opac",
+ authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
+ debug => 1,
+ }
+);
+
+my $patron = Koha::Patrons->find( $loggedinuser );
+my $borcat = q{};
+if ( C4::Context->preference('OpacHiddenItemsExceptions') ) {
+ # we need to fetch the borrower info here, so we can pass the category
+ $borcat = $patron ? $patron->categorycode : $borcat;
+}
my $record = GetMarcBiblio({
biblionumber => $biblionumber,
- embed_items => 1 });
+ embed_items => 1,
+ opac => 1,
+ borcat => $borcat });
if ( ! $record ) {
print $query->redirect("/cgi-bin/koha/errors/404.pl");
exit;
}
my @all_items = GetItemsInfo($biblionumber);
-my @items2hide;
-if (scalar @all_items >= 1) {
- my $borcat;
- if ( C4::Context->preference('OpacHiddenItemsExceptions') ) {
-
- # we need to fetch the borrower info here, so we can pass the category
- my $borrower = GetMember( borrowernumber => $borrowernumber );
- $borcat = $borrower->{categorycode};
- }
- push @items2hide, GetHiddenItemnumbers({ items => \@all_items, borcat => $botcat });
-
- if (scalar @items2hide == scalar @all_items ) {
- print $query->redirect("/cgi-bin/koha/errors/404.pl");
- exit;
- }
-}
-
-my $framework = &GetFrameworkCode( $biblionumber );
+my $biblio = Koha::Biblios->find( $biblionumber );
+my $framework = $biblio ? $biblio->frameworkcode : q{};
my $tagslib = &GetMarcStructure( 0, $framework );
my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField('items.itemnumber',$framework);
-my $biblio = Koha::Biblios->find( $biblionumber );
+my @nonhiddenitems = $record->field($tag_itemnumber);
+if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) {
+ print $query->redirect("/cgi-bin/koha/errors/404.pl");
+ exit;
+}
my $record_processor = Koha::RecordProcessor->new({
filters => 'ViewPolicy',
});
$record_processor->process($record);
-# open template
-my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
- {
- template_name => "opac-MARCdetail.tt",
- query => $query,
- type => "opac",
- authnotrequired => ( C4::Context->preference("OpacPublic") ? 1 : 0 ),
- debug => 1,
- }
-);
-
-my ($bt_tag,$bt_subtag) = GetMarcFromKohaField('biblio.title',$framework);
-$template->param(
- bibliotitle => $biblio->title,
-) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
- $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8; # except -8;
-
# get biblionumbers stored in the cart
if(my $cart_list = $query->cookie("bib_list")){
my @cart_list = split(/\//, $cart_list);
}
}
+my ($bt_tag,$bt_subtag) = GetMarcFromKohaField('biblio.title',$framework);
+$template->param(
+ bibliotitle => $biblio->title,
+) if $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} <= 0 && # <=0 OPAC visible.
+ $tagslib->{$bt_tag}->{$bt_subtag}->{hidden} > -8; # except -8;
+
my $allow_onshelf_holds;
-my $patron = Koha::Patrons->find( $loggedinuser );
for my $itm (@all_items) {
my $item = Koha::Items->find( $itm->{itemnumber} );
$allow_onshelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } );
# loop through each tag
# warning : we may have differents number of columns in each row. Thus, we first build a hash, complete it if necessary
# then construct template.
+# $record has already had all the item fields filtered above.
my @fields = $record->fields();
my %witness
; #---- stores the list of subfields used at least once, with the "meaning" of the code
my @item_loop;
foreach my $field (@fields) {
next if ( $field->tag() < 10 );
- next if ( ( $field->tag() eq $tag_itemnumber ) &&
- ( any { $field->subfield($subtag_itemnumber) eq $_ }
- @items2hide) );
my @subf = $field->subfields;
my $item;
}
}
+my $borcat = q{};
+if ( C4::Context->preference('OpacHiddenItemsExceptions') ) {
+ # we need to fetch the borrower info here, so we can pass the category
+ my $borrower = Koha::Patron->find( { borrowernumber -> $borrowernumber } );
+ $borcat = $borrower ? $borrower->categorycode : $borcat;
+}
+
my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy' });
foreach my $biblionumber ( @bibs ) {
$template->param( biblionumber => $biblionumber );
my $dat = &GetBiblioData($biblionumber);
next unless $dat;
+ # No filtering on the item records needed for the record itself
+ # since the only reason item information is grabbed is because of branchcodes.
my $record = &GetMarcBiblio({ biblionumber => $biblionumber });
my $framework = &GetFrameworkCode( $biblionumber );
$record_processor->options({
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
my $marcseriesarray = GetMarcSeries ($record,$marcflavour);
my $marcurlsarray = GetMarcUrls ($record,$marcflavour);
- my @items = &GetItemsInfo( $biblionumber );
+
+ # grab all the items...
+ my @all_items = &GetItemsInfo( $biblionumber );
+
+ # determine which ones should be hidden / visible
+ my @hidden_items = GetHiddenItemnumbers({ items => \@all_items, borcat => $borcat });
+
+ # If every item is hidden, then the biblio should be hidden too.
+ next if (scalar @all_items >= 1 && scalar @hidden_items == scalar @all_items);
+
+ # copy the visible ones into the items array.
+ my @items;
+ foreach my $item (@all_items) {
+ if ( none { $item->{itemnumber} ne $_ } @hidden_items ) {
+ push @items, $item;
+ }
+ }
+
my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
my $hasauthors = 0;
}
}
-my $query = new CGI;
+my $query = CGI->new();
+
+my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0;
+$biblionumber = int($biblionumber);
+
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
{
template_name => "opac-detail.tt",
}
);
-my $biblionumber = $query->param('biblionumber') || $query->param('bib') || 0;
-$biblionumber = int($biblionumber);
-
my @all_items = GetItemsInfo($biblionumber);
my @hiddenitems;
-if ( scalar @all_items >= 1 ) {
- my $borcat;
- if ( C4::Context->preference('OpacHiddenItemsExceptions') ) {
+my $patron = Koha::Patrons->find( $borrowernumber );
+my $borcat= q{};
+if ( C4::Context->preference('OpacHiddenItemsExceptions') ) {
+ $borcat = $patron ? $patron->categorycode : q{};
+}
- # we need to fetch the borrower info here, so we can pass the category
- my $borrower = GetMember( borrowernumber => $borrowernumber );
- $borcat = $borrower->{categorycode};
- }
+my $record = GetMarcBiblio({
+ biblionumber => $biblionumber,
+ opac => 1 });
+if ( ! $record ) {
+ print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
+ exit;
+}
+if ( scalar @all_items >= 1 ) {
push @hiddenitems,
GetHiddenItemnumbers( { items => \@all_items, borcat => $borcat } );
}
}
-my $record = GetMarcBiblio({ biblionumber => $biblionumber });
-if ( ! $record ) {
- print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
- exit;
-}
-
my $biblio = Koha::Biblios->find( $biblionumber );
-my $framework = &GetFrameworkCode( $biblionumber );
+my $framework = $biblio ? $biblio->frameworkcode : q{};
my $record_processor = Koha::RecordProcessor->new({
filters => 'ViewPolicy',
options => {
};
my $hits;
my @newresults;
+ my $search_context = {
+ 'interface' => 'opac',
+ 'category' => $borcat
+ };
for (my $i=0;$i<@servers;$i++) {
my $server = $servers[$i];
$hits = $results_hashref->{$server}->{"hits"};
- @newresults = searchResults({ 'interface' => 'opac' }, '', $hits, $results_per_page, $offset, $arrParamsBusc->{'scan'}, $results_hashref->{$server}->{"RECORDS"});
+ @newresults = searchResults( $search_context, '', $hits, $results_per_page, $offset, $arrParamsBusc->{'scan'}, $results_hashref->{$server}->{"RECORDS"});
}
return \@newresults;
}#searchAgain
items_count => scalar( @items ),
);
} else {
- my $patron = Koha::Patrons->find( $borrowernumber );
for my $itm (@items) {
my $item = Koha::Items->find( $itm->{itemnumber} );
$itm->{holds_count} = $item_reserves{ $itm->{itemnumber} };
}
}
for my $review (@$reviews) {
- my $patron = Koha::Patrons->find( $review->{borrowernumber} ); # FIXME Should be Koha::Review->reviewer or similar
+ my $review_patron = Koha::Patrons->find( $review->{borrowernumber} ); # FIXME Should be Koha::Review->reviewer or similar
# setting some borrower info into this hash
- if ( $patron ) {
- $review->{patron} = $patron;
- if ( $libravatar_enabled and $patron->email ) {
- $review->{avatarurl} = libravatar_url( email => $patron->email, https => $ENV{HTTPS} );
+ if ( $review_patron ) {
+ $review->{patron} = $review_patron;
+ if ( $libravatar_enabled and $review_patron->email ) {
+ $review->{avatarurl} = libravatar_url( email => $review_patron->email, https => $ENV{HTTPS} );
}
- if ( $patron->borrowernumber eq $borrowernumber ) {
+ if ( $review_patron->borrowernumber eq $borrowernumber ) {
$loggedincommenter = 1;
}
}
use Koha::RecordProcessor;
use utf8;
-my $query = new CGI;
+my $query = CGI->new();
my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
{
if ($bib_list && $format) {
+ my $borcat = q{};
+ if ( C4::Context->preference('OpacHiddenItemsExceptions') ) {
+ # we need to fetch the borrower info here, so we can pass the category
+ my $borrower = Koha::Patrons->find( { borrowernumber => $borrowernumber } );
+ $borcat = $borrower ? $borrower->categorycode : $borcat;
+ }
+
my @bibs = split( /\//, $bib_list );
my $marcflavour = C4::Context->preference('marcflavour');
my $record = GetMarcBiblio({
biblionumber => $biblio,
- embed_items => 1 });
+ embed_items => 1,
+ opac => 1,
+ borcat => $borcat });
my $framework = &GetFrameworkCode( $biblio );
$record_processor->options({
interface => 'opac',
}
);
+my $borcat = q{};
+if ( C4::Context->preference('OpacHiddenItemsExceptions') ) {
+ # we need to fetch the borrower info here, so we can pass the category
+ my $borrower = Koha::Patrons->find( { borrowernumber => $borrowernumber } );
+ $borcat = $borrower ? $borrower->categorycode : $borcat;
+}
+
my $shelfnumber = $query->param('shelfnumber');
my $format = $query->param('format');
my $context = $query->param('context');
my $record = GetMarcBiblio({
biblionumber => $biblionumber,
- embed_items => 1 });
+ embed_items => 1,
+ opac => 1,
+ borcat => $borcat });
my $framework = &GetFrameworkCode( $biblionumber );
$record_processor->options({
interface => 'opac',
$biblionumber = int($biblionumber);
my $error = q{};
+# Determine logged in user's patron category.
+# Blank if not logged in.
+my $userenv = C4::Context->userenv;
+my $borcat = q{};
+if ($userenv) {
+ my $borrowernumber = $userenv->{'number'};
+ if ($borrowernumber) {
+ my $borrower = Koha::Patrons->find( { borrowernumber => $borrowernumber } );
+ $borcat = $borrower ? $borrower->categorycode : $borcat;
+ }
+}
+
my $include_items = ($format =~ /bibtex/) ? 0 : 1;
my $marc = $biblionumber
? GetMarcBiblio({
biblionumber => $biblionumber,
- embed_items => $include_items })
+ embed_items => $include_items,
+ opac => 1,
+ borcat => $borcat })
: undef;
if(!$marc) {
use C4::Tags qw(get_tags);
use C4::SocialData;
use C4::External::OverDrive;
-use C4::Members qw(GetMember);
+use Koha::Libraries;
use Koha::ItemTypes;
use Koha::Ratings;
use Koha::Virtualshelves;
$DEBUG and printf STDERR "taglist (%s biblionumber)\nmarclist (%s records)\n", scalar(@$taglist), scalar(@marclist);
$results_hashref->{biblioserver}->{RECORDS} = \@marclist;
# FIXME: tag search and standard search should work together, not exclusively
+ # FIXME: Because search and standard search don't work together OpacHiddenItems
+ # displays search results which should be hidden.
# FIXME: No facets for tags search.
} elsif ($build_grouped_results) {
eval {
$search_context->{'interface'} = 'opac';
if (C4::Context->preference('OpacHiddenItemsExceptions')){
# we need to fetch the borrower info here, so we can pass the category
- my $borrower = GetMember( borrowernumber => $borrowernumber );
- $search_context->{'category'} = $borrower->{'categorycode'};
+ my $patron = Koha::Patrons->find( { borrowernumber => $borrowernumber } );
+ $search_context->{'category'} = $patron ? $patron->categorycode : q{};
}
for (my $i=0;$i<@servers;$i++) {
});
my $email = Koha::Email->new();
my $patron = Koha::Patrons->find( $borrowernumber );
+ my $borcat = $patron ? $patron->categorycode : q{};
my $user_email = $patron->first_valid_email_address
|| C4::Context->preference('KohaAdminEmailAddress');
next unless $dat;
my $record = GetMarcBiblio({
biblionumber => $biblionumber,
- embed_items => 1 });
+ embed_items => 1,
+ opac => 1,
+ borcat => $borcat });
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
}
);
+ my $patron = Koha::Patrons->find( $borrowernumber );
+ my $borcat = $patron ? $patron->categorycode : q{};
+
my $shelf = Koha::Virtualshelves->find( $shelfid );
my $contents = $shelf->get_contents;
my $marcflavour = C4::Context->preference('marcflavour');
while ( my $content = $contents->next ) {
my $biblionumber = $content->biblionumber;
- my $fw = GetFrameworkCode($biblionumber);
- my $dat = GetBiblioData($biblionumber);
my $record = GetMarcBiblio({
biblionumber => $biblionumber,
- embed_items => 1 });
+ embed_items => 1,
+ opac => 1,
+ borcat => $borcat });
+ next unless $record;
+ my $fw = GetFrameworkCode($biblionumber);
+ my $dat = GetBiblioData($biblionumber);
+
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
my $subtitle = GetRecordValue('subtitle', $record, $fw);
push( @results, $dat );
}
- my $patron = Koha::Patrons->find( $borrowernumber );
-
$template2->param(
BIBLIO_RESULTS => \@results,
comment => $comment,
use C4::Output qw(:html :ajax pagination_bar);
use C4::Scrubber;
use C4::Biblio;
+use C4::Items qw(GetItemsInfo GetHiddenItemnumbers);
use C4::Tags qw(add_tag get_approval_rows get_tag_rows remove_tag stratify_tags);
use C4::XSLT;
my $results = [];
my $my_tags = [];
+my $borcat = q{};
if ($loggedinuser) {
+ my $patron = Koha::Patrons->find( { borrowernumber => $loggedinuser } );
+ $borcat = $patron ? $patron->categorycode : $borcat;
+ my $should_hide = C4::Context->preference('OpacHiddenItems') // q{};
+ $should_hide = ( $should_hide =~ /\S/ ) ? 1 : 0;
$my_tags = get_tag_rows({borrowernumber=>$loggedinuser});
my $my_approved_tags = get_approval_rows({ approved => 1 });
foreach my $tag (@$my_tags) {
+ $tag->{visible} = 0;
my $biblio = Koha::Biblios->find( $tag->{biblionumber} );
- my $record = &GetMarcBiblio({ biblionumber => $tag->{biblionumber} });
+ my $record = &GetMarcBiblio({
+ biblionumber => $tag->{biblionumber},
+ embed_items => 1,
+ opac => 1,
+ borcat => $borcat });
+ next unless $record;
+ my $hidden_items = undef;
+ my @hidden_itemnumbers;
+ my @all_items;
+ if ($should_hide) {
+ @all_items = GetItemsInfo( $tag->{biblionumber} );
+ @hidden_itemnumbers = GetHiddenItemnumbers({
+ items => \@all_items,
+ borcat => $borcat });
+ $hidden_items = \@hidden_itemnumbers;
+ }
+ next if ( $should_hide && scalar @all_items == scalar @hidden_itemnumbers );
$tag->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $tag->{biblionumber} ) );
$tag->{title} = $biblio->title;
$tag->{author} = $biblio->author;
if ( $xslfile ) {
$tag->{XSLTBloc} = XSLTParse4Display(
$tag->{ biblionumber }, $record, "OPACXSLTResultsDisplay",
- 1, undef, $sysxml, $xslfile, $lang
+ 1, $hidden_items, $sysxml, $xslfile, $lang
);
}
$date =~ /\s+(\d{2}\:\d{2}\:\d{2})/;
$tag->{time_created_display} = $1;
$tag->{approved} = ( grep { $_->{term} eq $tag->{term} and $_->{approved} } @$my_approved_tags );
+ $tag->{visible} = 1;
}
}
$arghash->{biblionumber} = $arg;
}
$results = get_approval_rows($arghash);
+ my @filtered_results;
+ foreach my $my_tag (@$my_tags) {
+ if (grep { $_->{term} eq $my_tag->{term} } @$results) {
+ if (! $my_tag->{visible} ) {
+ my $check_biblio = GetMarcBiblio({
+ biblionumber => $my_tag->{biblionumber},
+ embed_items => 1,
+ opac => 1,
+ borcat => $borcat });
+ if ($check_biblio) {
+ push @filtered_results, $my_tag;
+ }
+ } else {
+ push @filtered_results, $my_tag;
+ }
+ }
+ }
+ $results = \@filtered_results;
stratify_tags(10, $results); # work out the differents sizes for things
my $count = scalar @$results;
$template->param(TAGLOOP_COUNT => $count, mine => $mine);
# get borrower information ....
my $patron = Koha::Patrons->find( $borrowernumber );
my $borr = $patron->unblessed;
+# unblessed is a hash vs. object/undef. Hence the use of curly braces here.
+my $borcat = $borr ? $borr->{categorycode} : q{};
my ( $today_year, $today_month, $today_day) = Today();
my ($warning_year, $warning_month, $warning_day) = split /-/, $borr->{'dateexpiry'};
);
$issue->{rentalfines} = $rental_fines->count ? $rental_fines->next->get_column('rental_fines') : 0;
- my $marcrecord = GetMarcBiblio({ biblionumber => $issue->{'biblionumber'} });
+ my $marcrecord = GetMarcBiblio({
+ biblionumber => $issue->{'biblionumber'},
+ embed_items => 1,
+ opac => 1,
+ borcat => $borcat });
$issue->{'subtitle'} = GetRecordValue('subtitle', $marcrecord, GetFrameworkCode($issue->{'biblionumber'}));
# check if item is renewable
my ($status,$renewerror) = CanBookBeRenewed( $borrowernumber, $issue->{'itemnumber'} );
use CGI qw ( -utf8 );
-use Test::More tests => 4;
+use Test::More tests => 5;
use Test::MockModule;
use t::lib::Mocks;
use t::lib::TestBuilder;
$schema->resultset( 'BorrowerAttributeType' )->delete_all;
$schema->resultset( 'Category' )->delete_all;
$schema->resultset( 'Item' )->delete_all; # 'Branch' deps. on this
+ $schema->resultset( 'Club' )->delete_all;
$schema->resultset( 'Branch' )->delete_all;
# Configure Koha to enable ILS-DI server and extended attributes:
# Cleanup
$schema->storage->txn_rollback;
};
+
+# This is a stub, as it merely is for triggering the GetMarcBiblio call.
+subtest 'GetRecords' => sub {
+
+ plan tests => 1;
+
+ $schema->storage->txn_begin;
+
+ my $biblio = $builder->build({
+ source => 'Biblio',
+ value => {
+ title => 'Title 1', },
+ });
+
+ my $item = $builder->build({
+ source => 'Item',
+ value => {
+ biblionumber => $biblio->{biblionumber},
+ },
+ });
+
+ my $biblioitem = $builder->build({
+ source => 'Biblioitem',
+ value => {
+ biblionumber => $biblio->{biblionumber},
+ itemnumber => $item->{itemnumber},
+ },
+ });
+
+ my $query = CGI->new({
+ 'schema' => 'MARCXML',
+ 'id' => [ $biblio->{biblionumber} ]
+ });
+
+ my $result = C4::ILSDI::Services::GetRecords($query);
+ ok($result,'There is a result');
+
+ $schema->storage->txn_rollback;
+}
subtest 'GetHiddenItemnumbers tests' => sub {
- plan tests => 9;
+ plan tests => 11;
# This sub is controlled by the OpacHiddenItems system preference.
push @items, GetItem( $item2_itemnumber );
# Empty OpacHiddenItems
- C4::Context->set_preference('OpacHiddenItems','');
+ t::lib::Mocks::mock_preference('OpacHiddenItems','');
ok( !defined( GetHiddenItemnumbers( { items => \@items } ) ),
"Hidden items list undef if OpacHiddenItems empty");
# Blank spaces
- C4::Context->set_preference('OpacHiddenItems',' ');
+ t::lib::Mocks::mock_preference('OpacHiddenItems',' ');
ok( scalar GetHiddenItemnumbers( { items => \@items } ) == 0,
"Hidden items list empty if OpacHiddenItems only contains blanks");
$opachiddenitems = "
withdrawn: [1,0]";
t::lib::Mocks::mock_preference( 'OpacHiddenItems', $opachiddenitems );
- C4::Context->set_preference( 'OpacHiddenItems', $opachiddenitems );
@hidden = GetHiddenItemnumbers( { items => \@items } );
ok( scalar @hidden == 2, "Two items hidden");
is_deeply( \@hidden, \@itemnumbers, "withdrawn=1 and withdrawn=0 hidden");
ok( scalar @hidden == 2, "Two items hidden");
is_deeply( \@hidden, \@itemnumbers, "withdrawn=1 and homebranch library2 hidden");
+ # Override hidden with patron category
+ t::lib::Mocks::mock_preference( 'OpacHiddenItemsExceptions', 'S' );
+ @hidden = GetHiddenItemnumbers( { items => \@items, borcat => 'PT' } );
+ ok( scalar @hidden == 2, "Two items still hidden");
+ @hidden = GetHiddenItemnumbers( { items => \@items, borcat => 'S' } );
+ ok( scalar @hidden == 0, "Two items not hidden");
+
# Valid OpacHiddenItems, empty list
@items = ();
@hidden = GetHiddenItemnumbers( { items => \@items } );
};
subtest 'C4::Biblio::EmbedItemsInMarcBiblio' => sub {
- plan tests => 7;
+ plan tests => 8;
$schema->storage->txn_begin();
my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber });
warning_is { C4::Biblio::EmbedItemsInMarcBiblio() }
{ carped => 'EmbedItemsInMarcBiblio: No MARC record passed' },
- 'Should crap is no record passed.';
+ 'Should carp is no record passed.';
- C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber );
+ C4::Biblio::EmbedItemsInMarcBiblio({
+ marc_record => $record,
+ biblionumber => $biblionumber });
my @items = $record->field($itemfield);
is( scalar @items, $number_of_items, 'Should return all items' );
- C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber,
- [ $itemnumbers[1], $itemnumbers[3] ] );
+ my $marc_with_items = C4::Biblio::GetMarcBiblio({
+ biblionumber => $biblionumber,
+ embed_items => 1 });
+ is_deeply( $record, $marc_with_items, 'A direct call to GetMarcBiblio with items matches');
+
+ C4::Biblio::EmbedItemsInMarcBiblio({
+ marc_record => $record,
+ biblionumber => $biblionumber,
+ item_numbers => [ $itemnumbers[1], $itemnumbers[3] ] });
@items = $record->field($itemfield);
is( scalar @items, 2, 'Should return all items present in the list' );
- C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber, undef, 1 );
+ C4::Biblio::EmbedItemsInMarcBiblio({
+ marc_record => $record,
+ biblionumber => $biblionumber,
+ opac => 1 });
@items = $record->field($itemfield);
is( scalar @items, $number_of_items, 'Should return all items for opac' );
homebranch: ['$library1->{branchcode}']";
t::lib::Mocks::mock_preference( 'OpacHiddenItems', $opachiddenitems );
- C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber );
+ C4::Biblio::EmbedItemsInMarcBiblio({
+ marc_record => $record,
+ biblionumber => $biblionumber });
@items = $record->field($itemfield);
is( scalar @items,
$number_of_items,
'Even with OpacHiddenItems set, all items should have been embedded' );
- C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber, undef, 1 );
+ C4::Biblio::EmbedItemsInMarcBiblio({
+ marc_record => $record,
+ biblionumber => $biblionumber,
+ opac => 1 });
@items = $record->field($itemfield);
is(
scalar @items,
$opachiddenitems = "
homebranch: ['$library1->{branchcode}', '$library2->{branchcode}']";
t::lib::Mocks::mock_preference( 'OpacHiddenItems', $opachiddenitems );
- C4::Biblio::EmbedItemsInMarcBiblio( $record, $biblionumber, undef, 1 );
+ C4::Biblio::EmbedItemsInMarcBiblio({
+ marc_record => $record,
+ biblionumber => $biblionumber,
+ opac => 1 });
@items = $record->field($itemfield);
is(
scalar @items,
--- /dev/null
+#!/usr/bin/perl
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
+
+use Modern::Perl;
+
+use Test::More tests => 3;
+
+use_ok('Koha::BiblioUtils');
+use_ok('Koha::BiblioUtils::Iterator');
+
+use C4::Biblio;
+use C4::Items;
+use DBI;
+use t::lib::TestBuilder;
+use t::lib::Mocks;
+
+my $schema = Koha::Database->new()->schema();
+$schema->storage->txn_begin();
+
+# Delete issues to prevent foreign constraint failures.
+# blank all biblios, biblioitems, and items.
+$schema->resultset('Issue')->delete();
+$schema->resultset('Biblio')->delete();
+
+my $location = 'My Location';
+my $builder = t::lib::TestBuilder->new;
+my $library = $builder->build({
+ source => 'Branch',
+});
+my $itemtype = $builder->build({
+ source => 'Itemtype',
+});
+
+# Create a biblio instance for testing
+t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
+my ($bibnum, $bibitemnum) = get_biblio();
+
+# Add an item.
+my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => $library->{branchcode}, holdingbranch => $library->{branchcode}, location => $location, itype => $itemtype->{itemtype} } , $bibnum);
+
+my $rs = $schema->resultset('Biblioitem')->search({});
+my $iterator = Koha::BiblioUtils::Iterator->new($rs, items => 1 );
+my $record = $iterator->next();
+my $expected_tags = [ 100, 245, 952, 999 ];
+my @result_tags = map { $_->tag() } $record->field('...');
+my @sorted_tags = sort @result_tags;
+is_deeply(\@sorted_tags,$expected_tags, "Got the same tags as expected");
+
+$schema->storage->txn_rollback();
+
+# Helper method to set up a Biblio.
+sub get_biblio {
+ my ( $frameworkcode ) = @_;
+ $frameworkcode //= '';
+ my $bib = MARC::Record->new();
+ $bib->append_fields(
+ MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'),
+ MARC::Field->new('245', ' ', ' ', a => 'Silence in the library'),
+ );
+ my ($bibnum, $bibitemnum) = AddBiblio($bib, $frameworkcode);
+ return ($bibnum, $bibitemnum);
+}
--- /dev/null
+#!/usr/bin/perl
+
+# This file is part of Koha.
+#
+# Copyright (C) 2017 Mark Tompsett
+#
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
+
+use Modern::Perl;
+
+use Test::More tests => 3;
+use t::lib::TestBuilder;
+
+use MARC::Record;
+use MARC::Field;
+use Data::Dumper;
+
+use C4::Biblio;
+use C4::Items;
+use C4::Labels::Layout;
+
+use Koha::Database;
+
+use_ok('C4::Labels::Label');
+
+my $database = Koha::Database->new();
+my $schema = $database->schema();
+$schema->storage->txn_begin();
+
+my $batch_id;
+my ( $llx, $lly ) = ( 0, 0 );
+my $frameworkcode = q{};
+
+## Setup Test
+my $builder = t::lib::TestBuilder->new;
+
+# Add branch
+my $branch_1 = $builder->build( { source => 'Branch' } )->{branchcode};
+
+# Add categories
+my $category_1 = $builder->build( { source => 'Category' } )->{categorycode};
+
+# Add an item type
+my $itemtype =
+ $builder->build( { source => 'Itemtype', value => { notforloan => undef } } )
+ ->{itemtype};
+
+C4::Context->set_userenv( undef, undef, undef, undef, undef, undef, $branch_1 );
+
+# Create a helper biblio
+my $bib = MARC::Record->new();
+my $title = 'Silence in the library';
+if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) {
+ $bib->append_fields(
+ MARC::Field->new( '600', q{}, '1', a => 'Moffat, Steven' ),
+ MARC::Field->new( '200', q{}, q{}, a => $title ),
+ );
+}
+else {
+ $bib->append_fields(
+ MARC::Field->new( '100', q{}, q{}, a => 'Moffat, Steven' ),
+ MARC::Field->new( '245', q{}, q{}, a => $title ),
+ );
+}
+my ($bibnum) = AddBiblio( $bib, $frameworkcode );
+
+# Create a helper item instance for testing
+my ( $item_bibnum, $item_bibitemnum, $itemnumber ) = AddItem(
+ {
+ homebranch => $branch_1,
+ holdingbranch => $branch_1,
+ itype => $itemtype
+ },
+ $bibnum
+);
+
+# Modify item; setting barcode.
+my $testbarcode = '97531';
+ModItem( { barcode => $testbarcode }, $bibnum, $itemnumber );
+
+my $layout = C4::Labels::Layout->new( layout_name => 'TEST' );
+
+my $dummy_template_values = {
+ creator => 'Labels',
+ profile_id => 0,
+ template_code => 'Avery 5160 | 1 x 2-5/8',
+ template_desc => '3 columns, 10 rows of labels',
+ page_width => 8.5,
+ page_height => 11,
+ label_width => 2.63,
+ label_height => 1,
+ top_text_margin => 0.139,
+ left_text_margin => 0.0417,
+ top_margin => 0.35,
+ left_margin => 0.23,
+ cols => 3,
+ rows => 10,
+ col_gap => 0.13,
+ row_gap => 0,
+ units => 'INCH',
+ template_stat => 1,
+};
+
+my $label = C4::Labels::Label->new(
+ batch_id => $batch_id,
+ item_number => $itemnumber,
+ llx => $llx,
+ lly => $lly,
+ width => $dummy_template_values->{'label_width'},
+ height => $dummy_template_values->{'label_height'},
+ top_text_margin => $dummy_template_values->{'top_text_margin'},
+ left_text_margin => $dummy_template_values->{'left_text_margin'},
+ barcode_type => $layout->get_attr('barcode_type'),
+ printing_type => 'BIB',
+ guidebox => $layout->get_attr('guidebox'),
+ oblique_title => $layout->get_attr('oblique_title'),
+ font => $layout->get_attr('font'),
+ font_size => $layout->get_attr('font_size'),
+ callnum_split => $layout->get_attr('callnum_split'),
+ justify => $layout->get_attr('text_justify'),
+ format_string => $layout->get_attr('format_string'),
+ text_wrap_cols => $layout->get_text_wrap_cols(
+ label_width => $dummy_template_values->{'label_width'},
+ left_text_margin => $dummy_template_values->{'left_text_margin'}
+ ),
+);
+
+my $label_text = $label->create_label();
+ok( defined $label_text, 'Label Text Value defined.' );
+
+my $label_csv_data = $label->csv_data();
+ok( defined $label_csv_data, 'Label CSV Data defined' );
+
+$schema->storage->txn_rollback();
+
+1;
#!/usr/bin/perl;
use Modern::Perl;
-use Test::More tests => 11;
+use Test::More tests => 12;
use Test::MockModule;
use MARC::Record;
use MARC::Field;
my $csv_profile_id_1 = insert_csv_profile({ csv_content => $csv_content });
my $csv = Text::CSV::Encoded->new();
-my $csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_1, 1, $csv );
+# Test bad biblionumber case
+my $csv_output = C4::Record::marcrecord2csv( -1, $csv_profile_id_1, 1, $csv );
+ok(! defined $csv_output, 'Bad biblionumber gives undef as expected.');
+
+$csv_output = C4::Record::marcrecord2csv( $biblionumber, $csv_profile_id_1, 1, $csv );
is( $csv_output, q[Title|Author|Subject
"The art of computer programming,The art of another title"|"Donald E. Knuth.,Donald E. Knuth. II"|"Computer programming.,Computer algorithms."
use YAML;
use C4::Debug;
+use C4::XSLT;
require C4::Context;
# work around spurious wide character warnings
our $UseQueryParser = 0;
our $SearchEngine = 'Zebra';
our $marcflavour = 'MARC21';
+our $htdocs = File::Spec->rel2abs(dirname($0));
+my @htdocs = split /\//, $htdocs;
+$htdocs[-2] = 'koha-tmpl';
+$htdocs[-1] = 'opac-tmpl';
+$htdocs = join '/', @htdocs;
our $contextmodule = new Test::MockModule('C4::Context');
$contextmodule->mock('preference', sub {
my ($self, $pref) = @_;
return '';
} elsif ($pref eq 'template') {
return 'prog';
+ } elsif ($pref eq 'OPACXSLTResultsDisplay') {
+ return C4::XSLT::_get_best_default_xslt_filename($htdocs, 'bootstrap','en',$marcflavour . 'slim2OPACResults.xsl');
+ } elsif ($pref eq 'BiblioDefaultView') {
+ return 'normal';
+ } elsif ($pref eq 'IdRef') {
+ return '0';
+ } elsif ($pref eq 'IntranetBiblioDefaultView') {
+ return 'normal';
+ } elsif ($pref eq 'OPACBaseURL') {
+ return 'http://library.mydnsname.org';
+ } elsif ($pref eq 'OPACResultsLibrary') {
+ return 'homebranch';
+ } elsif ($pref eq 'OpacSuppression') {
+ return '0';
+ } elsif ($pref eq 'OPACURLOpenInNewWindow') {
+ return '0';
+ } elsif ($pref eq 'TraceCompleteSubfields') {
+ return '0';
+ } elsif ($pref eq 'TraceSubjectSubdivisions') {
+ return '0';
+ } elsif ($pref eq 'TrackClicks') {
+ return '0';
+ } elsif ($pref eq 'URLLinkText') {
+ return q{};
+ } elsif ($pref eq 'UseAuthoritiesForTracings') {
+ return '1';
+ } elsif ($pref eq 'UseControlNumber') {
+ return '0';
+ } elsif ($pref eq 'UseICU') {
+ return '0';
+ } elsif ($pref eq 'viewISBD') {
+ return '1';
} else {
warn "The syspref $pref was requested but I don't know what to say; this indicates that the test requires updating"
unless $pref =~ m/(XSLT|item|branch|holding|image)/i;