summaryrefslogtreecommitdiff
path: root/httemplate
diff options
context:
space:
mode:
Diffstat (limited to 'httemplate')
-rw-r--r--httemplate/browse/cable_provider.html32
-rw-r--r--httemplate/docs/about.html2
-rw-r--r--httemplate/edit/cable_provider.html20
-rw-r--r--httemplate/edit/cust_main-contacts.html23
-rw-r--r--httemplate/edit/cust_payby.html184
-rw-r--r--httemplate/edit/elements/edit.html21
-rw-r--r--httemplate/edit/process/cable_provider.html10
-rw-r--r--httemplate/edit/process/cust_payby.html19
-rw-r--r--httemplate/elements/menu.html1
-rw-r--r--httemplate/elements/select-cable_provider.html7
-rw-r--r--httemplate/elements/tr-select-cable_provider.html12
-rw-r--r--httemplate/elements/tr-select-month_year.html22
-rwxr-xr-xhttemplate/view/cust_main.cgi1
13 files changed, 334 insertions, 20 deletions
diff --git a/httemplate/browse/cable_provider.html b/httemplate/browse/cable_provider.html
new file mode 100644
index 000000000..0d344984b
--- /dev/null
+++ b/httemplate/browse/cable_provider.html
@@ -0,0 +1,32 @@
+<& elements/browse.html,
+ 'title' => 'Cable providers',
+ 'html_init' => $html_init,
+ 'name' => 'providers',
+ 'disableable' => 1,
+ 'disabled_statuspos' => 1,
+ 'query' => { 'table' => 'cable_provider',
+ 'hashref' => {},
+ 'order_by' => 'ORDER BY provider',
+ },
+ 'count_query' => $count_query,
+ 'header' => $header,
+ 'fields' => $fields,
+ 'links' => $links,
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+my $html_init =
+ qq!<A HREF="${p}edit/cable_provider.html"><I>Add a provider</I></A><BR><BR>!;
+
+my $count_query = 'SELECT COUNT(*) FROM cable_provider';
+
+my $link = [ $p.'edit/cable_provider.html?', 'providernum' ];
+
+my $header = [ 'Provider' ];
+my $fields = [ 'provider' ];
+my $links = [ $link ];
+
+</%init>
diff --git a/httemplate/docs/about.html b/httemplate/docs/about.html
index c2ba4e4a0..80d9488b6 100644
--- a/httemplate/docs/about.html
+++ b/httemplate/docs/about.html
@@ -56,7 +56,7 @@ GNU <b>Affero</b> General Public License.<BR>
% unless ( $agentnum ) {
<CENTER>
- <FONT SIZE="-3">"I can't figure out ... if it's an end or the beginning" - R. Hunter</FONT>
+ <FONT SIZE="-3">"" - R. Hunter</FONT>
</CENTER>
% }
diff --git a/httemplate/edit/cable_provider.html b/httemplate/edit/cable_provider.html
new file mode 100644
index 000000000..9a911ccfa
--- /dev/null
+++ b/httemplate/edit/cable_provider.html
@@ -0,0 +1,20 @@
+<& elements/edit.html,
+ 'name_singular' => 'Provider',
+ 'table' => 'cable_provider',
+ 'fields' => [
+ 'provider',
+ { field=>'disabled', type=>'checkbox', value=>'Y', },
+ ],
+ 'labels' => {
+ 'providernum' => 'Provider',
+ 'provider' => 'Provider',
+ 'disabled' => 'Disabled',
+ },
+ 'viewall_dir' => 'browse',
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>
diff --git a/httemplate/edit/cust_main-contacts.html b/httemplate/edit/cust_main-contacts.html
index bae58bd33..cd83a2960 100644
--- a/httemplate/edit/cust_main-contacts.html
+++ b/httemplate/edit/cust_main-contacts.html
@@ -1,8 +1,9 @@
-<% include('elements/edit.html',
+<& elements/edit.html,
'name_singular' => 'customer contacts', #yes, we're editing all of them
'table' => 'cust_main',
- 'post_url' => popurl(1). 'process/cust_main-contacts.html',
- 'labels' => { 'custnum' => ' ', #XXX supress this line entirely, its being redundant
+ 'post_url' => popurl(1). 'process/cust_main-contacts.html',
+ 'no_pkey_display' => 1,
+ 'labels' => {
'contactnum' => 'Contact',
#'locationnum' => '&nbsp;',
},
@@ -20,17 +21,17 @@
#'edit_callback' => $edit_callback,
#'error_callback' => $error_callback,
'agent_virt' => 1,
- 'menubar' => [], #remove "view all" link
+ 'menubar' => [], #remove "view all" link
#XXX it would be nice if this could instead be after the error but before
# the table
- 'html_init' => include('/elements/small_custview.html',
- $custnum,
- $conf->config('countrydefault') || 'US',
- 1, #no balance
- ),
- )
-%>
+ 'html_init' => include('/elements/small_custview.html',
+ $custnum,
+ $conf->config('countrydefault') || 'US',
+ 1, #no balance
+ ).
+ '<BR>',
+&>
<%init>
my $curuser = $FS::CurrentUser::CurrentUser;
diff --git a/httemplate/edit/cust_payby.html b/httemplate/edit/cust_payby.html
new file mode 100644
index 000000000..67eb40a89
--- /dev/null
+++ b/httemplate/edit/cust_payby.html
@@ -0,0 +1,184 @@
+%# #based on / some false laziness w/ cust_main-contacts.html
+<& elements/edit.html,
+ 'name_singular' => 'payment methods', #"customer payment methods" ?
+ 'table' => 'cust_main',
+ 'post_url' => popurl(1). 'process/cust_payby.html',
+ 'no_pkey_display' => 1,
+ 'labels' => {
+ 'custpaybynum' => ' ', #'Payment method',
+ #'locationnum' => '&nbsp;',
+ },
+ 'fields' => [
+ { field => 'custpaybynum',
+ type => 'selectlayers',
+ options => [ '',
+ grep { ! /^(DCRD|DCHK)$/ }
+ FS::payby->cust_payby
+ ],
+ labels => { '' => 'Select payment method',
+ FS::payby->payby2shortname
+ },
+ layer_fields => \%payby_fields,
+ layer_values_callback => $payby_layer_values,
+ m2m_method => 'cust_payby',
+ m2m_dstcol => 'custpaybynum',
+ m2_label => ' ', #'Payment method',
+ m2_error_callback => $m2_error_callback,
+ },
+ ],
+ #'new_callback' => $new_callback,
+ #'edit_callback' => $edit_callback,
+ #'error_callback' => $error_callback,
+ 'agent_virt' => 1,
+ 'menubar' => [], #remove "view all" link
+
+ #XXX it would be nice if this could instead be after the error but before
+ # the table
+ 'html_init' => include('/elements/small_custview.html',
+ $custnum,
+ $conf->config('countrydefault') || 'US',
+ 1, #no balance
+ ).
+ '<BR>',
+&>
+<%init>
+
+my $curuser = $FS::CurrentUser::CurrentUser;
+my $conf = new FS::Conf;
+
+my $custnum;
+if ( $cgi->param('error') ) {
+ $custnum = scalar($cgi->param('custnum'));
+
+ die "access denied"
+ unless $curuser->access_right(($custnum ? 'Edit' : 'New'). ' customer'); #payment methods?
+
+} elsif ( $cgi->keywords ) { #editing
+ $custnum = ($cgi->keywords)[0];
+
+ die "access denied"
+ unless $curuser->access_right('Edit customer');
+
+} else { #new customer
+
+ #this doesn't really work here, we're an edit only
+ die "guru meditation #53";
+
+ die "access denied"
+ unless $curuser->access_right('New customer');
+
+}
+
+
+#XXX
+my %payby_fields = (
+ 'CARD' => [ 'CARD_payinfo' => mt('Card number'),
+ 'CARD_exp' => {
+ label => 'Expiration',
+ type => 'select-month_year',
+ #XXX prefix?
+ },
+ 'CARD_paycvv' => 'CVV2', #XXX help popup
+ 'CARD_payname' => mt('Exact name on card'),
+ 'CARD_payauto' => { label => mt('Charge future payments to this credit card automatically'),
+ type => 'checkbox',
+ },
+ ],
+ 'CHEK' => [ 'CHEK_payinfo1' => mt('Account number'),
+ 'CHEK_paytype' => { label => 'Type',
+ #XXX select values
+ #@FS::cust_main::paytypes #??
+ },
+ 'CHEK_payinfo2' => mt('ABA/Routing number'), #XXX help popup
+ 'CHEK_exp_month' => { type => 'hidden',
+ value => 12,
+ },
+ 'CHEK_exp_year' => { type => 'hidden',
+ value => 2037,
+ },
+ 'CHEK_payname' => mt('Bank name'),
+ #'CHEK_paystate' => { label => $paystate_label,
+ # type => 'select-state',
+ # },
+ 'CHEK_payauto' => { label => mt('Charge future payments to this electronic check automatically'),
+ type => 'checkbox',
+ },
+ ],
+ #'LECB'
+ 'BILL' => [ 'BILL_payinfo' => mt('P.O.'),
+ 'BILL_exp_month' => { type => 'hidden',
+ value => 12,
+ },
+ 'BILL_exp_year' => { type => 'hidden',
+ value => 2037,
+ },
+ 'BILL_payname' => mt('Attention'),
+ ],
+ 'COMP' => [
+ 'COMP_payinfo' => mt('Approved by'),
+ ],
+
+);
+
+#XXX
+my $payby_layer_values = sub {
+ my ( $cgi, $cust_payby, $switches ) = @_;
+ +{
+# #map { $_ => { $part_event_condition->options } }
+# # keys %condition_fields
+# map { my $conditionname = $_;
+# my %opts = $switches->{'mode'} eq 'error'
+# ? %{ $cgi_conditions{$conditionname} || {} }
+# : $part_event_condition->options;
+# %opts = (
+# map { ( "$conditionname.$_" => $opts{$_} ); }
+# keys %opts
+# );
+# ( $conditionname => \%opts );
+# }
+# keys %condition_fields
+ };
+};
+
+
+#my $new_callback = sub {
+# my( $cgi, $cust_main, $fields_listref, $opt_hashref ) = @_;
+#};
+
+#my $edit_callback = sub {
+# my( $cgi, $cust_main, $fields_listref, $opt_hashref ) = @_;
+#};
+
+#my $error_callback = sub {
+# my( $cgi, $cust_main, $fields_listref, $opt_hashref ) = @_;
+#};
+
+my $m2_error_callback = sub {
+ my($cgi, $object) = @_;
+
+ #XXX
+
+ #process_o2m fields in process/cust_main-contacts.html
+ my @fields = qw( first last title comment );
+ my @gfields = ( '', map "_$_", @fields );
+
+ map {
+ if ( /^contactnum(\d+)$/ ) {
+ my $num = $1;
+ if ( grep $cgi->param("contactnum$num$_"), @gfields ) {
+ my $x = new FS::contact {
+ 'contactnum' => scalar($cgi->param("contactnum$num")),
+ map { $_ => scalar($cgi->param("contactnum${num}_$_")) } @fields,
+ };
+ $x;
+ } else {
+ ();
+ }
+ } else {
+ ();
+ }
+ }
+ $cgi->param;
+};
+
+</%init>
diff --git a/httemplate/edit/elements/edit.html b/httemplate/edit/elements/edit.html
index 051788cf7..6c965326b 100644
--- a/httemplate/edit/elements/edit.html
+++ b/httemplate/edit/elements/edit.html
@@ -116,6 +116,9 @@ Example:
# display of primary key, no submit button, no html_foot, no footer)
'embed' => $object, #need to pass the object
+ #don't show the primary key label and value
+ 'no_pkey_display' => 1,
+
###
# HTML callbacks
###
@@ -236,13 +239,17 @@ Example:
<INPUT TYPE="hidden" NAME="svcdb" VALUE="<% $table %>">
<INPUT TYPE="hidden" NAME="<% $pkey %>" VALUE="<% $clone ? '' : $object->$pkey() %>">
- <FONT SIZE="+1"><B>
- <% ( $opt{labels} && exists $opt{labels}->{$pkey} )
- ? $opt{labels}->{$pkey}
- : $pkey
- %>
- </B></FONT>
- #<% ( !$clone && $object->$pkey() ) || "(NEW)" %>
+% unless ( $opt{'no_pkey_display'} ) {
+
+ <FONT SIZE="+1"><B>
+ <% ( $opt{labels} && exists $opt{labels}->{$pkey} )
+ ? $opt{labels}->{$pkey}
+ : $pkey
+ %>
+ </B></FONT>
+ #<% ( !$clone && $object->$pkey() ) || "(NEW)" %>
+
+% }
% }
diff --git a/httemplate/edit/process/cable_provider.html b/httemplate/edit/process/cable_provider.html
new file mode 100644
index 000000000..ecffaf692
--- /dev/null
+++ b/httemplate/edit/process/cable_provider.html
@@ -0,0 +1,10 @@
+<& elements/process.html,
+ 'table' => 'cable_provider',
+ 'viewall_dir' => 'browse',
+&>
+<%init>
+
+die "access denied"
+ unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
+
+</%init>
diff --git a/httemplate/edit/process/cust_payby.html b/httemplate/edit/process/cust_payby.html
new file mode 100644
index 000000000..a999e4d74
--- /dev/null
+++ b/httemplate/edit/process/cust_payby.html
@@ -0,0 +1,19 @@
+<% include('elements/process.html',
+ 'table' => 'cust_main',
+ 'error_redirect' => popurl(3). 'edit/cust_payby.html?',
+ 'agent_virt' => 1,
+ 'skip_process' => 1, #we don't want to make any changes to cust_main
+ 'process_o2m' => {
+ 'table' => 'cust_payby',
+ 'fields' => \@payby_fields,
+ },
+ 'redirect' => popurl(3). 'view/cust_main.cgi?',
+ )
+%>
+<%init>
+
+#XXX
+my @payby_fields = qw();
+}
+
+</%init>
diff --git a/httemplate/elements/menu.html b/httemplate/elements/menu.html
index c8fe5f2e8..8cb967518 100644
--- a/httemplate/elements/menu.html
+++ b/httemplate/elements/menu.html
@@ -521,6 +521,7 @@ tie my %config_radius, 'Tie::IxHash',
;
tie my %config_cable, 'Tie::IxHash',
+ 'Cable providers' => [ $fsurl.'browse/cable_provider.html', '' ],
'Cable modem models' => [ $fsurl.'browse/cable_model.html', '' ],
;
diff --git a/httemplate/elements/select-cable_provider.html b/httemplate/elements/select-cable_provider.html
new file mode 100644
index 000000000..9530b78c0
--- /dev/null
+++ b/httemplate/elements/select-cable_provider.html
@@ -0,0 +1,7 @@
+<% include( '/elements/select-table.html',
+ 'table' => 'cable_provider',
+ 'name_col' => 'provider',
+ 'empty_label' => 'Select provider',
+ @_,
+ )
+%>
diff --git a/httemplate/elements/tr-select-cable_provider.html b/httemplate/elements/tr-select-cable_provider.html
new file mode 100644
index 000000000..abb8564dc
--- /dev/null
+++ b/httemplate/elements/tr-select-cable_provider.html
@@ -0,0 +1,12 @@
+% #if ( scalar(@domains) < 2 ) {
+% #} else {
+ <TR>
+ <TD ALIGN="right"><% $opt{'label'} || 'Provider' %></TD>
+ <TD>
+ <% include( '/elements/select-cable_provider.html', %opt) %>
+ </TD>
+ </TR>
+% #}
+<%init>
+ my %opt = @_;
+</%init>
diff --git a/httemplate/elements/tr-select-month_year.html b/httemplate/elements/tr-select-month_year.html
new file mode 100644
index 000000000..b1943bdbd
--- /dev/null
+++ b/httemplate/elements/tr-select-month_year.html
@@ -0,0 +1,22 @@
+% unless ( $opt{'js_only'} ) {
+
+ <% include('tr-td-label.html', %opt ) %>
+
+ <TD <% $colspan %> <% $style %>>
+% }
+
+ <% include('select-month_year.html', %opt ) %>
+
+% unless ( $opt{'js_only'} ) {
+ </TD>
+ </TR>
+% }
+<%init>
+
+my %opt = @_;
+
+my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
+
+my $colspan = $opt{'colspan'} ? 'COLSPAN="'.$opt{'colspan'}.'"' : '';
+
+</%init>
diff --git a/httemplate/view/cust_main.cgi b/httemplate/view/cust_main.cgi
index 430c50c5f..391988190 100755
--- a/httemplate/view/cust_main.cgi
+++ b/httemplate/view/cust_main.cgi
@@ -147,7 +147,6 @@ function areyousure(href, message) {
% if ( $br ) {
<BR><BR>
% }
-</%doc>
%my $signupurl = $conf->config('signupurl');
%if ( $signupurl ) {