summaryrefslogtreecommitdiff
path: root/httemplate/edit/process/cust_main_note.cgi
diff options
context:
space:
mode:
authorjeff <jeff>2006-10-27 17:01:31 +0000
committerjeff <jeff>2006-10-27 17:01:31 +0000
commit576c6b48428aa95e0fd80db011fe73c0b728c88b (patch)
tree79b8ddfe015d3732269f402d7129d4d36194bb9e /httemplate/edit/process/cust_main_note.cgi
parentfc3483c8679daf2e00467db05342e9fcd314d541 (diff)
editable notes
Diffstat (limited to 'httemplate/edit/process/cust_main_note.cgi')
-rwxr-xr-xhttemplate/edit/process/cust_main_note.cgi19
1 files changed, 17 insertions, 2 deletions
diff --git a/httemplate/edit/process/cust_main_note.cgi b/httemplate/edit/process/cust_main_note.cgi
index d9251f042..b94d2271c 100755
--- a/httemplate/edit/process/cust_main_note.cgi
+++ b/httemplate/edit/process/cust_main_note.cgi
@@ -4,18 +4,33 @@
% or die "Illegal custnum: ". $cgi->param('custnum');
%my $custnum = $1;
%
+%$cgi->param('notenum') =~ /^(\d+)$/
+% or die "Illegal notenum: ". $cgi->param('notenum');
+%my $notenum = $1;
+%
%my $otaker = $FS::CurrentUser::CurrentUser->name;
%$otaker = $FS::CurrentUser::CurrentUser->username
% if ($otaker eq "User, Legacy");
%
%my $new = new FS::cust_main_note ( {
+% notenum => $notenum,
% custnum => $custnum,
% _date => time,
% otaker => $otaker,
% comments => $cgi->param('comment'),
%} );
%
-%my $error = $new->insert;
+%my $error;
+%if ($notenum){
+% my $old = qsearchs('cust_main_note', { 'notenum' => $notenum });
+% $error = "No such note: $notenum" unless $old;
+% unless($error){
+% map { $new->$_($old->$_) } ('_date', 'otaker');
+% $error = $new->replace($old);
+% }
+%}else{
+% $error = $new->insert;
+%}
%
%if ($error) {
% $cgi->param('error', $error);
@@ -23,7 +38,7 @@
%}
%
%
-<% header('Note added') %>
+<% header('Note ' . ($notenum ? 'updated' : 'added') ) %>
<SCRIPT TYPE="text/javascript">
window.top.location.reload();
</SCRIPT>