merge NG auth, RT#21563
[freeside.git] / httemplate / view / cust_main / packages / contact.html
1 % if ( $contact ) {
2     <% $contact->line |h %>
3 % if ( $show_change_link ) {
4         <FONT SIZE=-1>
5           (&nbsp;<%pkg_change_contact_link($cust_pkg)%>&nbsp;)
6         </FONT>
7 % }
8 % if ( $show_detach_link ) {
9         <FONT SIZE=-1>
10           (&nbsp;<%pkg_detach_link($cust_pkg)%>&nbsp;)
11         </FONT>
12 %    }
13 % } elsif ( $show_contact_link ) {
14     <FONT SIZE=-1>
15       (&nbsp;<%pkg_add_contact_link($cust_pkg)%>&nbsp;)
16     </FONT>
17 % }
18 <%init>
19
20 my $conf = new FS::Conf;
21 my %opt = @_;
22
23 my $cust_pkg       = $opt{'cust_pkg'};
24
25 my $show_change_link = 
26   ! $cust_pkg->get('cancel')
27   && $FS::CurrentUser::CurrentUser->access_right('Change customer package');
28
29 my $show_detach_link =
30   ! $cust_pkg->get('cancel')
31   && $FS::CurrentUser::CurrentUser->access_right('Detach customer package');
32
33 my $show_contact_link =
34   ! $cust_pkg->get('cancel')
35   ; #&& $FS::CurrentUser::CurrentUser->access_right('Add package contact'); #or something like that
36
37 my $contact = $cust_pkg->contact_obj;
38
39 sub pkg_change_contact_link {
40   my $cust_pkg = shift;
41   #my $pkgpart = $cust_pkg->pkgpart;
42   include( '/elements/popup_link-cust_pkg.html',
43     'action'      => $p. "misc/change_pkg_contact.html",
44     'label'       => emt('Change'), # contact'),
45     'actionlabel' => emt('Change'),
46     'cust_pkg'    => $cust_pkg,
47     'width'       => 616,
48     'height'      => 220,
49   );
50 }
51
52 sub pkg_add_contact_link {
53   my $cust_pkg = shift;
54   #my $pkgpart = $cust_pkg->pkgpart;
55   include( '/elements/popup_link-cust_pkg.html',
56     'action'      => $p. "misc/change_pkg_contact.html",
57     'label'       => emt('Add contact'),
58     'actionlabel' => emt('Add contact'),
59     'cust_pkg'    => $cust_pkg,
60     'width'       => 616,
61     'height'      => 192,
62   );
63 }
64
65 sub pkg_detach_link {
66   my $cust_pkg = shift;
67   #my $pkgpart = $cust_pkg->pkgpart;
68   include( '/elements/popup_link-cust_pkg.html',
69     'action'      => $p. "misc/detach_pkg.html",
70     'label'       => emt('Detach'),
71     'actionlabel' => emt('Detach'),
72     'cust_pkg'    => $cust_pkg,
73     'width'       => 616,
74     'height'      => 684,
75   );
76 }
77
78 #sub edit_contact_link {
79 #  my $contactnum = shift;
80 #  include( '/elements/popup_link.html',
81 #    'action'      => $p. "edit/cust_contact.cgi?contactnum=$contactnum",
82 #    'label'       => emt('Edit contact'),
83 #    'actionlabel' => emt('Edit'),
84 #  );
85 #}
86
87 </%init>