summaryrefslogtreecommitdiff
path: root/httemplate/edit
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate/edit')
-rw-r--r--httemplate/edit/elements/part_svc_column.html5
-rwxr-xr-xhttemplate/edit/part_pkg.cgi75
-rwxr-xr-xhttemplate/edit/part_svc.cgi52
-rw-r--r--httemplate/edit/process/elements/process.html21
-rwxr-xr-xhttemplate/edit/process/part_pkg.cgi5
5 files changed, 59 insertions, 99 deletions
diff --git a/httemplate/edit/elements/part_svc_column.html b/httemplate/edit/elements/part_svc_column.html
index 4e112c078..816f3428b 100644
--- a/httemplate/edit/elements/part_svc_column.html
+++ b/httemplate/edit/elements/part_svc_column.html
@@ -267,8 +267,9 @@ my %communigate_fields = (
<& /elements/progress-init.html,
$svcdb, #form name
[ # form fields to send
- qw(svc svcpart classnum selfservice_access disabled preserve exportnum),
- @fields
+ 'ALL'
+# qw(svc svcpart classnum selfservice_access disabled preserve exportnum),
+# @fields
],
'process/part_svc.cgi', # target
$p.'browse/part_svc.cgi', # redirect landing
diff --git a/httemplate/edit/part_pkg.cgi b/httemplate/edit/part_pkg.cgi
index 80a61f813..f2c4aacef 100755
--- a/httemplate/edit/part_pkg.cgi
+++ b/httemplate/edit/part_pkg.cgi
@@ -92,7 +92,7 @@
{ type => 'columnstart' },
{ field => 'pkg',
- type => 'text',
+ type => 'input-locale-text',
size => 40, #32
maxlength => 50,
},
@@ -495,42 +495,6 @@ my $recur_show_zero_disabled = 1;
my $pkgpart = '';
-my $splice_locale_fields = sub {
- my( $fields, $pkey_value_callback, $pkg_value_callback ) = @_;
-
- my $n = 0;
- my @locale_fields = (
- map {
- my $pkey_value= $pkey_value_callback ? &$pkey_value_callback($_) : '';
- my $pkg_value = $pkg_value_callback
- ? $pkg_value_callback eq 'cgiparam'
- ? $cgi->param('pkgpartmsgnum'. $n. '_pkg')
- : &$pkg_value_callback($_)
- : '';
- (
- { field => 'pkgpartmsgnum'. $n,
- type => 'hidden',
- value => $pkey_value,
- },
- { field => 'pkgpartmsgnum'. $n. '_locale',
- type => 'hidden',
- value => $_,
- },
- { field => 'pkgpartmsgnum'. $n++. '_pkg',
- type => 'text',
- size => 40,
- #maxlength => 50,
- value => $pkg_value,
- },
- );
-
- }
- @locales
- );
- splice(@$fields, 7, 0, @locale_fields); #XXX 7 is arbitrary above
-
-};
-
my $error_callback = sub {
my($cgi, $object, $fields, $opt ) = @_;
@@ -579,16 +543,6 @@ my $error_callback = sub {
$pkgpart = $object->pkgpart;
- &$splice_locale_fields(
- $fields,
- sub {
- my $locale = shift;
- my $part_pkg_msgcat = $object->part_pkg_msgcat($locale);
- $part_pkg_msgcat ? $part_pkg_msgcat->pkgpartmsgnum : '';
- },
- 'cgiparam'
- );
-
if ( $cgi->param('error') =~ / is suggested with / ) {
#yeah, detection is a shitty kludge, but we don't have exception objects
$opt->{form_init} = '<INPUT TYPE="checkbox" NAME="part_pkg_restrict_soft_override" VALUE="Y"> Override suggestion<BR><BR>';
@@ -665,20 +619,6 @@ my $edit_callback = sub {
$pkgpart = $object->pkgpart;
- &$splice_locale_fields(
- $fields,
- sub {
- my $locale = shift;
- my $part_pkg_msgcat = $object->part_pkg_msgcat($locale);
- $part_pkg_msgcat ? $part_pkg_msgcat->pkgpartmsgnum : '';
- },
- sub {
- my $locale = shift;
- my $part_pkg_msgcat = $object->part_pkg_msgcat($locale);
- $part_pkg_msgcat ? $part_pkg_msgcat->pkg : '';
- }
- );
-
};
my $new_callback = sub {
@@ -692,8 +632,6 @@ my $new_callback = sub {
$options{'suspend_bill'}=1 if $conf->exists('part_pkg-default_suspend_bill');
- &$splice_locale_fields($fields, '', '');
-
};
my $clone_callback = sub {
@@ -732,17 +670,6 @@ my $clone_callback = sub {
foreach keys %part_pkg_currency;
}
- $recur_disabled = $object->freq ? 0 : 1;
-
- &$splice_locale_fields(
- $fields,
- '',
- sub {
- my $locale = shift;
- my $part_pkg_msgcat = $object->part_pkg_msgcat($locale);
- $part_pkg_msgcat ? $part_pkg_msgcat->pkg : '';
- }
- );
};
my $discount_error_callback = sub {
diff --git a/httemplate/edit/part_svc.cgi b/httemplate/edit/part_svc.cgi
index a07fc6005..fed21256f 100755
--- a/httemplate/edit/part_svc.cgi
+++ b/httemplate/edit/part_svc.cgi
@@ -36,9 +36,26 @@
}
</STYLE>
<SCRIPT TYPE="text/javascript">
+// copy all fields from the outer form (svc and its localizations, plus
+// preserve, selfservice_access, etc.) into the inner form, creating hidden
+// inputs if needed
function fixup_submit(layer) {
- document.forms[layer].submit.disabled = true;
- fixup(document.forms[layer]);
+ var layer_form = $(document.forms[layer]);
+ var main_form = $(document.forms['SvcEditMain']);
+ var data = main_form.serializeArray();
+ for (var i = 0; i < data.length; i++) {
+ var input = layer_form.children('[name=' + data[i].name + ']');
+ if (input[0]) {
+ input.prop('value', data[i].value);
+ } else {
+ $( '<input type="hidden">' )
+ .attr('name', data[i].name)
+ .prop('value', data[i].value)
+ .appendTo(layer_form);
+ }
+ }
+ layer_form[0]['submit'].disabled = true;
+ //fixup(document.forms[layer]);
window[layer+'process'].call();
}
@@ -141,19 +158,26 @@ window.onload = function() {
</SCRIPT>
-<FORM NAME="dummy">
+<FORM NAME="SvcEditMain">
<FONT CLASS="fsinnerbox-title">Service Part #<% $part_svc->svcpart ? $part_svc->svcpart : "(NEW)" %></FONT>
<TABLE CLASS="fsinnerbox">
-<TR>
- <TD ALIGN="right">Service</TD>
- <TD><INPUT TYPE="text" NAME="svc" VALUE="<% $hashref->{svc} %>"></TD>
-<TR>
+<& /elements/tr-input-locale-text.html,
+ 'object' => $part_svc,
+ 'cgi' => $cgi,
+ 'field' => 'svc',
+ 'label' => 'Service',
+ 'curr_value' => $hashref->{svc},
+&>
+%#<TR>
+%# <TD ALIGN="right">Service</TD>
+%# <TD><INPUT TYPE="text" NAME="svc" VALUE="<% $hashref->{svc} %>"></TD>
+%#<TR>
<& /elements/tr-select-part_svc_class.html, curr_value=>$hashref->{classnum} &>
<TR>
- <TD ALIGN="right">Self-service access</TD>
+ <TH ALIGN="right">Self-service access</TD>
<TD>
<SELECT NAME="selfservice_access">
% tie my %selfservice_access, 'Tie::IxHash', #false laziness w/browse/part_svc
@@ -172,12 +196,12 @@ window.onload = function() {
<TR>
- <TD ALIGN="right">Disable new orders</TD>
+ <TH ALIGN="right">Disable new orders</TD>
<TD><INPUT TYPE="checkbox" NAME="disabled" VALUE="Y"<% $hashref->{disabled} eq 'Y' ? ' CHECKED' : '' %>></TD>
</TR>
<TR>
- <TD ALIGN="right">Preserve this service on package cancellation</TD>
+ <TH ALIGN="right">Preserve this service on package cancellation</TD>
<TD><INPUT TYPE="checkbox" NAME="preserve" VALUE="Y"<% $hashref->{'preserve'} eq 'Y' ? ' CHECKED' : '' %>>&nbsp;</TD>
</TR>
@@ -240,12 +264,12 @@ my $widget = new HTML::Widgets::SelectLayers(
#'selected_layer' => $p_svcdb,
'selected_layer' => $hashref->{svcdb} || 'svc_acct',
'options' => \%svcdb,
- 'form_name' => 'dummy',
+ 'form_name' => 'SvcEditMain',
#'form_action' => 'process/part_svc.cgi',
'form_action' => 'part_svc.cgi', #self
- 'form_elements' => [qw( svc svcpart classnum selfservice_access
- disabled preserve
- )],
+# 'form_elements' => [qw( svc svcpart classnum selfservice_access
+# disabled preserve
+# )],
'html_between' => $help,
'layer_callback' => sub {
include('elements/part_svc_column.html',
diff --git a/httemplate/edit/process/elements/process.html b/httemplate/edit/process/elements/process.html
index fd12c61d9..60aaf749a 100644
--- a/httemplate/edit/process/elements/process.html
+++ b/httemplate/edit/process/elements/process.html
@@ -62,6 +62,8 @@ Example:
'fields' => [qw( fieldname fieldname2 )],
},
+ 'process_locale' => 'fieldname', # update entries in the _msgcat table
+
'process_upload' => {
'process' => 'misc/mytable-import.html',
# fields to pass to the back end job, besides the
@@ -363,12 +365,21 @@ foreach my $value ( @values ) {
}
- if ( !$error && $opt{'process_o2m'} ) {
-
- my @process_o2m = ref($opt{'process_o2m'}) eq 'ARRAY'
- ? @{ $opt{'process_o2m'} }
- : ( $opt{'process_o2m'} );
+ my @process_o2m;
+ if ( $opt{'process_o2m'} ) {
+ @process_o2m = ref($opt{'process_o2m'}) eq 'ARRAY'
+ ? @{ $opt{'process_o2m'} }
+ : ( $opt{'process_o2m'} );
+ }
+ if ( $opt{'process_locale'} ) {
+ push @process_o2m,
+ {
+ 'table' => $table . '_msgcat',
+ 'fields' => [ 'locale', $opt{'process_locale'} ],
+ };
+ }
+ if ( !$error ) {
foreach my $process_o2m (@process_o2m) {
diff --git a/httemplate/edit/process/part_pkg.cgi b/httemplate/edit/process/part_pkg.cgi
index b8042026a..c4d150ba1 100755
--- a/httemplate/edit/process/part_pkg.cgi
+++ b/httemplate/edit/process/part_pkg.cgi
@@ -9,6 +9,7 @@
'edit_ext' => 'cgi',
'precheck_callback' => $precheck_callback,
'args_callback' => $args_callback,
+ 'process_locale' => 'pkg',
'process_m2m' => \@process_m2m,
'process_o2m' => \@process_o2m,
)
@@ -310,10 +311,6 @@ foreach my $amount_param ( grep /^usagepricepart(\d+)_amount$/, $cgi->param ) {
my @process_o2m = (
{
- 'table' => 'part_pkg_msgcat',
- 'fields' => [qw( locale pkg )],
- },
- {
'table' => 'part_pkg_usageprice',
'fields' => [qw( price currency action target amount )],