[freeside-commits] freeside/httemplate/edit/process
cust_main_note.cgi, 1.1, 1.2
Jeff Finucane,420,,
jeff at wavetail.420.am
Fri Oct 27 10:01:32 PDT 2006
Update of /home/cvs/cvsroot/freeside/httemplate/edit/process
In directory wavetail:/tmp/cvs-serv8919/httemplate/edit/process
Modified Files:
cust_main_note.cgi
Log Message:
editable notes
Index: cust_main_note.cgi
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/cust_main_note.cgi,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cust_main_note.cgi 3 Oct 2006 22:44:28 -0000 1.1
+++ cust_main_note.cgi 27 Oct 2006 17:01:29 -0000 1.2
@@ -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>
More information about the freeside-commits
mailing list