예제 #1
0
function olc_address_summary($customers_id, $address_id)
{
    $customers_id = olc_db_prepare_input($customers_id);
    $address_id = olc_db_prepare_input($address_id);
    $address_query = olc_db_query("select ab.entry_street_address, ab.entry_suburb, ab.entry_postcode, ab.entry_city, ab.entry_state, ab.entry_country_id, ab.entry_zone_id, c.countries_name, c.address_format_id from " . TABLE_ADDRESS_BOOK . " ab, " . TABLE_COUNTRIES . " c where ab.address_book_id = '" . olc_db_input($address_id) . "' and ab.customers_id = '" . olc_db_input($customers_id) . "' and ab.entry_country_id = c.countries_id");
    $address = olc_db_fetch_array($address_query);
    $street_address = $address['entry_street_address'];
    $suburb = $address['entry_suburb'];
    $postcode = $address['entry_postcode'];
    $city = $address['entry_city'];
    $state = olc_get_zone_code($address['entry_country_id'], $address['entry_zone_id'], $address['entry_state']);
    $country = $address['countries_name'];
    $address_format_query = olc_db_query("select address_summary from " . TABLE_ADDRESS_FORMAT . " where address_format_id = '" . $address['address_format_id'] . APOS);
    $address_format = olc_db_fetch_array($address_format_query);
    //    eval("\$address = \"{$address_format['address_summary']}\";");
    $address_summary = $address_format['address_summary'];
    eval("\$address = \"{$address_summary}\";");
    return $address;
}
 function customerDetailsFields(&$order)
 {
     //Customer Details - for those who haven't signed up to PayPal
     $paypal_fields = olc_draw_hidden_field('cmd', '_ext-enter') . olc_draw_hidden_field('email', $order->customer['email_address']) . olc_draw_hidden_field('first_name', $order->billing['firstname']) . olc_draw_hidden_field('last_name', $order->billing['lastname']) . olc_draw_hidden_field('address1', $order->billing['street_address']) . olc_draw_hidden_field('address2', $order->billing['suburb']) . olc_draw_hidden_field('city', $order->billing['city']) . olc_draw_hidden_field('state', olc_get_zone_code($order->billing['country']['id'], $order->billing['zone_id'], $order->billing['zone_id'])) . olc_draw_hidden_field('zip', $order->billing['postcode']) . olc_draw_hidden_field('country', $order->billing['country']['iso_code_2']);
     //Telephone is problematic.
     /*//OMITTED SINCE NOT SPECIFICALLY BILLING ADDRESS RELATED
     		$telephone = preg_replace('/\D/', EMPTY_STRING, $order->customer['telephone']);
     		$paypal_fields .= olc_draw_hidden_field('night_phone_a',substr($telephone,0,3));
     		$paypal_fields .= olc_draw_hidden_field('night_phone_b',substr($telephone,3,3));
     		$paypal_fields .= olc_draw_hidden_field('night_phone_c',substr($telephone,6,4));
     		$paypal_fields .= olc_draw_hidden_field('day_phone_a',substr($telephone,0,3));
     		$paypal_fields .= olc_draw_hidden_field('day_phone_b',substr($telephone,3,3));
     		$paypal_fields .= olc_draw_hidden_field('day_phone_c',substr($telephone,6,4));
     		*/
     //Flow Language
     $paypal_fields .= olc_draw_hidden_field('lc', $order->billing['country']['iso_code_2']);
     return $paypal_fields;
 }
     olc_db_query($sql);
     // Get Sum of payment (Could have changed since last selects);
     $sql = "\n        SELECT sum(affiliate_payment) as affiliate_payment\n          FROM " . TABLE_AFFILIATE_SALES . "\n          WHERE affiliate_id='" . $affiliate_payment['affiliate_id'] . "' and  affiliate_billing_status=99\n        ";
     $affiliate_billing_query = olc_db_query($sql);
     $affiliate_billing = olc_db_fetch_array($affiliate_billing_query);
     // Get affiliate Informations
     $sql = "\n        SELECT a.*, c.countries_id, c.countries_name, c.countries_iso_code_2, c.countries_iso_code_3, c.address_format_id\n          from " . TABLE_AFFILIATE . " a\n          left join " . TABLE_ZONES . " z on (a.affiliate_zone_id  = z.zone_id)\n          left join " . TABLE_COUNTRIES . " c on (a.affiliate_country_id = c.countries_id)\n          WHERE affiliate_id = '" . $affiliate_payment['affiliate_id'] . "'\n        ";
     $affiliate_query = olc_db_query($sql);
     $affiliate = olc_db_fetch_array($affiliate_query);
     // Get need tax informations for the affiliate
     $affiliate_tax_rate = olc_get_affiliate_tax_rate(AFFILIATE_TAX_ID, $affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id']);
     $affiliate_tax = olc_round($affiliate_billing['affiliate_payment'] * $affiliate_tax_rate / 100, 2);
     // Netto-Provision
     $affiliate_payment_total = $affiliate_billing['affiliate_payment'] + $affiliate_tax;
     // Bill the order
     $affiliate['affiliate_state'] = olc_get_zone_code($affiliate['affiliate_country_id'], $affiliate['affiliate_zone_id'], $affiliate['affiliate_state']);
     $sql_data_array = array('affiliate_id' => $affiliate_payment['affiliate_id'], 'affiliate_payment' => $affiliate_billing['affiliate_payment'], 'affiliate_payment_tax' => $affiliate_tax, 'affiliate_payment_total' => $affiliate_payment_total, 'affiliate_payment_date' => 'now()', 'affiliate_payment_status' => '0', 'affiliate_firstname' => $affiliate['affiliate_firstname'], 'affiliate_lastname' => $affiliate['affiliate_lastname'], 'affiliate_street_address' => $affiliate['affiliate_street_address'], 'affiliate_suburb' => $affiliate['affiliate_suburb'], 'affiliate_city' => $affiliate['affiliate_city'], 'affiliate_country' => $affiliate['countries_name'], 'affiliate_postcode' => $affiliate['affiliate_postcode'], 'affiliate_company' => $affiliate['affiliate_company'], 'affiliate_state' => $affiliate['affiliate_state'], 'affiliate_address_format_id' => $affiliate['address_format_id']);
     olc_db_perform(TABLE_AFFILIATE_PAYMENT, $sql_data_array);
     $insert_id = olc_db_insert_id();
     // Set the Sales to Final State
     olc_db_query(SQL_UPDATE . TABLE_AFFILIATE_SALES . " set affiliate_payment_id = '" . $insert_id . "', affiliate_billing_status = 1, affiliate_payment_date = now() where affiliate_id = '" . $affiliate_payment['affiliate_id'] . "' and affiliate_billing_status = 99");
     // Notify Affiliate
     if (AFFILIATE_NOTIFY_AFTER_BILLING == TRUE_STRING_S) {
         $check_status_query = olc_db_query("select af.affiliate_email_address, ap.affiliate_lastname, ap.affiliate_firstname, ap.affiliate_payment_status, ap.affiliate_payment_date, ap.affiliate_payment_date from " . TABLE_AFFILIATE_PAYMENT . " ap, " . TABLE_AFFILIATE . " af where affiliate_payment_id  = '" . $insert_id . "' and af.affiliate_id = ap.affiliate_id ");
         $check_status = olc_db_fetch_array($check_status_query);
         $email = STORE_NAME . NEW_LINE . EMAIL_SEPARATOR . NEW_LINE . EMAIL_TEXT_AFFILIATE_PAYMENT_NUMBER . BLANK . $insert_id . NEW_LINE . EMAIL_TEXT_INVOICE_URL . BLANK . olc_catalog_href_link(FILENAME_CATALOG_AFFILIATE_PAYMENT_INFO, 'payment_id=' . $insert_id, SSL) . NEW_LINE . EMAIL_TEXT_PAYMENT_BILLED . BLANK . olc_date_long($check_status['affiliate_payment_date']) . "\n\n" . EMAIL_TEXT_NEW_PAYMENT;
         olc_mail($check_status['affiliate_firstname'] . BLANK . $check_status['affiliate_lastname'], $check_status['affiliate_email_address'], EMAIL_TEXT_SUBJECT, nl2br($email), STORE_OWNER, AFFILIATE_EMAIL_ADDRESS);
     }
 }
 $messageStack->add_session(SUCCESS_BILLING, 'success');
 olc_redirect(olc_href_link(FILENAME_AFFILIATE_PAYMENT, olc_get_all_get_params(array('action')) . 'action=edit'));
