1 <% include("/elements/header-popup.html", $title, '',
2 ( $cgi->param('error') ? '' : 'onload="addRow()"' ),
6 %# <% include('/elements/error.html') %>
8 <FORM ACTION="process/cust_pkg_detail.html" NAME="DetailForm" ID="DetailForm" METHOD="POST">
10 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
11 <INPUT TYPE="hidden" NAME="detailtype" VALUE="<% $detailtype %>">
13 <TABLE ID="DetailTable" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=1 STYLE="background-color: #cccccc">
15 % if ( $curuser->option('show_pkgnum') ) {
18 <TD ALIGN="right">Package #</TD>
19 <TD BGCOLOR="#ffffff"><% $pkgnum %></TD>
25 <TD ALIGN="right">Package</TD>
26 <TD BGCOLOR="#ffffff"><% $part_pkg->pkg %></TD>
30 <TD ALIGN="right">Comment</TD>
31 <TD BGCOLOR="#ffffff"><% $part_pkg->comment |h %></TD>
35 <TD ALIGN="right">Status</TD>
36 <TD BGCOLOR="#ffffff"><FONT COLOR="#<% $cust_pkg->statuscolor %>"><B><% ucfirst($cust_pkg->status) %></B></FONT></TD>
40 <TD COLSPAN=2><% ucfirst($name{$detailtype}) %>: </TD>
49 <INPUT TYPE="text" NAME="detail<% $row %>" SIZE="60" MAXLENGTH="65" VALUE="<% $_->detail |h %>" rownum="<% $row++ %>" onkeyup = "possiblyAddRow;" >
58 <INPUT TYPE="submit" ID="submit" NAME="submit" VALUE="<% $title %>">
62 <SCRIPT TYPE="text/javascript">
64 var rownum = <% $row %>;
66 function possiblyAddRow() {
67 if ( ( rownum - this.getAttribute('rownum') ) == 1 ) {
74 var table = document.getElementById('DetailTable');
75 var tablebody = table.getElementsByTagName('tbody').item(0);
77 var row = document.createElement('TR');
79 var empty_cell = document.createElement('TD');
80 row.appendChild(empty_cell);
82 var detail_cell = document.createElement('TD');
84 var detail_input = document.createElement('INPUT');
85 detail_input.setAttribute('name', 'detail'+rownum);
86 detail_input.setAttribute('id', 'detail'+rownum);
87 detail_input.setAttribute('size', 60);
88 detail_input.setAttribute('maxLength', 65);
89 detail_input.setAttribute('rownum', rownum);
90 detail_input.onkeyup = possiblyAddRow;
91 detail_cell.appendChild(detail_input);
93 row.appendChild(detail_cell);
95 tablebody.appendChild(row);
108 'I' => 'Edit customer package invoice details',
109 'C' => 'Edit customer package comments',
113 'I' => 'invoice details',
114 'C' => 'package comments',
117 my $curuser = $FS::CurrentUser::CurrentUser;
119 $cgi->param('detailtype') =~ /^(\w)$/ or die 'illegal detailtype';
122 my $right = $access_right{$detailtype};
124 unless $curuser->access_right($right);
126 $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'illegal pkgnum';
129 my $cust_pkg = qsearchs({
130 'table' => 'cust_pkg',
131 'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
132 'hashref' => { 'pkgnum' => $pkgnum },
133 'extra_sql' => ' AND '. $curuser->agentnums_sql,
136 my $part_pkg = $cust_pkg->part_pkg;
138 my @details = $cust_pkg->cust_pkg_detail($detailtype);
140 my $title = ( scalar(@details) ? 'Edit ' : 'Add ' ). $name{$detailtype};