From 30c3ff2acf90e1386fae00759078899c859faf36 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 3 Oct 2006 22:44:28 +0000 Subject: Enhanced customer notes --- httemplate/edit/cust_main.cgi | 7 ++++-- httemplate/edit/cust_main_note.cgi | 37 ++++++++++++++++++++++++++++++ httemplate/edit/process/cust_main_note.cgi | 34 +++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100755 httemplate/edit/cust_main_note.cgi create mode 100755 httemplate/edit/process/cust_main_note.cgi (limited to 'httemplate/edit') 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) { % } - +% +% my $ro_comments = $conf->exists('cust_main-use_comments')?'':'readonly'; +% if (!$ro_comments || $cust_main->comments) {
Comments <% &ntable("#cccccc") %> - + % +% } % %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') ) { + Error: <% $cgi->param('error') %> +

+% } + +
+ + + +

+ + +

+ + +
+ + + +<%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; + + + 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') %> + + + +% +% + -- cgit v1.2.1