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