disable quotations, RT#20688, RT#22232
[freeside.git] / httemplate / view / quotation.html
1 <& /elements/header.html, mt('Quotation View'), $menubar &>
2
3 <SCRIPT TYPE="text/javascript">
4 function areyousure(href, message) {
5   if (confirm(message) == true)
6     window.location.href = href;
7 }
8 </SCRIPT>
9
10 % unless ( $quotation->disabled eq 'Y' ) {
11
12 %   if ( $curuser->access_right('Order customer package') ) {
13       <& /elements/order_pkg_link.html,
14            'label'       => emt('Add package'),
15            'actionlabel' => emt('Add package'),
16            map { $_ => $quotation->$_ } qw( quotationnum custnum prospectnum )
17       &>
18       <BR><BR>
19 %   }
20
21 %   if ( 1 ) { #if ( $curuser->access_right('Send quotations') )
22
23 %     #if ( grep { $_ ne 'POST' } $cust_bill->cust_main->invoicing_list ) { 
24 %#      <A HREF="<% $p %>misc/email-quotation.html?<% $link %>"><% mt('Email this quotation') |h %></A>
25 %     #} 
26
27 %#      <A HREF="<% $p %>misc/send-invoice.cgi?method=print;<% $link %>"><% mt('Re-print this invoice') |h %></A>
28
29 %#%     if ( $conf->exists('hylafax') && length($cust_bill->cust_main->fax) ) { 
30 %#           | <A HREF="<% $p %>misc/send-invoice.cgi?method=fax;<% $link %>"><% mt('Re-fax this invoice') |h %></A>
31 %#%     } 
32
33 %   }
34
35 %   if ( $conf->exists('quotation_latex') ) { 
36       | <A HREF="<% $p %>view/quotation-pdf.cgi?<% $link %>"><% mt('View typeset quotation PDF') |h %></A>
37 %   }
38
39     <BR><BR>
40
41 %   if ( $curuser->access_right('New customer') && $quotation->quotation_pkg ) {
42       <A HREF="<%$p%>edit/process/quotation_convert.html?quotationnum=<% $quotation->quotationnum %>">Place order</A>
43       <BR><BR>
44 %   }
45
46 % }
47
48 % if ( $curuser->access_right('Disable quotation') ) {
49 %   if ( $quotation->disabled eq 'Y' ) {
50       <A HREF="<%$p%>misc/enable-quotation.html?quotationnum=<% $quotation->quotationnum %>" TITLE="<% emt('Enable this quotation') %>"><% emt('Enable this quotation') %></A>
51 %   } else {
52       <% areyousure_link(
53            "${p}misc/disable-quotation.html?quotationnum=". $quotation->quotationnum,
54            emt('Are you sure you want to disable this quotation?'),
55            emt('Disable this quotation'), #tooltip
56            emt('Disable this quotation'), #link
57       ) %>
58 %   }
59   <BR><BR>
60 % }
61
62
63 % if ( $conf->exists('quotation_html') ) { 
64     <% join('', $quotation->print_html( preref_callback=>$preref_callback )) %>
65 % } else { 
66 %   die "quotation_html config missing";
67 % }
68 % #plaintext quotations? <PRE><% join('', $quotation->print_text() ) %></PRE>
69
70 <& /elements/footer.html &>
71 <%init>
72
73 my $curuser = $FS::CurrentUser::CurrentUser;
74
75 #die "access denied"
76 #  unless $curuser->access_right('View quotations');
77
78 my $quotationnum;
79 my($query) = $cgi->keywords;
80 if ( $query =~ /^(\d+)$/ ) {
81   $quotationnum = $1;
82 } else {
83   $quotationnum = $cgi->param('quotationnum');
84 }
85
86 my $conf = new FS::Conf;
87
88 my $quotation = qsearchs({
89   'select'    => 'quotation.*',
90   'table'     => 'quotation',
91   #'addl_from' => 'LEFT JOIN cust_main USING ( custnum )',
92   'hashref'   => { 'quotationnum' => $quotationnum },
93   #'extra_sql' => ' AND '. $curuser->agentnums_sql,
94 });
95 die "Quotation #$quotationnum not found!" unless $quotation;
96
97 my $menubar = menubar( $quotation->cust_or_prospect_label_link($p) );
98
99 my $link = "quotationnum=$quotationnum";
100 #$link .= ';template='. uri_escape($template) if $template;
101 #$link .= ';notice_name='. $notice_name if $notice_name;
102
103 my $preref_callback = sub {
104   areyousure_link("${p}misc/delete-quotation_pkg.html?". shift->quotationpkgnum,
105                   emt('Are you sure you want to remove this package from the quotation?'),
106                   emt('Remove this package'), #tooltip
107                   qq(<img src="${p}images/cross.png">), #link
108                  );
109 };
110
111 sub areyousure_link {
112     my ($url,$msg,$title,$label) = (shift,shift,shift,shift);
113     '<A HREF="javascript:areyousure(\''.$url.'\',\''.$msg.'\')" TITLE="'.$title.'">'.$label.'</A>';
114 }
115
116 </%init>