projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d01937e
)
rework suspension delays, RT#6956
author
ivan
<ivan>
Thu, 16 Jun 2011 23:06:20 +0000
(23:06 +0000)
committer
ivan
<ivan>
Thu, 16 Jun 2011 23:06:20 +0000
(23:06 +0000)
FS/FS/Schema.pm
patch
|
blob
|
history
FS/FS/cust_pkg.pm
patch
|
blob
|
history
FS/FS/part_event/Condition/pkg_dundate.pm
[new file with mode: 0644]
patch
|
blob
httemplate/misc/delay_susp_pkg.html
patch
|
blob
|
history
httemplate/misc/process/delay_susp_pkg.html
patch
|
blob
|
history
httemplate/view/cust_main/packages/status.html
patch
|
blob
|
history
diff --git
a/FS/FS/Schema.pm
b/FS/FS/Schema.pm
index
25912a2
..
9dc5dc6
100644
(file)
--- a/
FS/FS/Schema.pm
+++ b/
FS/FS/Schema.pm
@@
-1436,6
+1436,7
@@
sub tables_hashref {
'cancel', @date_type, '', '',
'expire', @date_type, '', '',
'contract_end', @date_type, '', '',
'cancel', @date_type, '', '',
'expire', @date_type, '', '',
'contract_end', @date_type, '', '',
+ 'dundate', @date_type, '', '',
'change_date', @date_type, '', '',
'change_pkgnum', 'int', 'NULL', '', '', '',
'change_pkgpart', 'int', 'NULL', '', '', '',
'change_date', @date_type, '', '',
'change_pkgnum', 'int', 'NULL', '', '', '',
'change_pkgpart', 'int', 'NULL', '', '', '',
diff --git
a/FS/FS/cust_pkg.pm
b/FS/FS/cust_pkg.pm
index
deb1cf1
..
872a644
100644
(file)
--- a/
FS/FS/cust_pkg.pm
+++ b/
FS/FS/cust_pkg.pm
@@
-596,6
+596,7
@@
sub check {
|| $self->ut_numbern('cancel')
|| $self->ut_numbern('adjourn')
|| $self->ut_numbern('expire')
|| $self->ut_numbern('cancel')
|| $self->ut_numbern('adjourn')
|| $self->ut_numbern('expire')
+ || $self->ut_numbern('dundate')
|| $self->ut_enum('no_auto', [ '', 'Y' ])
|| $self->ut_enum('waive_setup', [ '', 'Y' ])
|| $self->ut_numbern('agent_pkgid')
|| $self->ut_enum('no_auto', [ '', 'Y' ])
|| $self->ut_enum('waive_setup', [ '', 'Y' ])
|| $self->ut_numbern('agent_pkgid')
diff --git a/FS/FS/part_event/Condition/pkg_dundate.pm
b/FS/FS/part_event/Condition/pkg_dundate.pm
new file mode 100644
(file)
index 0000000..
08b4e0a
--- /dev/null
+++ b/
FS/FS/part_event/Condition/pkg_dundate.pm
@@ -0,0
+1,32
@@
+package FS::part_event::Condition::pkg_dundate;
+use base qw( FS::part_event::Condition );
+
+use strict;
+
+sub description {
+ "Skip until package suspension delay date";
+}
+
+sub eventtable_hashref {
+ { 'cust_main' => 0,
+ 'cust_bill' => 0,
+ 'cust_pkg' => 1,
+ };
+}
+
+sub condition {
+ my($self, $cust_pkg, %opt) = @_;
+
+ #my $cust_main = $self->cust_main($cust_pkg);
+
+ $cust_pkg->dundate <= $opt{time};
+
+}
+
+#sub condition_sql {
+# my( $self, $table ) = @_;
+#
+# 'true';
+#}
+
+1;
diff --git
a/httemplate/misc/delay_susp_pkg.html
b/httemplate/misc/delay_susp_pkg.html
index
8adc40d
..
e5f1d8c
100755
(executable)
--- a/
httemplate/misc/delay_susp_pkg.html
+++ b/
httemplate/misc/delay_susp_pkg.html
@@
-68,6
+68,10
@@
my $title = 'Delay Suspension of Package';
my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum})
or die "Unknown pkgnum: $pkgnum";
my $cust_pkg = qsearchs('cust_pkg', {'pkgnum' => $pkgnum})
or die "Unknown pkgnum: $pkgnum";
+$date = time2str($date_format, $cust_pkg->dundate)
+ if $cust_pkg->dundate
+ && ! $cgi->param('error');
+
my $part_pkg = $cust_pkg->part_pkg;
</%init>
my $part_pkg = $cust_pkg->part_pkg;
</%init>
diff --git
a/httemplate/misc/process/delay_susp_pkg.html
b/httemplate/misc/process/delay_susp_pkg.html
index
8649cc2
..
675da04
100755
(executable)
--- a/
httemplate/misc/process/delay_susp_pkg.html
+++ b/
httemplate/misc/process/delay_susp_pkg.html
@@
-1,4
+1,4
@@
-<% header(
"Package suspension delayed"
) %>
+<% header(
$msg
) %>
<SCRIPT TYPE="text/javascript">
window.top.location.reload();
</SCRIPT>
<SCRIPT TYPE="text/javascript">
window.top.location.reload();
</SCRIPT>
@@
-21,21
+21,27
@@
$cgi->param('pkgnum') =~ /^(\d+)$/ or die "Illegal pkgnum";
$pkgnum = $1;
#untaint date
$pkgnum = $1;
#untaint date
-parse_datetime($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date";
-my $date = $1;
+my $date = '';
+my $msg = '';
+if ( $cgi->param('date') ) {
+ parse_datetime($cgi->param('date')) =~ /^(\d+)$/ or die "Illegal date";
+ $date = $1;
+ $msg = 'Package suspension delayed';
+} else {
+ $msg = 'Suspension delay removed';
+}
$cust_pkg = qsearchs( 'cust_pkg', {'pkgnum'=>$pkgnum} );
if ($cust_pkg) {
$cust_pkg = qsearchs( 'cust_pkg', {'pkgnum'=>$pkgnum} );
if ($cust_pkg) {
- $cust_main = $cust_pkg->cust_main;
- $cust_main->dundate( $date );
- $error = $cust_main->replace;
+ $cust_pkg->dundate( $date );
+ $error = $cust_pkg->replace;
} else {
} else {
- $error = "
Invalid
pkgnum";
+ $error = "
Unknown
pkgnum";
}
if ($error) {
$cgi->param('error', $error);
}
if ($error) {
$cgi->param('error', $error);
- print $cgi->redirect(popurl(2). "
cancel
_pkg.html?". $cgi->query_string );
+ print $cgi->redirect(popurl(2). "
delay_susp
_pkg.html?". $cgi->query_string );
}
</%init>
}
</%init>
diff --git
a/httemplate/view/cust_main/packages/status.html
b/httemplate/view/cust_main/packages/status.html
index
4492dad
..
537554e
100644
(file)
--- a/
httemplate/view/cust_main/packages/status.html
+++ b/
httemplate/view/cust_main/packages/status.html
@@
-172,6
+172,7
@@
<% pkg_status_row_if( $cust_pkg, $last_bill_or_renewed, 'last_bill', %opt, curuser=>$curuser ) %>
<% pkg_status_row_if( $cust_pkg, $next_bill_or_prepaid_until, 'bill', %opt, curuser=>$curuser ) %>
<% pkg_status_row_if($cust_pkg, emt('Will automatically suspend by'), 'autosuspend', %opt) %>
<% pkg_status_row_if( $cust_pkg, $last_bill_or_renewed, 'last_bill', %opt, curuser=>$curuser ) %>
<% pkg_status_row_if( $cust_pkg, $next_bill_or_prepaid_until, 'bill', %opt, curuser=>$curuser ) %>
<% pkg_status_row_if($cust_pkg, emt('Will automatically suspend by'), 'autosuspend', %opt) %>
+ <% pkg_status_row_if($cust_pkg, emt('Automatic suspension delayed until'), 'dundate', %opt) %>
<% pkg_status_row_if( $cust_pkg, emt('Will suspend on'), 'adjourn', %opt, curuser=>$curuser ) %>
<% pkg_status_row_if( $cust_pkg, emt('Expires'), 'expire', %opt, curuser=>$curuser ) %>
<% pkg_status_row_if( $cust_pkg, emt('Contract ends'), 'contract_end', %opt ) %>
<% pkg_status_row_if( $cust_pkg, emt('Will suspend on'), 'adjourn', %opt, curuser=>$curuser ) %>
<% pkg_status_row_if( $cust_pkg, emt('Expires'), 'expire', %opt, curuser=>$curuser ) %>
<% pkg_status_row_if( $cust_pkg, emt('Contract ends'), 'contract_end', %opt ) %>
@@
-422,11
+423,15
@@
sub pkg_adjourn_link {
}
sub pkg_delay_link {
}
sub pkg_delay_link {
+ my($cust_pkg) = shift;
include( '/elements/popup_link-cust_pkg.html',
'action' => $p. 'misc/delay_susp_pkg.html',
include( '/elements/popup_link-cust_pkg.html',
'action' => $p. 'misc/delay_susp_pkg.html',
- 'label' => emt('Delay suspend'),
+ 'label' => ( $cust_pkg->dundate
+ ? emt('Edit suspension delay')
+ : emt('Delay suspend')
+ ),
'actionlabel' => emt('Delay suspend for'),
'actionlabel' => emt('Delay suspend for'),
- 'cust_pkg' =>
shift
,
+ 'cust_pkg' =>
$cust_pkg
,
)
}
)
}