summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2014-04-27 14:21:22 -0700
committerIvan Kohler <ivan@freeside.biz>2014-04-27 14:21:22 -0700
commit729956733bf21293c801358c3e711c81d7df5b4f (patch)
tree6731dfbef39cdc6225026ec1c38b283887dc16dd /httemplate
parentdc54c9e83f5cc315e9e2823e61a9f861f842da48 (diff)
"on hold" package ordering and status, RT#28508
Diffstat (limited to 'httemplate')
-rwxr-xr-xhttemplate/browse/part_pkg.cgi15
-rw-r--r--httemplate/edit/process/quick-cust_pkg.cgi12
-rw-r--r--httemplate/elements/order_pkg.js19
-rwxr-xr-xhttemplate/misc/change_pkg.cgi2
-rw-r--r--httemplate/misc/order_pkg.html12
-rwxr-xr-xhttemplate/search/report_cust_pkg.html3
-rw-r--r--httemplate/view/cust_main/packages/status.html33
7 files changed, 70 insertions, 26 deletions
diff --git a/httemplate/browse/part_pkg.cgi b/httemplate/browse/part_pkg.cgi
index 8b50a509f..b84e066f2 100755
--- a/httemplate/browse/part_pkg.cgi
+++ b/httemplate/browse/part_pkg.cgi
@@ -128,9 +128,16 @@ $select = "
( $count_cust_pkg
AND ( cancel IS NULL OR cancel = 0 )
AND susp IS NOT NULL AND susp != 0
+ AND setup IS NOT NULL AND setup != 0
) AS num_suspended,
( $count_cust_pkg
+ AND ( cancel IS NULL OR cancel = 0 )
+ AND susp IS NOT NULL AND susp != 0
+ AND ( setup IS NULL OR setup = 0 )
+ ) AS num_on_hold,
+
+ ( $count_cust_pkg
AND cancel IS NOT NULL AND cancel != 0
) AS num_cancelled
@@ -368,6 +375,7 @@ if ( $acl_edit_global ) {
#if ( $cgi->param('active') ) {
push @header, 'Customer<BR>packages';
my %col = (
+ 'on hold' => '7E0079', #purple!
'not yet billed' => '009999', #teal? cyan?
'active' => '00CC00',
'suspended' => 'FF9900',
@@ -383,10 +391,11 @@ if ( $acl_edit_global ) {
my $label = $_;
if ( $magic eq 'active' && $part_pkg->freq == 0 ) {
$magic = 'inactive';
- #$label = 'one-time charge',
- $label = 'charge',
+ #$label = 'one-time charge';
+ $label = 'charge';
}
$label= 'not yet billed' if $magic eq 'not_yet_billed';
+ $label= 'on hold' if $magic eq 'on_hold';
[
{
@@ -411,7 +420,7 @@ if ( $acl_edit_global ) {
),
},
],
- } (qw( not_yet_billed active suspended cancelled ))
+ } (qw( on_hold not_yet_billed active suspended cancelled ))
),
($acl_config ?
[ {},
diff --git a/httemplate/edit/process/quick-cust_pkg.cgi b/httemplate/edit/process/quick-cust_pkg.cgi
index 7dcd232bc..38d5c4486 100644
--- a/httemplate/edit/process/quick-cust_pkg.cgi
+++ b/httemplate/edit/process/quick-cust_pkg.cgi
@@ -110,10 +110,6 @@ my $error = '';
my %hash = (
'pkgpart' => $pkgpart,
'quantity' => $quantity,
- 'start_date' => ( scalar($cgi->param('start_date'))
- ? parse_datetime($cgi->param('start_date'))
- : ''
- ),
'salesnum' => $salesnum,
'refnum' => $refnum,
'contactnum' => $contactnum,
@@ -133,6 +129,14 @@ my %hash = (
);
$hash{'custnum'} = $cust_main->custnum if $cust_main;
+if ( $cgi->param('start') eq 'on_hold' ) {
+ $hash{'susp'} = 'now';
+} elsif ( $cgi->param('start') eq 'on_date' ) {
+ $hash{'start_date'} = scalar($cgi->param('start_date'))
+ ? parse_datetime($cgi->param('start_date'))
+ : '';
+}
+
if ( $quotationnum ) {
$quotation_pkg = new FS::quotation_pkg \%hash;
diff --git a/httemplate/elements/order_pkg.js b/httemplate/elements/order_pkg.js
index 4e41fd64a..8cd0f5f2a 100644
--- a/httemplate/elements/order_pkg.js
+++ b/httemplate/elements/order_pkg.js
@@ -6,9 +6,12 @@ function pkg_changed () {
var opt = form.pkgpart.options[form.pkgpart.selectedIndex];
var date_button = document.getElementById('start_date_button');
- var date_button_disabled = document.getElementById('start_date_button_disabled');
+ var date_button_disabled = document.getElementById('start_date_disabled');
var date_text = document.getElementById('start_date_text');
+ var radio_now = document.getElementById('start_now');
+ //var radio_on_hold = document.getElementById('start_on_hold');
+ var radio_on_date = document.getElementById('start_on_date');
form.submitButton.disabled = false;
if ( discountnum ) {
@@ -32,11 +35,25 @@ function pkg_changed () {
date_text.disabled = false;
date_button.style.display = '';
date_button_disabled.style.display = 'none';
+ if ( radio_on_date ) {
+ radio_on_date.disabled = false;
+ if ( form.start_date_text.value.length > 0 && radio_now.checked ) {
+ radio_now.checked = false;
+ radio_on_date.checked = true;
+ }
+ }
} else {
date_text.style.backgroundColor = '#dddddd';
date_text.disabled = true;
date_button.style.display = 'none';
date_button_disabled.style.display = '';
+ if ( radio_on_date ) {
+ if ( radio_on_date.checked ) {
+ radio_on_date.checked = false;
+ radio_now.checked = true;
+ }
+ radio_on_date.disabled = true;
+ }
}
} else {
diff --git a/httemplate/misc/change_pkg.cgi b/httemplate/misc/change_pkg.cgi
index 5b4a3dea9..1b4a94e81 100755
--- a/httemplate/misc/change_pkg.cgi
+++ b/httemplate/misc/change_pkg.cgi
@@ -59,8 +59,6 @@
'name' => 'start_date',
'value' => ($cgi->param('start_date') || $cust_main->next_bill_date),
} &>
- <IMG SRC="<%$fsurl%>images/calendar-disabled.png" \
- ID="start_date_button_disabled" STYLE="display:none">
</TD>
</TR>
</TABLE>
diff --git a/httemplate/misc/order_pkg.html b/httemplate/misc/order_pkg.html
index b06f9622c..d777e17da 100644
--- a/httemplate/misc/order_pkg.html
+++ b/httemplate/misc/order_pkg.html
@@ -84,18 +84,20 @@
% }
<TR>
- <TH ALIGN="right"><% mt('Start date') |h %> </TD>
+ <TH ALIGN="right"><% mt('Start') |h %> </TD>
<TD COLSPAN=6>
+ <INPUT TYPE="radio" NAME="start" ID="start_now" VALUE="" <% $cgi->param('start') eq '' ? 'CHECKED' : ''%>>Now
+ &emsp;
+ <INPUT TYPE="radio" NAME="start" ID="start_on_hold" VALUE="on_hold" <% $cgi->param('start') eq 'on_hold' ? 'CHECKED' : ''%>>On hold
+ &emsp;
+ <INPUT TYPE="radio" NAME="start" ID="start_on_date" VALUE="on_date" <% $cgi->param('start') eq 'date' ? 'CHECKED' : ''%>>On date
+
<& /elements/input-date-field.html,{
'name' => 'start_date',
'format' => $date_format,
'value' => '',
'noinit' => 1,
} &>
- <IMG SRC = "<%$fsurl%>images/calendar-disabled.png"
- ID = "start_date_button_disabled"
- STYLE = "display:none">
- <FONT SIZE=-1>(<% mt('leave blank to start immediately') |h %>)</FONT>
</TD>
</TR>
diff --git a/httemplate/search/report_cust_pkg.html b/httemplate/search/report_cust_pkg.html
index e75a0985b..f124f0f87 100755
--- a/httemplate/search/report_cust_pkg.html
+++ b/httemplate/search/report_cust_pkg.html
@@ -260,7 +260,8 @@ my @date_fields = keys %label;
#false laziness w/cust_pkg.cgi
my %disable = (
'all' => {},
- 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, },
+ 'on hold' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'expire'=>1, 'cancel'=>1, 'dundate'=> 1, },
+ 'not yet billed' => { 'setup'=>1, 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'dundate'=>1, },
'one-time charge' => { 'last_bill'=>1, 'bill'=>1, 'adjourn'=>1, 'susp'=>1, 'expire'=>1, 'cancel'=>1, 'contract_end'=>1, 'dundate'=>1, },
'active' => { 'susp'=>1, 'cancel'=>1 },
'suspended' => { 'cancel'=>1, 'dundate'=>1, },
diff --git a/httemplate/view/cust_main/packages/status.html b/httemplate/view/cust_main/packages/status.html
index 70b623c0f..b58f1f3e6 100644
--- a/httemplate/view/cust_main/packages/status.html
+++ b/httemplate/view/cust_main/packages/status.html
@@ -46,21 +46,30 @@
%
% } else {
%
-% if ( $cust_pkg->get('susp') ) { #status: suspended
-% my $cpr = $cust_pkg->last_cust_pkg_reason('susp');
+% if ( $cust_pkg->get('susp') ) { #suspended or on hold
+%
+% if ( $cust_pkg->order_date eq $cust_pkg->get('susp') ) { #status: on hold
+
+ <% pkg_status_row( $cust_pkg, emt('On Hold'), '', 'color'=>'7E0079', %opt ) %>
- <% pkg_status_row( $cust_pkg, emt('Suspended'), 'susp', 'color'=>'FF9900', %opt ) %>
+% } else { #status: suspended
- <% pkg_reason_row( $cust_pkg, $cpr, 'color' => 'FF9900', %opt ) %>
+ <% pkg_status_row( $cust_pkg, emt('Suspended'), 'susp', 'color'=>'FF9900', %opt ) %>
+% my $cpr = $cust_pkg->last_cust_pkg_reason('susp');
+ <% pkg_reason_row( $cust_pkg, $cpr, 'color' => 'FF9900', %opt ) %>
+
+% }
<% pkg_status_row_noauto( $cust_pkg, %opt ) %>
<% pkg_status_row_discount( $cust_pkg, %opt ) %>
-% unless ( $cust_pkg->get('setup') ) {
- <% pkg_status_row_colspan( $cust_pkg, emt('Never billed'), '', %opt ) %>
-% } else {
- <% pkg_status_row($cust_pkg, emt('Setup'), 'setup', %opt ) %>
+% unless ( $cust_pkg->order_date eq $cust_pkg->get('susp') ) { #on hold
+% unless ( $cust_pkg->get('setup') ) {
+ <% pkg_status_row_colspan( $cust_pkg, emt('Never billed'), '', %opt ) %>
+% } else {
+ <% pkg_status_row($cust_pkg, emt('Setup'), 'setup', %opt ) %>
+% }
% }
<% pkg_status_row_if($cust_pkg, emt('Un-cancelled'), 'uncancel', %opt ) %>
@@ -93,8 +102,12 @@
% }
% }
% if ( $curuser->access_right('Unsuspend customer package') ) {
- (&nbsp;<% pkg_unsuspend_link($cust_pkg) %>&nbsp;)
- (&nbsp;<% pkg_resume_link($cust_pkg) %>&nbsp;)
+% if ( $cust_pkg->order_date eq $cust_pkg->get('susp') ) { #on hold
+ (&nbsp;<% pkg_link('misc/unsusp_pkg', emt('Start bililng now'), $cust_pkg) %>&nbsp;)
+% } else {
+ (&nbsp;<% pkg_unsuspend_link($cust_pkg) %>&nbsp;)
+ (&nbsp;<% pkg_resume_link($cust_pkg) %>&nbsp;)
+% }
% }
% if ( !$cust_pkg->change_to_pkgnum and
% $curuser->access_right('Cancel customer package immediately')