[freeside-commits] freeside/httemplate/edit/process/elements process.html, 1.23, 1.23.2.1
Ivan,,,
ivan at wavetail.420.am
Tue Aug 9 22:22:36 PDT 2011
Update of /home/cvs/cvsroot/freeside/httemplate/edit/process/elements
In directory wavetail.420.am:/tmp/cvs-serv19007/httemplate/edit/process/elements
Modified Files:
Tag: FREESIDE_2_3_BRANCH
process.html
Log Message:
multiple DID provisioning, RT#13721
Index: process.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/process/elements/process.html,v
retrieving revision 1.23
retrieving revision 1.23.2.1
diff -u -w -d -r1.23 -r1.23.2.1
--- process.html 11 May 2011 16:20:12 -0000 1.23
+++ process.html 10 Aug 2011 05:22:34 -0000 1.23.2.1
@@ -78,6 +78,9 @@
'agent_virt' => 1,
'agent_null_right' => 'Access Right Name',
+ #special bulk insert mode
+ 'bulk' => 'field',
+
&>
</%doc>
@@ -85,6 +88,9 @@
%
% my $edit_ext = $opt{'edit_ext'} || 'html';
% my $url = $opt{'error_redirect'} || popurl(2)."$table.$edit_ext";
+
+% #my $query = $m->scomp('/elements/create_uri_query');
+% #$cgi->redirect("$url?$query");
% if ( length($cgi->query_string) > 1920 ) { #stupid IE 2083 URL limit
%
% my $session = int(rand(4294967296)); #XXX
@@ -128,7 +134,7 @@
%
% if ( $opt{'redirect'} ) {
%
-<% $cgi->redirect( $opt{'redirect'}. $pkeyvalue ) %>
+<% $cgi->redirect( $opt{'redirect'}. $new_pkey) %>
%
% } else {
%
@@ -163,13 +169,13 @@
#|| [ grep { $_ ne $pkey } dbdef->table($table)->columns ];
|| [ fields($table) ];
-my $pkeyvalue = $cgi->param($pkey);
+my $old_pkey = $cgi->param($pkey);
my $old = '';
-if ( $pkeyvalue ) {
+if ( $old_pkey ) {
$old = qsearchs({
'table' => $table,
- 'hashref' => { $pkey => $pkeyvalue },
+ 'hashref' => { $pkey => $old_pkey },
'extra_sql' => ( $opt{'agent_virt'}
? ' AND '. $curuser->agentnums_sql(
'null_right' => $opt{'agent_null_right'}
@@ -179,13 +185,27 @@
});
}
+my $bfield = $opt{'bulk'};
+
my %hash =
map { my @entry = ( $_ => scalar($cgi->param($_)) );
$opt{'value_callback'} ? ( $_ => &{ $opt{'value_callback'} }( @entry ))
: ( @entry )
- } @$fields;
+ } grep { $_ ne $bfield } @$fields;
-my $new = $class->new( \%hash );
+my @values = ( 1 );
+if ( $bfield ) {
+ @values = $cgi->param($bfield);
+ warn join(',', @values);
+}
+
+my $new;
+my $new_pkey = '';
+foreach my $value ( @values ) {
+
+ $new = $class->new( \%hash );
+
+ $new->$bfield($value) if $bfield;
if ($old && exists($opt{'copy_on_empty'})) {
foreach my $field (@{$opt{'copy_on_empty'}}) {
@@ -232,11 +252,11 @@
}
if ( !$error ) {
- if ( $pkeyvalue ) {
+ if ( $old_pkey ) {
$error = $new->replace($old, @args);
} else {
$error = $new->insert(@args);
- $pkeyvalue = $new->getfield($pkey);
+ $new_pkey = $new->getfield($pkey);
}
}
@@ -320,4 +340,8 @@
}
+ last if $error;
+
+}
+
</%init>
More information about the freeside-commits
mailing list