'menubar' => \@menubar,
'html_init' => $html_init,
'html_form' => $html_form,
- 'html_posttotal' => $html_posttotal,
'name' => 'package definitions',
'disableable' => 1,
'disabled_statuspos' => 4,
'agent_virt' => 1,
- 'agent_null_right' => [ $edit, $edit_global ],
- 'agent_null_right_link' => $edit_global,
- 'agent_pos' => 6,
+ 'agent_null_right' => $edit_global,
+ 'agent_pos' => 3,
'query' =>
{ 'select' => $select,
'table' => 'part_pkg',
my $curuser = $FS::CurrentUser::CurrentUser;
-my $edit = 'Edit package definitions';
-my $edit_global = 'Edit global package definitions';
+my $edit = 'Edit FCC report configuration';
+my $edit_global = 'Edit FCC report configuration for all agents';
my $acl_edit = $curuser->access_right($edit);
my $acl_edit_global = $curuser->access_right($edit_global);
die "access denied"
unless $acl_edit || $acl_edit_global;
+if ( $cgi->param('redirect') ) {
+ my $session = $cgi->param('redirect');
+ my $pref = $curuser->option("redirect$session");
+ die "unknown redirect session $session\n" unless length($pref);
+ $cgi = new CGI($pref);
+ $cgi->param('redirect', $session);
+}
+
my $conf = new FS::Conf;
my $orderby = 'pkgpart';
my $addl_from =
FS::Report::FCC_477::join_optionnames(@optionnames);
-#restore this so pagination works
-$cgi->param('classnum', $classnum) if length($classnum);
-
-#should hide this if there aren't any classes
-my $html_posttotal =
- "<BR>( show class: ".
- include('/elements/select-pkg_class.html',
- #'curr_value' => $classnum,
- 'value' => $classnum, #insist on 0 :/
- 'onchange' => 'filter_change()',
- 'pre_options' => [ '-1' => 'all',
- '0' => '(none)', ],
- 'disable_empty' => 1,
- ).
- ' )';
-
my $link = [ $p.'edit/part_pkg.cgi?', 'pkgpart' ];
my @header = ( '#', 'Package', 'Comment' );
if $extra_count;
my $count_query = "SELECT COUNT(*) FROM part_pkg $count_extra_sql $extra_count";
+# in case of error redirect
+if ( $cgi->param('redirect') ) {
+ push @header, '';
+ push @fields, sub {
+ my $part_pkg = shift;
+ my $pkgpart = $part_pkg->pkgpart;
+ '<B><FONT COLOR="#ffffff">' . $cgi->param("error$pkgpart") || '' . '</FONT></B>'
+ };
+ $align .= 'l';
+}
+
my $html_init =
include('/elements/init_overlib.html') .
include('/elements/input-fcc_options.html', js_only => 1) .
- include('.style');
-
-my $html_form = '';
-my $html_foot = '';
-# insert a checkbox column
-unshift @header, '';
-unshift @fields, sub {
- '<INPUT TYPE="checkbox" NAME="pkgpart" VALUE=' . $_[0]->pkgpart .'>';
-};
-unshift @links, '';
-$align = 'c'.$align;
+ include('.style') .
+ include('.script');
+my $html_form = qq!<FORM ACTION="${p}edit/process/bulk-part_pkg-fcc.html" METHOD="POST" NAME="bulk-part_pkg-fcc">
+ <INPUT TYPE="hidden" NAME="jump">
+ ( show class: !.
+ include('/elements/select-pkg_class.html',
+ #'curr_value' => $classnum,
+ 'value' => $classnum, #insist on 0 :/
+ 'onchange' => 'filter_change()',
+ 'pre_options' => [ '-1' => 'all',
+ '0' => '(none)', ],
+ 'disable_empty' => 1,
+ ).
+ ' )
+ <BR><BR>';
-$html_form = qq!<FORM ACTION="${p}edit/process/bulk-part_pkg-fcc.html" METHOD="POST">!;
-$html_foot = qq!
- <INPUT TYPE="submit" VALUE="Save changes">
- </FORM>!;
+# pass the page selection through so we can jump back to the current spot
+if ( $cgi->param('maxrecords') =~ /^(\d+)$/ ) {
+ $html_form .= qq!<INPUT TYPE="hidden" NAME="maxrecords" VALUE="$1">!;
+}
+if ( $cgi->param('offset') =~ /^(\d+)$/ ) {
+ $html_form .= qq!<INPUT TYPE="hidden" NAME="offset" VALUE="$1">!;
+}
+
+# restore this only after creating $html_form
+$cgi->param('classnum', $classnum) if length($classnum);
+
+my $html_foot = '</FORM>';
my @menubar =
( 'Package definitions' => $p.'browse/part_pkg.cgi' );
}
</style>
</%def>
+<%def .script>
+<script type="text/javascript">
+ function finish_edit_fcc(id) {
+ cClick();
+ document.forms['bulk-part_pkg-fcc']['jump'].value = id;
+ document.forms['bulk-part_pkg-fcc'].submit(); //immediately save/refresh
+ }
+
+ function filter_change() {
+ window.location = '<% $cgi->self_url %>?classnum='
+ + document.getElementById('classnum').value;
+ }
+</script>
+</%def>