1. Provide an admin-friendly summary of changes at the top of the release notes.
2. Change quoting of optional post-upgrade SQL echoing in the upgrade script.
3. Fix preexisting issue with variable interpolation inside an alert modal.
4. Protect against null or empty date fields when formatting.
Signed-off-by: Mike Rylander <mrylander@gmail.com>
5. Added if (date == 'now') check.
Signed-off-by: Bill Erickson <berickxx@gmail.com>
COMMIT;
\qecho The following query will adjust all historical, unaged circulations so
-\qecho that if their due date field pushed to the end of the day, it is done
-\qecho in the circulating library's time zone, and not the server time zone.
+\qecho that if their due date field is pushed to the end of the day, it is done
+\qecho in the circulating library'''s time zone, and not the server time zone.
\qecho
\qecho It is safe to run this after any change to library time zones.
\qecho
\qecho Running this is not required, as no code before this change has
-\qecho depended on the time string of '23:59:59'. It is also not necessary
+\qecho depended on the time string of '''23:59:59'''. It is also not necessary
\qecho if all of your libraries are in the same time zone, and that time zone
-\qecho is the same as the databases configured time zone.
+\qecho is the same as the database'''s configured time zone.
\qecho
-\qecho DO $$
-\qecho declare
-\qecho new_tz text;
-\qecho ou_id int;
-\qecho begin
-\qecho for ou_id in select id from actor.org_unit loop
-\qecho for new_tz in select oils_json_to_text(value) from actor.org_unit_ancestor_setting('lib.timezone',ou_id) loop
-\qecho if new_tz is not null then
-\qecho update action.circulation
-\qecho set due_date = (due_date::timestamp || ' ' || new_tz)::timestamptz
-\qecho where circ_lib = ou_id
-\qecho and substring((due_date at time zone new_tz)::time::text from 1 for 8) <> '23:59:59';
-\qecho end if;
-\qecho end loop;
-\qecho end loop;
-\qecho end;
-\qecho $$;
+\qecho 'DO $$'
+\qecho 'declare'
+\qecho ' new_tz text;'
+\qecho ' ou_id int;'
+\qecho 'begin'
+\qecho ' for ou_id in select id from actor.org_unit loop'
+\qecho ' for new_tz in select oils_json_to_text(value) from actor.org_unit_ancestor_setting('''lib.timezone''',ou_id) loop'
+\qecho ' if new_tz is not null then'
+\qecho ' update action.circulation'
+\qecho ' set due_date = (due_date::timestamp || ''' ''' || new_tz)::timestamptz'
+\qecho ' where circ_lib = ou_id'
+\qecho ' and substring((due_date at time zone new_tz)::time::text from 1 for 8) <> '''23:59:59''';'
+\qecho ' end if;'
+\qecho ' end loop;'
+\qecho ' end loop;'
+\qecho 'end;'
+\qecho '$$;'
\qecho
</div>
<div class="modal-body">
<div ng-if="sameUser">
- [% |l("{{circDate | date:$root.egDateFormat}}") %]
+ [% |l('{{circDate | date:$root.egDateFormat}}') %]
There is an open circulation on the requested item.
This item was already checked out to this user on [_1].
[% END %]
</div>
<div ng-if="!sameUser">
- [% |l("{{circDate | date:$root.egDateFormat}}") %]
+ [% |l('{{circDate | date:$root.egDateFormat}}') %]
There is an open circulation on the requested item.
This copy was checked out by another patron on [_1].
[% END %]
];
return function (date, format, tz) {
+ if (!date) return '';
+
+ if (date == 'now')
+ date = new Date().toISOString();
+
if (format) {
var fmt = formatMap[format] || format;
angular.forEach(formatReplace, function (r) {
Honor timezone of the acting library
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Summary
++++++++
+
+* Display day-granular due dates in the circulating library's timezone.
+* Only display the date portion of the due date for day-granular circulations.
+* Display the full timestamp, in the client's timezone rather than the circulation library's, for hourly circulations.
+* Provide infrastructure for more advanced formatting of timestamps.
+* Override the built-in AngularJS date filter with an implementation that uses moment.js, providing consistency and better standards compliance.
+
+Upgrade note
+++++++++++++
+
+The following query will adjust all historical, unaged circulations so
+that if their due date field is pushed to the end of the day, it is done
+in the circulating library's time zone, and not the server time zone.
+
+It is safe to run this after any change to library time zones.
+
+Running this is not required, as no code before this change has
+depended on the time string of '23:59:59'. It is also not necessary
+if all of your libraries are in the same time zone, and that time zone
+is the same as the database's configured time zone.
+
+[source,sql]
+----
+DO $$
+declare
+ new_tz text;
+ ou_id int;
+begin
+ for ou_id in select id from actor.org_unit loop
+ for new_tz in select oils_json_to_text(value) from actor.org_unit_ancestor_setting('lib.timezone',ou_id) loop
+ if new_tz is not null then
+ update action.circulation
+ set due_date = (due_date::timestamp || ' ' || new_tz)::timestamptz
+ where circ_lib = ou_id
+ and substring((due_date at time zone new_tz)::time::text from 1 for 8) <> '23:59:59';
+ end if;
+ end loop;
+ end loop;
+end;
+$$;
+----
+
+Details
++++++++
+
This is a followup to the work done in bug 1485374, where we added the ability
for the client to specify a timezone in which timestamps should be interpreted
in business logic and the database.