diff options
author | jeff <jeff> | 2006-10-03 22:44:28 +0000 |
---|---|---|
committer | jeff <jeff> | 2006-10-03 22:44:28 +0000 |
commit | 30c3ff2acf90e1386fae00759078899c859faf36 (patch) | |
tree | 75fd2a828c64a2b7bd2d2f4c650d058af726e241 /httemplate/edit | |
parent | 40f370f0fbc6dedee27b8666f7d00e3888a1533b (diff) |
Enhanced customer notes
Diffstat (limited to 'httemplate/edit')
-rwxr-xr-x | httemplate/edit/cust_main.cgi | 7 | ||||
-rwxr-xr-x | httemplate/edit/cust_main_note.cgi | 37 | ||||
-rwxr-xr-x | httemplate/edit/process/cust_main_note.cgi | 34 |
3 files changed, 76 insertions, 2 deletions
diff --git a/httemplate/edit/cust_main.cgi b/httemplate/edit/cust_main.cgi index dfcd0401f..99f849fc8 100755 --- a/httemplate/edit/cust_main.cgi +++ b/httemplate/edit/cust_main.cgi @@ -359,17 +359,20 @@ function copyelement(from, to) { <INPUT TYPE="hidden" NAME="<% $hidden %>" VALUE=""> % } - +% +% my $ro_comments = $conf->exists('cust_main-use_comments')?'':'readonly'; +% if (!$ro_comments || $cust_main->comments) { <BR>Comments <% &ntable("#cccccc") %> <TR> <TD> - <TEXTAREA COLS=80 ROWS=5 WRAP="HARD" NAME="comments"><% $cust_main->comments %></TEXTAREA> + <TEXTAREA COLS=80 ROWS=5 WRAP="HARD" NAME="comments" <%$ro_comments%>><% $cust_main->comments %></TEXTAREA> </TD> </TR> </TABLE> % +% } % %unless ( $custnum ) { % # pry the wrong place for this logic. also pretty expensive diff --git a/httemplate/edit/cust_main_note.cgi b/httemplate/edit/cust_main_note.cgi new file mode 100755 index 000000000..468ef0051 --- /dev/null +++ b/httemplate/edit/cust_main_note.cgi @@ -0,0 +1,37 @@ +<% include('/elements/header-popup.html', 'Add Customer Note') %> + +% if ( $cgi->param('error') ) { + <FONT SIZE="+1" COLOR="#ff0000">Error: <% $cgi->param('error') %></FONT> + <BR><BR> +% } + +<FORM ACTION="<% popurl(1) %>process/cust_main_note.cgi" METHOD=POST> +<INPUT TYPE="hidden" NAME="custnum" VALUE="<% $custnum %>"> + + +<BR><BR> +<TEXTAREA NAME="comment" ROWS="12" COLS="60"> +<% $comment %> +</TEXTAREA> + +<BR><BR> +<INPUT TYPE="submit" VALUE="Add note"> + +</FORM> +</BODY> +</HTML> + +<%init> +my($custnum, $comment); +$comment = ''; + +if ( $cgi->param('error') ) { + $comment = $cgi->param('comment'); +} +$cgi->param('custnum') =~ /^(\d+)$/; +$custnum = $1; + +die "illegal query ". $cgi->keywords unless $custnum; + +</%init> + diff --git a/httemplate/edit/process/cust_main_note.cgi b/httemplate/edit/process/cust_main_note.cgi new file mode 100755 index 000000000..d9251f042 --- /dev/null +++ b/httemplate/edit/process/cust_main_note.cgi @@ -0,0 +1,34 @@ +% +% +%$cgi->param('custnum') =~ /^(\d+)$/ +% or die "Illegal custnum: ". $cgi->param('custnum'); +%my $custnum = $1; +% +%my $otaker = $FS::CurrentUser::CurrentUser->name; +%$otaker = $FS::CurrentUser::CurrentUser->username +% if ($otaker eq "User, Legacy"); +% +%my $new = new FS::cust_main_note ( { +% custnum => $custnum, +% _date => time, +% otaker => $otaker, +% comments => $cgi->param('comment'), +%} ); +% +%my $error = $new->insert; +% +%if ($error) { +% $cgi->param('error', $error); +% print $cgi->redirect(popurl(2). 'cust_main_note.cgi?'. $cgi->query_string ); +%} +% +% +<% header('Note added') %> + <SCRIPT TYPE="text/javascript"> + window.top.location.reload(); + </SCRIPT> + + </BODY></HTML> +% +% + |