[freeside-commits] branch FREESIDE_3_BRANCH updated. 1b5c30ddf2cf14c5a1196677111a9bd2b8e3521d

Jonathan Prykop jonathan at 420.am
Wed May 20 20:30:36 PDT 2015


The branch, FREESIDE_3_BRANCH has been updated
       via  1b5c30ddf2cf14c5a1196677111a9bd2b8e3521d (commit)
       via  d4241783f38422179fe88e65175995f0d1804e69 (commit)
       via  3f7e500647a77273c083569e6e8caa5f015b55ce (commit)
      from  34c9b9f788546382cfa1164d9039876932475f7c (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 1b5c30ddf2cf14c5a1196677111a9bd2b8e3521d
Author: jonathan <jonathan at freeside.biz>
Date:   Thu May 21 01:54:02 2015 +0000

    RT#28842 NG portal - Changes for prepaid needs [bug fix to hard-coded filename]

diff --git a/ng_selfservice/prepaid.php b/ng_selfservice/prepaid.php
index d9e6a8d..bf941f8 100644
--- a/ng_selfservice/prepaid.php
+++ b/ng_selfservice/prepaid.php
@@ -1,5 +1,5 @@
 <? $title ='Prepaid Card Account Recharge'; include('elements/header.php'); ?>
-<? $current_menu = 'recharge.php'; include('elements/menu.php'); ?>
+<? $current_menu = 'prepaid.php'; include('elements/menu.php'); ?>
 
 <?
 // This page is currently only designed for packages that use prepaid pricing.
@@ -141,7 +141,7 @@ if ($balance != 0) {
 }
 ?>
 
-<FORM NAME="OneTrueForm" METHOD="POST" ACTION="recharge.php" onSubmit="document.OneTrueForm.process.disabled=true">
+<FORM NAME="OneTrueForm" METHOD="POST" ACTION="prepaid.php" onSubmit="document.OneTrueForm.process.disabled=true">
 
 <?
 if ($balance <= 0) {

commit d4241783f38422179fe88e65175995f0d1804e69
Author: jonathan <jonathan at freeside.biz>
Date:   Wed May 20 07:30:08 2015 +0000

    RT#28842: NG portal - Changes for prepaid needs [bug fix for unlimited usage pkgs]

diff --git a/ng_selfservice/prepaid.php b/ng_selfservice/prepaid.php
index 1478400..d9e6a8d 100644
--- a/ng_selfservice/prepaid.php
+++ b/ng_selfservice/prepaid.php
@@ -84,7 +84,7 @@ foreach ($cust_pkg as $pkg) {
   $thissvc['pkgnum'] = $pkg['pkgnum'];
   $thissvc['status'] = $pkg['status'];
   $actsvcs[$thissvc['svcnum']] = $thissvc;
-  if ($thissvc['overlimit']) {
+  if ($thissvc['overlimit'] or ($thissvc['status'] != 'active')) {
     $expsvcs[$thissvc['svcnum']] = $thissvc;
   }
 }

commit 3f7e500647a77273c083569e6e8caa5f015b55ce
Author: jonathan <jonathan at freeside.biz>
Date:   Wed May 20 07:18:38 2015 +0000

    RT#28842: NG portal - Changes for prepaid needs

diff --git a/FS/FS/ClientAPI/MyAccount.pm b/FS/FS/ClientAPI/MyAccount.pm
index b4b60d4..4096344 100644
--- a/FS/FS/ClientAPI/MyAccount.pm
+++ b/FS/FS/ClientAPI/MyAccount.pm
@@ -139,6 +139,7 @@ sub skin_info {
       'logo' => scalar($conf->config_binary('logo.png', $agentnum )),
       ( map { $_ => join("\n", $conf->config("selfservice-$_", $agentnum ) ) }
         qw( head body_header body_footer company_address ) ),
+      'money_char' => $conf->config("money_char") || '$',
       'menu' => join("\n", $conf->config("ng_selfservice-menu", $agentnum ) ) ||
                 'main.php Home
 
diff --git a/ng_selfservice/index.php b/ng_selfservice/index.php
index 540f1f8..62b6562 100644
--- a/ng_selfservice/index.php
+++ b/ng_selfservice/index.php
@@ -30,7 +30,7 @@ if ( $error ) {
     <TD>
       <INPUT TYPE="text" NAME="username" VALUE="<? echo htmlspecialchars($username); ?>"><? if ( $single_domain ) { echo '@'.$single_domain; } ?>
     </TD>
-<  /TR>
+  </TR>
 
   <INPUT TYPE="hidden" NAME="domain" VALUE="<? echo $single_domain ?>">
 
diff --git a/ng_selfservice/prepaid.php b/ng_selfservice/prepaid.php
new file mode 100644
index 0000000..1478400
--- /dev/null
+++ b/ng_selfservice/prepaid.php
@@ -0,0 +1,202 @@
+<? $title ='Prepaid Card Account Recharge'; include('elements/header.php'); ?>
+<? $current_menu = 'recharge.php'; include('elements/menu.php'); ?>
+
+<?
+// This page is currently only designed for packages that use prepaid pricing.
+// Usage limits should be in seconds, and you currently cannot mix packages that have 
+// usage limits with packages that don't.  Payments must be made by prepaid card.
+// The account service must be flagged as primary service of package.
+//
+// You can't change packages if you have a positive balance, but you CAN use 
+// this form to only change package or only use a prepaid card--doing both isn't
+// required.
+
+$prepaid_cardnum = isset($_POST['prepaid_cardnum']) ? $_POST['prepaid_cardnum'] : '';
+$pkgpart = isset($_POST['pkgpart']) ? $_POST['pkgpart'] : '';
+$pkgnum  = isset($_POST['pkgnum']) ? $_POST['pkgnum'] : '';
+$success = '';
+$error   = '';
+
+if ($pkgnum || $pkgpart) {
+  if ($pkgnum && $pkgpart) {
+    $change_results = $freeside->change_pkg(array(
+      'session_id'      => $_COOKIE['session_id'],
+      'pkgpart'         => $pkgpart,
+      'pkgnum'          => $pkgnum,
+    ));
+    if ( isset($change_results['error']) && $change_results['error'] ) {
+      $error = $change_results['error'];
+    } else {
+      $success .= ' Package applied to your account.';
+      $pkgnum = '';
+      $pkgpart = '';
+    }
+  } else if ($pkgnum) {
+    $error = 'No account selected';
+  } else if ($pkgpart) {
+    $error = 'No package selected';
+  }
+}
+
+if ($prepaid_cardnum) {
+  $payment_results = $freeside->process_prepay(array(
+    'session_id'      => $_COOKIE['session_id'],
+    'prepaid_cardnum' => $prepaid_cardnum,
+  ));
+  if ( isset($payment_results['error']) && $payment_results['error'] ) {
+    $error = $payment_results['error'];
+  } else {
+    $success .= ' Prepaid card applied to your account.';
+    $prepaid_cardnum = '';
+  }
+}
+
+$customer_info = $freeside->customer_info_short( array(
+  'session_id' => $_COOKIE['session_id'],
+) );
+if ( isset($customer_info['error']) && $customer_info['error'] ) {
+  $error = $customer_info['error'];
+}
+
+$signup_info = $freeside->signup_info( array('customer_session_id' => $_COOKIE['session_id'], 'keys' => ['part_pkg']) );
+if (isset($signup_info['error']) && $signup_info['error']) {
+  $error = $signup_info['error'];
+}
+
+$list_pkgs = $freeside->list_pkgs( array(
+  'session_id' => $_COOKIE['session_id'],
+) );
+if ( isset($list_pkgs['error']) && $list_pkgs['error'] ) {
+  $error = $list_pkgs['error'];
+}
+
+extract($customer_info);
+extract($signup_info);
+extract($list_pkgs);
+
+$actsvcs = array();
+$expsvcs = array();
+foreach ($cust_pkg as $pkg) {
+  $thissvc = array();
+  $thissvc['svcnum']    = $pkg['primary_cust_svc']['svcnum'];
+  $thissvc['overlimit'] = $pkg['primary_cust_svc']['overlimit'];
+  $thissvc['label']     = $pkg['primary_cust_svc']['label'][1];
+  $thissvc['pkgnum'] = $pkg['pkgnum'];
+  $thissvc['status'] = $pkg['status'];
+  $actsvcs[$thissvc['svcnum']] = $thissvc;
+  if ($thissvc['overlimit']) {
+    $expsvcs[$thissvc['svcnum']] = $thissvc;
+  }
+}
+
+if (count($actsvcs) > 0) {
+  $list_svcs = $freeside->list_svcs( array(
+    'session_id' => $_COOKIE['session_id'],
+  ) );
+  if ( isset($list_svcs['error']) && $list_svcs['error'] ) {
+    $error = $list_svcs['error'];
+  }
+  extract($list_svcs);
+  foreach ($svcs as $svc) {
+    if (isset($actsvcs[$svc['svcnum']])) {
+      $actsvcs[$svc['svcnum']]['seconds'] = strlen($svc['seconds']) ? $svc['seconds'] : 'Unlimited';
+    }
+  }
+}
+
+if ($success) {
+  echo '<P><B>' . $success . '</B></P>';
+}
+include('elements/error.php');
+
+if (count($actsvcs) > 0) {
+?>
+<TABLE STYLE="text-align: left;">
+<TR><TH>Account</TH><TH STYLE="text-align: right;">Seconds Remaining</TH></TR>
+<? 
+  foreach ($actsvcs as $svc) {
+    if ($svc['status'] == 'active') {
+      $slabel = $svc['seconds'];
+    } else {
+      $slabel = '<I>' . ucfirst($svc['status']) . '</I>';
+    }  
+?>
+<TR>
+<TD><? echo $svc['label'] ?></TD>
+<TD STYLE="text-align: right;"><? echo $slabel ?></TD>
+</TR>
+<?
+  }
+?>
+</TABLE>
+<?
+}
+if ($balance != 0) {
+  $blabel = ($balance < 0) ? 'Credit' : 'Balance';
+?>
+
+<P><B><? echo $blabel ?>:</B> <? echo $money_char . abs($balance) ?></P>
+
+<?
+}
+?>
+
+<FORM NAME="OneTrueForm" METHOD="POST" ACTION="recharge.php" onSubmit="document.OneTrueForm.process.disabled=true">
+
+<?
+if ($balance <= 0) {
+  if (count($expsvcs) > 0) {
+?>
+
+<P>
+<B>Select an account to recharge:</B><BR>
+<SELECT NAME="pkgnum">
+<OPTION VALUE=""></OPTION>
+<? foreach ($expsvcs as $svc) { ?>
+<OPTION VALUE="<? echo $svc['pkgnum'] ?>"<? echo $pkgnum == $svc['pkgnum'] ? ' CHECKED' : ''  ?>>
+<?   echo $svc['label'] ?>
+</OPTION>
+<? } ?>
+</SELECT>
+</P>
+
+<P>
+<B>Select a package to add to account</B><BR>
+<SELECT NAME="pkgpart">
+<OPTION VALUE=""></OPTION>
+<? foreach ($part_pkg as $pkg) { ?>
+<OPTION VALUE="<? echo $pkg['pkgpart'] ?>"<? echo $pkgpart == $pkg['pkgpart'] ? ' CHECKED' : ''  ?>>
+<?   echo $pkg['pkg'] . ' - ' . $money_char . $pkg['options']['recur_fee'] ?>
+</OPTION>
+<? } ?>
+</SELECT>
+</P>
+
+<?
+  } else {
+?>
+
+<P>You have no services to recharge at this time.</P>
+
+<?
+  }
+}
+if (($balance > 0) or (count($expsvcs) > 0)) {
+?>
+
+<P>
+<B>Enter prepaid card number:</B><BR>
+<INPUT TYPE="text" NAME="prepaid_cardnum" VALUE="<? echo $prepaid_cardnum ?>">
+</P>
+
+<INPUT TYPE="submit" NAME="submit" VALUE="Submit">
+
+<?
+}
+?>
+
+</FORM>
+
+<? include('elements/menu_footer.php'); ?>
+<? include('elements/footer.php'); ?>
+

-----------------------------------------------------------------------

Summary of changes:
 FS/FS/ClientAPI/MyAccount.pm |    1 +
 ng_selfservice/index.php     |    2 +-
 ng_selfservice/prepaid.php   |  202 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 204 insertions(+), 1 deletion(-)
 create mode 100644 ng_selfservice/prepaid.php




More information about the freeside-commits mailing list