From: Ivan Kohler Date: Fri, 3 May 2013 06:40:22 +0000 (-0700) Subject: detach a package into a new customer, RT#22185 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=4a3e900ad42a15a6a999e1d1461b816d7fac2230 detach a package into a new customer, RT#22185 --- 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 ) { ( <%pkg_change_contact_link($cust_pkg)%> ) + +% } +% if ( $show_detach_link ) { ( <%pkg_detach_link($cust_pkg)%> ) % } -% } elsif ( $show_link ) { - - ( <%pkg_add_contact_link($cust_pkg)%> ) - +% } elsif ( $show_contact_link ) { + + ( <%pkg_add_contact_link($cust_pkg)%> ) + % } <%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,