1 <& /elements/header-popup.html, {
2 'title' => $quotationnum ? mt('Add package to quotation')
3 : mt('Order new package'),
8 <& /elements/init_calendar.html &>
10 <SCRIPT TYPE="text/javascript" SRC="../elements/order_pkg.js"></SCRIPT>
12 <& /elements/error.html &>
14 <FORM NAME="OrderPkgForm" ACTION="<% $p %>edit/process/quick-cust_pkg.cgi" METHOD="POST">
16 <INPUT TYPE="hidden" NAME="custnum" VALUE="<% $cust_main ? $cust_main->custnum : '' %>">
17 <INPUT TYPE="hidden" NAME="prospectnum" VALUE="<% $prospect_main ? $prospect_main->prospectnum : '' %>">
18 <INPUT TYPE="hidden" NAME="qualnum" VALUE="<% scalar($cgi->param('qualnum')) |h %>">
19 <INPUT TYPE="hidden" NAME="quotationnum" VALUE="<% $quotationnum %>">
21 <INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $svcpart %>">
24 % my $num_sales = $agent->num_sales;
25 % my $conf_pkg_referral = $conf->exists('pkg_referral');
26 % my $show_sales = $num_sales && $conf_pkg_referral;
27 % my $show_sales_table = $num_sales || $conf_pkg_referral;
29 % if ( $show_sales ) {
30 <FONT CLASS="fsinnerbox-title"><% mt('Sales') |h %></FONT>
32 % if ( $show_sales_table ) {
33 <% ntable("#cccccc") %>
36 <& /elements/tr-select-sales.html,
37 'curr_value' => scalar($cgi->param('salesnum')),
38 'agentnum' => $agent->agentnum,
42 % if ( $conf->exists('pkg_referral') ) {
43 <& /elements/tr-select-part_referral.html,
44 'curr_value' => scalar( $cgi->param('refnum') ), #get rid of empty_label first# || $cust_main->refnum,
46 'multiple' => $conf->exists('pkg_referral-multiple'),
51 % if ( $show_sales_table ) {
55 <FONT CLASS="fsinnerbox-title"><% mt('Package') |h %></FONT>
56 <% ntable("#cccccc") %>
59 <INPUT TYPE="hidden" NAME="pkgpart" VALUE="<% $part_pkg->pkgpart %>">
61 <TH ALIGN="right"><% mt('Package') |h %></TH>
62 <TD COLSPAN=6><% $part_pkg->pkg_comment |h %></TD>
65 <& /elements/tr-select-cust-part_pkg.html,
66 'curr_value' => $pkgpart,
68 'cust_main' => $cust_main,
69 'prospect_main' => $prospect_main,
73 <& /elements/tr-input-pkg-quantity.html, curr_value => $quantity &>
75 % unless ( $quotationnum ) {
77 % if ( $cust_main && $cust_main->payby =~ /^(CARD|CHEK)$/ ) {
78 % my $what = lc(FS::payby->shortname($cust_main->payby));
80 <TH ALIGN="right"><% mt("Disable automatic $what charge") |h %> </TH>
81 <TD COLSPAN=6><INPUT TYPE="checkbox" NAME="no_auto" VALUE="Y"></TD>
86 <TH ALIGN="right"><% mt('Start') |h %> </TD>
88 <INPUT TYPE="radio" NAME="start" ID="start_now" VALUE="" <% $cgi->param('start') eq '' ? 'CHECKED' : ''%>>Now
90 <INPUT TYPE="radio" NAME="start" ID="start_on_hold" VALUE="on_hold" <% $cgi->param('start') eq 'on_hold' ? 'CHECKED' : ''%>>On hold
92 <INPUT TYPE="radio" NAME="start" ID="start_on_date" VALUE="on_date" <% $cgi->param('start') eq 'date' ? 'CHECKED' : ''%>>On date
94 <& /elements/input-date-field.html,{
95 'name' => 'start_date',
96 'format' => $date_format,
104 <TH ALIGN="right"><% mt('Contract end date') |h %> </TD>
106 <& /elements/input-date-field.html,{
107 'name' => 'contract_end',
108 'format' => $date_format,
119 <% include('/misc/cust_pkg_usageprice.html',
120 'pkgpart' => $pkgpart
124 % my $discount_cust_pkg = $curuser->access_right('Discount customer package');
125 % my $waive_setup_fee = $curuser->access_right('Waive setup fee');
127 % if ( $discount_cust_pkg || $waive_setup_fee ) {
128 <FONT CLASS="fsinnerbox-title"><% mt('Discounting') |h %></FONT>
129 <% ntable("#cccccc") %>
130 <& /elements/tr-select-pkg-discount.html &>
136 % my $lock_locationnum = scalar($cgi->param('lock_locationnum'));
137 % my $contact_title = $lock_locationnum ? 'Contact'
138 % : 'Contact and Location';
139 <FONT CLASS="fsinnerbox-title"><% mt($contact_title) |h %></FONT>
140 <% ntable("#cccccc") %>
142 <& /elements/tr-select-contact.html,
144 'cust_main' => $cust_main,
145 'prospect_main' => $prospect_main,
148 % if ( $cgi->param('lock_locationnum') ) {
150 <INPUT TYPE = "hidden"
153 VALUE = "<% scalar($cgi->param('lock_locationnum')) |h %>"
158 <& /elements/tr-select-cust_location.html,
160 'cust_main' => $cust_main,
161 'prospect_main' => $prospect_main,
168 % unless ( $cgi->param('lock_locationnum') ) {
170 <& /elements/standardize_locations.html,
171 'form' => "OrderPkgForm",
172 'callback' => 'document.OrderPkgForm.submit()',
174 'with_census_functions' => 1,
180 % my $onclick = $cgi->param('lock_locationnum')
181 % ? 'document.OrderPkgForm.submit()'
182 % : 'standardize_new_location()';
183 <INPUT NAME = "submitButton"
185 VALUE = "<% mt("Order Package") |h %>"
186 onClick = "this.disabled=true; <% $onclick %>;"
187 <% $pkgpart ? '' : 'DISABLED' %>
195 my $curuser = $FS::CurrentUser::CurrentUser;
198 unless $curuser->access_right('Order customer package');
200 my $conf = new FS::Conf;
201 my $date_format = $conf->config('date_format') || '%m/%d/%Y';
204 if ( $cgi->param('custnum') =~ /^(\d+)$/ ) {
206 $cust_main = qsearchs({
207 'table' => 'cust_main',
208 'hashref' => { 'custnum' => $custnum },
209 'extra_sql' => ' AND '. $curuser->agentnums_sql,
213 my $prospect_main = '';
214 if ( $cgi->param('prospectnum') =~ /^(\d+)$/ ) {
215 my $prospectnum = $1;
216 $prospect_main = qsearchs({
217 'table' => 'prospect_main',
218 'hashref' => { 'prospectnum' => $prospectnum },
219 'extra_sql' => ' AND '. $curuser->agentnums_sql,
223 my $quotationnum = '';
224 if ( $cgi->param('quotationnum') =~ /^(\d+)$/ ) {
228 die 'no custnum or prospectnum' unless $cust_main || $prospect_main;
230 my $agent = $cust_main ? $cust_main->agent
231 : $prospect_main->agent;
234 if ( $cgi->param('lock_pkgpart') ) {
235 $part_pkg = qsearchs({
236 'table' => 'part_pkg',
237 'hashref' => { 'pkgpart' => scalar($cgi->param('lock_pkgpart')) },
238 'extra_sql' => ' AND '. FS::part_pkg->agent_pkgs_sql($agent),
240 or die "unknown pkgpart ". $cgi->param('lock_pkgpart');
243 my $pkgpart = $part_pkg ? $part_pkg->pkgpart : scalar($cgi->param('pkgpart'));
246 if ( $cgi->param('quantity') =~ /^\s*(\d+)\s*$/ ) {
250 my $format = $date_format. ' %T %z (%Z)'; #false laziness w/REAL_cust_pkg.cgi?
252 my $svcpart = scalar($cgi->param('svcpart'));