예제 #4
0
function olc_address_format($address_format_id, $address, $html, $boln, $eoln)
{
    $address_format_query = olc_db_query(SELECT . "address_format as format" . SQL_FROM . TABLE_ADDRESS_FORMAT . SQL_WHERE . "address_format_id = '" . $address_format_id . APOS);
    $address_format = olc_db_fetch_array($address_format_query);
    $company = addslashes($address['company']);
    $firstname = addslashes($address['firstname']);
    $cid = addslashes($address['csID']);
    $lastname = addslashes($address['lastname']);
    $street = addslashes($address['street_address']);
    $suburb = addslashes($address['suburb']);
    $city = addslashes($address['city']);
    $state = addslashes($address['state']);
    $country_id = $address['country_id'];
    $zone_id = $address['zone_id'];
    $postcode = addslashes($address['postcode']);
    $zip = $postcode;
    $country = olc_get_country_name($country_id);
    $state = olc_get_zone_code($country_id, $zone_id, $state);
    if ($html) {
        // HTML Mode
        $HR = HTML_HR;
        $hr = HTML_HR;
        if ($boln == EMPTY_STRING && $eoln == NEW_LINE) {
            // Values not specified, use rational defaults
            $CR = HTML_BR;
            $cr = HTML_BR;
            $eoln = $cr;
        } else {
            // Use values supplied
            $CR = $eoln . $boln;
            $cr = $CR;
        }
    } else {
        // Text Mode
        $CR = $eoln;
        $cr = $CR;
        $HR = '----------------------------------------';
        $hr = '----------------------------------------';
    }
    $statecomma = EMPTY_STRING;
    $streets = $street;
    if ($suburb != EMPTY_STRING) {
        $streets = $street . $cr . $suburb;
    }
    if ($firstname == EMPTY_STRING) {
        $firstname = addslashes($address['name']);
    }
    if ($country == EMPTY_STRING) {
        $country = addslashes($address['country']);
    }
    if ($state != EMPTY_STRING) {
        $statecomma = $state . ', ';
    }
    $fmt = $address_format['format'];
    eval("\$address = \"{$fmt}\";");
    $address = stripslashes($address);
    if (ACCOUNT_COMPANY == TRUE_STRING_S && olc_not_null($company)) {
        $address = $company . $cr . $address;
    }
    return $address;
}