diff --git a/conf/config.ini b/conf/config.ini index a140489a..2fc29344 100755 --- a/conf/config.ini +++ b/conf/config.ini @@ -4,11 +4,6 @@ ; only for HathiTrust site -[IntoCopyright] -; YYYYMMDDHH -date = 9999999999 - - [Switches] fetchAlephHolings = false onlyHathiHoldings = true diff --git a/services/Record/RecordUtils.php b/services/Record/RecordUtils.php index 2bc2cec1..a370a8b4 100644 --- a/services/Record/RecordUtils.php +++ b/services/Record/RecordUtils.php @@ -184,7 +184,6 @@ function record_is_tombstone($rec) { function is_fullview($rcode, $inUSA = null) { - global $configArray; if (!isset($inUSA)) { $session = VFSession::instance(); $inUSA = $session->get('inUSA'); @@ -199,23 +198,9 @@ function is_fullview($rcode, $inUSA = null) { // Assume false $fv = false; - // Newly into copyright? Return true if after the right date - // The munged facet is in Solr.php -- don't forget - // to deal with that, too. - - $todays_date = intval(date("YmdH")); - $copyright_active_date = intval($configArray['IntoCopyright']['date']); - if (is_array($rcode) && - array_search("newly_open", $rcode) && - $todays_date >= $copyright_active_date - ) { - return true; - } else if (is_array($rcode)) { // ditch the newly_open marker - $index = array_search("newly_open", $rcode); - if ($index) { - unset($rcode[$index]); - } - $rcode = $rcode[0]; + if (is_array($rcode)) { + // Empty array? Just use default empty string. + $rcode = empty($rcode) ? '' : reset($rcode); } // Public domain? return true diff --git a/sys/Solr.php b/sys/Solr.php index ae53bbc7..85b390b7 100755 --- a/sys/Solr.php +++ b/sys/Solr.php @@ -427,7 +427,6 @@ function filterComponents($ss) { if ($index == "ht_availability" and $oval == 'Full text') { $ft = $this->fulltext_filter_base(); - $ft = $this->fulltext_filter_add_jan1_rollover($ft); $ft = $this->fulltext_filter_add_etas_or_resource_sharing($ft); $rv[] = $ft; } @@ -463,26 +462,6 @@ function fulltext_filter_add_etas_or_resource_sharing($current_ft_filter) { } } - function fulltext_filter_add_jan1_rollover($current_ft_filter) { - // Hack into place a change of the full-text only facet - // for the temporary newly_open rightscode value - // but only on or after the date from config.ini - - global $configArray; - - $todays_date = intval(date("YmdH")); - $copyright_active_date = intval($configArray['IntoCopyright']['date']); - - if ($todays_date >= $copyright_active_date) { - $newly_open = $this->quoteFilterValue('newly_open'); - return "($current_ft_filter OR ht_rightscode:$newly_open)"; - } - else { - return $current_ft_filter; - } - } - - /** * tagIDs($ss) * diff --git a/test/RecordUtilsTest.php b/test/RecordUtilsTest.php index 7dbb9959..4bffffdc 100644 --- a/test/RecordUtilsTest.php +++ b/test/RecordUtilsTest.php @@ -150,6 +150,65 @@ public function test_ht_link_data_from_json_activated_role(): void { $this->assertEquals(true, $data['has_activated_role']); $this->assertEquals('resourceSharing', $data['role_name']); } + + /** + * @covers RecordUtils::is_fullview + */ + public function test_is_fullview(): void { + $utils = new RecordUtils(); + $examples = [ + // Rights fv us? fv non-us? + ['pd', true, true], + ['ic', false, false], + ['op', false, false], + ['orph', false, false], + ['und', false, false], + // umall is obsolete, test is included to demonstrate behavior + ['umall', false, false], + ['ic-world', true, true], + ['nobody', false, false], + ['pdus', true, false], + ['cc-by-3.0', true, true], + // skip the rest of the CC 3.0 rights... + ['orphcand', false, false], + ['cc-zero', true, true], + ['und-world', true, true], + ['icus', false, true], + ['cc-by-4.0', true, true], + // skip the rest of the CC 4.0 rights... + ['pd-pvt', false, false], + ['supp', false, false], + // Edge cases + ['???', false, false], + [[], false, false], + [['pd', 'ic'], true, true] + ]; + foreach ($examples as $example) { + $this->assertEquals($example[1], $utils->is_fullview($example[0], true)); + $this->assertEquals($example[2], $utils->is_fullview($example[0], false)); + } + } + + /** + * @covers RecordUtils::is_open_to_no_one + */ + public function test_is_open_to_no_one(): void { + $utils = new RecordUtils(); + $examples = [ + // Rights open to no one? + ['pd', false], + ['ic', false], + ['pd-pvt', true], + ['supp', true], + ['nobody', true], + [['pd', 'pd-pvt'], true], + [['pd', 'supp'], true], + [['pd', 'nobody'], true] + ]; + foreach ($examples as $example) { + $this->assertEquals($example[1], $utils->is_open_to_no_one($example[0])); + } + } } ?>