summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Kohler <ivan@freeside.biz>2012-04-09 18:04:57 -0700
committerIvan Kohler <ivan@freeside.biz>2012-04-09 18:04:57 -0700
commit4ec5b193c5234d54b7c676e21927d7de934258e5 (patch)
tree81ad80f26a77f45f4a382b48333a1e5c2d7d3c0a
parentdbd9550c7379a9d8881e33ec84ce2d6701995806 (diff)
parent8824f2dc4410251c89e4913c713ceb11bb312e88 (diff)
Merge branch 'FREESIDE_2_3_BRANCH' of git.freeside.biz:/home/git/freeside into FREESIDE_2_3_BRANCH
-rw-r--r--FS/FS/Report/Table/Monthly.pm31
-rw-r--r--FS/FS/cust_pkg.pm2
-rw-r--r--httemplate/elements/tr-select-from_to.html2
-rw-r--r--httemplate/graph/elements/monthly.html9
-rw-r--r--httemplate/graph/report_cust_bill_pkg.html6
-rw-r--r--httemplate/misc/xmlhttp-cust_main-duplicates.html68
-rwxr-xr-xhttemplate/search/cust_pkg.cgi11
-rwxr-xr-xhttemplate/search/report_cust_pkg.html43
8 files changed, 119 insertions, 53 deletions
diff --git a/FS/FS/Report/Table/Monthly.pm b/FS/FS/Report/Table/Monthly.pm
index 41216992f..87c13a8ca 100644
--- a/FS/FS/Report/Table/Monthly.pm
+++ b/FS/FS/Report/Table/Monthly.pm
@@ -49,9 +49,8 @@ sub data {
my $syear = $self->{'start_year'};
my $emonth = $self->{'end_month'};
my $eyear = $self->{'end_year'};
- # how far to extrapolate into the future
- my $pmonth = $self->{'project_month'};
- my $pyear = $self->{'project_year'};
+ # whether to extrapolate into the future
+ my $projecting = $self->{'projection'};
# sanity checks
if ( $eyear < $syear or
@@ -61,17 +60,14 @@ sub data {
my $agentnum = $self->{'agentnum'};
- if ( $pyear > $eyear or
- ($pyear == $eyear and $pmonth > $emonth) ) {
+ if ( $projecting ) {
- # create the entire projection set first to avoid timing problems
+ $self->init_projection;
- $self->init_projection if $pmonth;
-
- my $thisyear = $eyear;
- my $thismonth = $emonth;
- while ( $thisyear < $pyear ||
- ( $thisyear == $pyear and $thismonth <= $pmonth )
+ my $thismonth = $smonth;
+ my $thisyear = $syear;
+ while ( $thisyear < $eyear ||
+ ( $thisyear == $eyear and $thismonth <= $emonth )
) {
my $speriod = timelocal(0,0,0,1,$thismonth-1,$thisyear);
$thismonth++;
@@ -84,10 +80,8 @@ sub data {
my %data;
- my $max_year = $pyear || $eyear;
- my $max_month = $pmonth || $emonth;
-
- my $projecting = 0; # are we currently projecting?
+ my $max_year = $eyear;
+ my $max_month = $emonth;
while ( $syear < $max_year
|| ( $syear == $max_year && $smonth < $max_month+1 ) ) {
@@ -101,11 +95,6 @@ sub data {
push @{$data{label}}, "$smonth/$syear";
}
- if ( $syear > $eyear || ( $syear == $eyear && $smonth >= $emonth + 1 ) ) {
- # start getting data from the projection
- $projecting = 1;
- }
-
my $speriod = timelocal(0,0,0,1,$smonth-1,$syear);
push @{$data{speriod}}, $speriod;
if ( ++$smonth == 13 ) { $syear++; $smonth=1; }
diff --git a/FS/FS/cust_pkg.pm b/FS/FS/cust_pkg.pm
index 88ce3a0e1..a0e21fec0 100644
--- a/FS/FS/cust_pkg.pm
+++ b/FS/FS/cust_pkg.pm
@@ -3230,7 +3230,7 @@ sub search {
"NOT (".FS::cust_pkg->onetime_sql . ")";
}
else {
- foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end cancel )) {
+ foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end change_date cancel )) {
next unless exists($params->{$field});
diff --git a/httemplate/elements/tr-select-from_to.html b/httemplate/elements/tr-select-from_to.html
index 100381234..a27412f99 100644
--- a/httemplate/elements/tr-select-from_to.html
+++ b/httemplate/elements/tr-select-from_to.html
@@ -39,7 +39,7 @@
my %hash = (
'show_month_abbr' => 1,
'start_year' => '1999',
- 'end_year' => '2012', #haha, well...
+ 'end_year' => '2013', #haha, well...
@_,
);
</%init>
diff --git a/httemplate/graph/elements/monthly.html b/httemplate/graph/elements/monthly.html
index 072798c2a..86530dd39 100644
--- a/httemplate/graph/elements/monthly.html
+++ b/httemplate/graph/elements/monthly.html
@@ -92,10 +92,7 @@ $opt{'start_year'} ||= $cgi->param('start_year'); # || 1899+$curyear;
$opt{'end_month'} ||= $cgi->param('end_month'); # || $curmon+1;
$opt{'end_year'} ||= $cgi->param('end_year'); # || 1900+$curyear;
-#find end of projection
-$opt{'project_month'} ||= $cgi->param('project_month') || 0;
-$opt{'project_year'} ||= $cgi->param('project_year') || 0;
-# setting these to zero prevents projection on reports that don't support it
+$opt{'projection'} ||= $cgi->param('projection') ? 1 : 0;
if ( $opt{'daily'} ) { # daily granularity
$opt{'start_day'} ||= $cgi->param('start_day');
@@ -118,9 +115,7 @@ my %reportopts = (
'end_day' => $opt{'end_day'},
'end_month' => $opt{'end_month'},
'end_year' => $opt{'end_year'},
- 'project_day' => $opt{'project_day'},
- 'project_month' => $opt{'project_month'},
- 'project_year' => $opt{'project_year'},
+ 'projection' => $opt{'projection'},
'agentnum' => $opt{'agentnum'},
'remove_empty' => $opt{'remove_empty'},
'doublemonths' => $opt{'doublemonths'},
diff --git a/httemplate/graph/report_cust_bill_pkg.html b/httemplate/graph/report_cust_bill_pkg.html
index f2c486cf4..07d4421e8 100644
--- a/httemplate/graph/report_cust_bill_pkg.html
+++ b/httemplate/graph/report_cust_bill_pkg.html
@@ -7,10 +7,8 @@
<% include('/elements/tr-select-from_to.html' ) %>
<TR>
- <TD ALIGN="right">Project to:</TD>
- <TD><& /elements/select-month_year.html,
- prefix => 'project',
- show_month_abbr => 1 &></TD>
+ <TD ALIGN="right"><INPUT TYPE="checkbox" NAME="projection" VALUE="1"></TD>
+ <TD>Show projected data for future months</TD>
</TR>
<% include('/elements/tr-select-agent.html',
diff --git a/httemplate/misc/xmlhttp-cust_main-duplicates.html b/httemplate/misc/xmlhttp-cust_main-duplicates.html
new file mode 100644
index 000000000..6654b3e39
--- /dev/null
+++ b/httemplate/misc/xmlhttp-cust_main-duplicates.html
@@ -0,0 +1,68 @@
+% if ( @cust_main ) {
+<CENTER><BR><B>Duplicate customer</B><BR>
+Choose an existing customer
+<TABLE WIDTH="300px">
+<FORM name="DuplicateForm">
+% foreach (@cust_main) {
+% my $custnum = $_->custnum;
+<TR>
+ <TD ALIGN="right" VALIGN="top"><B><% $custnum %>: </B></TD>
+ <TD ALIGN="left">
+ <% $_->name %>&mdash;<B><FONT COLOR="#<%$_->statuscolor%>"><%$_->ucfirst_cust_status%></FONT></B><BR>
+<% $_->address1 %><BR>
+<% $_->city %>,&nbsp;<% $_->state %>&nbsp;&nbsp;<% $_->zip %>
+ </TD>
+ <TD ALIGN="center">
+ <INPUT TYPE="radio" NAME="dup_custnum" VALUE="<%$custnum%>">
+ </TD>
+</TR>
+% } #foreach cust_main
+</FORM>
+</TABLE>
+<TABLE WIDTH="100%">
+<TR>
+ <TD ALIGN="center">
+ <BUTTON TYPE="button" onclick="submit_continue();">
+ <IMG SRC="<%$p%>images/error.png"> Create a new customer
+ </BUTTON>
+ </TD>
+ <TD ALIGN="center">
+ <BUTTON TYPE="button" onclick="<% $set_to_customer %>">
+ <IMG SRC="<%$p%>images/tick.png"> Use the selected customer
+ </BUTTON>
+ </TD>
+</TR>
+<TR>
+ <TD COLSPAN=2 ALIGN="center">
+ <BUTTON TYPE="button" onclick="submit_abort();">
+ <IMG SRC="<%$p%>images/cross.png"> Cancel submission
+ </BUTTON>
+ </TD>
+</TR>
+% }
+%# else return nothing
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('List customers');
+
+my $conf = new FS::Conf;
+
+my $sub = $cgi->param('sub');
+my $hashref = decode_json($cgi->param('arg'));
+my @cust_main = qsearch('cust_main', $hashref);
+
+my $set_to_customer = <<EOF;
+ var custnum_array = document.getElementsByName('dup_custnum');
+ var custnum;
+ for(i=0; i<custnum_array.length; i++) {
+ if(custnum_array[i].checked) {
+ custnum = custnum_array[i].value;
+ }
+ }
+ //alert('Setting to customer '+custnum);
+ document.CustomerForm.elements['duplicate_of_custnum'].value = custnum;
+ submit_continue();
+EOF
+
+</%init>
diff --git a/httemplate/search/cust_pkg.cgi b/httemplate/search/cust_pkg.cgi
index 297edee90..887ec6039 100755
--- a/httemplate/search/cust_pkg.cgi
+++ b/httemplate/search/cust_pkg.cgi
@@ -20,6 +20,7 @@
emt('Susp. delay'),
emt('Expire'),
emt('Contract end'),
+ emt('Changed'),
emt('Cancel'),
emt('Reason'),
FS::UI::Web::cust_header(
@@ -45,7 +46,7 @@
sub { FS::part_pkg::freq_pretty(shift); },
( map { time_or_blank($_) }
- qw( setup last_bill bill adjourn susp dundate expire contract_end cancel ) ),
+ qw( setup last_bill bill adjourn susp dundate expire contract_end change_date cancel ) ),
sub { my $self = shift;
my $return = '';
@@ -94,13 +95,14 @@
'',
'',
'',
+ '',
FS::UI::Web::cust_colors(),
'',
],
- 'style' => [ '', '', '', '', 'b', '', '', '', '', '', '', '', '', '', '', '', '', '',
+ 'style' => [ '', '', '', '', 'b', '', '', '', '', '', '', '', '', '', '', '', '', '', '',
FS::UI::Web::cust_styles() ],
'size' => [ '', '', '', '', '-1' ],
- 'align' => 'rrlccrrlrrrrrrrrrl'. FS::UI::Web::cust_aligns(). 'r',
+ 'align' => 'rrlccrrlrrrrrrrrrrl'. FS::UI::Web::cust_aligns(). 'r',
'links' => [
$link,
$link,
@@ -117,6 +119,7 @@
'',
'',
'',
+ '', # link to changed-from package?
'',
'',
'',
@@ -182,7 +185,7 @@ my %disable = (
'' => {},
);
-foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end cancel active )) {
+foreach my $field (qw( setup last_bill bill adjourn susp expire contract_end change_date cancel active )) {
my($beginning, $ending) = FS::UI::Web::parse_beginning_ending($cgi, $field);
diff --git a/httemplate/search/report_cust_pkg.html b/httemplate/search/report_cust_pkg.html
index 3da59c2ac..e47bbb1e5 100755
--- a/httemplate/search/report_cust_pkg.html
+++ b/httemplate/search/report_cust_pkg.html
@@ -88,23 +88,35 @@
%>
% }
-
+ <TR>
+ <TD COLSPAN=2>
+ <TABLE>
+ <TR>
+ <TD></TD>
+ <TD>From date <i>(m/d/y)</i></TD>
+ <TD>To date <i>(m/d/y)</i></TD>
+ </TR>
+% my $noinit = 0;
% foreach my $field (@date_fields) {
- <TR>
- <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD>
- <TD>
- <TABLE>
- <% include( '/elements/tr-input-beginning_ending.html',
- prefix => $field,
- layout => 'horiz',
- )
- %>
- </TABLE>
- </TD>
- </TR>
-
-% }
+ <TR>
+ <TD ALIGN="right" VALIGN="center"><% $label{$field} %></TD>
+% foreach (qw(beginning ending)) {
+ <TD>
+ <& /elements/input-date-field.html, {
+ 'name' => $field.'_'.$_,
+ 'value' => '',
+ 'noinit' => $noinit,
+ 'format' => '%m/%d/%Y',
+ } &>
+ </TD>
+% $noinit = 1;
+% }
+ </TR>
+% } #foreach $field
+ </TABLE>
+ </TD>
+ </TR>
<SCRIPT TYPE="text/javascript">
@@ -186,6 +198,7 @@ tie my %label, 'Tie::IxHash',
'dundate' => 'Suspension delayed until',
'expire' => 'Expires',
'contract_end' => 'Contract ends',
+ 'change_date' => 'Changed from other package',
'cancel' => 'Cancelled',
;
my @date_fields = keys %label;