summaryrefslogtreecommitdiff
path: root/httemplate/view/cust_main/packages/contact.html
blob: 93985e40419e2b7a4d740b2d29e6ff9b16867781 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
% if ( $contact ) {
    <% $contact->line |h %>
% if ( $show_change_link && ! $opt{no_links} ) {
        <FONT SIZE=-1>
          (&nbsp;<%pkg_change_contact_link($cust_pkg)%>&nbsp;)
        </FONT>
% }
% if ( $show_detach_link && ! $opt{no_links} ) {
        <FONT SIZE=-1>
          (&nbsp;<%pkg_detach_link($cust_pkg)%>&nbsp;)
        </FONT>
%    }
% } elsif ( $show_contact_link && ! $opt{no_links} ) {
    <FONT SIZE=-1>
      (&nbsp;<%pkg_add_contact_link($cust_pkg)%>&nbsp;)
    </FONT>
% }
<%init>

my $conf = new FS::Conf;
my %opt = @_;

my $cust_pkg       = $opt{'cust_pkg'};

my $show_change_link = 
  ! $cust_pkg->get('cancel')
  && $FS::CurrentUser::CurrentUser->access_right('Change customer package');

my $show_detach_link =
  ! $cust_pkg->get('cancel')
  && $FS::CurrentUser::CurrentUser->access_right('Detach customer package');

my $show_contact_link =
  ! $cust_pkg->get('cancel')
  ; #&& $FS::CurrentUser::CurrentUser->access_right('Add package contact'); #or something like that

my $contact = $cust_pkg->contact_obj;

sub pkg_change_contact_link {
  my $cust_pkg = shift;
  #my $pkgpart = $cust_pkg->pkgpart;
  include( '/elements/popup_link-cust_pkg.html',
    'action'      => $p. "misc/change_pkg_contact.html",
    'label'       => emt('Change'), # contact'),
    'actionlabel' => emt('Change'),
    'cust_pkg'    => $cust_pkg,
    'width'       => 616,
    'height'      => 220,
  );
}

sub pkg_add_contact_link {
  my $cust_pkg = shift;
  #my $pkgpart = $cust_pkg->pkgpart;
  include( '/elements/popup_link-cust_pkg.html',
    'action'      => $p. "misc/change_pkg_contact.html",
    'label'       => emt('Add contact'),
    'actionlabel' => emt('Add contact'),
    'cust_pkg'    => $cust_pkg,
    'width'       => 616,
    'height'      => 192,
  );
}

sub pkg_detach_link {
  my $cust_pkg = shift;
  #my $pkgpart = $cust_pkg->pkgpart;
  include( '/elements/popup_link-cust_pkg.html',
    'action'      => $p. "misc/detach_pkg.html",
    'label'       => emt('Detach'),
    'actionlabel' => emt('Detach'),
    'cust_pkg'    => $cust_pkg,
    'width'       => 616,
    'height'      => 684,
  );
}

#sub edit_contact_link {
#  my $contactnum = shift;
#  include( '/elements/popup_link.html',
#    'action'      => $p. "edit/cust_contact.cgi?contactnum=$contactnum",
#    'label'       => emt('Edit contact'),
#    'actionlabel' => emt('Edit'),
#  );
#}

</%init>