1 <% include('/elements/header-popup.html', 'Bulk edit packages') %>
3 %# this should be centralized somewhere
4 <STYLE TYPE="text/css">
5 .row0 { background-color: #eeeeee; }
6 .row1 { background-color: #ffffff; }
8 <& /elements/error.html &>
11 function toggle_section(what) {
14 if (document.getElementById(id).checked == true) { isDisabled = false; }
15 else { isDisabled = true; }
17 var whatDiv = document.getElementById(id+'_div');
18 if (isDisabled) { whatDiv.style.display = "none"; }
19 else { whatDiv.style.display = "block"; }
24 <FORM ACTION="process/bulk-part_pkg.html" METHOD="POST" onsubmit="return confirm('Edit these packages?');">
28 <B>Select the package information to change</B><BR>
29 <INPUT TYPE="checkbox" ID="report_class" NAME="report_class" VALUE="1" onChange='toggle_section(this);'>
32 <DIV ID="report_class_div" STYLE="display: none;">
33 <& /elements/table-grid.html &>\
34 <& /elements/tr-justtitle.html, value => mt('Report classes') &>
36 % foreach my $num (sort keys %report_class) {
37 <TR CLASS="row<%$row % 2%>">
39 % if ( $initial_state{$num} == -1 ) {
40 % # needs to be a tristate so that you can say "don't change it"
41 <& /elements/checkbox-tristate.html, field => 'report_option_'.$num &>
43 %# for visual consistency
44 <INPUT TYPE="checkbox" CLASS="partial" ID="report_option_<%$num%>" NAME="report_option_<%$num%>" VALUE="1" <% $initial_state{$num} ? 'CHECKED':'' %>><LABEL />
47 <TD><% $report_class{$num}->name %></TD>
54 <INPUT TYPE="checkbox" ID="pricing" NAME="pricing" VALUE="1" onChange='toggle_section(this);'>
57 <DIV ID="pricing_div" STYLE="display: none;">
58 <& /elements/table-grid.html &>\
59 <& /elements/tr-justtitle.html, value => mt('Package pricing') &>
61 <TD>Percentage of setup fee increase </TD>
62 <TD><INPUT TYPE="text" ID="setup_fee_increase" NAME="setup_fee_increase">%</TD>
64 <TD>Percentage of recurring fee increase </TD>
65 <TD><INPUT TYPE="text" ID="recurring_fee_increase" NAME="recurring_fee_increase">%</TD>
70 <INPUT TYPE="submit" VALUE="Bulk change packages">
72 <TD WIDTH="5"> </TD>
74 <B>The following packages will be changed:</B><BR>
75 % foreach my $pkgpart (sort keys(%part_pkg)) {
76 <INPUT TYPE="hidden" NAME="pkgpart" VALUE="<% $pkgpart %>">
77 <% $part_pkg{$pkgpart}->pkg_comment |h %><BR>
83 <& /elements/footer.html &>
85 die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Bulk edit package definitions');
86 my @pkgparts = $cgi->param('pkgpart')
87 or die "no package definitions selected";
89 my %part_pkg = map { $_ => FS::part_pkg->by_key($_) } @pkgparts;
90 my %part_pkg_option = map { $_ => { $part_pkg{$_}->options } } @pkgparts;
91 my %report_class = map { $_->num => $_ }
92 qsearch('part_pkg_report_option', { disabled => '' });
95 foreach my $num (keys %report_class) {
98 foreach my $option (values %part_pkg_option) {
99 if ( $option->{"report_option_$num"} ) {
105 if ( $yes and $no ) {
106 $initial_state{$num} = -1;
108 $initial_state{$num} = 1;
110 $initial_state{$num} = '';
111 } # else, uh, you didn't provide any pkgparts