1 <% include("/elements/header-popup.html", $title, '',
2 ( $cgi->param('error') ? '' : 'onload="addRow()"' ),
6 %# <% include('/elements/error.html') %>
8 <FORM ACTION="process/quotation_pkg_detail.html" NAME="DetailForm" ID="DetailForm" METHOD="POST">
10 <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>">
12 <TABLE ID="DetailTable" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=1 STYLE="background-color: #cccccc">
15 <TD ALIGN="right">Package</TD>
16 <TD BGCOLOR="#ffffff"><% $part_pkg->pkg %></TD>
20 <TD ALIGN="right">Comment</TD>
21 <TD BGCOLOR="#ffffff"><% $part_pkg->comment |h %></TD>
28 <TD ALIGN="right"><% $row ? '' : 'Detail' %></TD>
30 <INPUT TYPE="text" NAME="detail<% $row %>" SIZE="60" MAXLENGTH="65" VALUE="<% $_ |h %>" rownum="<% $row++ %>" onkeyup="possiblyAddRow" onchange="possiblyAddrow">
39 <INPUT TYPE="submit" ID="submit" NAME="submit" VALUE="<% $title %>">
43 <SCRIPT TYPE="text/javascript">
44 % # abject false laziness with edit/cust_pkg_detail.html
46 var rownum = <% $row %>;
48 function possiblyAddRow() {
49 if ( ( rownum - this.getAttribute('rownum') ) == 1 ) {
56 var table = document.getElementById('DetailTable');
57 var tablebody = table.getElementsByTagName('tbody').item(0);
59 var row = document.createElement('TR');
61 var empty_cell = document.createElement('TD');
63 empty_cell.innerHTML = 'Detail:'
64 empty_cell.style.textAlign = 'right';
66 row.appendChild(empty_cell);
68 var detail_cell = document.createElement('TD');
70 var detail_input = document.createElement('INPUT');
71 detail_input.setAttribute('name', 'detail'+rownum);
72 detail_input.setAttribute('id', 'detail'+rownum);
73 detail_input.setAttribute('size', 60);
74 detail_input.setAttribute('maxLength', 65);
75 detail_input.setAttribute('rownum', rownum);
76 detail_input.onkeyup = possiblyAddRow;
77 detail_input.onchange = possiblyAddRow;
78 detail_cell.appendChild(detail_input);
80 row.appendChild(detail_cell);
82 tablebody.appendChild(row);
94 my $curuser = $FS::CurrentUser::CurrentUser;
97 unless $curuser->access_right('Generate quotation');
99 $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'illegal pkgnum';
102 my $quotation_pkg = qsearchs({
103 'table' => 'quotation_pkg',
104 'addl_from' => 'LEFT JOIN quotation USING ( quotationnum )'.
105 'LEFT JOIN cust_main USING ( custnum )',
106 'hashref' => { 'quotationpkgnum' => $pkgnum },
107 'extra_sql' => ' AND '. $curuser->agentnums_sql,
110 my $part_pkg = $quotation_pkg->part_pkg;
112 my @details = $quotation_pkg->details;
114 my $title = ( scalar(@details) ? 'Edit ' : 'Add ' ). 'Quotation Details';