[freeside-commits] freeside/httemplate/edit/elements edit.html, 1.29, 1.30
Ivan,,,
ivan at wavetail.420.am
Fri Nov 21 23:10:13 PST 2008
- Previous message: [freeside-commits] freeside/httemplate/browse part_event.html, 1.1, 1.2
- Next message: [freeside-commits] freeside/FS/FS Schema.pm, 1.114, 1.115 cust_credit.pm, 1.35, 1.36 Conf.pm, 1.252, 1.253 cust_pkg.pm, 1.102, 1.103 part_event.pm, 1.2, 1.3 cust_main.pm, 1.386, 1.387
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/cvs/cvsroot/freeside/httemplate/edit/elements
In directory wavetail.420.am:/tmp/cvs-serv12704/edit/elements
Modified Files:
edit.html
Log Message:
billing event cloning
Index: edit.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/elements/edit.html,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- edit.html 21 Nov 2008 02:57:21 -0000 1.29
+++ edit.html 22 Nov 2008 07:10:11 -0000 1.30
@@ -164,7 +164,7 @@
<FORM ACTION="<% $url %>" METHOD=POST NAME="edit_topform">
<INPUT TYPE="hidden" NAME="svcdb" VALUE="<% $table %>">
-<INPUT TYPE="hidden" NAME="<% $pkey %>" VALUE="<% $object->$pkey() %>">
+<INPUT TYPE="hidden" NAME="<% $pkey %>" VALUE="<% $clone ? '' : $object->$pkey() %>">
<FONT SIZE="+1"><B>
<% ( $opt{labels} && exists $opt{labels}->{$pkey} )
@@ -172,7 +172,7 @@
: $pkey
%>
</B></FONT>
-#<% $object->$pkey() || "(NEW)" %>
+#<% ( !$clone && $object->$pkey() ) || "(NEW)" %>
% my $tablenum = 0;
<TABLE ID="TableNumber<% $tablenum++ %>" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=0>
@@ -313,7 +313,7 @@
% my @existing = ();
% if ( $mode eq 'error' ) {
% @existing = &{ $f->{'m2_error_callback'} }( $cgi, $object );
-% } elsif ( $object->$pkey() ) { # $mode eq 'edit'
+% } elsif ( $object->$pkey() ) { # $mode eq 'edit'||'clone'
% @existing = $object->$table();
% warn scalar(@existing). " from $object->$table: ". join('/', @existing)
% if $opt{'debug'};
@@ -527,7 +527,7 @@
<BR>
-<INPUT TYPE="submit" ID="submit" VALUE="<% $object->$pkey() ? "Apply changes" : "Add $opt{'name'}" %>">
+<INPUT TYPE="submit" ID="submit" VALUE="<% ( !$clone && $object->$pkey() ) ? "Apply changes" : "Add $opt{'name'}" %>">
</FORM>
@@ -559,8 +559,19 @@
$cgi = new CGI($pref);
}
-my $object;
+my %qsearch = (
+ 'table' => $table,
+ 'extra_sql' => ( $opt{'agent_virt'}
+ ? ' AND '. $curuser->agentnums_sql(
+ 'null_right' => $opt{'agent_null_right'}
+ )
+ : ''
+ ),
+);
+
my $mode;
+my $object;
+my $clone = '';
if ( $cgi->param('error') ) {
$mode = 'error';
@@ -572,6 +583,22 @@
&{$opt{'error_callback'}}($cgi, $object, $fields, \%opt )
if $opt{'error_callback'};
+} elsif ( $cgi->param('clone') =~ /^(\d+)$/ ) {
+
+ $mode = 'clone';
+
+ $clone = $1;
+
+ $object = qsearchs({ %qsearch, 'hashref' => { $pkey => $clone } });
+
+ #XXX document me
+ &{$opt{'clone_callback'}}($cgi, $object, $fields)
+ if $opt{'clone_callback'};
+
+ #$object->$pkey('');
+
+ $opt{action} ||= 'Add';
+
} elsif ( $cgi->keywords || $cgi->param($pkey) ) { #editing
$mode = 'edit';
@@ -584,16 +611,8 @@
$value = $query;
}
$value =~ /^(\d+)$/ or die "unparsable $pkey";
- $object = qsearchs({
- 'table' => $table,
- 'hashref' => { $pkey => $1 },
- 'extra_sql' => ( $opt{'agent_virt'}
- ? ' AND '. $curuser->agentnums_sql(
- 'null_right' => $opt{'agent_null_right'}
- )
- : ''
- ),
- });
+ $object = qsearchs({ %qsearch, 'hashref' => { $pkey => $1 } });
+
warn "$table $pkey => $1"
if $opt{'debug'};
- Previous message: [freeside-commits] freeside/httemplate/browse part_event.html, 1.1, 1.2
- Next message: [freeside-commits] freeside/FS/FS Schema.pm, 1.114, 1.115 cust_credit.pm, 1.35, 1.36 Conf.pm, 1.252, 1.253 cust_pkg.pm, 1.102, 1.103 part_event.pm, 1.2, 1.3 cust_main.pm, 1.386, 1.387
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the freeside-commits
mailing list