From 022b4952fb2414e2fed63fc622b6868a81e8cbec Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Tue, 17 Apr 2012 17:34:06 -0400 Subject: [PATCH] Clean up and refine serial note support, part 1 This commit fixes a number of minor problems with serial notes: 1) Serial notes are currently returned in "random" (database) order. Adding a create_date sort is a sensible default. 2) If you have many notes, they start to display in a squashed and unreadable fashion. Switching from a groupbox to a styled vbox provides a simple workaround. 3) It is currently impossible to display newlines in notes. We can deal with this by changing the display style. Signed-off-by: Dan Wells --- .../src/perlmods/lib/OpenILS/Application/Serial.pm | 10 ++++++++-- Open-ILS/xul/staff_client/server/serial/notes.xul | 8 ++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm index 6d645aef8f..377069dcf4 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Serial.pm @@ -65,6 +65,11 @@ my %MFHD_TAGS_BY_NAME = ( $MFHD_NAMES[0] => '853', $MFHD_NAMES[1] => '854', $MFHD_NAMES[2] => '855'); my $_strp_date = new DateTime::Format::Strptime(pattern => '%F'); +my %FM_NAME_TO_ID = ( + 'subscription' => 'ssub', + 'distribution' => 'sdist', + 'item' => 'sitem' + ); # helper method for conforming dates to ISO8601 sub _cleanse_dates { @@ -1947,18 +1952,19 @@ sub fetch_notes { my $id = $$args{object_id}; my $authtoken = $$args{authtoken}; + my $order_by = $$args{order_by} || 'create_date'; my( $r, $evt); if( $$args{pub} ) { return $U->cstorereq( 'open-ils.cstore.direct.serial.'.$type.'_note.search.atomic', - { $type => $id, pub => 't' } ); + { $type => $id, pub => 't' }, {'order_by' => {$FM_NAME_TO_ID{$type}.'n' => $order_by}} ); } else { # FIXME: restore perm check # ( $r, $evt ) = $U->checksesperm($authtoken, 'VIEW_COPY_NOTES'); # return $evt if $evt; return $U->cstorereq( - 'open-ils.cstore.direct.serial.'.$type.'_note.search.atomic', {$type => $id} ); + 'open-ils.cstore.direct.serial.'.$type.'_note.search.atomic', {$type => $id}, {'order_by' => {$FM_NAME_TO_ID{$type}.'n' => $order_by}} ); } return undef; diff --git a/Open-ILS/xul/staff_client/server/serial/notes.xul b/Open-ILS/xul/staff_client/server/serial/notes.xul index 895b91368d..bb6ce84608 100644 --- a/Open-ILS/xul/staff_client/server/serial/notes.xul +++ b/Open-ILS/xul/staff_client/server/serial/notes.xul @@ -247,16 +247,16 @@ -- 2.43.2