1 <& /elements/header.html, 'Package usage minutes' &>
2 <& /elements/menubar.html, 'Package definitions', $p.'browse/part_pkg.cgi' &>
3 <STYLE TYPE="text/css">
5 background-color: #dddddd;
11 border-color: #555555;
21 <FORM METHOD="POST" ACTION="<%$fsurl%>edit/process/part_pkg_usage.html">
22 <TABLE STYLE="margin-top: 1em">
29 % foreach my $class (@usage_class) {
30 <TH><% $class->classname %></TH>
34 % my $error = $cgi->param('error');
35 % foreach my $part_pkg (@part_pkg) {
36 % my $pkgpart = $part_pkg->pkgpart;
39 % @part_pkg_usage = @{ $error->{$pkgpart} };
41 % @part_pkg_usage = $part_pkg->part_pkg_usage;
42 % foreach my $usage (@part_pkg_usage) {
43 % foreach ($usage->classnums) {
44 % $usage->set("class$_".'_', 'Y');
48 <TR CLASS="pkg_head" ID="pkgpart<%$pkgpart%>">
49 <TD COLSPAN=<%$n_cols%>><% $part_pkg->pkg_comment %></TD>
50 % # make it easy to enumerate the pkgparts later
51 <INPUT TYPE="hidden" NAME="pkgpart" VALUE="<% $pkgpart %>">
54 <TR id="pkgpart<%$pkgpart%>_template" CLASS="usage">
56 <INPUT TYPE="hidden" NAME="pkgusagepart">
57 <INPUT TYPE="text" NAME="minutes" ID="minutes" SIZE=7>
59 % foreach (qw(shared rollover)) {
61 <INPUT TYPE="checkbox" NAME="<% $_ %>" ID="<% $_ %>" VALUE="Y">
65 <INPUT TYPE="text" NAME="description" ID="description" SIZE=20>
68 <INPUT TYPE="text" NAME="priority" ID="priority" SIZE=3>
70 % foreach (@usage_class) {
71 % my $classnum = 'class' . $_->classnum . '_';
73 <INPUT TYPE="checkbox" NAME="<% $classnum %>" ID="<% $classnum %>" VALUE="Y">
77 <& /elements/auto-table.html,
78 table => "pkgpart$pkgpart",
79 template_row => "pkgpart$pkgpart".'_template',
80 data => \@part_pkg_usage,
87 <& /elements/footer.html &>
89 my $curuser = $FS::CurrentUser::CurrentUser;
91 unless $curuser->access_right(
92 ['Edit package definitions', 'Edit global package definitions']
95 my @where = ("(plan = 'voip_cdr' OR plan = 'voip_inbound')",
98 push @where, FS::part_pkg->curuser_pkgs_sql
99 unless $curuser->access_right('Edit global package definitions');
100 my $extra_sql = ' WHERE '.join(' AND ', @where);
101 my @part_pkg = qsearch({
102 'table' => 'part_pkg',
103 'extra_sql' => $extra_sql,
104 'order_by' => ' ORDER BY pkgpart',
107 my @usage_class = sort { $a->weight <=> $b->weight }
108 qsearch('usage_class', { disabled => '' });
110 my $n_usage_classes = scalar(@usage_class);
111 my $n_cols = $n_usage_classes + 5; # minutes, shared, rollover, desc, prio