Пример #1
0
     $lang_id = $languages[$i]['id'];
     $_POST['coupon_name'][$iso_639_2] = trim($_POST['coupon_name'][$lang_id]);
     $_POST['coupon_desc'][$iso_639_2] = trim($_POST['coupon_desc'][$lang_id]);
 }
 $_POST['coupon_amount'] = trim($_POST['coupon_amount']);
 $update_errors = 0;
 if (!$_POST['coupon_name']) {
     $update_errors = 1;
     $messageStack->add(ERROR_NO_COUPON_NAME, 'error');
 }
 if (!$_POST['coupon_amount'] && !$_POST['coupon_free_ship']) {
     $update_errors = 1;
     $messageStack->add(ERROR_NO_COUPON_AMOUNT, 'error');
 }
 if (!$_POST['coupon_code']) {
     $coupon_code = oos_create_coupon_code();
 }
 if ($_POST['coupon_code']) {
     $coupon_code = $_POST['coupon_code'];
 }
 $query1 = $dbconn->Execute("SELECT coupon_code\n                                FROM " . $oostable['coupons'] . "\n                                WHERE coupon_code = '" . oos_db_prepare_input($coupon_code) . "'");
 if ($query1->RecordCount() && $_POST['coupon_code'] && $_GET['oldaction'] != 'voucheredit') {
     $update_errors = 1;
     $messageStack->add(ERROR_COUPON_EXISTS, 'error');
 }
 if ($update_errors != 0) {
     $action = 'new';
 } else {
     $action = 'update_preview';
 }
 break;
Пример #2
0
         $send_mail->Body = $message;
         $send_mail->AddAddress($mail['customers_email_address'], $mail['customers_firstname'] . ' ' . $mail['customers_lastname']);
         $send_mail->Send();
         $send_mail->ClearAddresses();
         $send_mail->ClearAttachments();
         // Now create the coupon main and email entry
         $couponstable = $oostable['coupons'];
         $insert_result = $dbconn->Execute("INSERT INTO {$couponstable} (coupon_code, coupon_type, coupon_amount, date_created) VALUES ('" . $id1 . "', 'G', '" . $_POST['amount'] . "', '" . date("Y-m-d H:i:s", time()) . "')");
         $insert_id = $dbconn->Insert_ID();
         $coupon_email_tracktable = $oostable['coupon_email_track'];
         $insert_result = $dbconn->Execute("INSERT INTO {$coupon_email_tracktable} (coupon_id, customer_id_sent, sent_firstname, emailed_to, date_sent) VALUES ('" . $insert_id . "', '0', 'Admin', '" . $mail['customers_email_address'] . "', '" . date("Y-m-d H:i:s", time()) . "' )");
         // Move that ADOdb pointer!
         $mail_result->MoveNext();
     }
 } elseif (isset($_POST['email_to']) && !$_POST['back_x']) {
     $id1 = oos_create_coupon_code($_POST['email_to']);
     $message = oos_db_prepare_input($_POST['message']);
     $message .= "\n\n" . TEXT_GV_WORTH . $currencies->format($_POST['amount']) . "\n\n";
     $message .= TEXT_TO_REDEEM;
     $message .= TEXT_WHICH_IS . $id1 . TEXT_IN_CASE . "\n\n";
     $message .= OOS_HTTP_SERVER . OOS_SHOP . 'index.php?page=' . $aCatalogPage['gv_redeem'] . '&gv_no=' . $id1 . "\n\n";
     $message .= TEXT_OR_VISIT . OOS_HTTP_SERVER . OOS_SHOP . TEXT_ENTER_CODE;
     //Let's build a message object using the email class
     $send_mail = new PHPMailer();
     $send_mail->PluginDir = OOS_ABSOLUTE_PATH . 'includes/lib/phpmailer/';
     $sLang = isset($_SESSION['iso_639_1']) ? $_SESSION['iso_639_1'] : 'en';
     $send_mail->SetLanguage($sLang, OOS_ABSOLUTE_PATH . 'includes/lib/phpmailer/language/');
     $send_mail->CharSet = CHARSET;
     $send_mail->IsMail();
     $send_mail->From = $from_mail ? $from_mail : STORE_OWNER_EMAIL_ADDRESS;
     $send_mail->FromName = $from_name ? $from_name : STORE_OWNER;
Пример #3
0
    $gv_amount = trim($amount);


    if (preg_match('/[^0-9/.]/', $gv_amount)) {
        $error = '1';
        $error_amount = $aLang['error_entry_amount_check'];
    }
    $gv_amount = round($gv_amount, $oCurrencies->currencies[DEFAULT_CURRENCY]['decimal_places']);
    if ($gv_amount>$customer_amount || $gv_amount == 0) {
        $error = '1';
        $error_amount = $aLang['error_entry_amount_check'];
    }
}

if ($action == 'process') {
    $id1 = oos_create_coupon_code($mail['customers_email_address']);

    $coupon_gv_customertable = $oostable['coupon_gv_customer'];
    $sql = "SELECT amount
            FROM $coupon_gv_customertable
            WHERE customer_id = '" . intval($_SESSION['customer_id']) . "'";
    $gv_result = $dbconn->Execute($sql);
    $gv_result = $gv_result->fields;

    $new_amount = round($gv_result['amount'], $oCurrencies->currencies[DEFAULT_CURRENCY]['decimal_places'])-$amount;
    if ($new_amount<0) {
        $error = '1';
        $error_amount = $aLang['error_entry_amount_check'];
        $action = 'send';
    } else {
        $coupon_gv_customertable = $oostable['coupon_gv_customer'];