summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
authorivan <ivan>2006-06-19 08:05:28 +0000
committerivan <ivan>2006-06-19 08:05:28 +0000
commit6b12c14cc10503d6b0783e8ef71fe44d9a9b37b6 (patch)
treef4adf16218b35f566763c8baaf4a1c41e1d81b6b /httemplate
parenta59c9cdd72fdf85d81007ba86e81479f6ec8e6e5 (diff)
add ability to select specific package defs. and package status to package report for qis
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/config/config.cgi72
-rw-r--r--httemplate/elements/menu.html4
-rw-r--r--httemplate/elements/select-cust-fields.html23
-rw-r--r--httemplate/elements/select-cust_pkg-status.html19
-rw-r--r--httemplate/elements/tr-select-cust-fields.html14
-rw-r--r--httemplate/elements/tr-select-cust_pkg-status.html13
-rw-r--r--httemplate/graph/cust_bill_pkg.cgi2
-rwxr-xr-xhttemplate/search/cust_pkg_report.cgi22
-rwxr-xr-xhttemplate/search/report_cust_pkg.html47
-rw-r--r--httemplate/view/cust_main/contacts.html2
10 files changed, 180 insertions, 38 deletions
diff --git a/httemplate/config/config.cgi b/httemplate/config/config.cgi
index 21f79a9dc..6008c0e42 100644
--- a/httemplate/config/config.cgi
+++ b/httemplate/config/config.cgi
@@ -55,25 +55,65 @@ function SafeOnsubmit() {
#warn $i->key unless defined($type);
%>
<% if ( $type eq '' ) { %>
- <font color="#ff0000">no type</font>
+
+ <font color="#ff0000">no type</font>
+
<% } elsif ( $type eq 'textarea' ) { %>
- <textarea name="<%= $i->key. $n %>" rows=5><%= "\n". join("\n", $conf->config($i->key) ) %></textarea>
+
+ <textarea name="<%= $i->key. $n %>" rows=5><%= "\n". join("\n", $conf->config($i->key) ) %></textarea>
+
<% } elsif ( $type eq 'checkbox' ) { %>
- <input name="<%= $i->key. $n %>" type="checkbox" value="1"<%= $conf->exists($i->key) ? ' CHECKED' : '' %>>
+
+ <input name="<%= $i->key. $n %>" type="checkbox" value="1"<%= $conf->exists($i->key) ? ' CHECKED' : '' %>>
+
<% } elsif ( $type eq 'text' ) { %>
- <input name="<%= $i->key. $n %>" type="<%= $type %>" value="<%= $conf->exists($i->key) ? $conf->config($i->key) : '' %>">
+
+ <input name="<%= $i->key. $n %>" type="<%= $type %>" value="<%= $conf->exists($i->key) ? $conf->config($i->key) : '' %>">
+
<% } elsif ( $type eq 'select' || $type eq 'selectmultiple' ) { %>
- <select name="<%= $i->key. $n %>" <%= $type eq 'selectmultiple' ? 'MULTIPLE' : '' %>>
- <% my %saw;
- foreach my $value ( "", @{$i->select_enum} ) {
- local($^W)=0; next if $saw{$value}++; %>
- <option value="<%= $value %>"<%= $value eq $conf->config($i->key) || ( $type eq 'selectmultiple' && grep { $_ eq $value } $conf->config($i->key) ) ? ' SELECTED' : '' %>><%= $value %>
- <% } %>
- <% if ( $conf->exists($i->key) && $conf->config($i->key) && ! grep { $conf->config($i->key) eq $_ } @{$i->select_enum}) { %>
- <option value=<%= $conf->config($i->key) %> SELECTED><%= $conf->config($i->key) %>
+
+ <select name="<%= $i->key. $n %>" <%= $type eq 'selectmultiple' ? 'MULTIPLE' : '' %>>
+ <%
+ my %hash = ();
+ if ( $i->select_enum ) {
+ tie %hash, 'Tie::IxHash',
+ '' => '', map { $_ => $_ } @{ $i->select_enum };
+ } elsif ( $i->select_hash ) {
+ if ( ref($i->select_hash) eq 'ARRAY' ) {
+ tie %hash, 'Tie::IxHash',
+ '' => '', @{ $i->select_hash };
+ } else {
+ tie %hash, 'Tie::IxHash',
+ '' => '', %{ $i->select_hash };
+ }
+ } else {
+ %hash = ( '' => 'WARNING: neither select_enum nor select_hash specified in Conf.pm for configuration option "'. $i->key. '"' );
+ }
+
+ my %saw = ();
+ foreach my $value ( keys %hash ) {
+ local($^W)=0; next if $saw{$value}++;
+ my $label = $hash{$value};
+ %>
+
+ <option value="<%= $value %>"<%= $value eq $conf->config($i->key) || ( $type eq 'selectmultiple' && grep { $_ eq $value } $conf->config($i->key) ) ? ' SELECTED' : '' %>><%= $label %>
+
+ <% } %>
+
+ <% my $curvalue = $conf->config($i->key);
+ if ( $conf->exists($i->key) && $curvalue
+ && ! grep { $curvalue eq $_ } @{$i->select_enum}
+ ) {
+ %>
+
+ <option value="<%= $conf->config($i->key) %>" SELECTED><%= exists( $hash{ $conf->config($i->key) } ) ? $hash{ $conf->config($i->key) } : $conf->config($i->key) %>
+
<% } %>
+
</select>
+
<% } elsif ( $type eq 'select-sub' ) { %>
+
<select name="<%= $i->key. $n %>">
<option value="">
<% my %options = &{$i->options_sub};
@@ -88,7 +128,9 @@ function SafeOnsubmit() {
<option value=<%= $conf->config($i->key) %> SELECTED><%= $conf->config($i->key) %>: <%= &{ $i->option_sub }( $conf->config($i->key) ) %>
<% } %>
</select>
- <% } elsif ( $type eq 'editlist' ) { %>
+
+ <% } elsif ( $type eq 'editlist' ) { %>
+
<script>
function doremove<%= $i->key. $n %>() {
fromObject = document.OneTrueForm.<%= $i->key. $n %>;
@@ -167,9 +209,13 @@ function SafeOnsubmit() {
<% } %>
<td><input type="button" value="add" onClick="doadd<%= $i->key. $n %>(this.form)"></td>
</tr></table>
+
<% } else { %>
+
<font color="#ff0000">unknown type <%= $type %></font>
+
<% } %>
+
<% $n++; } %>
</td>
<td><a name="<%= $i->key %>">
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index c09fcee8c..8da197f34 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -85,7 +85,7 @@
'All customer packages' => [ $fsurl.'search/cust_pkg.cgi?pkgnum', 'List all customer packages', ],
'Suspended customer packages' => [ $fsurl.'search/cust_pkg.cgi?magic=suspended', 'List suspended packages' ],
'Customer packages with unconfigured services' => [ $fsurl.'search/cust_pkg.cgi?APKG_pkgnum', 'List packages which have provisionable services' ],
- 'By next bill date' => [ $fsurl.'search/cust_pkg_report.cgi', 'Search packages by next bill date' ],
+ 'Advanced package reports' => [ $fsurl.'search/report_cust_pkg.html', 'by agent, date range, status, package definition' ],
;
tie my %report_financial, 'Tie::IxHash',
@@ -264,7 +264,7 @@
if ( ref($url_or_submenu) ) {
- warn $item;
+ #warn $item;
my( $subhtml, $submenuname ) = submenu($url_or_submenu, $item);
diff --git a/httemplate/elements/select-cust-fields.html b/httemplate/elements/select-cust-fields.html
new file mode 100644
index 000000000..4d47fbe40
--- /dev/null
+++ b/httemplate/elements/select-cust-fields.html
@@ -0,0 +1,23 @@
+<%
+ my( $cust_fields, %opt ) = @_;
+
+ use FS::ConfDefaults;
+ $opt{'avail_fields'} ||= [ FS::ConfDefaults->cust_fields_avail() ];
+
+ tie my %hash, 'Tie::IxHash', @{ $opt{'avail_fields'} };
+
+%>
+
+<SELECT NAME="cust_fields">
+
+ <OPTION VALUE="">(configured default)
+
+ <%
+ foreach my $value ( keys %hash ) { %>
+
+ <OPTION VALUE="<%= $value %>"><%= $hash{$value} %>
+
+ <% } %>
+
+</SELECT>
+
diff --git a/httemplate/elements/select-cust_pkg-status.html b/httemplate/elements/select-cust_pkg-status.html
new file mode 100644
index 000000000..5da93fe79
--- /dev/null
+++ b/httemplate/elements/select-cust_pkg-status.html
@@ -0,0 +1,19 @@
+<%
+ my( $status, %opt ) = @_;
+
+ $opt{'statuses'} ||= [ FS::cust_pkg->statuses() ]; # { disabled=>'' } )
+
+%>
+
+<SELECT NAME="status">
+
+ <OPTION VALUE="">all
+
+ <% foreach my $status ( @{ $opt{'statuses'} } ) { %>
+
+ <OPTION VALUE="<%= $status %>"><%= $status %>
+
+ <% } %>
+
+</SELECT>
+
diff --git a/httemplate/elements/tr-select-cust-fields.html b/httemplate/elements/tr-select-cust-fields.html
new file mode 100644
index 000000000..ca37e4276
--- /dev/null
+++ b/httemplate/elements/tr-select-cust-fields.html
@@ -0,0 +1,14 @@
+<%
+ my( $cust_fields, %opt ) = @_;
+
+ use FS::ConfDefaults;
+ $opt{'avail_fields'} ||= [ FS::ConfDefaults->cust_fields_avail() ];
+
+%>
+
+<TR>
+ <TD ALIGN="right"><%= $opt{'label'} || 'Customer fields' %></TD>
+ <TD>
+ <%= include( '/elements/select-cust-fields.html', $cust_fields, %opt ) %>
+ </TD>
+</TR>
diff --git a/httemplate/elements/tr-select-cust_pkg-status.html b/httemplate/elements/tr-select-cust_pkg-status.html
new file mode 100644
index 000000000..17768517d
--- /dev/null
+++ b/httemplate/elements/tr-select-cust_pkg-status.html
@@ -0,0 +1,13 @@
+<%
+ my( $status, %opt ) = @_;
+
+ $opt{'statuses'} ||= [ FS::cust_pkg->statuses() ]; # { disabled=>'' } )
+
+%>
+
+<TR>
+ <TD ALIGN="right"><%= $opt{'label'} || 'Status' %></TD>
+ <TD>
+ <%= include( '/elements/select-cust_pkg-status.html', $status, %opt ) %>
+ </TD>
+</TR>
diff --git a/httemplate/graph/cust_bill_pkg.cgi b/httemplate/graph/cust_bill_pkg.cgi
index cb8225516..acd39b025 100644
--- a/httemplate/graph/cust_bill_pkg.cgi
+++ b/httemplate/graph/cust_bill_pkg.cgi
@@ -18,6 +18,7 @@ if ( $cgi->param('agentnum') =~ /^(\d+)$/ ) {
}
my $title = $sel_agent ? $sel_agent->agent.' ' : '';
+#false lazinessish w/search/cust_pkg.cgi
my $classnum = 0;
my @pkg_class = ();
if ( $cgi->param('classnum') =~ /^(\d*)$/ ) {
@@ -34,6 +35,7 @@ if ( $cgi->param('classnum') =~ /^(\d*)$/ ) {
push @pkg_class, '(empty class)';
}
}
+#eslaf
my $hue = 0;
#my $hue_increment = 170;
diff --git a/httemplate/search/cust_pkg_report.cgi b/httemplate/search/cust_pkg_report.cgi
deleted file mode 100755
index d9aada5f4..000000000
--- a/httemplate/search/cust_pkg_report.cgi
+++ /dev/null
@@ -1,22 +0,0 @@
-<%= include('/elements/header.html', 'Packages' ) %>
-
-<FORM ACTION="cust_pkg.cgi" METHOD="GET">
-<INPUT TYPE="hidden" NAME="magic" VALUE="bill">
-
-Return packages with next bill date:
-<BR><BR>
-
- <TABLE>
- <%= include( '/elements/tr-input-beginning_ending.html' ) %>
- <%= include( '/elements/tr-select-agent.html',
- $cgi->param('agentnum'),
- )
- %>
- </TABLE>
-
-<BR>
-<INPUT TYPE="submit" VALUE="Get Report">
-
-</FORM>
-
-<%= include('/elements/footer.html') %>
diff --git a/httemplate/search/report_cust_pkg.html b/httemplate/search/report_cust_pkg.html
new file mode 100755
index 000000000..98e91217f
--- /dev/null
+++ b/httemplate/search/report_cust_pkg.html
@@ -0,0 +1,47 @@
+<%= include('/elements/header.html', 'Package Report' ) %>
+
+<FORM ACTION="cust_pkg.cgi" METHOD="GET">
+<INPUT TYPE="hidden" NAME="magic" VALUE="bill">
+
+ <TABLE BGCOLOR="#cccccc" CELLSPACING=0>
+
+ <TR>
+ <TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Search options</FONT></TH>
+ </TR>
+ <%= include( '/elements/tr-select-agent.html',
+ $cgi->param('agentnum'),
+ )
+ %>
+ <%= include( '/elements/tr-select-cust_pkg-status.html' ) %>
+ <%= include( '/elements/tr-select-pkg_class.html', '',
+ 'pre_options' => [ '0' => 'all' ],
+ 'empty_label' => '(empty class)',
+ )
+ %>
+ <% #include( '/elements/tr-selectmultiple-part_pkg.html' ) %>
+ <TR>
+ <TD ALIGN="right" VALIGN="center">Next bill date</TD>
+ <TD>
+ <TABLE>
+ <%= include( '/elements/tr-input-beginning_ending.html' ) %>
+ </TABLE>
+ </TD>
+ </TR>
+
+ <TR>
+ <TH BGCOLOR="#e8e8e8" COLSPAN=2>&nbsp;</TH>
+ </TR>
+
+ <TR>
+ <TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"><FONT SIZE="+1">Display options</FONT></TH>
+ </TR>
+ <%= include( '/elements/tr-select-cust-fields.html' ) %>
+
+ </TABLE>
+
+<BR>
+<INPUT TYPE="submit" VALUE="Get Report">
+
+</FORM>
+
+<%= include('/elements/footer.html') %>
diff --git a/httemplate/view/cust_main/contacts.html b/httemplate/view/cust_main/contacts.html
index 7aba11813..48371550b 100644
--- a/httemplate/view/cust_main/contacts.html
+++ b/httemplate/view/cust_main/contacts.html
@@ -114,7 +114,7 @@ Service address
</TR>
<TR>
<TD ALIGN="right">Country</TD>
- <TD BGCOLOR="#ffffff"><%= $cust_main->get("${pre}country") %></TD>
+ <TD BGCOLOR="#ffffff"><%= code2country( $cust_main->get("${pre}country") ) %></TD>
</TR>
<TR>
<TD ALIGN="right"><%= $daytime_label %></TD>