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