blob: b836baebc2fa85e5fe24c50e4f0c96da33c7f55d (
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
|
% if ( $error ) {
<% header('Error') %>
<FONT COLOR="#ff0000"><B><% $error |h %></B></FONT><BR><BR>
<CENTER><INPUT TYPE="BUTTON" VALUE="OK" onClick="parent.cClick()"></CENTER>
</BODY></HTML>
% } else {
<% header($action) %>
<SCRIPT TYPE="text/javascript">
window.top.location.reload();
</SCRIPT>
</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 @orig_details = $quotation_pkg->details();
my $action = 'Quotation details'.
( scalar(@orig_details) ? ' changed ' : ' added ' );
my $param = $cgi->Vars;
my @details = ();
for ( my $row = 0; exists($param->{"detail$row"}); $row++ ) {
push @details, $param->{"detail$row"}
if $param->{"detail$row"} =~ /\S/;
}
my $error = $quotation_pkg->set_details(
details => \@details,
copy_on_order => scalar($cgi->param('copy_on_order')) ? 'Y' : ''
);
</%init>
|