summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FS/FS/AccessRight.pm1
-rw-r--r--FS/FS/access_right.pm1
-rw-r--r--httemplate/view/cust_main/packages/contact.html25
3 files changed, 20 insertions, 7 deletions
diff --git a/FS/FS/AccessRight.pm b/FS/FS/AccessRight.pm
index bfb39b4ad..373617e36 100644
--- a/FS/FS/AccessRight.pm
+++ b/FS/FS/AccessRight.pm
@@ -132,6 +132,7 @@ tie my %rights, 'Tie::IxHash',
'Order customer package',
'One-time charge',
'Change customer package',
+ 'Detach customer package',
'Bulk change customer packages',
'Edit customer package dates',
'Discount customer package', #NEW
diff --git a/FS/FS/access_right.pm b/FS/FS/access_right.pm
index d370ba5d1..5bcf92214 100644
--- a/FS/FS/access_right.pm
+++ b/FS/FS/access_right.pm
@@ -232,6 +232,7 @@ sub _upgrade_data { # class method
'Financial reports' => [ 'Employees: Commission Report',
'Employees: Audit Report',
],
+ 'Change customer package' => 'Detach customer package',
;
foreach my $old_acl ( keys %onetime ) {
diff --git a/httemplate/view/cust_main/packages/contact.html b/httemplate/view/cust_main/packages/contact.html
index 4e0551b31..0c81eb39d 100644
--- a/httemplate/view/cust_main/packages/contact.html
+++ b/httemplate/view/cust_main/packages/contact.html
@@ -1,15 +1,18 @@
% if ( $contact ) {
<% $contact->line |h %>
-% if ( $show_link ) {
+% if ( $show_change_link ) {
<FONT SIZE=-1>
(&nbsp;<%pkg_change_contact_link($cust_pkg)%>&nbsp;)
+ </FONT>
+% }
+% if ( $show_detach_link ) {
(&nbsp;<%pkg_detach_link($cust_pkg)%>&nbsp;)
</FONT>
% }
-% } elsif ( $show_link ) {
- <FONT SIZE=-1>
- (&nbsp;<%pkg_add_contact_link($cust_pkg)%>&nbsp;)
- </FONT>
+% } elsif ( $show_contact_link ) {
+ <FONT SIZE=-1>
+ (&nbsp;<%pkg_add_contact_link($cust_pkg)%>&nbsp;)
+ </FONT>
% }
<%init>
@@ -18,10 +21,18 @@ my %opt = @_;
my $cust_pkg = $opt{'cust_pkg'};
-my $show_link =
+my $show_change_link =
! $cust_pkg->get('cancel')
&& $FS::CurrentUser::CurrentUser->access_right('Change customer package');
+my $show_detach_link =
+ ! $cust_pkg->get('cancel')
+ && $FS::CurrentUser::CurrentUser->access_right('Detach customer package');
+
+my $show_contact_link =
+ ! $cust_pkg->get('cancel')
+ ; #&& $FS::CurrentUser::CurrentUser->access_right('Add package contact'); #or something like that
+
my $contact = $cust_pkg->contact_obj;
sub pkg_change_contact_link {
@@ -43,7 +54,7 @@ sub pkg_add_contact_link {
include( '/elements/popup_link-cust_pkg.html',
'action' => $p. "misc/change_pkg_contact.html",
'label' => emt('Add contact'),
- 'actionlabel' => emt('Change'),
+ 'actionlabel' => emt('Add contact'),
'cust_pkg' => $cust_pkg,
'width' => 616,
'height' => 192,