diff options
author | Ivan Kohler <ivan@freeside.biz> | 2017-10-14 17:04:23 -0700 |
---|---|---|
committer | Ivan Kohler <ivan@freeside.biz> | 2017-10-14 17:04:23 -0700 |
commit | 5dabafc5e63ae7559ca6d2867e653660b981e639 (patch) | |
tree | 4321703a47774935cd941a3a5764bf4b733f2ccf | |
parent | 5ac72e74de9e105c8952eee7cf905ab9116926e1 (diff) | |
parent | fba604e65e810922ce0269cc887b5c57ce135352 (diff) |
Merge branch 'master' of git.freeside.biz:/home/git/freeside
-rw-r--r-- | FS/FS/ClientAPI/MyAccount.pm | 28 | ||||
-rw-r--r-- | FS/FS/cust_payby.pm | 5 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/change_check_pay.html | 23 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/change_creditcard_pay.html | 23 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/myaccount_menu.html | 7 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/process_change_check_pay.html | 3 | ||||
-rw-r--r-- | fs_selfservice/FS-SelfService/cgi/process_change_creditcard_pay.html | 3 | ||||
-rwxr-xr-x | fs_selfservice/FS-SelfService/cgi/selfservice.cgi | 113 | ||||
-rw-r--r-- | httemplate/docs/license.html | 4 | ||||
-rw-r--r-- | httemplate/elements/header-logo.html | 114 | ||||
-rw-r--r-- | httemplate/misc/confirm-censustract.html | 2 | ||||
-rw-r--r-- | httemplate/misc/openmap.html | 17 |
12 files changed, 308 insertions, 34 deletions
diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index a10a452..ce887ef 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -882,6 +882,7 @@ sub payment_info { if ($cust_payby) { $return{payname} = $cust_payby->payname || ( $cust_main->first. ' '. $cust_main->get('last') ); + $return{custpaybynum} = $cust_payby->custpaybynum; if ( $cust_payby->payby =~ /^(CARD|DCRD)$/ ) { $return{card_type} = cardtype($cust_payby->payinfo); @@ -1674,14 +1675,15 @@ sub insert_payby { #XXX payinfo1 + payinfo2 for CHEK? #or take the opportunity to use separate, more well- named fields? - # my $payinfo; - # $p->{'payinfo1'} =~ /^([\dx]+)$/ - # or return { 'error' => "illegal account number ". $p->{'payinfo1'} }; - # my $payinfo1 = $1; - # $p->{'payinfo2'} =~ /^([\dx\.]+)$/ # . turned on by echeck-country CA ? - # or return { 'error' => "illegal ABA/routing number ". $p->{'payinfo2'} }; - # my $payinfo2 = $1; - # $payinfo = $payinfo1. '@'. $payinfo2; + if ($p->{'payby'} eq 'CHEK') { + $p->{'payinfo1'} =~ /^([\dx]+)$/ + or return { 'error' => "illegal account number ". $p->{'payinfo1'} }; + my $payinfo1 = $1; + $p->{'payinfo2'} =~ /^([\dx\.]+)$/ # . turned on by echeck-country CA ? + or return { 'error' => "illegal ABA/routing number ". $p->{'payinfo2'} }; + my $payinfo2 = $1; + $p->{'payinfo'} = $payinfo1. '@'. $payinfo2; + } my $cust_payby = new FS::cust_payby { 'custnum' => $custnum, @@ -1705,6 +1707,16 @@ sub update_payby { my($context, $session, $custnum) = _custoragent_session_custnum($p); return { 'error' => $session } if $context eq 'error'; + if ($p->{'payby'} eq 'CHEK') { + $p->{'payinfo1'} =~ /^([\dx]+)$/ + or return { 'error' => "illegal account number ". $p->{'payinfo1'} }; + my $payinfo1 = $1; + $p->{'payinfo2'} =~ /^([\dx\.]+)$/ # . turned on by echeck-country CA ? + or return { 'error' => "illegal ABA/routing number ". $p->{'payinfo2'} }; + my $payinfo2 = $1; + $p->{'payinfo'} = $payinfo1. '@'. $payinfo2; + } + my $cust_payby = qsearchs('cust_payby', { 'custnum' => $custnum, 'custpaybynum' => $p->{'custpaybynum'}, diff --git a/FS/FS/cust_payby.pm b/FS/FS/cust_payby.pm index fd90597..704741f 100644 --- a/FS/FS/cust_payby.pm +++ b/FS/FS/cust_payby.pm @@ -159,8 +159,9 @@ sub insert { local $FS::UID::AutoCommit = 0; my $dbh = dbh; - my $error = $self->check_payinfo_cardtype - || $self->SUPER::insert; + my $error = $self->check_payinfo_cardtype if $self->payby =~/^(CARD|DCRD)$/; + $self->SUPER::insert unless $error; + if ( $error ) { $dbh->rollback if $oldAutoCommit; return $error; diff --git a/fs_selfservice/FS-SelfService/cgi/change_check_pay.html b/fs_selfservice/FS-SelfService/cgi/change_check_pay.html new file mode 100644 index 0000000..7dd2583 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/change_check_pay.html @@ -0,0 +1,23 @@ +<%= include('header', 'Change ach payment information') %> + +<%= if ( $error ) { + $OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">Error: $error</FONT><BR><BR>!; + } ''; %> + +<FORM NAME="OneTrueForm" METHOD="POST" ACTION="<%=$selfurl%>" onSubmit="document.OneTrueForm.process.disabled=true"> + + <TABLE BGCOLOR="#cccccc"> + <INPUT TYPE="hidden" NAME="payby" VALUE="CHEK"> + <%= include('check') %> + <TR><TD COLSPAN=3> + <INPUT TYPE="checkbox" NAME="auto" VALUE="1">Charge future payments to this card automatically + </TD></TR> + </TABLE> + + <INPUT TYPE="hidden" NAME="action" VALUE="process_change_check_pay"> + <INPUT TYPE="hidden" NAME="custpaybynum" VALUE="<%=$custpaybynum%>"> + <BR> + <!-- onClick="this.disabled=true"> --> + <INPUT TYPE="submit" NAME="process" VALUE="Save payment information"> + +<%= include('footer') %>
\ No newline at end of file diff --git a/fs_selfservice/FS-SelfService/cgi/change_creditcard_pay.html b/fs_selfservice/FS-SelfService/cgi/change_creditcard_pay.html new file mode 100644 index 0000000..cce5559 --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/change_creditcard_pay.html @@ -0,0 +1,23 @@ +<%= include('header', 'Change credit card payment information') %> + +<%= if ( $error ) { + $OUT .= qq!<FONT SIZE="+1" COLOR="#ff0000">Error: $error</FONT><BR><BR>!; + } ''; %> + +<FORM NAME="OneTrueForm" METHOD="POST" ACTION="<%=$selfurl%>" onSubmit="document.OneTrueForm.process.disabled=true"> + + <TABLE BGCOLOR="#cccccc"> + <INPUT TYPE="hidden" NAME="payby" VALUE="CARD"> + <%= include('card') %> + <TR><TD COLSPAN=3> + <INPUT TYPE="checkbox" NAME="auto" VALUE="1">Charge future payments to this card automatically + </TD></TR> + </TABLE> + + <INPUT TYPE="hidden" NAME="action" VALUE="process_change_creditcard_pay"> + <INPUT TYPE="hidden" NAME="custpaybynum" VALUE="<%=$custpaybynum%>"> + <BR> + <!-- onClick="this.disabled=true"> --> + <INPUT TYPE="submit" NAME="process" VALUE="Save payment information"> + +<%= include('footer') %>
\ No newline at end of file diff --git a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html index 6af5e5e..1bc35e3 100644 --- a/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html +++ b/fs_selfservice/FS-SelfService/cgi/myaccount_menu.html @@ -93,9 +93,10 @@ push @menu, unless ( $access_pkgnum ) { push @menu, - { title=>'Change billing address', url=>'change_bill', indent=>2 }, - { title=>'Change service address', url=>'change_ship', indent=>2 }, - { title=>'Change payment information', url=>'change_pay', indent=>2 }, + { title=>'Change billing address', url=>'change_bill', indent=>2 }, + { title=>'Change service address', url=>'change_ship', indent=>2 }, + { title=>'Change credit card information', url=>'change_creditcard_pay', indent=>2 }, + { title=>'Change check information', url=>'change_check_pay', indent=>2 }, ; } diff --git a/fs_selfservice/FS-SelfService/cgi/process_change_check_pay.html b/fs_selfservice/FS-SelfService/cgi/process_change_check_pay.html new file mode 100644 index 0000000..a1ad60c --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/process_change_check_pay.html @@ -0,0 +1,3 @@ +<%= include('header', 'ACH information updated successfully' ) %> +<FONT SIZE=4>Ach information updated successfully.</FONT> +<%= include('footer') %>
\ No newline at end of file diff --git a/fs_selfservice/FS-SelfService/cgi/process_change_creditcard_pay.html b/fs_selfservice/FS-SelfService/cgi/process_change_creditcard_pay.html new file mode 100644 index 0000000..c95e09a --- /dev/null +++ b/fs_selfservice/FS-SelfService/cgi/process_change_creditcard_pay.html @@ -0,0 +1,3 @@ +<%= include('header', 'Information updated successfully' ) %> +<FONT SIZE=4>Information updated successfully.</FONT> +<%= include('footer') %>
\ No newline at end of file diff --git a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi index cd9e32c..6cf264c 100755 --- a/fs_selfservice/FS-SelfService/cgi/selfservice.cgi +++ b/fs_selfservice/FS-SelfService/cgi/selfservice.cgi @@ -12,8 +12,8 @@ use Date::Format; use Date::Parse 'str2time'; use Number::Format 1.50; use FS::SelfService qw( - access_info login_info login customer_info edit_info invoice - payment_info process_payment realtime_collect process_prepay + access_info login_info login customer_info edit_info insert_payby update_payby + invoice payment_info process_payment realtime_collect process_prepay list_pkgs order_pkg signup_info order_recharge part_svc_info provision_acct provision_external provision_phone provision_forward unprovision_svc change_pkg suspend_pkg domainselector @@ -59,6 +59,10 @@ my @actions = ( qw( change_bill change_ship change_pay + change_creditcard_pay + change_check_pay + process_change_creditcard_pay + process_change_check_pay process_change_bill process_change_ship process_change_pay @@ -261,19 +265,30 @@ sub myaccount { customer_info( 'session_id' => $session_id ); } -sub change_bill { my $payment_info = - payment_info( 'session_id' => $session_id ); - return $payment_info if ( $payment_info->{'error'} ); - my $customer_info = - customer_info( 'session_id' => $session_id ); - return { - %$payment_info, - %$customer_info, - }; - } +sub change_bill { + my $payby = shift; + my $payment_info; + if ($payby) { + $payment_info = payment_info( 'session_id' => $session_id, 'payment_payby' => $payby, ); + } + else { + $payment_info = payment_info( 'session_id' => $session_id, ); + } + + return $payment_info if ( $payment_info->{'error'} ); + my $customer_info = + customer_info( 'session_id' => $session_id ); + return { + %$payment_info, + %$customer_info, + }; +} sub change_ship { change_bill(@_); } sub change_pay { change_bill(@_); } +sub change_creditcard_pay { change_bill('CARD'); } +sub change_check_pay { change_bill('CHEK'); } + sub _process_change_info { my ($erroraction, @fields) = @_; @@ -298,6 +313,56 @@ sub _process_change_info { } } +sub _process_change_payby { + my ($erroraction, @fields) = @_; + + my $results = ''; + + $results ||= update_payby ( + 'session_id' => $session_id, + map { ($_ => $cgi->param($_)) } grep { defined($cgi->param($_)) } @fields, + ); + + + if ( $results->{'error'} ) { + no strict 'refs'; + $action = $erroraction; + return { + $cgi->Vars, + %{&$action()}, + 'error' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>', + }; + } else { + return $results; + } +} + +sub _process_insert_payby { + my ($erroraction, @fields) = @_; + + my $results = ''; + + $results ||= insert_payby ( + 'session_id' => $session_id, + map { ($_ => $cgi->param($_)) } grep { defined($cgi->param($_)) } @fields, + ); + + ## check error + + + if ( $results->{'error'} ) { + no strict 'refs'; + $action = $erroraction; + return { + $cgi->Vars, + %{&$action()}, + 'error' => '<FONT COLOR="#FF0000">'. $results->{'error'}. '</FONT>', + }; + } else { + return $results; + } +} + sub process_change_bill { _process_change_info( 'change_bill', qw( first last company address1 address2 city state @@ -342,6 +407,30 @@ sub process_change_pay { _process_change_info( 'change_pay', @list ); } +sub process_change_creditcard_pay { + my $payby = $cgi->param( 'payby' ); + $cgi->param('paydate', $cgi->param('year') . '-' . $cgi->param('month') . '-01'); + my @list = + qw( payby payinfo payinfo1 payinfo2 paydate payname custpaybynum + address1 address2 city county state zip country auto paytype + paystate ss stateid stateid_state invoicing_list + ); + if ($cgi->param( 'custpaybynum' )) { _process_change_payby( 'change_creditcard_pay', @list ); } + else { _process_insert_payby( 'change_creditcard_pay', @list ); } +} + +sub process_change_check_pay { + my $payby = $cgi->param( 'payby' ); + #$cgi->param('paydate', '2039-12-01'); + my @list = + qw( payby payinfo payinfo1 payinfo2 paydate payname custpaybynum + address1 address2 city county state zip country auto paytype + paystate ss stateid stateid_state invoicing_list + ); + if ($cgi->param( 'custpaybynum' )) { _process_change_payby( 'change_check_pay', @list ); } + else { _process_insert_payby( 'change_check_pay', @list ); } +} + sub view_invoice { $cgi->param('invnum') =~ /^(\d+)$/ or die "illegal invnum"; diff --git a/httemplate/docs/license.html b/httemplate/docs/license.html index 91fbbe2..570f503 100644 --- a/httemplate/docs/license.html +++ b/httemplate/docs/license.html @@ -148,6 +148,10 @@ under the terms of the MIT license. Contains the form validation jQuery plugin <a href="https://jqueryvalidation.org/">jQuery Validation</a> by Jörn Zaefferer, licensed under the terms of MIT License. +<P> +Contains the leaflet JavaScript library <a href="http://leafletjs.com/">Leaflet JS</a> by Vladimir Agafonkin, +licensed under the terms of MIT License. + <!-- artwork --> <P> diff --git a/httemplate/elements/header-logo.html b/httemplate/elements/header-logo.html new file mode 100644 index 0000000..f272c56 --- /dev/null +++ b/httemplate/elements/header-logo.html @@ -0,0 +1,114 @@ +<%doc> + +Example: + + <& /elements/header-logo.html', + { + 'title' => 'Title', + 'menubar' => \@menubar, + 'etc' => '', #included in <BODY> tag, for things like onLoad= + 'head' => '', #included before closing </HEAD> tag + 'nobr' => 0, #1 for no <BR><BR> after the title + 'no_jquery' => #for use from RT, which loads its own + } + &> + +</%doc> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +%#<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +%# above is what RT declares, should we switch now? hopefully no glitches result +%# or just fuck it, XHTML died anyway, HTML 5 or bust? +<HTML> + <HEAD> + <TITLE> + <% encode_entities($title) || $title_noescape |n %> + </TITLE> + <!-- per RT, to prevent IE compatibility mode --> + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> + <!-- The X-UA-Compatible <meta> tag above must be very early in <head> --> + <META HTTP-Equiv="Cache-Control" Content="no-cache"> + <META HTTP-Equiv="Pragma" Content="no-cache"> + <META HTTP-Equiv="Expires" Content="0"> +% if ( $mobile ) { + <META NAME="viewport" content="width=device-width height=device-height user-scalable=yes"> +% } + +% unless ( $nocss ) { + <link href="<%$fsurl%>elements/freeside.css" type="text/css" rel="stylesheet"> + <link href="<%$fsurl%>elements/freeside-print.css" type="text/css" rel="stylesheet" media="print"> +% } + +% unless ( $no_jquery ) { + <link rel="stylesheet" href="<% $fsurl %>elements/jquery-ui.min.css"> + <SCRIPT SRC="<% $fsurl %>elements/jquery.js"></SCRIPT> + <SCRIPT SRC="<% $fsurl %>elements/jquery-ui.min.js"></SCRIPT> + <SCRIPT SRC="<% $fsurl %>elements/jquery.validate.min.js"></SCRIPT> +% if ( $FS::CurrentUser::CurrentUser->option('printtofit') ) { + <SCRIPT SRC="<% $fsurl %>elements/printtofit.js"></SCRIPT> +% } +% } + <% include('init_overlib.html') |n %> + <% include('rs_init_object.html') |n %> + <script type="text/javascript" src="<% $fsurl %>elements/topreload.js"></script> + <% $head |n %> + +%# announce our base path, and the Mason comp path of this page + <script type="text/javascript"> + window.fsurl = <% $fsurl |js_string %>; + window.request_comp_path = <% $m->request_comp->path |js_string %>; + </script> + + </HEAD> + <BODY BGCOLOR="#f8f8f8" <% $etc |n %> STYLE="margin-top:0; margin-bottom:0; margin-left:0px; margin-right:0px"> + <table width="100%" CELLPADDING=0 CELLSPACING=0 STYLE="padding-left:0px; padding-right:4px" CLASS="fshead"> + <tr> + <td BGCOLOR="#ffffff"><% $company_url ? qq(<A HREF="$company_url">) : '' |n %><IMG BORDER=0 ALT="freeside" HEIGHT="36" SRC="<%$fsurl%>view/REAL_logo.cgi"><% $company_url ? '</A>' : '' |n %></td> + <td align=left BGCOLOR="#ffffff"> <!-- valign="top" --> + <font size=6><% $company_name || 'ExampleCo' %></font> + </td> + </tr> + </table> + +<%init> + +my( $title, $title_noescape, $menubar, $etc, $head ) = ( '', '', '', '', '' ); +my( $nobr, $nocss, $no_jquery ) = ( 0, 0, 0 ); + +my $mobile; + +my $opt = shift; +$title = $opt->{title}; +$title_noescape = $opt->{title_noescape}; +$menubar = $opt->{menubar}; +$etc = $opt->{etc}; +$head = $opt->{head}; +$nobr = $opt->{nobr}; +$nocss = $opt->{nocss}; +$mobile = $opt->{mobile}; +$no_jquery = $opt->{no_jquery}; + +my $conf = new FS::Conf; + +my $curuser = $FS::CurrentUser::CurrentUser; + +my $menu_position = $curuser->option('menu_position') + || 'top'; #new default for 1.9 + +if ( !defined($mobile) ) { + $mobile = $curuser->option('mobile_menu',1) && FS::UI::Web::is_mobile(); +} +if ( $cgi->param('mobile') =~ /^(\d)$/ ) { # allow client to override + $mobile = $1; +} + +my($company_name, $company_url); +my @agentnums = $curuser->agentnums; +if ( scalar(@agentnums) == 1 ) { + $company_name = $conf->config('company_name', $agentnums[0] ); + $company_url = $conf->config('company_url', $agentnums[0] ); +} else { + $company_name = $conf->config('company_name'); + $company_url = $conf->config('company_url'); +} + +</%init>
\ No newline at end of file diff --git a/httemplate/misc/confirm-censustract.html b/httemplate/misc/confirm-censustract.html index b491d49..0f115e5 100644 --- a/httemplate/misc/confirm-censustract.html +++ b/httemplate/misc/confirm-censustract.html @@ -16,7 +16,7 @@ Confirm census tract <% $location{address1} |h %> <% $location{address2} |h %><BR> <% $location{city} |h %>, <% $location{state} |h %> <% $location{zip} |h %><BR> <BR> -% my $querystring = "census_year=$year&address=$location{address1}, $location{address2}, $location{city}, $location{state}, $location{zip}"; +% my $querystring = "census_year=$year&address=$location{address1}, $location{address2}, $location{city}, $location{state}"; <A HREF="<%$p%>misc/openmap.html?<% $querystring %>" TARGET="_blank">Map service module location</A><BR> % $querystring = "census_year=$year&pre=$pre&zip_code=" . $cache->get('zip'); diff --git a/httemplate/misc/openmap.html b/httemplate/misc/openmap.html index 6ccc724..73f1071 100644 --- a/httemplate/misc/openmap.html +++ b/httemplate/misc/openmap.html @@ -1,11 +1,7 @@ -<html> -<head> - <title>Find Census Tract Map</title> - <link rel="stylesheet" href="elements/leaflet/leaflet.css"/> - <script src="elements/leaflet/leaflet.js"></script> -</head> -<body> - <h1>Please select your location on the map</h1> +<& /elements/header-logo.html, { title => 'Find Census Tract Map', head => $head, } &> + +<P><h1>Please select your location on the map</h1></P> +<P> </P> <table> <tr> <td valign=top> @@ -79,6 +75,11 @@ local $SIG{__DIE__}; #disable Mason error trap my $DEBUG = 0; +my $head = ' + <link rel="stylesheet" href="elements/leaflet/leaflet.css"/> + <script src="elements/leaflet/leaflet.js"></script> +'; + my $census_year = $cgi->param('census_year'); my $pre = $cgi->param('pre'); my $zip_code = $cgi->param('zip_code'); |