Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions ls/lib/Config/global.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,6 @@ base_fallback_paths = /ls/web/firebird|/ls/web|/ls/web/common-web/firebird|/ls/w
# use local repository
local_base_fallback_paths = /ls/web/firebird|/ls/web|/mdp-web/firebird|/mdp-web

#
# Solr Indexing/Search
#
# January 1 copyright to pd for new years day code
pd_check_start_date = 2020-01-01 00:00:01
pd_check_end_date = 2020-01-30 00:00:00
# 1923 Publications collection
#XXX FIX this for 2020
new_years_pd_coll_id = 149827760




solr_update_script = /update
solr_select_script = /select
Expand Down
63 changes: 0 additions & 63 deletions ls/lib/LS/PIFiller/ListSearchResults.pm
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ use Utils;
use Namespaces;
# for logging in json
use JSON::XS;
# for New Years hack
use Date::Calc;


BEGIN
Expand Down Expand Up @@ -2021,27 +2019,6 @@ sub _ls_wrap_result_data {
};
}

#----------------------------------------------------------------------
Comment thread
moseshll marked this conversation as resolved.
#XXX new years hack
# check if item is in 1923 coll and if so overide

my $config = $C->get_object('MdpConfig');
# get CO
my $co = $C->get_object('Collection');
my $new_years_pd_coll_id = $config->get('new_years_pd_coll_id');
#my $coll_id= '149827760';
if (__now_in_date_range_new_years($C))
{
if ($co->item_in_collection($id,$new_years_pd_coll_id)){
$fulltext_flag ='1';
}
}

#----------------------------------------------------------------------




$s .= wrap_string_in_tag($fulltext_flag, 'fulltext');
$s .= wrap_string_in_tag($emergency_flag, 'emergency');
$s .= wrap_string_in_tag($$activated_role{role}, 'activated_role') if ( ref($activated_role) );
Expand Down Expand Up @@ -2519,46 +2496,6 @@ sub __truncate_ary_ref
return (\@temp);
}

#----------------------------------------------------------------------
### New Years Hack for full view label
# ---------------------------------------------------------------------
sub __now_in_date_range_new_years
{

my $C = shift;
my $config = $C->get_object('MdpConfig');
my $pd_check_start_date = $config->get('pd_check_start_date');
my $pd_check_end_date = $config->get('pd_check_end_date');
my $start_ary = __datetime_string_to_array_ref($pd_check_start_date);
my $end_ary = __datetime_string_to_array_ref($pd_check_end_date);

# $t? param true= use gmt, no param = local??
#XXX fix bug in slip-lib/Result/Query!!!

my @now_date = Date::Calc::Today_and_Now();
my $pd_start_time = Date::Calc::Date_to_Time(@{$start_ary});
my $pd_end_time = Date::Calc::Date_to_Time(@{$end_ary});
my $now_time = Date::Calc::Date_to_Time(@now_date);

if ($now_time >=$pd_start_time && $now_time < $pd_end_time)
{
return (1);
}
return (0);
}
# ---------------------------------------------------------------------

# ---------------------------------------------------------------------
sub __datetime_string_to_array_ref
{
my $date_string = shift;
my ($date_part, $time_part) = split(/\s+/,$date_string);
my @date=split(/\-/,$date_part);
my @time=split(/\:/,$time_part);
my @out = (@date,@time);
return \@out;
}

# ---------------------------------------------------------------------

