JB_render_box_top(80, $label['candidate_order_confirm']); if ($_REQUEST['action'] == 'membership') { ?> <table width="100%"> <tr> <td> <?php // check to see if there are unpaid orders of the same subscription_id $sql = "select * from membership_invoices where user_id=" . jb_escape_sql($_SESSION['JB_ID']) . " AND user_type='C' AND membership_id='" . jb_escape_sql($_REQUEST['membership_id']) . "' AND (status='in_cart' OR status='Confirmed') "; $result = JB_mysql_query($sql); if (mysql_num_rows($result) > 0) { $row = mysql_fetch_array($result, MYSQL_ASSOC); $invoice_id = $row['invoice_id']; } else { // this is a new order, make a new invoice $invoice_id = JB_place_membership_invoice($_SESSION['JB_ID'], $_REQUEST['membership_id']); } if ($invoice_id !== false) { // delete other in_cart orders $sql = "DELETE FROM membership_invoices WHERE (`status`='in_cart' ) AND `invoice_id` <> '{$invoice_id}' AND user_type = 'C' AND `user_id`='" . jb_escape_sql($_SESSION['JB_ID']) . "' "; $result = JB_mysql_query($sql); JB_display_membership_invoice($invoice_id); ?> </td> <td width="100%"> <p align="center"> <input type="button" class="pay_button" value="<?php echo $label['c_membership_trn_confirm']; ?>
<input type="button" value="New Invoice" onclick="window.location='membership_report.php?new=1'"> <?php if ($_REQUEST['new'] != '') { //echo "<p>New Invoice"; if ($_REQUEST['go'] != '') { if ($_REQUEST['user_id'] == '') { $error = "<p>Error: User account not selected...</p>"; } if ($_REQUEST['membership_id'] == '') { $error = "<p>Error: Membership not selected...</p>"; } if ($error != '') { echo $error; } else { JB_place_membership_invoice($_REQUEST['user_id'], $_REQUEST['membership_id']); $_REQUEST['new'] = ''; $JBMarkup->ok_msg('New invoice added.'); } } if ($_REQUEST['new'] != '') { ?> <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?> ?action=post" > <input type="hidden" name="new" value="<?php echo jb_escape_html($_REQUEST['new']); ?> ">