[freeside-commits] branch FREESIDE_3_BRANCH updated. 2fd370d2f80ff2b39992d2e646496179cb1b87ab
Ivan
ivan at 420.am
Fri Dec 27 02:56:27 PST 2013
The branch, FREESIDE_3_BRANCH has been updated
via 2fd370d2f80ff2b39992d2e646496179cb1b87ab (commit)
from e142577d0c06f0dc50930db249a0eddb4860b6e9 (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 2fd370d2f80ff2b39992d2e646496179cb1b87ab
Author: Ivan Kohler <ivan at freeside.biz>
Date: Fri Dec 27 02:56:23 2013 -0800
selectable sales report colors, RT#19464
diff --git a/FS/FS/access_user.pm b/FS/FS/access_user.pm
index bbebecb..33db1fb 100644
--- a/FS/FS/access_user.pm
+++ b/FS/FS/access_user.pm
@@ -441,6 +441,7 @@ sub agents {
'table' => 'agent',
'hashref' => { disabled=>'' },
'extra_sql' => ' AND '. $self->agentnums_sql(@_),
+ 'order_by' => 'ORDER BY agent',
});
}
diff --git a/httemplate/docs/credits.html b/httemplate/docs/credits.html
index 218698f..908f717 100644
--- a/httemplate/docs/credits.html
+++ b/httemplate/docs/credits.html
@@ -73,6 +73,7 @@ Scott Edwards<BR>
Kenny Elliott<BR>
Donald Greer<BR>
Joel Griffiths<BR>
+Brian Grinstead<BR>
Ryan Gunn<BR>
Troy Hammonds<BR>
Sean Hanson<BR>
@@ -162,7 +163,7 @@ function myHeight() {
return document.body.document.height;
else
*/
- return 1900; // approx height (add more per contributors)
+ return 1959; // approx height (add more per contributors)
}
document.body.style.overflow = 'hidden';
diff --git a/httemplate/docs/license.html b/httemplate/docs/license.html
index 05a89c1..7838ae3 100644
--- a/httemplate/docs/license.html
+++ b/httemplate/docs/license.html
@@ -42,6 +42,7 @@ All rights reserved<BR>
published by the Free Software Foundation, either version 3 of the License,
or (at your option) any later version.
+
<!--entire other packages-->
<P>
@@ -56,6 +57,7 @@ under the original GPLv2 license.
Contains "Torrus" <http://www.torrus.org/> from Stanislav Sinyagin / K-Open
GmbH, licensed under the terms of the GNU GPL.
+
<!--important widgets or other "whole" bits-->
<P>
@@ -75,6 +77,7 @@ the GNU GPL.
Contains XMenu <http://webfx.eae.net/dhtml/xmenu/xmenu.html>
by Erik Arvidsson, licensed under the terms of the GNU GPL.
+
<!--RT add-ons-->
<P>
@@ -86,6 +89,7 @@ Contains "RTx::Statistics Package"
Contains "RTx::WebCronTool" <http://search.cpan.org/dist/RTx-WebCronTool/> from
Audrey Tang, licensed under the same terms as Perl (GPL/Artistic).
+
<!--libraries-->
<P>
@@ -117,6 +121,15 @@ Contains the Masked Input JavaScript library by Kendall Conrad, licensed under
a <a href="http://creativecommons.org/licenses/by-sa/3.0/us/">Creative Commons
Attribution-ShareAlike 3.0 United States</a> license.
+<P>
+Contains the jQuery library <http://jquery.com/> by the jQuery Foundation and
+other contributors, licensed under the terms of the MIT license.
+
+<P>
+Contains the Spectrum No Hassle jQuery Colorpicker by Brian Grinstead, licensed
+under the terms of the MIT license.
+
+
<!-- artwork -->
<P>
diff --git a/httemplate/graph/cust_bill_pkg.cgi b/httemplate/graph/cust_bill_pkg.cgi
index 9660e5b..39c9722 100644
--- a/httemplate/graph/cust_bill_pkg.cgi
+++ b/httemplate/graph/cust_bill_pkg.cgi
@@ -133,11 +133,6 @@ if ( $cgi->param('class_agg_break') eq 'aggregate' ) {
#eslaf
-my $hue = 0;
-#my $hue_increment = 170;
-#my $hue_increment = 145;
-my $hue_increment = 125;
-
my @items = ();
my @params = ();
my @labels = ();
@@ -165,14 +160,15 @@ elsif ( $use_usage == 2 ) {
# If per-agent totals are enabled, they go under the Agent level.
# There aren't any other kinds of subtotals.
-foreach my $agent ( $all_agent || $sel_agent || qsearch('agent', { 'disabled' => '' } ) ) {
+my $anum = 0;
+foreach my $agent ( $all_agent || $sel_agent || $FS::CurrentUser::CurrentUser->agents ) {
- my $col_scheme = Color::Scheme->new
- ->from_hue($hue) #->from_hex($agent->color)
- ->scheme('analogic')
- ;
- my @recur_colors = ();
- my @onetime_colors = ();
+ my @agent_colors = map { my $col = $cgi->param("agent$anum-color$_");
+ $col =~ s/^#//;
+ $col;
+ }
+ (0 .. 5);
+ my @colorbuf = ();
### fixup the color handling for package classes...
### and usage
@@ -219,11 +215,8 @@ foreach my $agent ( $all_agent || $sel_agent || qsearch('agent', { 'disabled' =>
$rowlink .= "$class_param=$_;" foreach @classnums;
push @links, $rowlink;
- @recur_colors = ($col_scheme->colors)[0,4,8,1,5,9]
- unless @recur_colors;
- @onetime_colors = ($col_scheme->colors)[2,6,10,3,7,11]
- unless @onetime_colors;
- push @colors, shift @recur_colors;
+ @colorbuf = @agent_colors unless @colorbuf;
+ push @colors, shift @colorbuf;
push @no_graph, 0;
} #foreach $component
@@ -260,11 +253,8 @@ foreach my $agent ( $all_agent || $sel_agent || qsearch('agent', { 'disabled' =>
"distribute=$distribute;".
"use_override=$use_override;charges=$component;";
- @recur_colors = ($col_scheme->colors)[0,4,8,1,5,9]
- unless @recur_colors;
- @onetime_colors = ($col_scheme->colors)[2,6,10,3,7,11]
- unless @onetime_colors;
- push @colors, shift @recur_colors;
+ @colorbuf = @agent_colors unless @colorbuf;
+ push @colors, shift @colorbuf;
push @no_graph, 0;
} #foreach $component
@@ -314,7 +304,7 @@ foreach my $agent ( $all_agent || $sel_agent || qsearch('agent', { 'disabled' =>
push @no_graph, 1;
}
- $hue += $hue_increment;
+ $anum++;
}
diff --git a/httemplate/graph/report_cust_bill_pkg.html b/httemplate/graph/report_cust_bill_pkg.html
index d43ce7b..1e54df3 100644
--- a/httemplate/graph/report_cust_bill_pkg.html
+++ b/httemplate/graph/report_cust_bill_pkg.html
@@ -1,4 +1,11 @@
-<% include('/elements/header.html', 'Sales Report' ) %>
+<& /elements/header.html,
+ { title => 'Sales Report',
+ head => '
+ <SCRIPT TYPE="text/javascript" SRC="'. $p. 'elements/jquery.js"></SCRIPT>
+ <SCRIPT TYPE="text/javascript" SRC="'. $p. 'elements/spectrum.js"></SCRIPT>
+ <LINK REL="stylesheet" HREF="'. $p. 'elements/spectrum.css" />',
+ }
+&>
<FORM ACTION="cust_bill_pkg.cgi" METHOD="GET">
@@ -16,6 +23,24 @@
</TR>
<SCRIPT TYPE="text/javascript">
+
+function agent_changed(obj) {
+
+ if ( obj.value == '' ) { //breakdown, one color list per agent needed
+ document.getElementById('agent0-label').style.display = '';
+% for ( 1 .. $#agents ) {
+ document.getElementById('agent<% $_ %>-colors').style.display = '';
+% }
+ } else { //aggregate, only one color list needed
+ document.getElementById('agent0-label').style.display = 'none';
+% for ( 1 .. $#agents ) {
+ document.getElementById('agent<% $_ %>-colors').style.display = 'none';
+% }
+ }
+
+ enable_agent_totals(obj);
+}
+
function enable_agent_totals(obj) {
%# enable it iff we are breaking down by agent AND something else
obj.form.agent_totals.disabled = !(
@@ -56,7 +81,7 @@ window.onload = class_mode_changed;
'disable_empty' => 0,
'pre_options' => [ 'all' => 'all (aggregate)' ],
'empty_label' => 'all (breakdown)',
- 'onchange' => 'enable_agent_totals',
+ 'onchange' => 'agent_changed',
&>
<& /elements/tr-select-cust_class.html,
@@ -159,6 +184,64 @@ window.onload = class_mode_changed;
% }
<TR>
+ <TD ALIGN="right">Colors</TD>
+ <TD>
+% my @names = ();
+%
+% #no particular long-term attachment to this, just trying to replicate
+% # historical behavior so people's graphs don't change color suddenly in 3.x
+% my $hue = 0;
+% my $hue_increment = 125;
+
+ <TABLE>
+% my $anum = 0;
+% foreach my $agent ( @agents ) {
+ <TR <% $anum ? 'STYLE="display:none"' : '' %>
+ ID="agent<%$anum%>-colors"
+ >
+ <TD <% $anum ? '' :'STYLE="display:none"' %>
+ ID="agent<%$anum%>-label"
+ >
+ <% $agent->agent |h %>
+ </TD>
+ <TD>
+% my $col_scheme = Color::Scheme->new
+% ->from_hue($hue) #->from_hex($agent->color)
+% ->scheme('analogic')
+% ;
+%
+% my $cnum = 0;
+% my @colors = ($col_scheme->colors)[ 0,4,8,1,5,9 ];#again some some random historical shite
+% for (@colors) {
+% my $name = "agent$anum-color$cnum";
+% push @names, $name;
+% $cnum++;
+ <INPUT TYPE = "color"
+ NAME = "<% $name %>"
+ ID = "<% $name %>"
+ VALUE = "#<%$_%>"
+ >
+% }
+ </TD>
+ </TR>
+% $anum++;
+% $hue += $hue_increment;
+% }
+ </TABLE>
+ </TD>
+</TR>
+
+<SCRIPT TYPE="text/javascript">
+ $(document).ready(function() {
+% foreach my $name (@names) {
+ $("#<% $name %>").spectrum({
+ clickoutFiresChange: true
+ });
+% }
+ });
+</SCRIPT>
+
+<TR>
<TD ALIGN="right"><INPUT TYPE="checkbox" NAME="agent_totals" VALUE="1" DISABLED="1"></TD>
<TD>Show per-agent subtotals</TD>
</TR>
@@ -189,4 +272,6 @@ window.onload = class_mode_changed;
die "access denied"
unless $FS::CurrentUser::CurrentUser->access_right('Financial reports');
+my @agents = $FS::CurrentUser::CurrentUser->agents;
+
</%init>
-----------------------------------------------------------------------
Summary of changes:
FS/FS/access_user.pm | 1 +
httemplate/docs/credits.html | 3 +-
httemplate/docs/license.html | 13 ++++
httemplate/graph/cust_bill_pkg.cgi | 36 ++++-------
httemplate/graph/report_cust_bill_pkg.html | 89 +++++++++++++++++++++++++++-
5 files changed, 116 insertions(+), 26 deletions(-)
More information about the freeside-commits
mailing list