#
Expand Down
129 changes: 57 additions & 72 deletions ls/lib/LS/Query/Facets.pm
Original file line number Diff line number Diff line change
Expand Up @@ -466,71 +466,55 @@ fq=((rights:1+OR+rights:7+OR+...)+OR+(ht_heldby_brlm:inst+AND+attr:3)+OR+(ht_hel

# ---------------------------------------------------------------------
sub __HELPER_get_Solr_fulltext_filter_query_arg {

my $self = shift;
my $C = shift;

my $fulltext_FQ_string;

#XXX TODO check that the statement below and the code comply with current rights rules
# These are the attrs, for this users authorization type
# (e.g. SSD, HT affiliate, in-library), geo location and
# institution that equate to the 'allow' status, i.e. fulltext.
# This code takes into account whether the attr requires
# institution to hold the volumes, whether the holding have to be
# brittle, and qualifies accordingly.

my $fulltext_attr_list_ref = Access::Rights::get_fulltext_attr_list($C);

# enhanced user access rights not affected by institution or holdings
# SSDProxy user access rights not affected by institution or holdings (regular SSD are affected)
my $access_type = Access::Rights::get_access_type_determination($C);
if ($access_type eq $RightsGlobals::SSD_PROXY_USER )
{
$fulltext_FQ_string =
'(rights:(' . join('+OR+', @{$fulltext_attr_list_ref} ) . '))';
my $self = shift;
my $C = shift;

my $fulltext_FQ_string;

#XXX TODO check that the statement below and the code comply with current rights rules
# These are the attrs, for this users authorization type
# (e.g. SSD, HT affiliate, in-library), geo location and
# institution that equate to the 'allow' status, i.e. fulltext.
# This code takes into account whether the attr requires
# institution to hold the volumes, whether the holding have to be
# brittle, and qualifies accordingly.

my $fulltext_attr_list_ref = Access::Rights::get_fulltext_attr_list($C);
# enhanced user access rights not affected by institution or holdings
# SSDProxy user access rights not affected by institution or holdings (regular SSD are affected)
my $access_type = Access::Rights::get_access_type_determination($C);
if (
$access_type eq $RightsGlobals::SSD_PROXY_USER
||
$access_type eq $RightsGlobals::HT_TOTAL_USER
||
$access_type eq $RightsGlobals::HT_STAFF_USER) {
$fulltext_FQ_string = '(rights:(' . join('+OR+', @{$fulltext_attr_list_ref} ) . '))';
} else {
#split rights attributes into those not needing holdings information = unqualified_string
# and holdings_qualified_string which specified combinations of rights and holdings

# unqualified string = OR query clause for rights attributes that don't need to be combined with holdings
# holdings_qualified_attr_list = list of rights attr for this user/ip or other conditions that must be qualified by holdings
my ($holdings_qualified_attr_list, $unqualified_string) = $self->__get_holdings_qualified_attr_list_and_unqualified_string($fulltext_attr_list_ref);

# Now qualify by holdings. If there is no institution, there
# cannot be a clause qualified by institution holdings at all.
my $holdings_qualified_string;
my $inst = $C->get_object('Auth')->get_institution_code($C, 'mapped');
if ($inst) {
$holdings_qualified_string = $self->__get_holdings_qualified_string($C, $holdings_qualified_attr_list, $inst);
}
else
{
#split rights attributes into those not needing holdings information = unqualified_string
# and holdings_qualified_string which specified combinations of rights and holdings

# unqualified string = OR query clause for rights attributes that don't need to be combined with holdings
# holdings_qualified_attr_list = list of rights attr for this user/ip or other conditions that must be qualified by holdings

my ($holdings_qualified_attr_list, $unqualified_string) = $self->__get_holdings_qualified_attr_list_and_unqualified_string($fulltext_attr_list_ref);

# Now qualify by holdings. If there is no institution, there
# cannot be a clause qualified by institution holdings at all.
my $holdings_qualified_string;
my $inst = $C->get_object('Auth')->get_institution_code($C, 'mapped');

if ($inst)
{
$holdings_qualified_string = $self->__get_holdings_qualified_string($C, $holdings_qualified_attr_list, $inst);
}

if ($holdings_qualified_string)
{
$fulltext_FQ_string = '(' . $unqualified_string . '+OR+' . $holdings_qualified_string . ')';
}
else
{
$fulltext_FQ_string = '(' . $unqualified_string . ')';
}
}

#tbw code to get items that will go from IC to PD on New Years day see:https://tools.lib.umich.edu/jira/browse/HT-769
if ($self-> __now_in_date_range_new_years($C))
{
my $new_years_pd_Q_string =$self->__get_new_years_pd_Q_string($C);
# remove closing paren from $fulltext_FQ_string
$fulltext_FQ_string =~s/\)$//;
$fulltext_FQ_string = $fulltext_FQ_string . '+OR+'. $new_years_pd_Q_string . ')';
if ($holdings_qualified_string) {
$fulltext_FQ_string = '(' . $unqualified_string . '+OR+' . $holdings_qualified_string . ')';
} else {
$fulltext_FQ_string = '(' . $unqualified_string . ')';
}
return $fulltext_FQ_string;
}
return $fulltext_FQ_string;
}

#----------------------------------------------------------------------
sub __get_holdings_qualified_attr_list_and_unqualified_string
{
Expand All @@ -553,6 +537,7 @@ sub __get_holdings_qualified_attr_list_and_unqualified_string
$unqualified_string =
'(rights:(' . join('+OR+', @unqualified_attr_list) . '))';
}

return( \@holdings_qualified_attr_list, $unqualified_string)
}

Expand All @@ -568,27 +553,27 @@ sub __get_holdings_qualified_string

my @qualified_OR_clauses = ();
my $access_type = Access::Rights::get_access_type_determination($C);

foreach my $attr (@{$holdings_qualified_attr_list}) {
if (($access_type != $RightsGlobals::SSD_USER)
&&
($attr eq $RightsGlobals::g_access_requires_brittle_holdings_attribute_value)) {
push(@qualified_OR_clauses, qq{(ht_heldby_brlm:$inst+AND+rights:$attr)});
}
else {
push(@qualified_OR_clauses, qq{(ht_heldby:$inst+AND+rights:$attr)});
}
# Section 108 in-library access requiring BRLM holdings only applies in-library
if (($access_type == $RightsGlobals::LIBRARY_IPADDR_USER)
Comment thread
moseshll marked this conversation as resolved.
&&
($attr eq $RightsGlobals::g_access_requires_brittle_holdings_attribute_value)) {
push(@qualified_OR_clauses, qq{(ht_heldby_brlm:$inst+AND+rights:$attr)});
} else {
push(@qualified_OR_clauses, qq{(ht_heldby:$inst+AND+rights:$attr)});
}
}

# etas
if ($access_type == $RightsGlobals::EMERGENCY_ACCESS_AFFILIATE && $self->is_california($inst)) {
push(@qualified_OR_clauses, $self->etas_CA_holdings_filter());
push(@qualified_OR_clauses, $self->etas_CA_holdings_filter());
}

my $holdings_qualified_string = '';
if (scalar @qualified_OR_clauses > 0)
{
$holdings_qualified_string = '(' . join('+OR+', @qualified_OR_clauses) . ')';
$holdings_qualified_string = '(' . join('+OR+', @qualified_OR_clauses) . ')';
}


Expand Down
Loading