Skip to content

Commit

Permalink
Merge branch '24.08.00' into 24.09.00
Browse files Browse the repository at this point in the history
  • Loading branch information
mdnoble73 committed Aug 2, 2024
2 parents 7b14fdd + 4ccb1eb commit 603f4d8
Show file tree
Hide file tree
Showing 33 changed files with 576 additions and 118 deletions.
Binary file modified code/reindexer/reindexer.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,15 @@ protected void checkInconsistentLiteraryForms() {
//logger.warn("Found inconsistent literary forms for grouped work " + id + " both fiction and non fiction had the same amount of usage. Defaulting to neither.");
literaryForm.clear();
literaryForm.put("Unknown", 1);
if (this.debugEnabled) {this.addDebugMessage("Fiction and non fiction score are the same - literary form is unknown ", 2);}
} else if (numFictionIndicators.compareTo(numNonFictionIndicators) > 0) {
logger.debug("Popularity dictates that Fiction is the correct literary form for grouped work " + id);
literaryForm.remove("Non Fiction");
if (this.debugEnabled) {this.addDebugMessage("Fiction has the highest literary form score", 2);}
} else if (numFictionIndicators.compareTo(numNonFictionIndicators) < 0) {
logger.debug("Popularity dictates that Non Fiction is the correct literary form for grouped work " + id);
literaryForm.remove("Fiction");
if (this.debugEnabled) {this.addDebugMessage("Non fiction has the highest literary form score", 2);}
}
}
}
Expand Down Expand Up @@ -343,6 +346,7 @@ protected void checkInconsistentLiteraryFormsFull() {
//Check to see if the highest usage literary forms are inconsistent
if (hasInconsistentLiteraryForms(highestUsageLiteraryForms)) {
//Ugh, we have inconsistent literary forms and can't make an educated guess as to which is correct.
if (this.debugEnabled) {this.addDebugMessage("Literary forms (" + literaryFormFull + ") don't match - full form is Unknown", 2);}
literaryFormFull.clear();
literaryFormFull.put("Unknown", 1);
}
Expand All @@ -361,6 +365,7 @@ private void removeInconsistentFullLiteraryForms(HashMap<String, Integer> litera
for (String curLiteraryForm : literaryFormFull.keySet()) {
if (firstLiteraryFormIsNonFiction != nonFictionFullLiteraryForms.contains(curLiteraryForm)) {
logger.debug(curLiteraryForm + " got voted off the island for grouped work " + id + " because it was inconsistent with other full literary forms.");
if (this.debugEnabled) {this.addDebugMessage(curLiteraryForm + " got voted off the island for grouped work " + id + " because it was inconsistent with other full literary forms.", 2);}
literaryFormFull.remove(curLiteraryForm);
changeMade = true;
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ private String loadAxis360Subjects(AbstractGroupedWorkSolr groupedWork, JSONObje
String genre = getFieldValue(titleData, "genre");
genres.add(genre);
Util.addToMapWithCount(literaryForm, genre);
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is " + genre + " based on Axis360 record", 2);}
Util.addToMapWithCount(literaryFormFull, genre);

String targetAudience;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,12 @@ SolrInputDocument getSolrDocument(BaseIndexingLogEntry logEntry) {
checkDefaultValue(literaryFormFull, "Not Coded");
checkDefaultValue(literaryFormFull, "Other");
checkDefaultValue(literaryFormFull, "Unknown");
if (this.isDebugEnabled()) {this.addDebugMessage("Total full literary form score: " + this.literaryFormFull, 2);}
checkInconsistentLiteraryFormsFull();
checkDefaultValue(literaryForm, "Not Coded");
checkDefaultValue(literaryForm, "Other");
checkDefaultValue(literaryForm, "Unknown");
if (this.isDebugEnabled()) {this.addDebugMessage("Total fiction vs non fiction score: " + this.literaryForm, 2);}
checkInconsistentLiteraryForms();
//Check if .isHide
if (groupedWorkIndexer.isHideUnknownLiteraryForm()) {
Expand All @@ -139,6 +141,8 @@ SolrInputDocument getSolrDocument(BaseIndexingLogEntry logEntry) {
literaryFormFull.remove("Not Coded");
}
//Add field
if (this.debugEnabled) {this.addDebugMessage("Literary form is " + literaryForm.keySet(), 4);}
if (this.debugEnabled) {this.addDebugMessage("Full literary form is " + literaryFormFull.keySet(), 4);}
doc.addField("literary_form_full", literaryFormFull.keySet());
doc.addField("literary_form", literaryForm.keySet());
if (targetAudienceFull.size() > 1 || !groupedWorkIndexer.isTreatUnknownAudienceAsUnknown()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,11 @@ void processRecord(AbstractGroupedWorkSolr groupedWork, String identifier, BaseI
if (rawResponse.getBoolean("fiction")){
Util.addToMapWithCount(literaryForm, "Fiction");
Util.addToMapWithCount(literaryFormFull, "Fiction");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is fiction based on Hoopla record", 2);}
}else{
Util.addToMapWithCount(literaryForm, "Non Fiction");
Util.addToMapWithCount(literaryFormFull, "Non Fiction");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is non fiction based on Hoopla record", 2);}
}
}
if (!literaryForm.isEmpty()){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1837,8 +1837,10 @@ protected void loadTargetAudiences(AbstractGroupedWorkSolr groupedWork, org.marc

protected void loadLiteraryForms(AbstractGroupedWorkSolr groupedWork, org.marc4j.marc.Record record, ArrayList<ItemInfo> printItems, String identifier) {
if (settings.getDetermineLiteraryFormBy() == 0){
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Determining literary form by bib record data", 1);}
super.loadLiteraryForms(groupedWork, record, printItems, identifier);
}else{
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Determining literary form by item subfield with literary_form map", 1);}
//Load based on a subfield of the items
for (ItemInfo printItem : printItems) {
if (printItem.getMarcField() != null) {
Expand All @@ -1847,6 +1849,7 @@ protected void loadLiteraryForms(AbstractGroupedWorkSolr groupedWork, org.marc4j
if (subfield.getData() != null) {
String translatedValue = translateValue("literary_form", subfield.getData(), identifier, true);
if (translatedValue != null) {
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Subfield " + settings.getLiteraryFormSubfield() + " for item " + printItem.getItemIdentifier() + " is " + subfield.getData() + " which maps to " + translatedValue, 2);}
groupedWork.addLiteraryForm(translatedValue);
groupedWork.addLiteraryFormFull(translatedValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,12 +702,14 @@ protected void loadLiteraryForms(AbstractGroupedWorkSolr groupedWork, org.marc4j
literaryFormChar = Character.toUpperCase(ohOhSixField.getData().charAt(16));
if (literaryFormChar != ' ') {
literaryForms.add(Character.toString(literaryFormChar));
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Record is a book based on Leader and Literary Form is " + indexer.translateSystemCollection("literary_form", literaryForms, identifier).toString() + " based on Leader and 006", 2);}
}
}
if (literaryForms.isEmpty() && ohOhEightField != null && ohOhEightField.getData().length() > 33) {
literaryFormChar = Character.toUpperCase(ohOhEightField.getData().charAt(33));
if (literaryFormChar != ' ') {
literaryForms.add(Character.toString(literaryFormChar));
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Record is a book based on Leader 6/7 and Literary Form is " + indexer.translateSystemCollection("literary_form", literaryForms, identifier).toString() + " based on Leader and 008 (counts for 2 points)", 2);}
}
}
addToMapWithCount(literaryFormsWithCount, indexer.translateSystemCollection("literary_form", literaryForms, identifier), 2);
Expand All @@ -720,14 +722,19 @@ protected void loadLiteraryForms(AbstractGroupedWorkSolr groupedWork, org.marc4j
if (position30 == 'F' || position31 == 'F'){
addToMapWithCount(literaryFormsWithCount, "Fiction", 2);
addToMapWithCount(literaryFormsFull, "Fiction", 2);
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Record is audio based on based on Leader 6/7 and Literary Form is fiction based on 008 position 30, 31 (counts for 2 points)", 2);}
}else if ((position30 == '|' || position30 == ' ') && (position31 == '|' || position31 == ' ')){
addToMapWithCount(literaryFormsWithCount, "Not Coded", 1);
addToMapWithCount(literaryFormsFull, "Not Coded", 1);
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Record is audio based on based on Leader 6/7 and Literary Form is not coded based on 008 position 30, 31", 2);}
}else{
addToMapWithCount(literaryFormsWithCount, "Non Fiction", 2);
addToMapWithCount(literaryFormsFull, "Non Fiction", 2);
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Record is audio based on Leader 6/7 and Literary Form is non fiction based on 008 position 30, 31 (counts for 2 points)", 2);}
}
}
} else {
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Could not determine literary form based on Leader 6/7", 2);}
}
} catch (Exception e) {
indexer.getLogEntry().incErrors("Unexpected error loading literary forms", e);
Expand Down Expand Up @@ -756,27 +763,32 @@ protected void loadLiteraryForms(AbstractGroupedWorkSolr groupedWork, org.marc4j
){
addToMapWithCount(literaryFormsWithCount, "Fiction");
addToMapWithCount(literaryFormsFull, "Fiction");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is fiction based on 650v, 651v", 2);}
}else if (subjectForm.equalsIgnoreCase("Biography")){
addToMapWithCount(literaryFormsWithCount, "Non Fiction");
addToMapWithCount(literaryFormsFull, "Non Fiction");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is non fiction based on 'biography' in 650v, 651v", 2);}
}else if (subjectForm.equalsIgnoreCase("Novela juvenil")
|| subjectForm.equalsIgnoreCase("Novela")
){
addToMapWithCount(literaryFormsWithCount, "Fiction");
addToMapWithCount(literaryFormsFull, "Fiction");
addToMapWithCount(literaryFormsFull, "Novels");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is fiction/novel based on 'novela' in 650v, 651v", 2);}
}else if (subjectForm.equalsIgnoreCase("Drama")
|| subjectForm.equalsIgnoreCase("Dramas")
|| subjectForm.equalsIgnoreCase("Juvenile drama")
){
addToMapWithCount(literaryFormsWithCount, "Fiction");
addToMapWithCount(literaryFormsFull, "Fiction");
addToMapWithCount(literaryFormsFull, "Dramas");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is fiction/drama based on 'drama' in 650v, 651v", 2);}
}else if (subjectForm.equalsIgnoreCase("Poetry")
|| subjectForm.equalsIgnoreCase("Juvenile Poetry")
){
addToMapWithCount(literaryFormsWithCount, "Non Fiction");
addToMapWithCount(literaryFormsFull, "Poetry");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is non fiction/poetry based on 'poetry' in 650v, 651v", 2);}
}else if (subjectForm.equalsIgnoreCase("Humor")
|| subjectForm.equalsIgnoreCase("Juvenile Humor")
|| subjectForm.equalsIgnoreCase("Comedy")
Expand All @@ -788,19 +800,23 @@ protected void loadLiteraryForms(AbstractGroupedWorkSolr groupedWork, org.marc4j
addToMapWithCount(literaryFormsWithCount, "Fiction");
addToMapWithCount(literaryFormsFull, "Fiction");
addToMapWithCount(literaryFormsFull, "Humor, Satires, etc.");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is fiction/humor based on 650v, 651v", 2);}
}else if (subjectForm.equalsIgnoreCase("Correspondence")
){
addToMapWithCount(literaryFormsWithCount, "Non Fiction");
addToMapWithCount(literaryFormsFull, "Letters");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is non fiction/letters based on 'correspondence' in 650v, 651v", 2);}
}else if (subjectForm.equalsIgnoreCase("Short Stories")
){
addToMapWithCount(literaryFormsWithCount, "Fiction");
addToMapWithCount(literaryFormsFull, "Fiction");
addToMapWithCount(literaryFormsFull, "Short Stories");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is fiction/short stories based on 'short stories' in 650v, 651v", 2);}
}else if (subjectForm.equalsIgnoreCase("essays")
){
addToMapWithCount(literaryFormsWithCount, "Non Fiction");
addToMapWithCount(literaryFormsFull, "Essays");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is non fiction/essays based on 'essays' in 650v, 651v", 2);}
}else if (subjectForm.equalsIgnoreCase("Personal narratives, American")
|| subjectForm.equalsIgnoreCase("Personal narratives, Polish")
|| subjectForm.equalsIgnoreCase("Personal narratives, Sudanese")
Expand Down Expand Up @@ -837,6 +853,7 @@ protected void loadLiteraryForms(AbstractGroupedWorkSolr groupedWork, org.marc4j
) {
addToMapWithCount(literaryFormsWithCount, "Non Fiction");
addToMapWithCount(literaryFormsFull, "Non Fiction");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is non fiction based on 650v, 651v", 2);}
}else{
//noinspection RedundantCollectionOperation
if (!unknownSubjectForms.contains(subjectForm)){
Expand All @@ -855,10 +872,12 @@ protected void loadLiteraryForms(AbstractGroupedWorkSolr groupedWork, org.marc4j
) {
addToMapWithCount(literaryFormsWithCount, "Non Fiction");
addToMapWithCount(literaryFormsFull, "Non Fiction");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is non fiction based on 655a", 2);}
}
if (subjectForm.startsWith("fiction")) {
addToMapWithCount(literaryFormsWithCount, "Fiction");
addToMapWithCount(literaryFormsFull, "Fiction");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is fiction based on 655a", 2);}
}
}
groupedWork.addLiteraryForms(literaryFormsWithCount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -587,21 +587,26 @@ private String loadOverDriveSubjects(AbstractGroupedWorkSolr groupedWork, JSONOb
Util.addToMapWithCount(literaryForm, "Non Fiction");
Util.addToMapWithCount(literaryFormFull, "Non Fiction");
genres.add("Non Fiction");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is non fiction based on OverDrive subjects", 2);}
} else if (curSubject.contains("Fiction")) {
Util.addToMapWithCount(literaryForm, "Fiction");
Util.addToMapWithCount(literaryFormFull, "Fiction");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is fiction based on OverDrive subjects", 2);}
genres.add("Fiction");
}

if (curSubject.contains("Poetry")) {
Util.addToMapWithCount(literaryForm, "Non Fiction");
Util.addToMapWithCount(literaryFormFull, "Poetry");
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is non-fiction/poetry based on OverDrive subjects", 2);}
} else if (curSubject.contains("Essays")) {
Util.addToMapWithCount(literaryForm, "Non Fiction");
Util.addToMapWithCount(literaryFormFull, curSubject);
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is non fiction/" + curSubject + " based on OverDrive subjects", 2);}
} else if (curSubject.contains("Short Stories") || curSubject.contains("Drama")) {
Util.addToMapWithCount(literaryForm, "Fiction");
Util.addToMapWithCount(literaryFormFull, curSubject);
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is fiction/" + curSubject + " based on OverDrive subject", 2);}
}

if (curSubject.contains("Juvenile")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ void processRecord(AbstractGroupedWorkSolr groupedWork, String identifier, BaseI
if (fictionNonFiction != null){
groupedWork.addLiteraryForm(fictionNonFiction);
groupedWork.addLiteraryFormFull(fictionNonFiction);
if (groupedWork != null && groupedWork.isDebugEnabled()) {groupedWork.addDebugMessage("Literary Form is " + fictionNonFiction + " based on Palace Project", 2);}
}
if (!genres.isEmpty()) {
groupedWork.addGenre(genres);
Expand Down
14 changes: 4 additions & 10 deletions code/web/Drivers/Koha.php
Original file line number Diff line number Diff line change
Expand Up @@ -6239,16 +6239,10 @@ public function processMessagingSettingsForm(User $patron): array {

$kohaVersion = $this->getKohaVersion();
if ($kohaVersion >= 24.05) {
foreach ($params as $key => $value) {
if (is_array($value)) {
foreach ($value as $arrayValue) {
$postParams[$key] = $arrayValue;
}
} else {
$postParams[$key] = $value;
}
}
$postParams['op'] = 'cud-modify';
$postParams = $getParams;
$postParams[] = 'op=' . 'cud-modify';
$postParams = implode('&', $postParams);
$postParams .= '&' . $digestParams;
$result = $this->postToKohaPage("$catalogUrl/cgi-bin/koha/opac-messaging.pl?", $postParams);
} else {
$updateMessageUrl .= implode('&', $getParams);
Expand Down
2 changes: 1 addition & 1 deletion code/web/interface/themes/responsive/EBSCO/list-list.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{if !empty($researchStarters) && ($smarty.foreach.recordLoop.iteration == 2 || count($recordSet) < 2)}
{$researchStarters}
{/if}
{if !empty($showExploreMoreBar) && ($smarty.foreach.recordLoop.iteration == 2 || count($recordSet) < 2)}
{if !empty($showExploreMoreBar) && ($smarty.foreach.recordLoop.iteration == 2 || count($recordSet) < 2) && $displayExploreMoreBarInEbscoEds}
<div id="explore-more-bar-placeholder"></div>
<script type="text/javascript">
$(document).ready(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{if !empty($researchStarters) && ($smarty.foreach.recordLoop.iteration == 2 || count($recordSet) < 2)}
{$researchStarters}
{/if}
{if !empty($showExploreMoreBar) && ($smarty.foreach.recordLoop.iteration == 2 || count($recordSet) < 2)}
{if !empty($showExploreMoreBar) && ($smarty.foreach.recordLoop.iteration == 2 || count($recordSet) < 2) && $displayExploreMoreBarInEbscoHost}
<div id="explore-more-bar-placeholder"></div>
<script type="text/javascript">
$(document).ready(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ $(document).ready(function(){
var rowId = $(this).attr("id");
var newId = Number(rowId.replace("none",""));
$("#sms"+newId).removeAttr("checked");
$("#phone"+newId).removeAttr("checked");
$("#email"+newId).removeAttr("checked");
$("#digest"+newId).removeAttr("checked");
$("#rss"+newId).removeAttr("checked");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
{if !empty($ilsMessages)}
{include file='ilsMessages.tpl' messages=$ilsMessages}
{/if}
{if !empty($message)}
{if !empty($updateMessage)}
<div class="row">
<div class="col-xs-12">
<div class="alert alert-success">{translate text=$message isPublicFacing=true isMetadata=true}</div>
<div class="alert alert-success">{translate text=$updateMessage isPublicFacing=true isMetadata=true}</div>
</div>
</div>
{/if}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{strip}
{* TODO: Consider renaming classes to assume they are under the exploreMoreBar class *}
<div class="exploreMoreBar row">
<div class="exploreMoreBar row">
{*<div class="label-left">*}
<div class="label-top">
<div class="exploreMoreBarLabel">
Expand Down
2 changes: 1 addition & 1 deletion code/web/interface/themes/responsive/Search/list-list.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{* This is raw HTML -- do not escape it: *}
{$record}
</div>
{if !empty($showExploreMoreBar) && ($smarty.foreach.recordLoop.iteration == 2 || count($recordSet) < 2)}
{if !empty($showExploreMoreBar) && ($smarty.foreach.recordLoop.iteration == 2 || count($recordSet) < 2) && $displayExploreMoreBarInCatalogSearch}
<div id="explore-more-bar-placeholder"></div>
<script type="text/javascript">
$(document).ready(
Expand Down
Loading

0 comments on commit 603f4d8

Please sign in to comment.