detach a package into a new customer, RT#22185
authorIvan Kohler <ivan@freeside.biz>
Fri, 3 May 2013 06:40:22 +0000 (23:40 -0700)
committerIvan Kohler <ivan@freeside.biz>
Fri, 3 May 2013 06:40:22 +0000 (23:40 -0700)
FS/FS/AccessRight.pm
FS/FS/access_right.pm
httemplate/view/cust_main/packages/contact.html

index bfb39b4..373617e 100644 (file)
@@ -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
index d370ba5..5bcf922 100644 (file)
@@ -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 ) {
index 4e0551b..0c81eb3 100644 (file)
@@ -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,