disable quotation after ordering, #33852
[freeside.git] / httemplate / view / cust_main / packages / section.html
1 % if ( @$packages ) { 
2 <TR>
3 % #my $width = $show_location ? 'WIDTH="25%"' : 'WIDTH="33%"';
4   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Package') |h %></TH>
5   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Status') |h %></TH>
6   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Contact/Location') |h %></TH>
7 % if (!$opt{no_services}) {
8   <TH CLASS="grid" BGCOLOR="#cccccc"><% mt('Services') |h %></TH>
9 % }
10 </TR>
11
12 % #$FS::cust_pkg::DEBUG = 2;
13 %   foreach my $cust_pkg (@$packages) {
14 %    # if requested, this can override cust_pkg-group_by_location
15     <& .packagerow, $cust_pkg,
16         %conf_opt,
17         ( map { $_ => $opt{$_} } qw(
18             cust_main bgcolor no_links cust_location_cache
19             before_pkg_callback before_svc_callback after_svc_callback
20             cust_pkg-group_by_location
21             no_services
22         )),
23     &>
24 %   }
25 % } else { # there are no packages
26 <BR>
27 % }
28 <%def .packagerow>
29 %
30 % my ($cust_pkg, %iopt) = @_;
31 % $iopt{'cust_pkg'} = $cust_pkg;
32 % $iopt{'part_pkg'} = $cust_pkg->part_pkg;
33   <!--pkgnum: <% $cust_pkg->pkgnum %>-->
34   <TR CLASS="row<%$row % 2%>">
35     <& package.html, %iopt &>
36     <& status.html,  %iopt &>
37     <TD CLASS="inv" BGCOLOR="<% $iopt{bgcolor} %>" WIDTH="20%" VALIGN="top">
38       <& contact.html, %iopt &>
39       <& location.html, %iopt &>
40     </TD>
41 %   if (!$iopt{no_services}) {
42     <& services.html, %iopt &>
43 %   }
44   </TR>
45 % # insert hidden predecessors to this package, if any
46 % # and a rolldown button to show them
47 % # (we'll make it do something later)
48 % if ( $cust_pkg->get('changed_from_pkg') ) {
49   <TR CLASS="row<% $row % 2 %>">
50     <TD COLSPAN=4>
51     <BUTTON CLASS="rolldown_button"
52             ID="rolldown_<% $cust_pkg->change_pkgnum %>">
53       History &#x2b07;
54     </BUTTON>
55 % # the hidden block here has ID="cust_pkgX" where X is the first pkgnum
56 % # it contains.
57     <& hidden.html, $cust_pkg->get('changed_from_pkg'),
58        %iopt,
59        'next_pkg' => $cust_pkg,
60     &>
61     </TD>
62   </TR>
63 % }
64 % $row++;
65 % # show the change target, if there is one
66 % if ( $cust_pkg->change_to_pkg ) {
67     <& .packagerow, $cust_pkg->change_to_pkg, %iopt, 'change_from' => 1 &>
68 % }
69 % # include supplemental packages if any
70 % $iopt{'supplemental'} = ($iopt{'supplemental'} || 0) + 1;
71 % foreach my $supp_pkg ($cust_pkg->supplemental_pkgs) {
72     <& .packagerow, $supp_pkg, %iopt &>
73 % }
74 </%def>
75 <%shared>
76 my $row = 0;
77 </%shared>
78 <%init>
79
80 my %opt = @_;
81 my $conf = new FS::Conf;
82
83 my $curuser = $FS::CurrentUser::CurrentUser;
84
85 my $packages = $opt{'packages'};
86
87 # Sort order is hardcoded for now, can change this if needed.
88 @$packages = sort { 
89   ( $a->getfield('cancel') <=> $b->getfield('cancel') )  or
90   ( $a->getfield('setup')  <=> $b->getfield('setup')  )  or
91   ( $a->getfield('pkgnum') <=> $b->getfield('pkgnum') )
92 } @$packages;
93
94 my %change_custnum = map { $_->change_custnum => 1 }
95                        grep { $_->change_custnum }
96                          grep { $_->getfield('cancel') }
97                            @$packages;
98
99 my $pkg_attached = ( scalar(keys %change_custnum) == 1
100                        && ! grep { ! $_->getfield('cancel') } @$packages
101                    );
102
103 my $countrydefault = scalar($conf->config('countrydefault')) || 'US';  
104
105 my %conf_opt = (
106   #for package.html
107   'invoice-unitprice'         => $conf->exists('invoice-unitprice'),
108   'show_pkgnum'               => $curuser->option('show_pkgnum'),
109   'part_pkg-term_discounts'   => $conf->exists('part_pkg-term_discounts'),
110
111   #for services.html and status.html
112   'cust_pkg-display_times'    => ($conf->exists('cust_pkg-display_times')
113                                  || $curuser->option('cust_pkg-display_times')),
114   #for status.html
115   'cust_pkg-show_autosuspend' => $conf->exists('cust_pkg-show_autosuspend'),
116   'pkg_attached'              => $pkg_attached,
117   #for status.html pkg-balances
118   'pkg-balances'              => $conf->exists('pkg-balances'),
119   'money_char'                => ( $conf->config('money_char') || '$' ),
120
121   #for location.html
122   'countrydefault'            => $countrydefault,
123   'statedefault'              => ( scalar($conf->config('statedefault'))
124                                   || ($countrydefault eq 'US' ? 'CA' : '') ),
125   'cust_pkg-group_by_location'=> $conf->exists('cust_pkg-group_by_location'),
126   'cust_main-require_censustract'=> $conf->exists('cust_main-require_censustract'),
127   'company_address'           => [ $conf->config('company_address', $opt{cust_main}->agentnum ) ],
128   
129   #for services.html
130   'svc_external-skip_manual'  => $conf->exists('svc_external-skip_manual'),
131   'svc_phone-bulk_provision_simple' => $conf->exists('svc_phone-bulk_provision_simple'),
132   'legacy_link'               => $conf->exists('legacy_link'),
133   'manage_link'               => scalar($conf->config('svc_broadband-manage_link')),
134   'manage_link_text'          => scalar($conf->config('svc_broadband-manage_link_text')),
135   'manage_link_loc'           => scalar($conf->config('svc_broadband-manage_link_loc')),
136   'manage_link-new_window'    => $conf->exists('svc_broadband-manage_link-new_window'),
137   'cust_pkg-large_pkg_size'   => scalar($conf->config('cust_pkg-large_pkg_size')),
138   'cust_pkg-hide_discontinued-part_svc' => $conf->exists('cust_pkg-hide_discontinued-part_svc'),
139
140 );
141
142 </%init>