예제 #1
0
</font></td>
	<td><b><font face="Arial" size="2"><?php 
            echo $show_balance;
            ?>
</font></b></td>
	
</tr>

  <?php 
        }
        ?>

  </table>

  <h3>Total Balance: <?php 
        echo JB_format_currency($balance, DEFAULT_CURR);
        ?>
</h3>
  <form method="post" action="<?php 
        echo htmlentities($_SERVER['PHP_SELF']) . "?" . $date_link;
        ?>
" >
		<input type="submit" name="clean_up" onclick="if (!confirmLink(this, 'Delete all Void, are you sure?')) return false; " value="Delete all Void">
  </form>
  

  <?php 
    } else {
        echo "No Orders found.";
    }
    echo "<hr>";
예제 #2
0
function JB_convert_to_default_currency_formatted($cur_code, $amount)
{
    if (func_num_args() > 2) {
        $show_code = func_get_arg(2);
    }
    if (func_num_args() > 3) {
        $from_rate = func_get_arg(3);
    }
    if ($from_rate == '') {
        $sql = "SELECT * from currencies WHERE code='" . jb_escape_sql($cur_code) . "' ";
        $result = JB_mysql_query($sql) or die(mysql_error());
        $row = mysql_fetch_array($result, MYSQL_ASSOC);
        $from_rate = $row['rate'];
    }
    $sql = "SELECT * from currencies WHERE is_default='Y' ";
    $result = JB_mysql_query($sql) or die(mysql_error());
    $row = mysql_fetch_array($result, MYSQL_ASSOC);
    $to_rate = $row['rate'];
    $to_code = $row['code'];
    $to_decimal_places = $row['decimal_places'];
    if ($from_rate == 0) {
        $from_rate = 1;
    }
    // on older vesions the currency may be blank...
    $new_amount = $amount * $to_rate / $from_rate;
    $new_amount = round($new_amount, $to_decimal_places);
    return JB_format_currency($new_amount, $to_code, $show_code);
}
예제 #3
0
function JB_get_list_template_value($field, $val, $admin, $form_id = 1)
{
    $LM =& JB_get_ListMarkupObject($form_id);
    $Form =& JB_get_DynamicFormObject($form_id);
    // it is assumed that this function is called in 'view' mode
    // the viewer id and type is unknown so null is passed
    if ($Form->process_field_restrictions($field, null, null, $admin)) {
        // Its a restricted field, eg anonymous, blocked or member's only
        return $Form->get_value($field['field_id']);
    }
    switch ($field['field_type']) {
        case 'TIME':
            // convert timestamp to local time zone
            // using the raw value stored in the record
            if ($val != '0000-00-00 00:00:00') {
                $val = JB_get_local_time($Form->get_value($field['field_id']) . ' GMT');
            }
            break;
        case 'EDITOR':
            $val = strip_tags($val);
            $val = jb_escape_html($val);
            if (!$admin) {
                $val = JB_email_at_replace($val);
            }
            break;
        case 'IMAGE':
            if (JB_image_thumb_file_exists($Form->get_value($field['field_id']))) {
                $val = $LM->get_img_html($Form->get_value($field['field_id']));
            }
            break;
        case "CURRENCY":
            if ($val > 0) {
                $val = JB_escape_html(JB_format_currency($Form->get_value($field['field_id']), JB_get_default_currency()));
            } else {
                $val = '';
            }
            break;
        case "CATEGORY":
            $val = jb_escape_html(JB_getCatName($Form->get_value($field['field_id'])));
            break;
        case "RADIO":
            $val = jb_escape_html(JB_getCodeDescription($field['field_id'], $Form->get_value($field['field_id'])));
            break;
        case "SELECT":
            $val = jb_escape_html(JB_getCodeDescription($field['field_id'], $Form->get_value($field['field_id'])));
            break;
        case "MSELECT":
        case "CHECK":
            $vals = explode(",", $Form->get_value($field['field_id']));
            $comma = '';
            $str = '';
            if (sizeof($vals) > 0) {
                foreach ($vals as $v) {
                    $str .= $comma . jb_escape_html(JB_getCodeDescription($field['field_id'], $v));
                    $comma = ", ";
                }
            }
            $val = $str;
            break;
        case "DATE":
        case "DATE_CAL":
            if ($val != '0000-00-00 00:00:00') {
                $val = JB_get_local_time($Form->get_value($field['field_id']) . " GMT");
                $val = JB_get_formatted_date($val);
            } else {
                $val = '';
            }
            break;
        case "SKILL_MATRIX":
            $sql = "SELECT name FROM skill_matrix_data where object_id='" . JB_escape_sql($Form->get_value('resume_id')) . "' ";
            $result = JB_mysql_query($sql) or die(mysql_error());
            $val = '';
            $comma = '';
            while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
                $val .= $comma . $row['name'];
                $comma = ", ";
            }
            break;
        default:
            // plugins can alter the data in the cell to be
            // be presented on the list in a custom manner
            $args = array('val' => &$val, 'has_changed' => false, 'field' => &$field, 'form_id' => $form_id, 'data' => $Form->get_values());
            JBPLUG_do_callback('get_list_template_value', $args);
            // This hook was added in 3.6, allows plugins to modify the cell data based on $field, eg. $field['field_type'], the plugin should set 'has_changed' to true if the data in 'val' was changed.
            if ($args['has_changed']) {
                // has it changed?
                return $val;
            }
            // if not modified by plugin
            $val = jb_escape_html($val);
            if (!$admin) {
                $val = JB_email_at_replace($val);
            }
    }
    return $val;
}
예제 #4
0
            ?>
							<span class="style1"><?php 
            echo jb_escape_html($row['name']);
            ?>
