Пример #1
0
    $invoice_row = JB_get_membership_invoice_row($_REQUEST['invoice_id']);
    JB_expire_membership($invoice_row, $send_email = false);
    $JBMarkup->ok_msg('Subscription expired');
}
if ($_REQUEST['reactivate'] != '') {
    $invoice_row = JB_get_membership_invoice_row($_REQUEST['invoice_id']);
    $now = gmdate("Y-m-d H:i:s");
    $sql = "UPDATE membership_invoices SET `status`='Completed', `processed_date`='{$now}' WHERE invoice_id='" . jb_escape_sql($_REQUEST['invoice_id']) . "'";
    $result = JB_mysql_query($sql) or JB_mail_error("[{$sql}]" . mysql_error());
    JB_start_membership($invoice_row);
    $JBMarkup->ok_msg('Subscription reactivated');
}
if ($_REQUEST['save'] != '') {
    $invoice_row = JB_get_membership_invoice_row($_REQUEST['invoice_id']);
    $sql = "UPDATE membership_invoices SET amount='" . jb_escape_sql($_REQUEST['amount']) . "',  item_name='" . jb_escape_sql($_REQUEST['item_name']) . "', payment_method='" . jb_escape_sql($_REQUEST['payment_method']) . "' WHERE invoice_id='" . jb_escape_sql($_REQUEST['invoice_id']) . "'";
    $result = JB_mysql_query($sql) or JB_mail_error("[{$sql}]" . mysql_error());
    $JBMarkup->ok_msg('Subscription modified');
}
?>
<h3>Modify a Subscription</h3>
<?php 
$invoice_row = JB_get_membership_invoice_row($_REQUEST['invoice_id']);
if (strtolower($invoice_row['payment_method']) == 'paypal') {
    $disabled = ' disabled ';
}
?>
	<form method="post" action="member_modify.php" class="dynamic_form" id='dynamic_form'>
	   <table border="0" id="invoice" cellpadding="3"  cellspacing="0">
	  
		<tr> 
		   <td class="dynamic_form_field"><?php 
Пример #2
0
function JB_update_memberships()
{
    // get all the expired invoices
    $now = gmdate("Y-m-d H:i:s");
    // +3600 add 1 hour, this ads an additional hour to the membership so that PayPal IPN and other have a chance to renew the invoice.
    $sql = "SELECT * FROM membership_invoices WHERE ((`status`='Completed' ) OR ((`status`='Pending') AND `reason`='jb_credit_advanced')) AND  (UNIX_TIMESTAMP(`member_end`)+3600 < UNIX_TIMESTAMP('{$now}')) AND months_duration > 0 ";
    $invoice_result = JB_mysql_query($sql) or JB_mail_error(mysql_error() . $sql);
    while ($invoice_row = mysql_fetch_array($invoice_result)) {
        JB_expire_membership($invoice_row);
    }
}
Пример #3
0
function JB_reverse_membership_invoice($invoice_id, $reason)
{
    $invoice_row = JB_get_membership_invoice_row($invoice_id);
    if ($invoice_row['status'] == 'Completed') {
        $sql = "UPDATE membership_invoices SET `status`='Reversed', reason='" . jb_escape_sql($reason) . "' WHERE invoice_id='" . jb_escape_sql($invoice_id) . "'";
        $result = JB_mysql_query($sql) or JB_mail_error("[{$sql}]" . mysql_error());
        // Deactivate the memberships:
        if ($invoice_row['user_type'] == 'E') {
            // employers
            $sql = "UPDATE `employers` SET  membership_active = 'N' WHERE ID='" . jb_escape_sql($invoice_row['user_id']) . "' ";
            JB_mysql_query($sql) or JB_mail_error("[{$sql}]" . mysql_error());
        } elseif ($invoice_row['user_type'] == 'C') {
            // candidates
            $sql = "UPDATE `users` SET  membership_active = 'N' WHERE ID='" . jb_escape_sql($invoice_row['user_id']) . "' ";
            JB_mysql_query($sql) or JB_mail_error("[{$sql}]" . mysql_error());
        }
        JB_stop_membership($invoice_row);
    }
}