X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fcust_main_note.cgi;h=a633c9d12da069ac138f117336be916fb6b694e3;hb=c86fe9ea75d23d3d0c3536b709ac1e086f15a5de;hp=468ef00517bdaf4327305828edcaeb88bd5b5676;hpb=30c3ff2acf90e1386fae00759078899c859faf36;p=freeside.git diff --git a/httemplate/edit/cust_main_note.cgi b/httemplate/edit/cust_main_note.cgi index 468ef0051..a633c9d12 100755 --- a/httemplate/edit/cust_main_note.cgi +++ b/httemplate/edit/cust_main_note.cgi @@ -1,37 +1,47 @@ -<% 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') %>
+

- +<% include('/elements/htmlarea.html', 'field' => 'comment', + 'curr_value' => $comment) %> +% #

- +">
<%init> -my($custnum, $comment); -$comment = ''; +my $comment; +my $notenum = ''; if ( $cgi->param('error') ) { $comment = $cgi->param('comment'); +} 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; } -$cgi->param('custnum') =~ /^(\d+)$/; -$custnum = $1; -die "illegal query ". $cgi->keywords unless $custnum; +$cgi->param('custnum') =~ /^(\d+)$/ or die "illeagl custnum"; +my $custnum = $1; + +my $action = $notenum ? 'Edit' : 'Add'; + +die "access denied" + unless $FS::CurrentUser::CurrentUser->access_right("$action customer note");