From a2faeced765b00c0339fd86d7905cb77318e3d20 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 28 Jan 2015 02:24:07 -0800 Subject: sticky customer notes, RT#29311 --- FS/FS/Schema.pm | 15 ++++++++------- FS/FS/cust_main.pm | 4 ++-- FS/FS/cust_main_note.pm | 1 + 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'FS') diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index ca6d169e5..b7611c154 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -2013,13 +2013,14 @@ sub tables_hashref { 'cust_main_note' => { 'columns' => [ - 'notenum', 'serial', '', '', '', '', - 'custnum', 'int', '', '', '', '', - 'classnum', 'int', 'NULL', '', '', '', - '_date', @date_type, '', '', - 'otaker', 'varchar', 'NULL', 32, '', '', - 'usernum', 'int', 'NULL', '', '', '', - 'comments', 'text', 'NULL', '', '', '', + 'notenum', 'serial', '', '', '', '', + 'custnum', 'int', '', '', '', '', + 'classnum', 'int', 'NULL', '', '', '', + '_date', @date_type, '', '', + 'otaker', 'varchar', 'NULL', 32, '', '', + 'usernum', 'int', 'NULL', '', '', '', + 'comments', 'text', 'NULL', '', '', '', + 'sticky', 'int', '', '', 0, '', ], 'primary_key' => 'notenum', 'unique' => [], diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index 9f9562059..30dbc043c 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -2139,8 +2139,8 @@ Returns all notes (see L) for this customer. sub notes { my($self,$orderby_classnum) = (shift,shift); - my $orderby = "_DATE DESC"; - $orderby = "CLASSNUM ASC, $orderby" if $orderby_classnum; + my $orderby = "sticky DESC, _date DESC"; + $orderby = "classnum ASC, $orderby" if $orderby_classnum; qsearch( 'cust_main_note', { 'custnum' => $self->custnum }, '', diff --git a/FS/FS/cust_main_note.pm b/FS/FS/cust_main_note.pm index 712580764..ee63883d2 100644 --- a/FS/FS/cust_main_note.pm +++ b/FS/FS/cust_main_note.pm @@ -112,6 +112,7 @@ sub check { || $self->ut_numbern('_date') || $self->ut_textn('otaker') || $self->ut_anything('comments') + || $self->ut_numbern('sticky') ; return $error if $error; -- cgit v1.2.1