From 87a37c1ebbfd5f634b0767f253117276d87b9da6 Mon Sep 17 00:00:00 2001 From: Kodi Date: Thu, 8 Oct 2026 14:46:27 -0700 Subject: [PATCH 1/3] DIS-2978: Prevent Editing Reading History Return Dates Add setting in Library Systems > ILS/Account Integration > Reading History > Disallow Editing of Return Dates Update tpl files to only allow editing if this setting is on for patron's home library Update release notes Tested on my local instance of Aspen --- .../MyAccount/readingHistoryEntry.tpl | 70 +++++++++++-------- .../MyAccount/readingHistoryList.tpl | 2 + code/web/release_notes/26.11.00/DIS-2978.yaml | 13 ++++ code/web/services/MyAccount/AJAX.php | 1 + .../version_updates/26.11.00.php | 55 +++++++++++++++ code/web/sys/LibraryLocation/Library.php | 10 +++ 6 files changed, 122 insertions(+), 29 deletions(-) create mode 100644 code/web/release_notes/26.11.00/DIS-2978.yaml create mode 100644 code/web/sys/DBMaintenance/version_updates/26.11.00.php diff --git a/code/web/interface/themes/responsive/MyAccount/readingHistoryEntry.tpl b/code/web/interface/themes/responsive/MyAccount/readingHistoryEntry.tpl index c711f5eafd6..f8bee590fde 100644 --- a/code/web/interface/themes/responsive/MyAccount/readingHistoryEntry.tpl +++ b/code/web/interface/themes/responsive/MyAccount/readingHistoryEntry.tpl @@ -184,38 +184,50 @@ {$detail.checkOutDate|escape} {/if} - - {assign var="displayDate" value=$detail.checkInDate} - {if !empty($detail.editedCheckInDate)} - {assign var="displayDate" value=$detail.editedCheckInDate} - {/if} - {if empty($detail.checkInDate) && empty($detail.editedCheckInDate)} -
- {translate text="Currently Checked Out" isPublicFacing=true} - -
- {elseif $detail.checkInDate == -1 && empty($detail.editedCheckInDate)} -
-
- {translate text="Unknown" isPublicFacing=true} + {if empty($disallowReturnDateEdits)} + {* Editable version *} + + {if empty($detail.checkInDate) && empty($detail.editedCheckInDate)} +
+ {translate text="Currently Checked Out" isPublicFacing=true}
-
- {else} -
-
- - {if is_numeric($displayDate)} - {$displayDate|date_format:"%b %d, %Y"} - {else} - {$displayDate|escape} - {/if} - - + {elseif $detail.checkInDate == -1 && empty($detail.editedCheckInDate)} +
+
+ {translate text="Unknown" isPublicFacing=true} + +
-
- {/if} - + {else} +
+
+ + {if is_numeric($displayDate)} + {$displayDate|date_format:"%b %d, %Y"} + {else} + {$displayDate|escape} + {/if} + + +
+
+ {/if} + + {else} + {* Read-only version *} + + {if empty($detail.checkInDate) && empty($detail.editedCheckInDate)} + {translate text="Currently Checked Out" isPublicFacing=true} + {elseif $detail.checkInDate == -1 && empty($detail.editedCheckInDate)} + {translate text="Unknown" isPublicFacing=true} + {elseif is_numeric($displayDate)} + {$displayDate|date_format:"%b %d, %Y"} + {else} + {$displayDate|escape} + {/if} + + {/if} {if !empty($detail.format)} {$detail.format|replace:',':', '} diff --git a/code/web/interface/themes/responsive/MyAccount/readingHistoryList.tpl b/code/web/interface/themes/responsive/MyAccount/readingHistoryList.tpl index b8aeb42d300..42601a4681a 100644 --- a/code/web/interface/themes/responsive/MyAccount/readingHistoryList.tpl +++ b/code/web/interface/themes/responsive/MyAccount/readingHistoryList.tpl @@ -116,5 +116,7 @@ diff --git a/code/web/release_notes/26.11.00/DIS-2978.yaml b/code/web/release_notes/26.11.00/DIS-2978.yaml new file mode 100644 index 00000000000..c45dd961916 --- /dev/null +++ b/code/web/release_notes/26.11.00/DIS-2978.yaml @@ -0,0 +1,13 @@ +Jira: DIS-2827 +Type: Enhancement +Developer: Kodi Lein (KL) +Contributing Org: Grove For Libraries +Sponsor: OCLS +GroveRelease: 26.11.00 +CommunityRelease: 26.12.00 +Component: Reading History +Description: + - Add option to disallow editing of reading history return dates. +New Settings: + - Library Systems > ILS/Account Integration > Reading History > Disallow Editing of Return Dates +New Permissions: \ No newline at end of file diff --git a/code/web/services/MyAccount/AJAX.php b/code/web/services/MyAccount/AJAX.php index 8170cf57b7f..4c237d69309 100644 --- a/code/web/services/MyAccount/AJAX.php +++ b/code/web/services/MyAccount/AJAX.php @@ -4781,6 +4781,7 @@ public function getReadingHistory() : array { $interface->assign('library', $patronHomeLibrary); $result['showCostSavings'] = $patronHomeLibrary->enableCostSavings && $patron->enableCostSavings; $result['costSavingsMessage'] = $user->getTotalCostSavingsMessage(true); + $interface->assign('disallowReturnDateEdits', $patronHomeLibrary->disallowReturnDateEdits); $result['success'] = true; $result['message'] = ""; diff --git a/code/web/sys/DBMaintenance/version_updates/26.11.00.php b/code/web/sys/DBMaintenance/version_updates/26.11.00.php new file mode 100644 index 00000000000..3b7268e8b93 --- /dev/null +++ b/code/web/sys/DBMaintenance/version_updates/26.11.00.php @@ -0,0 +1,55 @@ + [ + 'title' => '', + 'description' => '', + 'continueOnError' => false, + 'sql' => [ + '' + ] + ], //name*/ + + //mark n + + //kirstien + + //kodi + 'disallow_reading_history_return_date_edits' => [ + 'title' => 'Disallow reading history return date edits', + 'description' => 'Add setting to library table for disallowing editing of return dates in reading history.', + 'continueOnError' => false, + 'sql' => [ + "ALTER TABLE library ADD COLUMN disallowReturnDateEdits TINYINT(1) NOT NULL DEFAULT 0" + ] + ] + + //yanjun + + //imani + + //galen + + //chloe + + //pedro + + //mark j + + //lucas + + //tomas + + // stephen + + //jacob - OpenFifth + + //kyle - ByWater + + ]; +} diff --git a/code/web/sys/LibraryLocation/Library.php b/code/web/sys/LibraryLocation/Library.php index a4681abe6f8..6529cce18de 100644 --- a/code/web/sys/LibraryLocation/Library.php +++ b/code/web/sys/LibraryLocation/Library.php @@ -214,6 +214,7 @@ class Library extends DataObject { $displayCallNumberInCheckoutHistory; public /** @noinspection PhpUnused */ $displayVolumeInCheckoutHistory; + public $disallowReturnDateEdits; public $alwaysDisplayRenewalCount; public $allowRenewingOutOfHoldGroupCheckouts; @@ -3134,6 +3135,15 @@ static function getObjectStructure(string $context = ''): array { 'permissions' => ['Library ILS Connection'], 'relatedIls' => ['evergreen', 'koha'], ], + 'disallowReturnDateEdits' => [ + 'property' => 'disallowReturnDateEdits', + 'type' => 'checkbox', + 'label' => 'Disallow Editing of Return Dates', + 'description' => 'Whether users can edit the return date of titles in their reading history within Aspen.', + 'hideInLists' => true, + 'default' => 0, + 'permissions' => ['Library ILS Options'], + ], 'forceReadingHistoryOptIn' => [ 'property' => 'forceReadingHistoryOptIn', 'type' => 'checkbox', From 61eee623f5a11de6a8221b906b8b62b40a8a16e7 Mon Sep 17 00:00:00 2001 From: Kodi Date: Thu, 8 Oct 2026 15:14:52 -0700 Subject: [PATCH 2/3] Update 26.11.00.php --- code/web/sys/DBMaintenance/version_updates/26.11.00.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/web/sys/DBMaintenance/version_updates/26.11.00.php b/code/web/sys/DBMaintenance/version_updates/26.11.00.php index 3b7268e8b93..fffdee01359 100644 --- a/code/web/sys/DBMaintenance/version_updates/26.11.00.php +++ b/code/web/sys/DBMaintenance/version_updates/26.11.00.php @@ -27,7 +27,7 @@ function getUpdates26_11_00(): array { 'sql' => [ "ALTER TABLE library ADD COLUMN disallowReturnDateEdits TINYINT(1) NOT NULL DEFAULT 0" ] - ] + ] //disallow_reading_history_return_date_edits //yanjun From 5fc6973dc8d4769429e7dc7320877070c046c18a Mon Sep 17 00:00:00 2001 From: Kodi Date: Thu, 8 Oct 2026 15:15:37 -0700 Subject: [PATCH 3/3] Update 26.11.00.php --- code/web/sys/DBMaintenance/version_updates/26.11.00.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/web/sys/DBMaintenance/version_updates/26.11.00.php b/code/web/sys/DBMaintenance/version_updates/26.11.00.php index fffdee01359..daa1b3ffc08 100644 --- a/code/web/sys/DBMaintenance/version_updates/26.11.00.php +++ b/code/web/sys/DBMaintenance/version_updates/26.11.00.php @@ -27,7 +27,7 @@ function getUpdates26_11_00(): array { 'sql' => [ "ALTER TABLE library ADD COLUMN disallowReturnDateEdits TINYINT(1) NOT NULL DEFAULT 0" ] - ] //disallow_reading_history_return_date_edits + ], //disallow_reading_history_return_date_edits //yanjun