From 5cfe4a2d5a299af5af44b249e12f114c9c886850 Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 19 Apr 2017 10:53:49 -0700 Subject: [PATCH] wordpress plugin, RT#75279 --- FS/FS/ClientAPI/MyAccount.pm | 1 + FS/FS/cust_main.pm | 14 +++++++++++ fs_selfservice/wordpress/README.txt | 8 +++--- fs_selfservice/wordpress/example_selfservice.php | 20 ++++++--------- fs_selfservice/wordpress/freeside_selfservice.php | 4 +-- fs_selfservice/wordpress/view_invoice.php | 30 +++++++++++++++++++++++ 6 files changed, 58 insertions(+), 19 deletions(-) create mode 100644 fs_selfservice/wordpress/view_invoice.php diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm index e69122bcf..807200603 100644 --- a/FS/FS/ClientAPI/MyAccount.pm +++ b/FS/FS/ClientAPI/MyAccount.pm @@ -593,6 +593,7 @@ sub customer_info_short { or return { 'error' => "customer_info_short: unknown custnum $custnum" }; $return{display_custnum} = $cust_main->display_custnum; + $return{max_invnum} = $cust_main->max_invnum; if ( $session->{'pkgnum'} ) { $return{balance} = $cust_main->balance_pkgnum( $session->{'pkgnum'} ); diff --git a/FS/FS/cust_main.pm b/FS/FS/cust_main.pm index f4990a418..19a581656 100644 --- a/FS/FS/cust_main.pm +++ b/FS/FS/cust_main.pm @@ -3432,6 +3432,20 @@ sub num_cust_attachments_deleted { ); } +=item max_invnum + +Returns the most recent invnum (invoice number) for this customer. + +=cut + +sub max_invnum { + my $self = shift; + $self->scalar_sql( + " SELECT MAX(invnum) FROM cust_bill WHERE custnum = ?", + $self->custnum + ); +} + =item cust_bill [ OPTION => VALUE... | EXTRA_QSEARCH_PARAMS_HASHREF ] Returns all the invoices (see L) for this customer. diff --git a/fs_selfservice/wordpress/README.txt b/fs_selfservice/wordpress/README.txt index 7e4dbcdc1..759f83963 100644 --- a/fs_selfservice/wordpress/README.txt +++ b/fs_selfservice/wordpress/README.txt @@ -18,8 +18,8 @@ self-service" plugin, and click "Activate". Configuration: -In Wordpress, go to Settings -> General and set "Freeside self-service URL" -to the +In Wordpress, go to Settings -> General and set "Freeside server" +to your Freeside server name or IP address. Freeside configuration: @@ -38,8 +38,8 @@ VPN or tunnel. Usage: -See the included example_login.php, process_login.php and -example_selfservice.php files. These files perform a self-service login +See the included example_login.php, process_login.php, example_selfservice.php +and view_invoice.php files. These files perform a self-service login and display a basic landing page. To use, copy them to the wordpress content directory (or a subdirectory), and point your browser to example_login.php diff --git a/fs_selfservice/wordpress/example_selfservice.php b/fs_selfservice/wordpress/example_selfservice.php index ae588bf28..2bfb5b35c 100644 --- a/fs_selfservice/wordpress/example_selfservice.php +++ b/fs_selfservice/wordpress/example_selfservice.php @@ -4,9 +4,6 @@ require( dirname( __FILE__ ) . '/wp-blog-header.php' ); $freeside = new FreesideSelfService(); -error_log( "COOKIE: ". $_COOKIE['freeside_session_id'] ); -error_log( "COOKIE: ". $GLOBALS['FREESIDE_SESSION_ID'] ); - $customer_info = $freeside->customer_info_short( array( 'session_id' => $_COOKIE['freeside_session_id'], ) ); @@ -22,8 +19,6 @@ extract($customer_info); get_header(); -error_log( "COOKIE: ". $_COOKIE['freeside_session_id'] ); - ?>

Billing

@@ -37,19 +32,21 @@ error_log( "COOKIE: ". $_COOKIE['freeside_session_id'] );

Username

-

me@gmail.com

+

Account Number

Address

-Box 564, Disneyland
-USA +
+' : '' ?> +,
+

Email Address

-

me@gmail.com

+



@@ -60,8 +57,8 @@ USA


-

View my Bill

-

Change Bill Deliver Options

+

View my Bill

+

Change Bill Deliver Options

@@ -70,7 +67,6 @@ USA

Internet

Voice

-