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