</span>
							<?php 
        }
        ?>
						</td><td>
							<?php 
        if ($mode == 'edit') {
            echo "<input type='text' name='package_price' value='" . $row['price'] . "'>";
        } else {
            ?>
							<span class="style1"><?php 
            echo JB_format_currency($row['price'], $row['currency_code']);
            ?>
</span>
							<?php 
        }
        ?>
						</td>
						<td>
							<?php 
        if ($mode == 'edit') {
            echo "<select name='package_currency'>";
            JB_currency_option_list($row['currency_code']);
            //echo "<input type='text' name='package_currency' value='".$row['posts_quantity']."'>";
            echo "</select>";
        } else {
            ?>
예제 #5
0
    function process_payment_return()
    {
        global $label;
        if ($_REQUEST['order_id'] != '' && $_REQUEST['nhezk5'] != '') {
            $invoice_id = jb_strip_order_id($_REQUEST['order_id']);
            $product_type = substr($invoice_id, 0, 1);
            // 'P' or 'S'
            $invoice_id = substr($invoice_id, 1);
            if ($_SESSION['JB_ID'] == '') {
                echo "Error: You must be logged in to view this page";
                JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
            } else {
                JBPLUG_do_callback('pay_trn_verification_passed', $invoice_id, $product_type);
                ?>
				
				<div style='background-color: #ffffff; border-color:#C0C0C0; border-style:solid;padding:10px'>
				<p align="center"><center>
				<?php 
                if ($product_type == 'P') {
                    $sql = "SELECT * from package_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } elseif ($product_type == 'S') {
                    $sql = "SELECT * from subscription_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } elseif ($product_type == 'M') {
                    $sql = "SELECT * from membership_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                }
                $result = JB_mysql_query($sql) or die(mysql_error() . $sql);
                $order_row = mysql_fetch_array($result, MYSQL_ASSOC);
                if (BANK_TAX_RATE > 0) {
                    if (BANK_ADD_TAX != 'Y') {
                        // taxes included in prices
                        // work out the tax paid in the amount
                        $tax = $order_row['amount'] - $order_row['amount'] / (1.0 + BANK_TAX_RATE);
                    } else {
                        $tax = $order_row['amount'] * BANK_TAX_RATE;
                        $order_row['amount'] = $order_row['amount'] + $tax;
                        // update the amount on the invoice row
                        if (!does_field_exist("package_invoices", "invoice_tax")) {
                            $sql = "ALTER TABLE `package_invoices` ADD `invoice_tax` FLOAT NOT NULL DEFAULT '0';";
                            mysql_query($sql) or die($sql . mysql_error());
                            $sql = "ALTER TABLE `subscription_invoices` ADD `invoice_tax` FLOAT NOT NULL DEFAULT '0';";
                            mysql_query($sql) or die($sql . mysql_error());
                            $sql = "ALTER TABLE `membership_invoices` ADD `invoice_tax` FLOAT NOT NULL DEFAULT '0';";
                            mysql_query($sql) or die($sql . mysql_error());
                        }
                        if ($product_type == 'P') {
                            $sql = "UPDATE package_invoices SET invoice_tax='" . (0 - $tax) . "', amount = amount + '" . jb_escape_sql($order_row['amount']) . "' WHERE invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' AND invoice_tax != '' ";
                        } elseif ($product_type == 'S') {
                            $sql = "UPDATE subscription_invoices SET invoice_tax='" . (0 - $tax) . "', amount = amount + '" . jb_escape_sql($order_row['amount']) . "' WHERE invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' AND invoice_tax != ''";
                        } elseif ($product_type == 'M') {
                            $sql = "UPDATE membership_invoices SET invoice_tax='" . (0 - $tax) . "', amount = amount + '" . jb_escape_sql($order_row['amount']) . "' WHERE invoice_id='" . jb_escape_sql($invoice_id) . "' and user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "' AND invoice_tax != ''";
                        }
                    }
                }
                if (BANK_ADVANCE_CREDIT == 'YES' && strtolower($order_row['status']) != 'pending') {
                    // place the order as 'pending' and advance the credits
                    if ($product_type == 'P') {
                        // posting credits
                        $order_row = JB_pend_package_invoice($invoice_id, $payment_method = 'bank', $pending_reason = 'jb_credit_advanced');
                        // credit the points to the customer's account
                        JB_add_posting_credits($order_row);
                    }
                    if ($product_type == 'S') {
                        // subscription to view resumes
                        $order_row = JB_pend_subscription_invoice($invoice_id, $payment_method = 'bank', $pending_reason = 'jb_credit_advanced');
                        JB_start_employer_subscription($order_row);
                    }
                    if ($product_type == 'M') {
                        // membership
                        $order_row = JB_pend_membership_invoice($invoice_id, $payment_method = 'bank', $pending_reason = 'jb_credit_advanced');
                        JB_start_membership($order_row);
                    }
                    JBPLUG_do_callback('pay_trn_pending', $invoice_id, $product_type);
                }
                $bank_amount = JB_convert_to_currency($order_row['amount'], $order_row['currency_code'], BANK_CURRENCY);
                $bank_amount = JB_format_currency($bank_amount, BANK_CURRENCY, true);
                $label['payment_bank_heading'] = str_replace("%INVOICE_AMOUNT%", $bank_amount, $label['payment_bank_heading']);
                $label['payment_bank_note'] = str_replace("%CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $label['payment_bank_note']);
                $label['payment_bank_note'] = str_replace("%INVOICE_CODE%", $product_type . $invoice_id, $label['payment_bank_note']);
                $label['payment_bank_tax'] = str_replace("%INVOICE_TAX%", JB_format_currency($tax, BANK_CURRENCY, true), $label['payment_bank_tax']);
                if (JB_get_default_currency() != BANK_CURRENCY) {
                    echo JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']) . " = " . $bank_amount;
                    echo "<br>";
                }
                ?>
				
				<table width="70%"><tr><td>
				<?php 
                if (BANK_TAX_RATE > 0) {
                    ?>
				<b><?php 
                    echo $label['payment_bank_tax'];
                    ?>
</b><br>
				<?php 
                }
                ?>
				<b><?php 
                echo $label['payment_bank_heading'];
                ?>
</b><br>
				
				<?php 
                if (BANK_NAME != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_name'];
                    ?>
</b> <?php 
                    echo BANK_NAME;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_ADDRESS != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_addr'];
                    ?>
</b> <?php 
                    echo BANK_ADDRESS;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_ACCOUNT_NAME != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_ac_name'];
                    ?>
</b> <?php 
                    echo BANK_ACCOUNT_NAME;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_ACCOUNT_NUMBER != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_ac_number'];
                    ?>
</b> <?php 
                    echo BANK_ACCOUNT_NUMBER;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_BRANCH_NUMBER != '') {
                    ?>
				<b><?php 
                    echo $label['payment_bank_branch_number'];
                    ?>
</b> <?php 
                    echo BANK_BRANCH_NUMBER;
                    ?>
<br>
				<?php 
                }
                ?>
				<?php 
                if (BANK_SWIFT != '') {
                    ?>

				<b><?php 
                    echo $label['payment_bank_swift'];
                    ?>
</b> <?php 
                    echo BANK_SWIFT;
                    ?>
<br>

				<?php 
                }
                ?>
				<?php 
                echo $label['payment_bank_note'];
                ?>
				</td></tr>
				</table>
				
				</p>
				</center>
				
				</div>
				<?php 
                if ($order_row['user_type'] == 'C') {
                    $sql = "Select * from users where ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } else {
                    $sql = "Select * from employers where ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                }
                $result = JB_mysql_query($sql) or die(mysql_error());
                $e_row = mysql_fetch_array($result, MYSQL_ASSOC);
                if ($product_type == 'P') {
                    $template_r = JB_get_email_template(60, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, BANK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "P" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%QUANTITY%", $order_row['posts_quantity'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%BANK_NAME%", BANK_NAME, $msg);
                    $msg = str_replace("%BANK_ADDRESS%", BANK_ADDRESS, $msg);
                    $msg = str_replace("%BANK_AC_SWIFT%", BANK_SWIFT, $msg);
                    $msg = str_replace("%BANK_AC_CURRENCY%", BANK_CURRENCY, $msg);
                    $msg = str_replace("%BANK_AC_BRANCH%", BANK_AC_BRANCH, $msg);
                    $msg = str_replace("%AC_NAME%", BANK_ACCOUNT_NAME, $msg);
                    $msg = str_replace("%AC_NUMBER%", BANK_ACCOUNT_NUMBER, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    if (BANK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 60);
                        JB_process_mail_queue(1, $email_id);
                    }
                } elseif ($product_type == 'S') {
                    // subscription invoice confirmed (id 80)
                    $template_r = JB_get_email_template(80, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, BANK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "S" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%QUANTITY%", $order_row['posts_quantity'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%BANK_NAME%", BANK_NAME, $msg);
                    $msg = str_replace("%BANK_ADDRESS%", BANK_ADDRESS, $msg);
                    $msg = str_replace("%BANK_AC_SWIFT%", BANK_SWIFT, $msg);
                    $msg = str_replace("%BANK_AC_CURRENCY%", BANK_CURRENCY, $msg);
                    $msg = str_replace("%BANK_AC_BRANCH%", BANK_AC_BRANCH, $msg);
                    $msg = str_replace("%AC_NAME%", BANK_ACCOUNT_NAME, $msg);
                    $msg = str_replace("%AC_NUMBER%", BANK_ACCOUNT_NUMBER, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SUB_DURATION%", $order_row['months_duration'], $msg);
                    if (BANK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 80);
                        JB_process_mail_queue(1, $email_id);
                    }
                } elseif ($product_type == 'M') {
                    // membership invoice confirmed (id 100)
                    $template_r = JB_get_email_template(100, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, BANK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "M" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%INVOICE_CODE%", "M" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%BANK_NAME%", BANK_NAME, $msg);
                    $msg = str_replace("%BANK_ADDRESS%", BANK_ADDRESS, $msg);
                    $msg = str_replace("%BANK_AC_SWIFT%", BANK_SWIFT, $msg);
                    $msg = str_replace("%BANK_AC_CURRENCY%", BANK_CURRENCY, $msg);
                    $msg = str_replace("%BANK_AC_BRANCH%", BANK_AC_BRANCH, $msg);
                    $msg = str_replace("%AC_NAME%", BANK_ACCOUNT_NAME, $msg);
                    $msg = str_replace("%AC_NUMBER%", BANK_ACCOUNT_NUMBER, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    if ($order_row['months_duration'] == '0') {
                        $order_row['months_duration'] = $label['member_not_expire'];
                    }
                    $msg = str_replace("%MEM_DURATION%", $order_row['months_duration'], $msg);
                    if (BANK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 100);
                        JB_process_mail_queue(1, $email_id);
                    }
                }
                JB_update_payment_method($product_type, $order_row['invoice_id'], "bank");
            }
        } else {
            JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
        }
    }
예제 #6
0
    function process_payment_return()
    {
        global $label;
        if ($_REQUEST['order_id'] != '' && $_REQUEST['nhezk5'] != '') {
            $invoice_id = jb_strip_order_id($_REQUEST['order_id']);
            $product_type = substr($invoice_id, 0, 1);
            // 'P' or 'S'
            $invoice_id = substr($invoice_id, 1);
            if ($_SESSION['JB_ID'] == '') {
                JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
                echo "Error: You must be logged in to view this page";
            } else {
                JBPLUG_do_callback('pay_trn_verification_passed', $invoice_id, $product_type);
                ?>
		

			<div style='background-color: #ffffff; border-color:#C0C0C0; border-style:solid;padding:10px'>
		<p align="center"><center>
				<?php 
                if ($product_type == 'P') {
                    $sql = "SELECT * from package_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } elseif ($product_type == 'S') {
                    $sql = "SELECT * from subscription_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and employer_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } elseif ($product_type == 'M') {
                    $sql = "SELECT * from membership_invoices where invoice_id='" . jb_escape_sql($invoice_id) . "' and user_id='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                }
                $result = JB_mysql_query($sql) or die(mysql_error() . $sql);
                $order_row = mysql_fetch_array($result, MYSQL_ASSOC);
                if (CHECK_TAX_RATE > 0) {
                    if (CHECK_ADD_TAX != 'Y') {
                        // work out the tax paid in the amount
                        $tax = $order_row['amount'] - $order_row['amount'] / (1.0 + CHECK_TAX_RATE);
                    } else {
                        $tax = $order_row['amount'] * CHECK_TAX_RATE;
                        $order_row['amount'] = $order_row['amount'] + $tax;
                    }
                }
                if (CHECK_ADVANCE_CREDIT == 'YES' && strtolower($order_row['status']) != 'pending') {
                    // place the order as 'pending' and advance the credits
                    if ($product_type == 'P') {
                        // posting credits
                        $order_row = JB_pend_package_invoice($invoice_id, $payment_method = 'check', $pending_reason = 'jb_credit_advanced');
                        // credit the points to the customer's account
                        JB_add_posting_credits($order_row);
                    }
                    if ($product_type == 'S') {
                        // subscription to view resumes
                        $order_row = JB_pend_subscription_invoice($invoice_id, $payment_method = 'check', $pending_reason = 'jb_credit_advanced');
                        JB_start_employer_subscription($order_row);
                    }
                    if ($product_type == 'M') {
                        // membership
                        $order_row = JB_pend_membership_invoice($invoice_id, $payment_method = 'check', $pending_reason = 'jb_credit_advanced');
                        JB_start_membership($order_row);
                    }
                    JBPLUG_do_callback('pay_trn_pending', $invoice_id, $product_type);
                }
                $check_amount = JB_convert_to_currency($order_row['amount'], $order_row['currency_code'], CHECK_CURRENCY);
                $check_amount = JB_format_currency($check_amount, CHECK_CURRENCY, true);
                $label['payment_check_sub_head'] = str_replace("%INVOICE_CODE%", $product_type . $_REQUEST['order_id'], $label['payment_check_sub_head']);
                echo $label['payment_check_sub_head'];
                $label['payment_check_heading'] = str_replace("%INVOICE_AMOUNT%", $check_amount, $label['payment_check_heading']);
                $label['payment_check_tax'] = str_replace("%INVOICE_TAX%", JB_format_currency($tax, CHECK_CURRENCY, true), $label['payment_check_tax']);
                if (JB_get_default_currency() != CHECK_CURRENCY) {
                    echo JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']) . " = " . $check_amount;
                    echo "<br>";
                }
                ?>
				
				<table width="70%"><tr><td>
				<?php 
                if (CHECK_TAX_RATE > 0) {
                    ?>
				<b><?php 
                    echo $label['payment_check_tax'];
                    ?>
</b><br>
				<?php 
                }
                ?>
				<b><?php 
                echo $label['payment_check_heading'];
                ?>
</b><br>
				<?php 
                if (CHECK_NAME != '') {
                    ?>
				<b><?php 
                    echo $label['payment_check_payable'];
                    ?>
</b><pre><?php 
                    echo CHECK_PAYABLE;
                    ?>
</pre><br>
				<?php 
                }
                ?>
				<?php 
                if (CHECK_ADDRESS != '') {
                    ?>
				<b><?php 
                    echo $label['payment_check_address'];
                    ?>
</b><pre><?php 
                    echo CHECK_ADDRESS;
                    ?>
</pre><br>
				<?php 
                }
                ?>
				<?php 
                /*if ( CHECK_ACCOUNT_NAME != '') { ?>
                		<b><?php echo $label['payment_check_currency'];?></b><pre><?php echo CHECK_CURRENCY; ?></pre><br>
                		<?php } */
                ?>
				
				</td></tr>
				</table>
				
				</p>
				</center>
				
				</div>
				<?php 
                if ($order_row['user_type'] == 'C') {
                    $sql = "Select * from users where ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                } else {
                    $sql = "Select * from employers where ID='" . jb_escape_sql($_SESSION['JB_ID']) . "'";
                }
                $result = JB_mysql_query($sql) or die(mysql_error());
                $e_row = mysql_fetch_array($result, MYSQL_ASSOC);
                if ($product_type == 'S') {
                    $template_r = JB_get_email_template(81, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, CHECK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "S" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%SUB_DURATION%", $order_row['months_duration'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%PAYEE_NAME%", CHECK_PAYABLE, $msg);
                    $msg = str_replace("%PAYEE_ADDRESS%", CHECK_ADDRESS, $msg);
                    $msg = str_replace("%CHECK_CURRENCY%", CHECK_CURRENCY, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    //echo $msg;
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    if (CHECK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 81);
                        JB_process_mail_queue(1, $email_id);
                    }
                } elseif ($product_type == 'M') {
                    $template_r = JB_get_email_template(101, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, CHECK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "S" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    if ($order_row['months_duration'] == '0') {
                        $order_row['months_duration'] = $label['member_not_expire'];
                    }
                    $msg = str_replace("%MEM_DURATION%", $order_row['months_duration'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%PAYEE_NAME%", CHECK_PAYABLE, $msg);
                    $msg = str_replace("%PAYEE_ADDRESS%", CHECK_ADDRESS, $msg);
                    $msg = str_replace("%CHECK_CURRENCY%", CHECK_CURRENCY, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    //echo $msg;
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    if (CHECK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 101);
                        JB_process_mail_queue(1, $email_id);
                    }
                } elseif ($product_type == 'P') {
                    $template_r = JB_get_email_template(61, $_SESSION['LANG']);
                    $template = mysql_fetch_array($template_r);
                    $msg = $template['EmailText'];
                    $from = $template['EmailFromAddress'];
                    $from_name = $template['EmailFromName'];
                    $subject = $template['EmailSubject'];
                    $msg = str_replace("%INVOICE_TAX%", JB_format_currency($tax, CHECK_CURRENCY, true), $msg);
                    $msg = str_replace("%FNAME%", $e_row['FirstName'], $msg);
                    $msg = str_replace("%LNAME%", $e_row['LastName'], $msg);
                    $msg = str_replace("%SITE_NAME%", JB_SITE_NAME, $msg);
                    $msg = str_replace("%INVOICE_CODE%", "P" . $order_row['invoice_id'], $msg);
                    $msg = str_replace("%ITEM_NAME%", $order_row['item_name'], $msg);
                    $msg = str_replace("%QUANTITY%", $order_row['posts_quantity'], $msg);
                    $msg = str_replace("%INVOICE_AMOUNT%", JB_convert_to_default_currency_formatted($order_row['currency_code'], $order_row['amount']), $msg);
                    $msg = str_replace("%PAYEE_NAME%", CHECK_PAYABLE, $msg);
                    $msg = str_replace("%PAYEE_ADDRESS%", CHECK_ADDRESS, $msg);
                    $msg = str_replace("%CHECK_CURRENCY%", CHECK_CURRENCY, $msg);
                    $msg = str_replace("%SITE_CONTACT_EMAIL%", JB_SITE_CONTACT_EMAIL, $msg);
                    $msg = str_replace("%SITE_URL%", JB_BASE_HTTP_PATH, $msg);
                    //echo $msg;
                    $to = $e_row['Email'];
                    $to_name = jb_get_formatted_name($e_row['FirstName'], $e_row['LastName']);
                    if (CHECK_EMAIL_CONFIRM == 'YES') {
                        $email_id = JB_queue_mail($to, $to_name, $from, $from_name, $subject, $msg, '', 61);
                        JB_process_mail_queue(1, $email_id);
                    }
                }
                JB_update_payment_method($product_type, $order_row['invoice_id'], "check");
            }
        } else {
            JBPLUG_do_callback('pay_trn_verification_failed', $invoice_id, $product_type);
        }
    }
예제 #7
0
 function get_template_value($tmpl, $admin = false, $raw = false)
 {
     $val = '';
     $field_id = $this->tag_to_field_id[$tmpl]['field_id'];
     if (!isset($this->data[$field_id])) {
         $this->data[$field_id] = '';
     }
     if ($raw) {
         // return without any post-processing
         return $this->data[$field_id];
     }
     /* Hook here for your plugin to bypass this function
      * Tip: Your plugin can use $this object like this: 
      * $obj = JB_get_DynamicFormObject($form_id)
      * $field_id = $this->tag_to_field_id[$tmpl]['field_id'];
      * ...
      */
     $val = false;
     JBPLUG_do_callback('get_template_value', $val, $this->form_id, $tmpl, $admin);
     if ($val !== false) {
         return $val;
     }
     if ($this->process_field_restrictions($tmpl, $this->viewer_id, $this->viewer_type, $admin)) {
         // Its a restricted field, eg anonymous, blocked or member's only
         return $this->data[$field_id];
     }
     // it is assumed that this function is called in 'view' mode
     /*if (JB_process_field_restrictions($this->data, $this->tag_to_field_id[$tmpl], 'view', $admin)) {
     			// Its a restricted field, eg anonymous, blocked or member's only
     			return $this->data[$field_id]; 
     		} */
     switch ($this->tag_to_field_id[$tmpl]['field_type']) {
         case "URL":
             $val = $this->data[$field_id];
             if (strlen($val) > 0) {
                 if (strpos($val, 'http://') === false && strpos($val, 'https://') === false) {
                     $val = 'http://' . $val;
                 }
                 $val = JB_escape_html($val);
                 // no html allowed in this field
             }
             break;
         case "IMAGE":
             if (!JB_image_thumb_file_exists($this->data[$field_id])) {
                 $val = $label['employer_resume_list_no_image'];
             } else {
                 $val = $this->data[$field_id];
             }
             break;
         case "NUMERIC":
         case "INTEGER":
             $val = jb_escape_html($this->data[$field_id]);
             // no html allowed in this field
             break;
         case "CURRENCY":
             if ($val > 0) {
                 $val = JB_escape_html(JB_format_currency($this->data[$field_id], JB_get_default_currency()));
             } else {
                 $val = '';
             }
             break;
         case "CATEGORY":
             $val = jb_escape_html(JB_getCatName($this->data[$field_id]));
             break;
         case "RADIO":
             $val = jb_escape_html(JB_getCodeDescription($field_id, $this->data[$field_id]));
             break;
         case "SELECT":
             $val = jb_escape_html(JB_getCodeDescription($field_id, $this->data[$field_id]));
             break;
         case "MSELECT":
         case "CHECK":
             $vals = explode(",", $this->data[$field_id]);
             $comma = '';
             $str = '';
             if (sizeof($vals) > 0) {
                 foreach ($vals as $v) {
                     $str .= $comma . jb_escape_html(JB_getCodeDescription($field_id, $v));
                     $comma = ", ";
                 }
             }
             $val = $str;
             break;
         case "TIME":
             if ($this->data[$field_id] != '0000-00-00 00:00:00') {
                 // convert the time to a local time zone
                 $val = JB_get_local_time($this->data[$field_id] . " GMT");
             }
             break;
         case "DATE":
         case "DATE_CAL":
             if ($this->data[$field_id] != '0000-00-00 00:00:00') {
                 $val = JB_get_local_time($this->data[$field_id] . " GMT");
                 $val = JB_get_formatted_date($val);
             } else {
                 $val = '';
             }
             break;
         case "SKILL_MATRIX":
             $sql = "SELECT name FROM skill_matrix_data where object_id='" . JB_escape_sql($this->data['resume_id']) . "' ";
             $result = JB_mysql_query($sql) or die(mysql_error());
             $val = '';
             $comma = '';
             while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
                 $val .= $comma . $row['name'];
                 $comma = ", ";
             }
             break;
         case "TIME":
             // time is used for post_date, resume_date, signup_date, profile_date, etc..
             $val = JB_get_local_time($this->data[$field_id] . " GMT");
             // the time is always stored as GMT
             break;
         case 'TEXTAREA':
         case "TEXT":
             $val = JB_escape_html($this->data[$field_id]);
             // no html allowed in this field
             break;
         case "EDITOR":
             // HTML is allowed for this field
             //assuming that input was sanitized and only allowed HTML is included
             $val = $this->data[$field_id];
             break;
         case 'GMAP':
             $val = 'lat:' . $this->data[$field_id . '_lat'] . '/lng:' . $this->data[$field_id . '_lng'];
             break;
         default:
             $val = false;
             // A plugin can filter the $val value to be returned
             JBPLUG_do_callback('get_template_value_filter', $val, $this->tag_to_field_id[$tmpl]['field_type']);
             if ($val !== false) {
                 return $val;
             } else {
                 // $val is empty which means that it wasn't set by a plugin
                 // escape HTML just in case.
                 $val = JB_escape_html($this->data[$field_id]);
                 // no html allowed in this field
             }
             break;
     }
     if ($field_id == '') {
         //echo '<b>Configuration error: Failed to bind the "'.$tmpl.'" Template Tag. (not defined)</b> <br> ';
     }
     return $val;
 }