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 areyousure() {
12 var warning = 'Edit these packages?';
13 if(confirm(warning)) { process(); }
16 function toggle_section(what) {
19 if (document.getElementById(id).checked == true) { isDisabled = false; }
20 else { isDisabled = true; }
22 var whatDiv = document.getElementById(id+'_div');
23 if (isDisabled) { whatDiv.style.display = "none"; }
24 else { whatDiv.style.display = "block"; }
29 <FORM ACTION="process/bulk-part_pkg.html" METHOD="POST">
33 <B>Select the package information to change</B><BR>
34 <INPUT TYPE="checkbox" ID="report_class" NAME="report_class" VALUE="1" onChange='toggle_section(this);'>
37 <DIV ID="report_class_div" STYLE="display: none;">
38 <& /elements/table-grid.html &>\
39 <& /elements/tr-justtitle.html, value => mt('Report classes') &>
41 % foreach my $num (sort keys %report_class) {
42 <TR CLASS="row<%$row % 2%>">
44 % if ( $initial_state{$num} == -1 ) {
45 % # needs to be a tristate so that you can say "don't change it"
46 <& /elements/checkbox-tristate.html, field => 'report_option_'.$num &>
48 %# for visual consistency
49 <INPUT TYPE="checkbox" CLASS="partial" ID="report_option_<%$num%>" NAME="report_option_<%$num%>" VALUE="1" <% $initial_state{$num} ? 'CHECKED':'' %>><LABEL />
52 <TD><% $report_class{$num}->name %></TD>
59 <INPUT TYPE="checkbox" ID="package_fees" NAME="package_fees" VALUE="1" onChange='toggle_section(this);'>
62 <DIV ID="package_fees_div" STYLE="display: none;">
63 <& /elements/table-grid.html &>\
64 <& /elements/tr-justtitle.html, value => mt('Package fees') &>
66 <TD>Percentage of setup fee increase </TD>
67 <TD><INPUT TYPE="text" ID="setup_fee_increase" NAME="setup_fee_increase">%</TD>
69 <TD>Percentage of recurring fee increase </TD>
70 <TD><INPUT TYPE="text" ID="recurring_fee_increase" NAME="recurring_fee_increase">%</TD>
75 <INPUT TYPE="submit" VALUE="Bulk change packages" onclick="areyousure()">
77 <TD WIDTH="5"> </TD>
79 <B>The following packages will be changed:</B><BR>
80 % foreach my $pkgpart (sort keys(%part_pkg)) {
81 <INPUT TYPE="hidden" NAME="pkgpart" VALUE="<% $pkgpart %>">
82 <% $part_pkg{$pkgpart}->pkg_comment |h %><BR>
88 <& /elements/footer.html &>
90 die "access denied" unless $FS::CurrentUser::CurrentUser->access_right('Bulk edit package definitions');
91 my @pkgparts = $cgi->param('pkgpart')
92 or die "no package definitions selected";
94 my %part_pkg = map { $_ => FS::part_pkg->by_key($_) } @pkgparts;
95 my %part_pkg_option = map { $_ => { $part_pkg{$_}->options } } @pkgparts;
96 my %report_class = map { $_->num => $_ }
97 qsearch('part_pkg_report_option', { disabled => '' });
100 foreach my $num (keys %report_class) {
103 foreach my $option (values %part_pkg_option) {
104 if ( $option->{"report_option_$num"} ) {
110 if ( $yes and $no ) {
111 $initial_state{$num} = -1;
113 $initial_state{$num} = 1;
115 $initial_state{$num} = '';
116 } # else, uh, you didn't provide any pkgparts