my( $cust_main ) = @_;
my $conf = new FS::Conf;
+ my $curuser = $FS::CurrentUser::CurrentUser;
+
my $packages = get_packages($cust_main, $conf);
%>
<A NAME="cust_pkg"><FONT SIZE="+2">Packages</FONT></A>
-<%= include('order_pkg.html', $cust_main ) %>
+<% if ( $curuser->access_right('Order customer package') ) { %>
+ <%= include('order_pkg.html', $cust_main ) %>
+<% } %>
-<% if ( $conf->config('payby-default') ne 'HIDE' ) { %>
+<% if ( $curuser->access_right('One-time charge')
+ && $conf->config('payby-default') ne 'HIDE'
+ ) {
+%>
<%= include('quick-charge.html', $cust_main ) %>
<% } %>
-<A HREF="<%= $p %>edit/cust_pkg.cgi?<%= $cust_main->custnum %>">Bulk order and cancel packages</A> (preserves services)
+<% if ( $curuser->access_right('Bulk change customer packages') ) { %>
+ <A HREF="<%= $p %>edit/cust_pkg.cgi?<%= $cust_main->custnum %>">Bulk order and cancel packages</A> (preserves services)
+<% } %>
+
<BR><BR>
<% if ( @$packages ) { %>
<TD ROWSPAN=<%= $rowspan || 1 %>>
<A NAME="cust_pkg<%=$pkg->{pkgnum}%>"><%=$pkg->{pkgnum}%></A>:
<%=$pkg->{pkg}%> - <%=$pkg->{comment}%><BR>
-<% unless ($pkg->{cancel}) { %>
- ( <%=pkg_change_link($pkg)%> )
- ( <%=pkg_dates_link($pkg)%> | <%=pkg_customize_link($pkg,$cust_main->custnum)%> )
-<% } %>
+ <FONT SIZE=-1>
+ <% unless ( $pkg->{cancel} ) { %>
+ <% if ( $curuser->access_right('Change customer package') ) { %>
+ ( <%=pkg_change_link($pkg)%> )
+ <% } %>
+ <% if ( $curuser->access_right('Edit customer package dates') ) { %>
+ ( <%=pkg_dates_link($pkg)%> )
+ <% } %>
+ <% if ( $curuser->access_right('Customize customer package') ) { %>
+ ( <%=pkg_customize_link($pkg,$cust_main->custnum)%> )
+ <% } %>
+ <% } %>
+ </FONT>
</TD>
<TD ROWSPAN=<%= $rowspan || 1 %>>
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 WIDTH="100%">
<% } %>
<TR>
- <TD COLSPAN=<%=$colspan%>>( <%= pkg_unsuspend_link($pkg) %> | <%= pkg_cancel_link($pkg) %> )</TD>
+ <TD COLSPAN=<%=$colspan%>>
+ <FONT SIZE=-1>
+ <% if ( $curuser->access_right('Unsuspend customer package') ) { %>
+ ( <%= pkg_unsuspend_link($pkg) %> )
+ <% } %>
+ <% if ( $curuser->access_right('Cancel customer package') ) { %>
+ ( <%= pkg_cancel_link($pkg) %> )
+ <% } %>
+ </FONT>
+ </TD>
</TR>
<% } else { %> <!-- #status: active -->
</TR>
<TR>
- <TD COLSPAN=<%=$colspan%>>( <%= pkg_cancel_link($pkg) %> )</TD>
+ <TD COLSPAN=<%=$colspan%>>
+ <FONT SIZE=-1>
+ <% if ( $curuser->access_right('Cancel customer package immediately') ) { %>
+ ( <%= pkg_cancel_link($pkg) %> )
+ <% } %>
+ </FONT>
+ </TD>
</TR>
<% } else { %>
<% if ( $pkg->{freq} ) { %>
<TR>
- <TD COLSPAN=<%=$colspan%>>( <%= pkg_suspend_link($pkg) %> | <%= pkg_cancel_link($pkg) %> )</TD>
+ <TD COLSPAN=<%=$colspan%>>
+ <FONT SIZE=-1>
+ <% if ( $curuser->access_right('Suspend customer package') ) { %>
+ ( <%= pkg_suspend_link($pkg) %> )
+ <% } %>
+ <% if ( $curuser->access_right('Cancel customer package immediately') ) { %>
+ ( <%= pkg_cancel_link($pkg) %> )
+ <% } %>
+ <% if ( $curuser->access_right('Cancel customer package later') ) { %>
+ ( <%= pkg_expire_link($pkg) %> )
+ <% } %>
+ <FONT>
+ </TD>
</TR>
<% } %>
print '<TR>' if ($cnt > 0);
%>
<TD><%=svc_link($svcpart,$service)%></TD>
- <TD><%=svc_label_link($svcpart,$service)%><BR>( <%=svc_unprovision_link($service)%> )</TD>
+ <TD><%=svc_label_link($svcpart,$service)%>
+ <% if ( $curuser->access_right('Unprovision customer service') ) { %>
+ <BR>( <%=svc_unprovision_link($service)%> )
+ <% } %>
+ </TD>
</TR>
<%
$cnt++;
}
- if ($svcpart->{count} < $svcpart->{quantity}) {
+ if ( $svcpart->{count} < $svcpart->{quantity}
+ && $curuser->access_right('Provision customer services')
+ ) {
print qq!<TR>\n! if ($cnt > 0);
- print qq! <TD COLSPAN=2>!.svc_provision_link($pkg, $svcpart, $conf).qq!</TD>\n</TR>\n!;
+ print qq! <TD COLSPAN=2>!.svc_provision_link($pkg, $svcpart, $conf, $curuser).qq!</TD>\n</TR>\n!;
}
}
}
}
sub svc_provision_link {
- my ($pkg, $svcpart, $conf) = @_;
+ my ($pkg, $svcpart, $conf, $curuser) = @_;
( my $svc_nbsp = $svcpart->{svc} ) =~ s/\s+/ /g;
my $num_left = $svcpart->{quantity} - $svcpart->{count};
my $pkgnum_svcpart = "pkgnum$pkg->{pkgnum}-svcpart$svcpart->{svcpart}";
my $link = qq!<A CLASS="provision" HREF="$url">!.
"Provision $svc_nbsp ($num_left)</A>";
- if ( $conf->exists('legacy_link') ) {
+ if ( $conf->exists('legacy_link')
+ && $curuser->access_right('View/link unlinked services')
+ )
+ {
$link .= '<BR>'.
qq!<A CLASS="provision" HREF="${p}misc/link.cgi?!.
qq!$pkgnum_svcpart">!.
my $pkg = shift or return '';
qq!<A HREF="javascript:areyousure('${p}misc/cancel_pkg.cgi?$pkg->{pkgnum}', !.
qq!'Permanently delete included services and cancel this package?')">!.
- qq!Cancel now</A> | !.
+ qq!Cancel now</A>!;
+}
+
+sub pkg_expire_link {
+ my $pkg = shift or return '';
qq!<A HREF="${p}misc/expire_pkg.cgi?$pkg->{pkgnum}">Cancel later</A>!;
}