select agent and customer fields on attachment report, RT#81809
[freeside.git] / ng_selfservice / payment_accounts.php
1 <? $title ='Payment Accounts'; include('elements/header.php'); ?>
2 <? $current_menu = 'payment_accounts.php'; include('elements/menu.php'); ?>
3 <H1>My Payment Accounts</H1>
4 <br>
5
6 <?
7 if ( isset($_GET['action']) && $_GET['action'] ) {
8   $action = $_GET['action'];
9 }
10
11 if ($action == 'deleteaccount') {
12
13     if ( isset($_GET['paybynum']) && $_GET['paybynum'] ) {
14       if ( preg_match( '/^(\d+)$/', $_GET['paybynum'] ) ) {
15         $paybynum = $_GET['paybynum'];
16         $error = $freeside->delete_payby( array(
17           'session_id' => $_COOKIE['session_id'],
18           'custpaybynum' => $paybynum,
19         ) );
20       }
21       else {
22         $error['error'] = 'Bad Payby Number';
23       }
24     }
25
26   if ( isset($error['error']) && $error['error'] ) {
27     $error = $error['error'];
28   }
29   else {
30     $error = "Account " . $paybynum . " Deleted";
31   }
32
33 ?>
34    <FONT COLOR="red"><? echo $error ?></FONT>
35    <P>
36 <?
37 }
38
39   $payment_info = $freeside->list_payby( array(
40     'session_id' => $_COOKIE['session_id'],
41   ) );
42
43   if ( isset($payment_info['error']) && $payment_info['error'] ) {
44     $error = $payment_info['error'];
45     header('Location:index.php?error='. urlencode($error));
46     die();
47   }
48
49   extract($payment_info);
50 ?>
51
52 <TABLE>
53  <TR>
54    <TD>&nbsp;</TD>
55    <TD>Type</TD>
56    <TD>Account Type</TD>
57    <TD>Account Mask</TD>
58    <TD>Bank Name</TD>
59  </TR>
60
61 <?
62   foreach ($payby as $payaccount) {
63 ?>
64     <TR>
65       <TD><A HREF="payment_accounts.php?action=deleteaccount&paybynum=<? echo $payaccount['custpaybynum'] ?>">delete</A></TD>
66       <TD><? echo $payaccount['payby'] ?></TD>
67       <TD><? echo $payaccount['paytype'] ?></TD>
68       <TD><? echo $payaccount['paymask'] ?></TD>
69       <TD><? echo htmlspecialchars($payaccount['payname']) ?></TD>
70      </TR>
71  <?
72   }
73  ?>
74
75 </TABLE>
76
77 <? include('elements/menu_footer.php'); ?>
78 <? include('elements/footer.php'); ?>