show imported region and rate #s, RT#83146
[freeside.git] / httemplate / edit / quotation.html
1 <% include( 'elements/edit.html',
2                  'name'    => 'Quotation',
3                  'table'   => 'quotation',
4                  'menubar' => [],
5                  'html_table_class' => 'fsinnerbox', #default?
6                  'labels'  => { 
7                                 'quotationnum'          => 'Quotation number',
8                                 'prospectnum'           => 'Prospect',
9                                 'custnum'               => 'Customer',
10                                 '_date'                 => 'Date',
11                                 'close_date'            => 'Close Date',
12                                 'confidence'            => 'Confidence',
13                                 'quotation_description' => 'Description',
14                                 ($can_disable ? ('disabled'     => 'Disabled') : ()),
15                               },
16                  'fields'  => [
17                    { field=>'prospectnum',           type=>'fixed-prospect_main' },
18                    { field=>'custnum',               type=>'fixed-cust_main' },
19                    { field=>'_date',                 type=>'fixed-date' },
20                    { field=>'quotation_description', type=>'text', size=>50 },
21                    { field=>'close_date',            type=>'input-date-field' },
22                    { field=>'confidence',            type=>'text', size=>3, postfix=>'%' },
23                    ($can_disable ? { field=>'disabled', type=>'checkbox', value=>'Y'} : ()),
24                               ],
25                  #XXX some way to disable the "view all"
26                  'new_callback' => sub { my( $cgi, $quotation) = @_;
27                                          $quotation->$_( $cgi->param($_) )
28                                            foreach qw( prospectnum custnum );
29                                          $quotation->_date(time);
30                                        },
31                  'field_callback' => sub { my( $cgi, $quotation, $field_hashref ) = @_;
32                                          $quotation->close_date(($default_close_days * 86400) + time) if !$quotation->close_date && $default_close_days; 
33                                        },
34            )
35 %>
36 <%init>
37
38 die "access denied"
39   unless $FS::CurrentUser::CurrentUser->access_right('Generate quotation');
40
41 my $can_disable = $FS::CurrentUser::CurrentUser->access_right('Disable quotation');
42
43 my $conf = new FS::Conf;
44
45 my $default_close_days ||= $conf->config('quotation_disable_after_days');
46
47 </%init>