<& /elements/header-popup.html, $title &> <FORM ACTION="process/quotation_pkg_detail.html" NAME="DetailForm" ID="DetailForm" METHOD="POST"> <INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $pkgnum %>"> <TABLE ID="DetailTable" BGCOLOR="#cccccc" BORDER=0 CELLSPACING=1 STYLE="background-color: #cccccc"> <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></TD> <TD> <SELECT NAME="copy_on_order"> <OPTION VALUE=""<% $copy_on_order ? '' : ' SELECTED' %>> <% emt('Details will only appear on quotation') %> </OPTION> <OPTION VALUE="Y"<% $copy_on_order ? ' SELECTED' : '' %>> <% emt('Copy details to invoice when placing order') %> </OPTION> </SELECT> </TD> </TR> <& elements/detail-table.html, id => 'DetailTable', details => \@details, label => 'Details', &> </TABLE> <BR> <INPUT TYPE="submit" ID="submit" NAME="submit" VALUE="<% $title %>"> </FORM> </BODY> </HTML> <%init> my $curuser = $FS::CurrentUser::CurrentUser; die "access denied" unless $curuser->access_right('Generate quotation'); $cgi->param('pkgnum') =~ /^(\d+)$/ or die 'illegal pkgnum'; my $pkgnum = $1; my $quotation_pkg = qsearchs({ 'table' => 'quotation_pkg', 'addl_from' => 'LEFT JOIN quotation USING ( quotationnum )'. 'LEFT JOIN cust_main USING ( custnum )', 'hashref' => { 'quotationpkgnum' => $pkgnum }, 'extra_sql' => ' AND '. $curuser->agentnums_sql, }) || qsearchs({ 'table' => 'quotation_pkg', 'addl_from' => 'LEFT JOIN quotation USING ( quotationnum )'. 'LEFT JOIN prospect_main USING ( prospectnum )', 'hashref' => { 'quotationpkgnum' => $pkgnum }, 'extra_sql' => ' AND '. $curuser->agentnums_sql, }); my $part_pkg = $quotation_pkg->part_pkg; my @details = $quotation_pkg->details; my $copy_on_order = 0; if (@details) { # currently, they should either all have this flag, or none # but just in case, erring on the side of not copying to invoice # unless every existing detail has copy_on_order # (anyway, user has to submit change, this is just for autofill) my @quotation_pkg_detail = $quotation_pkg->quotation_pkg_detail; my @copy_on_order = grep { $_->copy_on_order } @quotation_pkg_detail; $copy_on_order = 1 if @copy_on_order; my @no_copy_on_order = grep { !$_->copy_on_order } @quotation_pkg_detail; $copy_on_order = 0 if @no_copy_on_order; } my $title = ( scalar(@details) ? 'Edit ' : 'Add ' ). 'Quotation Details'; </%init>