From: Dan Wells <dbw2@calvin.edu>
Date: Tue, 17 Apr 2012 21:34:06 +0000 (-0400)
Subject: Clean up and refine serial note support, part 1
X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=022b4952fb2414e2fed63fc622b6868a81e8cbec;p=evergreen%2Fmasslnc.git

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 <dbw2@calvin.edu>
---

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 @@
 	<messagecatalog id="serialStrings" src="/xul/server/locale/<!--#echo var='locale'-->/serial.properties" />
 
 	<stack hidden="true" id="note_template" flex="1">
-		<groupbox flex="1" style="background-color: black;"/>
-		<groupbox flex="1" style="background-color: #FFDE00; -moz-border-radius-topright: 35px;" >
+		<vbox flex="1" style="background-color: black; margin:3px"/>
+		<vbox flex="1" style="background-color: #FFDE00; -moz-border-radius-topright: 35px; border: 2px groove ThreeDFace; margin:3px;" >
 			<hbox>
 				<description name="title" style="font-weight: bold"/>
 				<spacer flex="1"/>
 				<description name="create_date" style="font-weight: bold"/>
 				<description name="pub" style="font-weight: bold"/>
 			</hbox>
-			<description name="value"/>
-		</groupbox>
+			<description style="white-space: pre-wrap;" name="value"/>
+		</vbox>
 	</stack>
 
 	<vbox flex="1" class="my_overflow" id="notes_panel">