X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main_note.cgi;h=18d59e9518b30a78cf8c48bdcd5f5940004c019b;hb=07ed221540128b8c75f4cb5a2af1e01b25fa8e18;hp=303895bd8366a2f72a9bfdb7bcacfa671f15cc38;hpb=576c6b48428aa95e0fd80db011fe73c0b728c88b;p=freeside.git diff --git a/httemplate/edit/cust_main_note.cgi b/httemplate/edit/cust_main_note.cgi index 303895bd8..18d59e951 100755 --- a/httemplate/edit/cust_main_note.cgi +++ b/httemplate/edit/cust_main_note.cgi @@ -1,51 +1,84 @@ <% include('/elements/header-popup.html', "$action Customer Note") %> -% if ( $cgi->param('error') ) { - Error: <% $cgi->param('error') %> -

-% } +<% include('/elements/error.html') %>
+% if (my @noteclasses = qsearch('cust_note_class',{ 'disabled' => '' })) { +% my %noteclassopts = $conf->exists('cust_main_note-require_class') +% ? ('disable_empty' => 1) +% : ('empty_label' => '(unclassified)'); + Class   + <% include( '/elements/select-table.html', + 'table' => 'cust_note_class', + 'records' => \@noteclasses, + 'name_col' => 'classname', + 'curr_value' => $classnum, + %noteclassopts, + ) %> +
+% } -

- +% if ( $FS::CurrentUser::CurrentUser->option('disable_html_editor') ) { + +% } else { + <& /elements/htmlarea.html, + 'field' => 'comment_html', + 'curr_value' => $comment, + 'config' => { toolbarStartupExpanded => Cpanel::JSON::XS::false, + height => 315, + }, + &> +% } -

-"> +
+ +<& /elements/checkbox.html, 'field' => 'sticky', + 'value' => 1, + 'curr_value' => $sticky, +&> +Sticky note

+ +">
<%init> -my($custnum, $comment, $notenum, $action); -$comment = ''; +my $conf = new FS::Conf; + +my $comment; +my $notenum = ''; +my $classnum; +my $sticky = 0; if ( $cgi->param('error') ) { $comment = $cgi->param('comment'); -}elsif ($cgi->param('notenum')) { - $cgi->param('notenum') =~ /^(\d+)$/; + $classnum = $cgi->param('classnum'); +} elsif ( $cgi->param('notenum') =~ /^(\d+)$/ ) { $notenum = $1; die "illegal query ". $cgi->keywords unless $notenum; my $note = qsearchs('cust_main_note', { 'notenum' => $notenum }); die "no such note: ". $notenum unless $note; $comment = $note->comments; + $classnum = $note->classnum; + $sticky = $note->sticky; } -$cgi->param('notenum') =~ /^(\d+)$/; -$notenum = $1; +$comment =~ s/\r//g; # remove weird line breaks to protect FCKeditor -$cgi->param('custnum') =~ /^(\d+)$/; -$custnum = $1; +$cgi->param('custnum') =~ /^(\d+)$/ or die "illegal custnum"; +my $custnum = $1; -die "illegal query ". $cgi->keywords unless $custnum; +my $action = $notenum ? 'Edit' : 'Add'; -$action = $notenum ? 'Edit' : 'Add'; +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right("$action customer note");