X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fview%2Fcust_main%2Fpackages%2Fcontact.html;h=10c584c8cb0895337b880ae5fd3e2d7a3fa20b69;hb=f4aa07316a23cbbd1db83cf1bceb1d59111ff0d6;hp=5f47cf7060c94f4578b129a9646959131dd85be1;hpb=67065f306c08433774a1044bcd8e5d6254d752da;p=freeside.git diff --git a/httemplate/view/cust_main/packages/contact.html b/httemplate/view/cust_main/packages/contact.html index 5f47cf706..10c584c8c 100644 --- a/httemplate/view/cust_main/packages/contact.html +++ b/httemplate/view/cust_main/packages/contact.html @@ -1,19 +1,22 @@ % if ( $contact ) { <% $contact->line |h %> +% if ( $show_change_link && ! $opt{no_links} ) { + + ( <%pkg_change_contact_link($cust_pkg)%> ) + +% } +% if ( $show_detach_link && ! $opt{no_links} ) { + + ( <%pkg_detach_link($cust_pkg)%> ) + +% } +
+% } elsif ( $show_contact_link && ! $opt{no_links} ) { + + ( <%pkg_add_contact_link($cust_pkg)%> ) + +
% } - -% if ( ! $cust_pkg->get('cancel') -% && $FS::CurrentUser::CurrentUser->access_right('Change customer package') -% ) -% { - -%#XXX ( <%pkg_change_contact_link($cust_pkg)%> ) -%# % if ( $cust_pkg->contactnum ) { -%# ( <%edit_contact_link($cust_pkg->contactnum)%> ) -%# % } - -% } - <%init> my $conf = new FS::Conf; @@ -21,27 +24,66 @@ my %opt = @_; my $cust_pkg = $opt{'cust_pkg'}; +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 { my $cust_pkg = shift; - my $pkgpart = $cust_pkg->pkgpart; + #my $pkgpart = $cust_pkg->pkgpart; include( '/elements/popup_link-cust_pkg.html', -#XXX - 'action' => $p. "misc/change_pkg.cgi?contactnum=-1", - 'label' => emt('Change contact'), + 'action' => $p. "misc/change_pkg_contact.html", + 'label' => emt('Change'), # contact'), 'actionlabel' => emt('Change'), 'cust_pkg' => $cust_pkg, + 'width' => 616, + 'height' => 220, + ); +} + +sub pkg_add_contact_link { + my $cust_pkg = shift; + #my $pkgpart = $cust_pkg->pkgpart; + include( '/elements/popup_link-cust_pkg.html', + 'action' => $p. "misc/change_pkg_contact.html", + 'label' => emt('Add contact'), + 'actionlabel' => emt('Add contact'), + 'cust_pkg' => $cust_pkg, + 'width' => 616, + 'height' => 192, ); } -sub edit_contact_link { - my $contactnum = shift; - include( '/elements/popup_link.html', - 'action' => $p. "edit/cust_contact.cgi?contactnum=$contactnum", - 'label' => emt('Edit contact'), - 'actionlabel' => emt('Edit'), +sub pkg_detach_link { + my $cust_pkg = shift; + #my $pkgpart = $cust_pkg->pkgpart; + include( '/elements/popup_link-cust_pkg.html', + 'action' => $p. "misc/detach_pkg.html", + 'label' => emt('Detach'), + 'actionlabel' => emt('Detach'), + 'cust_pkg' => $cust_pkg, + 'width' => 616, + 'height' => 720, ); } +#sub edit_contact_link { +# my $contactnum = shift; +# include( '/elements/popup_link.html', +# 'action' => $p. "edit/cust_contact.cgi?contactnum=$contactnum", +# 'label' => emt('Edit contact'), +# 'actionlabel' => emt('Edit'), +# ); +#} +