[freeside-commits] branch FREESIDE_3_BRANCH updated. 6070ba9748b0ec74276cb13abd1ba90bd68d1d21
Ivan
ivan at 420.am
Thu May 11 15:48:28 PDT 2017
The branch, FREESIDE_3_BRANCH has been updated
via 6070ba9748b0ec74276cb13abd1ba90bd68d1d21 (commit)
from b01ab86a3b25fa9c89aa2afd91646c59505318a4 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 6070ba9748b0ec74276cb13abd1ba90bd68d1d21
Author: Ivan Kohler <ivan at freeside.biz>
Date: Thu May 11 15:48:27 2017 -0700
test billing events, RT#73949
diff --git a/httemplate/browse/part_event.html b/httemplate/browse/part_event.html
index d2e6946..793fd52 100644
--- a/httemplate/browse/part_event.html
+++ b/httemplate/browse/part_event.html
@@ -10,7 +10,7 @@
'query' => { 'select' => 'part_event.*',
'table' => 'part_event',
'addl_from' => $join_conditions,
- 'hashref' => {},
+ 'hashref' => $hashref,
'order_by' => $order_conditions,
},
'count_query' => $count_query,
@@ -78,14 +78,39 @@ my $conditions_sub = sub {
my $part_event = shift;
my $addl = 0;
+
[
map {
my $part_event_condition = $_;
my %options = $part_event_condition->options;
+ my $desc = $part_event_condition->description;
+
+ if ( $cgi->param('test_eventtable_num') =~ /^(\d+)$/ ) {
+
+ my $tablenum = $1;
+
+ if ( $cgi->param('eventtable') =~ /^(cust_main|cust_pkg|cust_bill)$/ ) {
+ my $eventtable = "FS::$1";
+ my $object = $eventtable->by_key($tablenum);
+
+ my $cust_event = $part_event->new_cust_event($object);
+
+ my $test = $part_event_condition->condition(
+ $object,
+ 'cust_event' => $cust_event,
+ );
+
+ my $yesno = $test ? '(<FONT COLOR="#00ff00">yes</FONT>)'
+ : '(<FONT COLOR="#ff0000">no</FONT>)';
+
+ $desc .= " $yesno";
+ }
+ }
+
[
{
- 'data' => $part_event_condition->description,
+ 'data' => $desc,
'width' => '100%',
'align' => 'center',
'colspan' => 2,
@@ -166,6 +191,7 @@ die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Edit billing events')
|| $FS::CurrentUser::CurrentUser->access_right('Edit global billing events');
+
my $html_init =
#XXX better description
'Events are billing, collection or other actions triggered when certain '.
@@ -183,13 +209,25 @@ foreach my $part_event ( qsearch('part_event', {'disabled'=>''}) ) {
$html_init .= '</SELECT><INPUT TYPE="submit" VALUE="Clone existing event">'.
'</FORM><BR>';
-
+
+my $hashref = {};
+
my $count_query = 'SELECT COUNT(*) FROM part_event WHERE '.
$FS::CurrentUser::CurrentUser->agentnums_sql(
'null_right' => 'Edit global billing events',
'viewall_right' => 'None',
);
+if ( $cgi->param('eventtable') =~ /^(\w+)$/ ) {
+ $hashref->{eventtable} = $1;
+ $count_query .= " AND eventtable = '$1' ";
+}
+
+my $tablenum = '';
+if ( $cgi->param('test_eventtable_num') =~ /^(\d+)$/ ) {
+ $tablenum = $1;
+}
+
my $join_conditions = FS::part_event_condition->join_conditions_sql('', 'time' => time);
my $order_conditions = FS::part_event_condition->order_conditions_sql;
diff --git a/httemplate/misc/test-part_event.html b/httemplate/misc/test-part_event.html
new file mode 100644
index 0000000..e2d9d45
--- /dev/null
+++ b/httemplate/misc/test-part_event.html
@@ -0,0 +1,48 @@
+<& /elements/header.html, {
+ 'title_noescape' => 'Test billing events for '. encode_entities($cust_main->name),
+ }
+&>
+
+<A HREF="<%$p%>browse/part_event.html?eventtable=cust_main;test_eventtable_num=<% $custnum %>">Customer events<A>
+<BR><BR>
+<FORM METHOD="GET" ACTION="<%$p%>browse/part_event.html">
+Package events for
+<INPUT TYPE="hidden" NAME="eventtable" VALUE="cust_pkg">
+<& /elements/select-table.html,
+ 'table' => 'cust_pkg',
+ 'name_col' => 'pkg_label_long',
+ 'hashref' => { 'custnum' => $custnum, },
+ 'order_by' => 'ORDER BY pkgnum',
+ 'element_name' => 'test_eventtable_num',
+ 'disable_empty' => 1,
+&>
+<INPUT TYPE="submit" VALUE="Test package">
+</FORM>
+<BR>
+<FORM METHOD="GET" ACTION="<%$p%>browse/part_event.html">
+Invoice events for
+<INPUT TYPE="hidden" NAME="eventtable" VALUE="cust_bill">
+<& /elements/select-table.html,
+ 'table' => 'cust_bill',
+ 'name_col' => 'invnum',
+ 'hashref' => { 'custnum' => $custnum, },
+ 'order_by' => 'ORDER BY invnum',
+ 'element_name' => 'test_eventtable_num',
+ 'disable_empty' => 1,
+&>
+<INPUT TYPE="submit" VALUE="Test invoice">
+</FORM>
+<BR>
+
+<& /elements/footer.html &>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+$cgi->param('custnum') =~ /^(\d+)$/ or die 'unknown custnum';
+my $custnum = $1;
+
+my $cust_main = FS::cust_main->by_key($custnum);
+
+</%init>
-----------------------------------------------------------------------
Summary of changes:
httemplate/browse/part_event.html | 44 ++++++++++++++++++++++++++++---
httemplate/misc/test-part_event.html | 48 ++++++++++++++++++++++++++++++++++
2 files changed, 89 insertions(+), 3 deletions(-)
create mode 100644 httemplate/misc/test-part_event.html
More information about the freeside-commits
mailing list