X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main_note.cgi;h=61590566c278b751ec50eab9454b4947d169a971;hp=468ef00517bdaf4327305828edcaeb88bd5b5676;hb=75e11f1d1a5ced24496b5732e290f7762403feb8;hpb=c8cccb4a92adceb943c635fe62dad0d034462ce0 diff --git a/httemplate/edit/cust_main_note.cgi b/httemplate/edit/cust_main_note.cgi index 468ef0051..61590566c 100755 --- a/httemplate/edit/cust_main_note.cgi +++ b/httemplate/edit/cust_main_note.cgi @@ -1,37 +1,68 @@ -<% include('/elements/header-popup.html', 'Add Customer Note') %> +<% include('/elements/header-popup.html', "$action Customer Note") %> -% if ( $cgi->param('error') ) { - Error: <% $cgi->param('error') %> -

-% } +<% include('/elements/error.html') %>
+ +% if ($conf->exists('note-classes') && $conf->config('note-classes') > 0) { + Class   + <% include( '/elements/select-table.html', + 'table' => 'cust_note_class', + 'name_col' => 'classname', + 'curr_value' => $classnum, + 'empty_label' => '(none)', + 'hashref' => { 'disabled' => '' }, + ) %> +
+% } -

- +% if( $FS::CurrentUser::CurrentUser->option('disable_html_editor') ) { + +% } +% else { +<% include('/elements/htmlarea.html', 'field' => 'comment_html', + 'curr_value' => $comment) %> +% }

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