summaryrefslogtreecommitdiff
path: root/httemplate/edit/cust_pkg_detail.html
blob: a1a6db6d3fd0f4334aef17e16c4f89089b5811c7 (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
88
89
<& /elements/header-popup.html, $title &>

<FORM ACTION="process/cust_pkg_detail.html" NAME="DetailForm" ID="DetailForm" METHOD="POST">

<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
<INPUT TYPE="hidden" NAME="detailtype" VALUE="<% $detailtype %>">

<TABLE ID="DetailTable" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=1 STYLE="background-color: #cccccc">

% if ( $curuser->option('show_pkgnum') ) {

    <TR>
      <TD ALIGN="right">Package #</TD>
      <TD BGCOLOR="#ffffff"><% $pkgnum %></TD>
    </TR>

% }

  <TR>
    <TD ALIGN="right">Package</TD>
    <TD BGCOLOR="#ffffff"><% $part_pkg->pkg %></TD>
  </TR>

  <TR>
    <TD ALIGN="right">Comment</TD>
    <TD BGCOLOR="#ffffff"><% $part_pkg->comment |h %></TD>
  </TR>

  <TR>
    <TD ALIGN="right">Status</TD>
    <TD BGCOLOR="#ffffff"><FONT COLOR="#<% $cust_pkg->statuscolor %>"><B><% ucfirst($cust_pkg->status) %></B></FONT></TD>
  </TR>

  <TR>
    <TD COLSPAN=2><% ucfirst($name{$detailtype}) %>: </TD>
  </TR>

<& elements/detail-table.html, 
     id      => 'DetailTable',
     details => \@details,
 &>

</TABLE>

<BR>
<INPUT TYPE="submit" ID="submit" NAME="submit" VALUE="<% $title %>">

</FORM>

</BODY>
</HTML>
<%init>

my %access_right = (
  'I' => 'Edit customer package invoice details', 
  'C' => 'Edit customer package comments',
);

my %name = (
  'I' => 'invoice details',
  'C' => 'package comments',
);

my $curuser = $FS::CurrentUser::CurrentUser;

$cgi->param('detailtype') =~ /^(\w)$/ or die 'illegal detailtype';
my $detailtype = $1;

my $right = $access_right{$detailtype};
die "access denied"
  unless $curuser->access_right($right);

$cgi->param('pkgnum') =~ /^(\d+)$/ or die 'illegal pkgnum';
my $pkgnum = $1;

my $cust_pkg = qsearchs({
  'table'     => 'cust_pkg',
  'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
  'hashref'   => { 'pkgnum' => $pkgnum },
  'extra_sql' => ' AND '. $curuser->agentnums_sql,
});

my $part_pkg = $cust_pkg->part_pkg;

my @details = map { $_->detail } $cust_pkg->cust_pkg_detail($detailtype);

my $title = ( scalar(@details) ? 'Edit ' : 'Add ' ). $name{$detailtype};

</%init>