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