public function getBarCode($orderIDBarCode, $orderID, $orderShipID)
 {
     $targetDir = 'images' . DIRECTORY_SEPARATOR . 'shipping' . DIRECTORY_SEPARATOR . $orderID;
     //$targetDir2 = 'images'.DIRECTORY_SEPARATOR.'shipping'.DIRECTORY_SEPARATOR.'test';
     if (!file_exists($targetDir)) {
         if (!mkdir($targetDir)) {
             die("Failed to create Folder");
         }
         //@mkdir($targetDir2, 0777);
     }
     $bc = new Barcode39($orderIDBarCode);
     // set text size
     $bc->barcode_text_size = 5;
     // set barcode bar thickness (thick bars)
     $bc->barcode_bar_thick = 4;
     // set barcode bar thickness (thin bars)
     $bc->barcode_bar_thin = 2;
     $data = $bc->draw("images/shipping/{$orderID}/{$orderShipID}.gif");
     //print_r($data);
 }
示例#2
0
<?php

// include Barcode39 class
include "Barcode39.php";
// set Barcode39 object
$bc = new Barcode39("Shay Anderson");
// display new barcode
$bc->draw();
示例#3
0
 public function actionPrintBarCode($barcode = null)
 {
     $barcodeObj = new Barcode39($barcode);
     $barcodeObj->draw();
 }
示例#4
0
function generate_barcode($type, $data)
{
    require_once PT::$ABSPATH . "/lib/barcode-master/php-barcode.php";
    $font = "./lib/barcode-master/NOTTB___.TTF";
    $fontSize = 10;
    // GD1 in px ; GD2 in point
    $marge = 2;
    // between barcode and hri in pixel
    $y = 25;
    // barcode center
    $height = 50;
    // barcode height in 1D ; module size in 2D
    $width = 2;
    // barcode height in 1D ; not use in 2D
    $angle = 0;
    // rotation in degrees : nb : non horizontable barcode might not be usable because of pixelisation
    $code = $data;
    $type = $type;
    // Precompute digits to set image width
    switch ($type) {
        case 'std25':
        case 'int25':
            $digit = \BarcodeI25::getDigit($code, $crc, $type);
            break;
        case 'ean8':
        case 'ean13':
            $digit = \BarcodeEAN::getDigit($code, $type);
            break;
        case 'upc':
            $digit = \BarcodeUPC::getDigit($code);
            break;
        case 'code11':
            $digit = \Barcode11::getDigit($code);
            break;
        case 'code39':
            $digit = \Barcode39::getDigit($code);
            break;
        case 'code93':
            $digit = \Barcode93::getDigit($code, $crc);
            break;
        case 'code128':
            $digit = \Barcode128::getDigit($code);
            break;
        case 'codabar':
            $digit = \BarcodeCodabar::getDigit($code);
            break;
        case 'msi':
            $digit = \BarcodeMSI::getDigit($code, $crc);
            break;
        case 'datamatrix':
            $digit = \BarcodeDatamatrix::getDigit($code, $rect);
            break;
    }
    $imgWidth = strlen($digit) * $width;
    $x = $imgWidth / 2;
    $im = imagecreatetruecolor($imgWidth, 62);
    $black = ImageColorAllocate($im, 0x0, 0x0, 0x0);
    $white = ImageColorAllocate($im, 0xff, 0xff, 0xff);
    $red = ImageColorAllocate($im, 0xff, 0x0, 0x0);
    $blue = ImageColorAllocate($im, 0x0, 0x0, 0xff);
    imagefilledrectangle($im, 0, 0, $imgWidth, 62, $white);
    $data = \Barcode::gd($im, $black, $x, $y, $angle, $type, array('code' => $code), $width, $height);
    if (isset($font)) {
        $box = imagettfbbox($fontSize, 0, $font, $data['hri']);
        $len = $box[2] - $box[0];
        \Barcode::rotate(-$len / 2, $data['height'] / 2 + $fontSize + $marge, $angle, $xt, $yt);
        imagettftext($im, $fontSize, $angle, $x + $xt, $y + $yt, $black, $font, $data['hri']);
    }
    header('Content-type: image/gif');
    imagegif($im);
    imagedestroy($im);
}
示例#5
0
<?php

session_start();
include "connect.php";
include "Barcode39.php";
// escape variables for security
$name = $_GET["name"];
$id = $_GET["id"];
$nohp = $_GET["nohp"];
$keluhan = $_GET["kl"];
$kode_klinik = $_GET["kk"];
$slot = $_GET["slot"];
$uniqueid = uniqid(substr($nohp, 5));
$bc = new Barcode39($uniqueid);
$bc->barcode_text_size = 4;
$bc->barcode_bar_thick = 3;
$bc->barcode_bar_thin = 1;
$sql = "INSERT INTO `pesanan`( `id_user`, `nohp`, `id_slot`, `keluhan`, `tanggal_pesanan`, `kode_pesanan`, `status`) VALUES ('{$id}','{$nohp}','{$slot}','{$keluhan}',NOW(),'{$uniqueid}', 'pending');";
$query = "UPDATE waktu SET status='terpesan' where id='" . $slot . "'";
mysqli_query($conn, $query);
$query = "INSERT INTO `history_medical`(`id_user`, `kode_klinik`, `keluhan`, `penyakit`, `tgl_transaksi`) VALUES ('{$id}','{$kode_klinik}','{$keluhan}','',NOW())";
mysqli_query($conn, $query);
if (!mysqli_query($conn, $sql)) {
    die('Error: ' . mysqli_error($conn));
}
echo '<div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Hasil Registrasi</h4>
      </div>
      <div class="modal-body">
 private function prepareTemplate($newsletter, $params = array())
 {
     if (!$newsletter) {
         return false;
     }
     $this->load->library('url');
     $this->load->library('BarcodeQR');
     $this->load->library('Barcode39');
     $qr = new BarcodeQR();
     $barcode = new Barcode39(C_CODE);
     $qrStore = "cache/" . $this->escape($this->config->get('config_owner')) . '.png';
     $eanStore = "cache/" . $this->escape($this->config->get('config_owner')) . "_barcode_39.gif";
     if (!file_exists(DIR_IMAGE . $qrStore)) {
         $qr->url(HTTP_HOME);
         $qr->draw(150, DIR_IMAGE . $qrStore);
     }
     if (!file_exists(DIR_IMAGE . $eanStore)) {
         $barcode->draw(DIR_IMAGE . $eanStore);
     }
     $newsletter = str_replace("%7B", "{", $newsletter);
     $newsletter = str_replace("%7D", "}", $newsletter);
     $newsletter = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $newsletter);
     $newsletter = str_replace("{%store_url%}", HTTP_HOME, $newsletter);
     $newsletter = str_replace("{%url_login%}", Url::createUrl("account/login"), $newsletter);
     $newsletter = str_replace("{%store_owner%}", $this->config->get('config_owner'), $newsletter);
     $newsletter = str_replace("{%store_name%}", $this->config->get('config_name'), $newsletter);
     $newsletter = str_replace("{%store_rif%}", $this->config->get('config_rif'), $newsletter);
     $newsletter = str_replace("{%store_email%}", $this->config->get('config_email'), $newsletter);
     $newsletter = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $newsletter);
     $newsletter = str_replace("{%store_address%}", $this->config->get('config_address'), $newsletter);
     /*
     $newsletter = str_replace("{%products%}",$product_html,$newsletter);
     */
     $newsletter = str_replace("{%date_added%}", date('d-m-Y h:i A'), $newsletter);
     $newsletter = str_replace("{%ip%}", $_SERVER['REMOTE_ADDR'], $newsletter);
     $newsletter = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $newsletter);
     $newsletter = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="NT Code" />', $newsletter);
     if ($params['product']) {
         $newsletter = str_replace("{%product_name%}", '<h1><a href="' . $params['product']['url'] . '">' . $params['product']['name'] . '</a></h1>', $newsletter);
         $newsletter = str_replace("{%product_model%}", '<b>' . $params['product']['model'] . '</b>', $newsletter);
         $newsletter = str_replace("{%product_price%}", '<h2>' . $params['product']['price'] . '</h2>', $newsletter);
         $newsletter = str_replace("{%product_special%}", '<h2>' . $params['product']['special'] . '</h2>', $newsletter);
         $newsletter = str_replace("{%product_image%}", '<a href="' . $params['product']['url'] . '"><img src="' . $params['product']['image'] . '" alt="' . $params['product']['name'] . '" /></a>', $newsletter);
         $newsletter = str_replace("{%product_manufacturer%}", $params['product']['manufacturer'], $newsletter);
         $newsletter = str_replace("{%product_url%}", '<a href="' . $params['product']['url'] . '">Ver Detalles</a>', $newsletter);
         foreach ($params['product']['images'] as $key => $value) {
             $product_images .= "<img src=\"" . $value . "\" alt=\"" . $product['name'] . "\" />";
         }
         $newsletter = str_replace("{%product_images%}", $product_images, $newsletter);
         if ($params['product']['discounts']) {
             $product_discounts = "<table><tr><th>Cantidad</th><th>Precio</th></tr>";
             foreach ($params['product']['discounts'] as $key => $value) {
                 $product_discounts .= "<tr>";
                 $product_discounts .= "<td>" . $value['quantity'] . "</td>";
                 $product_discounts .= "<td>" . $value['price'] . "</td>";
                 $product_discounts .= "</tr>";
             }
             $product_discounts .= "</table>";
             $newsletter = str_replace("{%product_discounts%}", discounts, $newsletter);
         }
         foreach ($params['product']['tags'] as $key => $value) {
             $product_tags .= "<a href=\"" . $value['href'] . "\">" . $value['tag'] . "</a>";
         }
         $newsletter = str_replace("{%product_tags%}", $product_tags, $newsletter);
     }
     $newsletter .= "<p style=\"text-align:center;font:normal 10px Verdana;color:#333;\">Powered By Necotienda " . date('Y') . "</p>";
     return $newsletter;
     return html_entity_decode(htmlspecialchars_decode($newsletter));
 }
 public function confirm()
 {
     $this->language->load('payment/cod');
     $this->load->model('account/order');
     $this->load->model('account/payment');
     $this->load->library('email/mailer');
     if ($this->session->has('order_id')) {
         $this->data['order_id'] = $this->session->get('order_id');
     } elseif ($this->request->hasQuery('order_id')) {
         $this->data['order_id'] = $this->request->getQuery('order_id');
     } elseif ($this->request->hasPost('cod_order_id')) {
         $this->data['order_id'] = $this->request->getPost('cod_order_id');
     } else {
         $this->data['order_id'] = 0;
     }
     $order_info = $this->modelOrder->getOrder($this->data['order_id']);
     if ($order_info && $this->customer->isLogged()) {
         $total_payment = $this->modelPayment->getSumPayments(array('order_id' => $order_info['order_id'], 'limit' => 1000));
         $total = $order_info['total'] - $total_payment;
         $amount = explode(",", $this->request->getPost('cod_amount'));
         $payment = round(str_replace(".", "", $amount[0]) . "." . $amount[1], 2);
         $data['order_id'] = $order_info['order_id'];
         $data['payment_method'] = $this->language->get('text_title');
         $data['amount'] = $payment;
         $data['comment'] = $this->language->get('text_date_of_payment') . ": " . $this->request->getPost('cod_date_of_payment') . "\n";
         $data['comment'] .= $this->language->get('text_payment_method_on_delivery') . ": " . $this->request->getPost('cod_payment_method_on_delivery') . "\n";
         $data['comment'] .= "\n" . $this->request->getPost('cod_comment');
         $data['order_status_id'] = $this->config->get('cod_order_status_id');
         $data['order_payment_status_id'] = $this->config->get('config_payment_status_id');
         $json['payment_id'] = $payment_id = $this->modelPayment->add($data);
         $this->modelOrder->addOrderHistory($order_info['order_id'], $data);
         $this->modelOrder->updateStatus($order_info['order_id'], $this->config->get('cod_order_status_id'));
         $this->modelOrder->updatePaymentMethod($order_info['order_id'], $this->language->get('text_title'));
         $diff = $payment - $total;
         if ($diff < 0) {
             //falta dinero
             $diff = $diff * -1;
             $json['warning'] = 1;
             $json['msg'] = str_replace('{%payment_receipt%}', Url::createUrl("account/payment"), $this->language->get('error_moneyless'));
             $json['msg'] = str_replace('{%invoice%}', Url::createUrl("account/invoice", array('order_id' => $order_info['order_id'])), $json['msg']);
             $json['msg'] = str_replace('{%diff%}', $this->currency->format($diff), $json['msg']);
         } elseif ($diff > 0) {
             //sobra dinero
             $json['warning'] = 1;
             $json['msg'] = str_replace('{%payment_receipt%}', Url::createUrl("account/payment"), $this->language->get('error_moneymore'));
             $json['msg'] = str_replace('{%invoice%}', Url::createUrl("account/invoice", array('order_id' => $order_info['order_id'])), $json['msg']);
             $json['msg'] = str_replace('{%diff%}', $this->currency->format($diff), $json['msg']);
         } else {
             $json['success'] = 1;
             $json['msg'] = $this->language->get('text_success');
         }
         $mailer = new Mailer();
         if ($this->config->get('cod_newsletter_id')) {
             $this->load->model("marketing/newsletter");
             $this->load->library('BarcodeQR');
             $this->load->library('Barcode39');
             $qr = new BarcodeQR();
             $barcode = new Barcode39(C_CODE);
             $totals = $this->modelOrder->getOrderTotals($order_id);
             $text = $this->config->get('config_owner') . "\n";
             $text .= "Pago ID: " . $payment_id . "\n";
             $text .= "Pedido ID: " . $order_id . "\n";
             $text .= "Fecha Emision del Pedido: " . date('d-m-Y h:i A', strtotime($order_info['date_added'])) . "\n";
             $text .= "Cliente: " . $this->customer->getCompany() . "\n";
             $text .= "RIF: " . $this->customer->getRif() . "\n";
             $text .= "Direccion IP: " . $_SERVER['REMOTE_ADDR'] . "\n";
             $qrStore = "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.jpg';
             $qrPayment = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_qr_code_payment_" . $payment_id) . '.jpg';
             $eanStore = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_barcode_39_order_id_" . $order_id) . '.gif';
             $qr->text($text);
             $qr->draw(150, DIR_IMAGE . $qrPayment);
             $qr->url(HTTP_HOME);
             $qr->draw(150, DIR_IMAGE . $qrStore);
             $barcode->draw(DIR_IMAGE . $eanStore);
             $payment_text = '<h1>' . $this->config->get('config_owner') . "</h1>";
             $payment_text .= "Pago ID: " . $payment_id . "<br />";
             $payment_text .= "Pedido ID: " . $order_id . "<br />";
             $payment_text .= "Fecha Emision del Pedido: " . date('d-m-Y h:i A', strtotime($order_info['date_added'])) . "<br />";
             $payment_text .= "Cliente: " . $this->customer->getCompany() . "<br />";
             $payment_text .= "RIF: " . $this->customer->getRif() . "<br />";
             $payment_text .= "Direccion IP: " . $_SERVER['REMOTE_ADDR'] . "<br />";
             $total_html = "<div class=\"clear:both;float:none;\"></div><br /><table>";
             foreach ($totals as $total) {
                 $total_html .= "<tr>";
                 $total_html .= "<td style=\"text-align:right;\">" . $total['title'] . "</td>";
                 $total_html .= "<td style=\"text-align:right;\">" . $total['text'] . "</td>";
                 $total_html .= "</tr>";
             }
             $total_html .= "</table>";
             $payment_text .= $total_html;
             $result = $this->modelNewsletter->getById($this->config->get('cod_newsletter_id'));
             $message = $result['htmlbody'];
             $message = str_replace("{%title%}", 'Pago N&deg; ' . $payment_id . " - " . $this->config->get('config_name'), $message);
             $message = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $message);
             $message = str_replace("{%store_url%}", HTTP_HOME, $message);
             $message = str_replace("{%store_owner%}", $this->config->get('config_owner'), $message);
             $message = str_replace("{%store_name%}", $this->config->get('config_name'), $message);
             $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
             $message = str_replace("{%store_email%}", $this->config->get('config_email'), $message);
             $message = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $message);
             $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
             $message = str_replace("{%totals%}", $total_html, $message);
             $message = str_replace("{%order_id%}", $this->config->get('config_invoice_prefix') . $order_id, $message);
             $message = str_replace("{%invoice_id%}", $this->config->get('config_invoice_prefix') . $invoice_id, $message);
             $message = str_replace("{%rif%}", $this->customer->getRif(), $message);
             $message = str_replace("{%fullname%}", $this->customer->getFirstName() . " " . $this->customer->getFirstName(), $message);
             $message = str_replace("{%company%}", $this->customer->getCompany(), $message);
             $message = str_replace("{%email%}", $this->customer->getEmail(), $message);
             $message = str_replace("{%telephone%}", $this->customer->getTelephone(), $message);
             $message = str_replace("{%payment%}", $payment_text, $message);
             $message = str_replace("{%payment_method%}", $order_info['payment_method'], $message);
             $message = str_replace("{%date_added%}", date('d-m-Y h:i A', strtotime($order_info['date_added'])), $message);
             $message = str_replace("{%ip%}", $_SERVER['REMOTE_ADDR'], $message);
             $message = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $message);
             $message = str_replace("{%comment%}", $order_info['comment'], $message);
             $message = str_replace("{%qr_code_payment%}", '<img src="' . HTTP_IMAGE . $qrPayment . '" alt="QR Code" />', $message);
             $message = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="QR Code" />', $message);
             $message .= "<p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
         } else {
             $message = $this->config->get('config_owner') . "\n";
             $message .= "Pago ID: " . $payment_id . "\n";
             $message .= "Pedido ID: " . $order_id . "\n";
             $message .= "Fecha Emision: " . date('d-m-Y h:i A', strtotime($order_info['date_added'])) . "\n";
             $message .= "Cliente: " . $this->customer->getCompany() . "\n";
             $message .= "RIF: " . $this->customer->getRif() . "\n";
             $message .= "Direccion IP: " . $_SERVER['REMOTE_ADDR'] . "\n";
             $message .= "\n" . "Powered By Necotienda&reg; " . date('Y') . "\n";
         }
         if ($message) {
             if ($this->config->get('config_smtp_method') == 'smtp') {
                 $mailer->IsSMTP();
                 $mailer->Host = $this->config->get('config_smtp_host');
                 $mailer->Username = $this->config->get('config_smtp_username');
                 $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
                 $mailer->Port = $this->config->get('config_smtp_port');
                 $mailer->Timeout = $this->config->get('config_smtp_timeout');
                 $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
                 $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
             } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
                 $mailer->IsSendmail();
             } else {
                 $mailer->IsMail();
             }
             $mailer->IsHTML();
             $mailer->AddAddress($this->customer->getEmail(), $this->customer->getCompany());
             $mailer->AddBCC($this->config->get('config_email'), $this->config->get('config_name'));
             $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
             $mailer->Subject = $this->config->get('config_owner') . " " . $this->language->get('text_new_payment') . " #" . $payment_id;
             $mailer->Body = html_entity_decode(htmlspecialchars_decode($message));
             $mailer->Send();
         }
     } elseif (!$this->customer->isLogged()) {
         $json['error'] = 1;
         $json['msg'] = $this->language->get('error_not_logged');
     } else {
         $json['error'] = 1;
         $json['msg'] = $this->language->get('error_payment');
     }
     $this->load->library('json');
     $this->response->setOutput(Json::encode($json), $this->config->get('config_compression'));
 }
<?php 
$store_key = $_SESSION['mystoreid'];
$data = $_POST;
$medicine_name = $data['medicine_name'];
$batch_code = $data['batch_code'];
$mfg_date = $data['mfg_date'];
$expiry_date = $data['expiry_date'];
$mrp = $data['mrp'];
$action = $data['action'];
if (empty($medicine_name) || empty($batch_code) || empty($mfg_date) || empty($expiry_date) || empty($mrp)) {
    return true;
}
switch ($action) {
    case "insert_barcodes":
        $barcode = DhsHelper::getUniqueBarcode();
        $bc = new Barcode39($barcode);
        // set text size
        $bc->barcode_text_size = 5;
        // set barcode bar thickness (thick bars)
        $bc->barcode_bar_thick = 4;
        // set barcode bar thickness (thin bars)
        $bc->barcode_bar_thin = 2;
        // save barcode GIF file
        $bc->draw("admin/barcodes/{$barcode}.gif");
        $sql = "insert into `barcodes` (`barcode`, `medicine_name`, `batch_code`, `mfg_date`, `expiry_date`, `mrp`, `store_key`)\n\t\t\t\t\tvalues ({$barcode}, '{$medicine_name}', '{$batch_code}', '{$mfg_date}', '{$expiry_date}', {$mrp}, '{$store_key}')";
        if (!mysqli_query($con, $sql)) {
            die('Error' . mysql_error());
        }
        $max_id = mysql_insert_id();
        break;
}
示例#9
0
 public function getOrderBarCode()
 {
     $bctext = $this->order_increment_id;
     $bc = new Barcode39($bctext);
     $bc->barcode_text_size = 5;
     $bc->barcode_bar_thick = 3.5;
     $bc->barcode_bar_thin = 1;
     if (file_exists($this->barcode_img_name)) {
         unlink($this->barcode_img_name);
         $bc->draw($this->barcode_img_name);
     } else {
         $bc->draw($this->barcode_img_name);
     }
     $type = pathinfo($this->barcode_img_name, PATHINFO_EXTENSION);
     $data = file_get_contents($this->barcode_img_name);
     $dataUri = 'data:image/' . $type . ';base64,' . base64_encode($data);
     return $dataUri;
 }
示例#10
0
 public function amitAction()
 {
     $bc = new Barcode39("123-ABC");
     $bc->draw("public/barcode.gif");
 }
 public function index()
 {
     $Url = new Url($this->registry);
     if ($this->config->get('config_store_mode') != 'store') {
         $this->redirect(HTTP_HOME);
     }
     $this->language->load('checkout/success');
     $this->load->auto('account/address');
     $address = $this->modelAddress->getAddress($this->customer->getAddressId());
     $method_data = array();
     $results = $this->modelExtension->getExtensions('payment');
     foreach ($results as $result) {
         $this->load->model('payment/' . $result['key']);
         $this->language->load('payment/' . $result['key']);
         $method = $this->{'model_payment_' . $result['key']}->getMethod($address);
         if ($method) {
             $method_data[$result['key']] = $method;
         }
     }
     $sort_order = array();
     foreach ($method_data as $key => $value) {
         $sort_order[$key] = $value['sort_order'];
     }
     array_multisort($sort_order, SORT_ASC, $method_data);
     $this->data['payment_methods'] = $method_data;
     foreach ($method_data as $key => $value) {
         $this->children[$key] = 'payment/' . $key;
     }
     $order_id = 0;
     if ($this->session->has('order_id')) {
         $order_id = $this->session->get('order_id');
     } elseif ($this->request->hasPost('order_id')) {
         $order_id = $this->request->getPost('order_id');
     } elseif ($this->request->hasQuery('order_id')) {
         $order_id = $this->request->getQuery('order_id');
     }
     $this->data['order_id'] = $order_id;
     if ($order_id) {
         if ($this->config->get('marketing_email_new_order')) {
             $this->load->model('account/order');
             $this->load->model('account/payment');
             $this->load->model("marketing/newsletter");
             $this->load->library('email/mailer');
             $this->load->library('BarcodeQR');
             $this->load->library('Barcode39');
             $this->load->library('tcpdf/config/lang/spa');
             $this->load->library('tcpdf/tcpdf');
             $mailer = new Mailer();
             $qr = new BarcodeQR();
             $barcode = new Barcode39(C_CODE);
             $this->data['Currency'] = $this->currency;
             $this->data['order'] = $order = $this->modelOrder->getOrder($order_id);
             $this->data['products'] = $products = $this->modelOrder->getOrderProducts($order_id);
             $this->data['totals'] = $totals = $this->modelOrder->getOrderTotals($order_id);
             $this->data['payments'] = $payments = $this->modelPayment->getPayments(array('order_id' => $order_id, 'order_payment_status_id' => $this->config->get('order_payment_status_approved')));
             $shipping_address = $order['shipping_address_1'] . ", " . $order['shipping_city'] . ". " . $order['shipping_zone'] . " - " . $order['shipping_country'] . ". CP " . $order['shipping_zone_code'];
             $payment_address = $order['payment_address_1'] . ", " . $order['payment_city'] . ". " . $order['payment_zone'] . " - " . $order['payment_country'] . ". CP " . $order['payment_zone_code'];
             $text = $this->config->get('config_owner') . "\n";
             $text .= "Pedido ID: " . $order_id . "\n";
             $text .= "Fecha Emision: " . date('d-m-Y h:i A', strtotime($order['date_added'])) . "\n";
             $text .= "Cliente: " . $this->customer->getCompany() . "\n";
             $text .= "RIF: " . $this->customer->getRif() . "\n";
             $text .= "Direccion IP: " . $order['ip'] . "\n";
             $text .= "Productos (" . count($products) . ")\n";
             $text .= "Modelo\tCant.\tTotal\n";
             foreach ($products as $key => $product) {
                 $text .= $product['model'] . "\t" . $product['quantity'] . "\t" . $this->currency->format($product['total'], $order['currency'], $order['value']) . "\n";
             }
             $qrStore = "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.jpg';
             $qrOrder = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_qr_code_order_" . $order_id) . '.jpg';
             $eanStore = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_barcode_39_order_id_" . $order_id) . '.gif';
             $qr->text($text);
             $qr->draw(150, DIR_IMAGE . $qrOrder);
             $qr->url(HTTP_HOME);
             $qr->draw(150, DIR_IMAGE . $qrStore);
             $barcode->draw(DIR_IMAGE . $eanStore);
             $product_html = "<table><thead><tr style=\"background:#ccc;color:#666;\"><th>Item</th><th>" . $this->language->get('column_description') . "</th><th>" . $this->language->get('column_model') . "</th><th>" . $this->language->get('column_quantity') . "</th><th>" . $this->language->get('column_price') . "</th><th>" . $this->language->get('column_total') . "</th></tr></thead><tbody>";
             foreach ($products as $key => $product) {
                 $options = $this->modelOrder->getOrderOptions($order_id, $product['order_product_id']);
                 $option_data = "";
                 foreach ($options as $option) {
                     $option_data .= "&nbsp;&nbsp;&nbsp;&nbsp;- " . $option['name'] . "<br />";
                 }
                 $product_html .= "<tr>";
                 $product_html .= "<td style=\"width:5%\">" . (int) ($key + 1) . "</td>";
                 $product_html .= "<td style=\"width:45%\">" . $product['name'] . "<br />" . $option_data . "</td>";
                 $product_html .= "<td style=\"width:20%\">" . $product['model'] . "</td>";
                 $product_html .= "<td style=\"width:10%\">" . $product['quantity'] . "</td>";
                 $product_html .= "<td style=\"width:10%\">" . $this->currency->format($product['price'], $order['currency'], $order['value']) . "</td>";
                 $product_html .= "<td style=\"width:10%\">" . $this->currency->format($product['total'], $order['currency'], $order['value']) . "</td>";
                 $product_html .= "</tr>";
             }
             $product_html .= "</tbody></table>";
             $total_html = "<div class=\"clear:both;float:none;\"></div><br /><table style=\"float:right;\">";
             foreach ($totals as $total) {
                 $total_html .= "<tr>";
                 $total_html .= "<td style=\"text-align:right;\">" . $total['title'] . "</td>";
                 $total_html .= "<td style=\"text-align:right;\">" . $total['text'] . "</td>";
                 $total_html .= "</tr>";
             }
             $total_html .= "</table>";
             $result = $this->modelNewsletter->getById($this->config->get('marketing_email_new_order'));
             $message = $result['htmlbody'];
             $message = str_replace("{%title%}", 'Pedido N&deg; ' . $order_id . " - " . $this->config->get('config_name'), $message);
             $message = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $message);
             $message = str_replace("{%store_url%}", HTTP_HOME, $message);
             $message = str_replace("{%store_owner%}", $this->config->get('config_owner'), $message);
             $message = str_replace("{%store_name%}", $this->config->get('config_name'), $message);
             $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
             $message = str_replace("{%store_email%}", $this->config->get('config_email'), $message);
             $message = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $message);
             $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
             $message = str_replace("{%products%}", $product_html, $message);
             $message = str_replace("{%totals%}", $total_html, $message);
             $message = str_replace("{%order_id%}", $this->config->get('config_invoice_prefix') . $order_id, $message);
             $message = str_replace("{%invoice_id%}", $this->config->get('config_invoice_prefix') . $invoice_id, $message);
             $message = str_replace("{%rif%}", $this->customer->getRif(), $message);
             $message = str_replace("{%fullname%}", $this->customer->getFirstName() . " " . $this->customer->getFirstName(), $message);
             $message = str_replace("{%company%}", $this->customer->getCompany(), $message);
             $message = str_replace("{%email%}", $this->customer->getEmail(), $message);
             $message = str_replace("{%telephone%}", $this->customer->getTelephone(), $message);
             $message = str_replace("{%payment_address%}", $payment_address, $message);
             $message = str_replace("{%payment_method%}", $order['payment_method'], $message);
             $message = str_replace("{%shipping_address%}", $shipping_address, $message);
             $message = str_replace("{%shipping_method%}", $order['shipping_method'], $message);
             $message = str_replace("{%date_added%}", date('d-m-Y h:i A', strtotime($order['date_added'])), $message);
             $message = str_replace("{%ip%}", $order['ip'], $message);
             $message = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $message);
             $message = str_replace("{%comment%}", $order['comment'], $message);
             $message = str_replace("{%qr_code_order%}", '<img src="' . HTTP_IMAGE . $qrOrder . '" alt="QR Code" />', $message);
             $message = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="QR Code" />', $message);
             $message .= "<p style=\"text-align:center\">Powered By <a href=\"http://www.necotienda.org\">Necotienda</a>&reg; " . date('Y') . "</p>";
             if ($this->config->get('marketing_email_order_pdf')) {
                 $pdfFile = DIR_CACHE . str_replace(" ", "_", $this->config->get('config_owner') . "_pedido_" . $order_id) . '.pdf';
                 $result = $this->modelNewsletter->getById($this->config->get('marketing_email_order_pdf'));
                 $pdfBody = html_entity_decode($result['htmlbody']);
                 $pdfBody = str_replace("{%store_url%}", HTTP_HOME, $pdfBody);
                 $pdfBody = str_replace("{%title%}", 'Pedido N&deg; ' . $order_id . " - " . $this->config->get('config_name'), $pdfBody);
                 $pdfBody = str_replace("{%store_owner%}", $this->config->get('config_owner'), $pdfBody);
                 $pdfBody = str_replace("{%store_name%}", $this->config->get('config_name'), $pdfBody);
                 $pdfBody = str_replace("{%store_rif%}", $this->config->get('config_rif'), $pdfBody);
                 $pdfBody = str_replace("{%store_email%}", $this->config->get('config_email'), $pdfBody);
                 $pdfBody = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $pdfBody);
                 $pdfBody = str_replace("{%store_address%}", $this->config->get('config_address'), $pdfBody);
                 $pdfBody = str_replace("{%products%}", $product_html, $pdfBody);
                 $pdfBody = str_replace("{%totals%}", $total_html, $pdfBody);
                 $pdfBody = str_replace("{%order_id%}", $this->config->get('config_invoice_prefix') . $order_id, $pdfBody);
                 $pdfBody = str_replace("{%invoice_id%}", $this->config->get('config_invoice_prefix') . $invoice_id, $pdfBody);
                 $pdfBody = str_replace("{%rif%}", $this->customer->getRif(), $pdfBody);
                 $pdfBody = str_replace("{%fullname%}", $this->customer->getFirstName() . " " . $this->customer->getFirstName(), $pdfBody);
                 $pdfBody = str_replace("{%company%}", $this->customer->getCompany(), $pdfBody);
                 $pdfBody = str_replace("{%email%}", $this->customer->getEmail(), $pdfBody);
                 $pdfBody = str_replace("{%telephone%}", $this->customer->getTelephone(), $pdfBody);
                 $pdfBody = str_replace("{%payment_address%}", $payment_address, $pdfBody);
                 $pdfBody = str_replace("{%payment_method%}", $order['payment_method'], $pdfBody);
                 $pdfBody = str_replace("{%shipping_address%}", $shipping_address, $pdfBody);
                 $pdfBody = str_replace("{%shipping_method%}", $order['shipping_method'], $pdfBody);
                 $pdfBody = str_replace("{%date_added%}", date('d-m-Y h:i A', strtotime($order['date_added'])), $pdfBody);
                 $pdfBody = str_replace("{%ip%}", $order['ip'], $pdfBody);
                 $pdfBody = str_replace("{%comment%}", $order['comment'], $pdfBody);
                 if (file_exists(DIR_IMAGE . $this->config->get('config_logo'))) {
                     $pdfBody = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $pdfBody);
                 } else {
                     $pdfBody = str_replace("{%store_logo%}", '', $pdfBody);
                 }
                 if (file_exists(DIR_IMAGE . $qrStore)) {
                     $pdfBody = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $pdfBody);
                 } else {
                     $pdfBody = str_replace("{%qr_code_store%}", '', $pdfBody);
                 }
                 if (file_exists(DIR_IMAGE . $qrOrder)) {
                     $pdfBody = str_replace("{%qr_code_order%}", '<img src="' . HTTP_IMAGE . $qrOrder . '" alt="QR Code" />', $pdfBody);
                 } else {
                     $pdfBody = str_replace("{%qr_code_order%}", '', $pdfBody);
                 }
                 $pdfBody = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="QR Code" />', $pdfBody);
                 $pdfBody .= "<p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
                 // create new PDF document
                 $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
                 // set document information
                 $pdf->SetCreator("Powered By NecoTienda&reg;");
                 $pdf->SetTitle($this->config->get('config_name'));
                 $pdf->SetAuthor($this->config->get('config_name'));
                 $pdf->SetSubject($this->config->get('config_owner') . " " . $this->language->get('text_order') . " #" . $order_id);
                 $pdf->SetKeywords($this->config->get('config_name') . ', ' . $product_tags . ',pdf');
                 // set default header data
                 $pdf->SetHeaderData($this->config->get('config_logo'), PDF_HEADER_LOGO_WIDTH, $this->config->get('config_owner'), $this->config->get('config_name'));
                 // set header and footer fonts
                 $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
                 $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
                 // set default monospaced font
                 $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
                 //set margins
                 $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
                 $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
                 $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
                 //set auto page breaks
                 $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
                 //set image scale factor
                 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
                 //set some language-dependent strings
                 $pdf->setLanguageArray($l);
                 // set font
                 $pdf->SetFont('dejavusans', '', 10);
                 // add a page
                 $pdf->AddPage();
                 // output the HTML content
                 $pdf->writeHTML($pdfBody, true, false, true, false, '');
                 //Close and output PDF document
                 $pdf->Output($pdfFile, 'F');
             }
             $subject = $this->config->get('config_owner') . " " . $this->language->get('text_new_order') . " #" . $order_id;
             if ($this->config->get('config_smtp_method') == 'smtp') {
                 $mailer->IsSMTP();
                 $mailer->Host = $this->config->get('config_smtp_host');
                 $mailer->Username = $this->config->get('config_smtp_username');
                 $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
                 $mailer->Port = $this->config->get('config_smtp_port');
                 $mailer->Timeout = $this->config->get('config_smtp_timeout');
                 $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
                 $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
             } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
                 $mailer->IsSendmail();
             } else {
                 $mailer->IsMail();
             }
             $mailer->IsHTML();
             $mailer->AddAddress($this->customer->getEmail(), $this->customer->getCompany());
             $mailer->AddBCC($this->config->get('config_email'), $this->config->get('config_name'));
             $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
             $mailer->Subject = $subject;
             $mailer->Body = html_entity_decode(htmlspecialchars_decode($message));
             if ($pdfFile && file_exists($pdfFile)) {
                 $mailer->AddAttachment($pdfFile);
             }
             $mailer->Send();
         }
         $order_id = $this->session->get('order_id');
         $this->cart->clear();
         $this->session->clear('shipping_method');
         $this->session->clear('shipping_methods');
         $this->session->clear('payment_method');
         $this->session->clear('payment_methods');
         $this->session->clear('guest');
         $this->session->clear('comment');
         $this->session->clear('order_id');
         $this->session->clear('coupon');
     }
     $this->document->title = $this->language->get('heading_title');
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("common/home"), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("checkout/cart"), 'text' => $this->language->get('text_basket'), 'separator' => $this->language->get('text_separator'));
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("checkout/success"), 'text' => $this->language->get('text_checkout_success'), 'separator' => $this->language->get('text_separator'));
     $this->data['breadcrumbs'] = $this->document->breadcrumbs;
     $this->data['heading_title'] = $this->language->get('heading_title');
     if ($this->config->get('page_order_success')) {
         $this->load->model('content/page');
         $page = $this->modelPage->getById($this->config->get('page_order_success'));
         $this->data['text_message'] = html_entity_decode($page['description']);
     } else {
         $this->data['text_message'] = sprintf($this->language->get('text_message'), Url::createUrl("account/account"), Url::createUrl("account/order"), Url::createUrl("page/contact"));
     }
     // style files
     $csspath = defined("CDN") ? CDN . CSS : HTTP_CSS;
     $styles[] = array('media' => 'all', 'href' => $csspath . 'jquery-ui/jquery-ui.min.css');
     $styles[] = array('media' => 'all', 'href' => $csspath . 'neco.form.css');
     $this->data['styles'] = $this->styles = array_merge($this->styles, $styles);
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/checkout/success.tpl')) {
         $this->template = $this->config->get('config_template') . '/checkout/success.tpl';
     } else {
         $this->template = 'choroni/checkout/success.tpl';
     }
     $this->children[] = 'common/nav';
     $this->children[] = 'common/footer';
     $this->children[] = 'common/header';
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
            ?>
                                <?php 
            echo DataHelper::getInstance()->converterDataBancoParaDataUsuario($objDadoEcle->getData());
            ?>
.
                            <?php 
        }
        ?>
                        </div>
                    </div>
                </div><!-- frente -->
                <div class='verso'>
                    <div class='barcode'>
                        <?php 
        require_once "../../../../lib/barcode39/Barcode39.php";
        $objBc = new Barcode39($objMembro->getMatricula());
        $strArquivoBarcode = "../img/barcode39/membros/" . $objMembro->getId() . ".gif";
        if ($objBc->draw($strArquivoBarcode)) {
            echo '<img src="' . $strArquivoBarcode . '"/>';
        }
        ?>
                    </div>
                </div><!-- verso --> 
            </div>
            <?php 
    }
}
?>
        </div>
    </body>
</html>
示例#13
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Invoice</title>
<style type="text/css">
p {margin:0; padding:0;}
</style>
</head>
<body>
<section style="width:900px; margin:0 auto;">
<?php 
$bc = new Barcode39($resultData['sessid']);
$bc->barcode_text_size = 3;
$bc->barcode_bar_thick = 3;
$bc->barcode_bar_thin = 1;
$bc->draw("pdf-boxes/" . $tradeid . ".gif");
?>

<img src="images/logo.jpg" style="float:left; width:200px;" />
<img src="pdf-boxes/<?php 
echo $tradeid;
?>
.gif" style="float:right;" />


<table width="90%" align="center" style="font:14px arial; margin:20px 0 10px; clear:both; width:500px;">
<div style="clear:both; display:block;"></div>
 public function index()
 {
     $Url = new Url($this->registry);
     if ($this->customer->isLogged()) {
         $this->redirect(Url::createUrl("account/account"));
     }
     $this->language->load('account/forgotten');
     $this->document->title = $this->language->get('heading_title');
     $this->load->model('account/customer');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->load->library('email/mailer');
         $this->load->library('BarcodeQR');
         $this->load->library('Barcode39');
         $mailer = new Mailer();
         $qr = new BarcodeQR();
         $barcode = new Barcode39(C_CODE);
         $password = substr(md5(rand()), 0, 11);
         $qrStore = "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.png';
         $eanStore = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_barcode_39_order_id_" . $order_id) . '.gif';
         if (!file_exists(DIR_IMAGE . $qrStore)) {
             $qr->url(HTTP_HOME);
             $qr->draw(150, DIR_IMAGE . $qrStore);
         }
         if (!file_exists(DIR_IMAGE . $eanStore)) {
             $barcode->draw(DIR_IMAGE . $eanStore);
         }
         if ($this->config->get('marketing_email_new_password')) {
             $this->load->model("marketing/newsletter");
             $result = $this->modelNewsletter->getById($this->config->get('marketing_email_new_password'));
             $message = $result['htmlbody'];
             $message = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $message);
             $message = str_replace("{%store_url%}", HTTP_HOME, $message);
             $message = str_replace("{%url_login%}", Url::createUrl("account/login"), $message);
             $message = str_replace("{%url_activate%}", Url::createUrl("account/activate", array('ac' => $this->request->post['activation_code'])), $message);
             $message = str_replace("{%store_owner%}", $this->config->get('config_owner'), $message);
             $message = str_replace("{%store_name%}", $this->config->get('config_name'), $message);
             $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
             $message = str_replace("{%store_email%}", $this->config->get('config_email'), $message);
             $message = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $message);
             $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
             $message = str_replace("{%email%}", $this->request->post['email'], $message);
             $message = str_replace("{%password%}", $password, $message);
             $message = str_replace("{%date_added%}", date('d-m-Y h:i A'), $message);
             $message = str_replace("{%ip%}", $_SERVER['REMOTE_ADDR'], $message);
             $message = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $message);
             $message = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="NT Code" />', $message);
             $message .= "<p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
         } else {
             $message = "<h1>" . $this->config->get('config_name') . "</h1>";
             $message .= "<p>" . $this->language->get('text_password_renew') . "</p>";
             $message .= "<p><b>" . $password . "</b></p><br />";
             $message .= '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />';
             $message .= '<img src="' . HTTP_IMAGE . $eanStore . '" alt="NT Code" />';
             $message .= "<br /><p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
         }
         $subject = $this->config->get('config_name') . " " . $this->language->get('text_new_password');
         if ($this->config->get('config_smtp_method') == 'smtp') {
             $mailer->IsSMTP();
             $mailer->Host = $this->config->get('config_smtp_host');
             $mailer->Username = $this->config->get('config_smtp_username');
             $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
             $mailer->Port = $this->config->get('config_smtp_port');
             $mailer->Timeout = $this->config->get('config_smtp_timeout');
             $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
             $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
         } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
             $mailer->IsSendmail();
         } else {
             $mailer->IsMail();
         }
         $mailer->IsHTML();
         $mailer->AddAddress($this->request->post['email'], $this->config->get('config_name'));
         $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
         $mailer->Subject = $subject;
         $mailer->Body = html_entity_decode(htmlspecialchars_decode($message));
         $mailer->Send();
         $this->modelCustomer->editPassword($this->request->post['email'], $password);
         $this->session->set('success', $this->language->get('text_success'));
         $this->redirect(Url::createUrl("account/login"));
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("common/home"), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("account/account"), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'));
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("account/forgotten"), 'text' => $this->language->get('text_forgotten'), 'separator' => $this->language->get('text_separator'));
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_your_email'] = $this->language->get('text_your_email');
     $this->data['text_email'] = $this->language->get('text_email');
     $this->data['entry_email'] = $this->language->get('entry_email');
     $this->data['button_continue'] = $this->language->get('button_continue');
     $this->data['button_back'] = $this->language->get('button_back');
     if (isset($this->error['message'])) {
         $this->data['error'] = $this->error['message'];
     } else {
         $this->data['error'] = '';
     }
     $this->data['action'] = Url::createUrl("account/forgotten");
     $this->data['back'] = Url::createUrl("account/account");
     $this->loadWidgets();
     if ($scripts) {
         $this->scripts = array_merge($this->scripts, $scripts);
     }
     $this->children[] = 'common/column_left';
     $this->children[] = 'common/column_right';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/header';
     $this->children[] = 'common/footer';
     $template = $this->config->get('default_view_account_forgotten') ? $this->config->get('default_view_account_forgotten') : 'account/forgotten.tpl';
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/' . $template)) {
         $this->template = $this->config->get('config_template') . '/' . $template;
     } else {
         $this->template = 'choroni/' . $template;
     }
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }
示例#15
0
 public function getBarCode($orderIDBarCode, $orderID, $orderShipID)
 {
     //echo "This is the barcode: ".$this->barcodeImagePath."<br/>";
     //$targetDir  = 'images'.DIRECTORY_SEPARATOR.'shipping'.DIRECTORY_SEPARATOR.$orderID;
     // get Date Received from OrderID
     $dateReceived = Modules::run('orderItems/orderitemcontroller/getDateReceived', $orderID);
     $dateOrderReceivedArr = explode("-", $dateReceived);
     $yearOrder = $dateOrderReceivedArr[0];
     $monthOrder = $dateOrderReceivedArr[1];
     // checks and creates Year and Month Folder
     if (!is_dir($this->barcodeImagePath . '/' . $yearOrder . '/' . $monthOrder)) {
         if (!mkdir($this->barcodeImagePath . '/' . $yearOrder . '/' . $monthOrder, 0777, TRUE)) {
             die("Failed to create Year and Month Folders");
         }
     }
     $path = $this->barcodeImagePath . '/' . $yearOrder . '/' . $monthOrder . '/' . $orderID;
     if (!is_dir($path)) {
         if (!mkdir($path, 0777, TRUE)) {
             die("Failed to create Order Folder");
         }
     }
     $targetPath = $path . '/' . 'Shipping';
     if (!is_dir($targetPath)) {
         if (!mkdir($targetPath, 0777, TRUE)) {
             die("Failed to create Shipping Folder");
         }
     }
     //$targetDir                  = $path.'/'.$orderID;
     //$targetDir2 = 'images'.DIRECTORY_SEPARATOR.'shipping'.DIRECTORY_SEPARATOR.'test';
     //         if(!file_exists($targetDir))
     //         {
     //              if(!mkdir($targetDir,0777))
     //              {
     //                  die("Failed to create Folder");
     //              }
     //              else
     //              {
     //                  chmod($this->barcodeImagePath.'/'.$orderID, 0777);
     //              }
     //              //@mkdir($targetDir2, 0777);
     //         }
     $bc = new Barcode39($orderIDBarCode);
     // set text size
     $bc->barcode_text_size = 5;
     // set barcode bar thickness (thick bars)
     $bc->barcode_bar_thick = 4;
     // set barcode bar thickness (thin bars)
     $bc->barcode_bar_thin = 2;
     //$data =    $bc->draw("images/shipping/$orderID/$orderShipID.gif");
     $data = $bc->draw($targetPath . '/' . $orderShipID . ".gif");
     if ($data) {
         chmod($targetPath . '/' . $orderShipID . ".gif", 0777);
     }
     //print_r($data);
     //echo "<br/>";
 }
 private function prepareTemplate($newsletter)
 {
     if (!$newsletter) {
         return false;
     }
     $this->load->library('url');
     $this->load->library('BarcodeQR');
     $this->load->library('Barcode39');
     $qr = new BarcodeQR();
     $barcode = new Barcode39(C_CODE);
     $qrStore = "cache/" . $this->escape($this->config->get('config_owner')) . '.png';
     $eanStore = "cache/" . $this->escape($this->config->get('config_owner')) . "_barcode_39.gif";
     if (!file_exists(DIR_IMAGE . $qrStore)) {
         $qr->url(HTTP_HOME);
         $qr->draw(150, DIR_IMAGE . $qrStore);
     }
     if (!file_exists(DIR_IMAGE . $eanStore)) {
         $barcode->draw(DIR_IMAGE . $eanStore);
     }
     $newsletter = str_replace("%7B", "{", $newsletter);
     $newsletter = str_replace("%7D", "}", $newsletter);
     $newsletter = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $newsletter);
     $newsletter = str_replace("{%store_url%}", HTTP_HOME, $newsletter);
     $newsletter = str_replace("{%url_login%}", Url::createUrl("account/login"), $newsletter);
     $newsletter = str_replace("{%store_owner%}", $this->config->get('config_owner'), $newsletter);
     $newsletter = str_replace("{%store_name%}", $this->config->get('config_name'), $newsletter);
     $newsletter = str_replace("{%store_rif%}", $this->config->get('config_rif'), $newsletter);
     $newsletter = str_replace("{%store_email%}", $this->config->get('config_email'), $newsletter);
     $newsletter = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $newsletter);
     $newsletter = str_replace("{%store_address%}", $this->config->get('config_address'), $newsletter);
     /*
      $newsletter = str_replace("{%products%}",$product_html,$newsletter);
     */
     $newsletter = str_replace("{%date_added%}", date('d-m-Y h:i A'), $newsletter);
     $newsletter = str_replace("{%ip%}", $_SERVER['REMOTE_ADDR'], $newsletter);
     $newsletter = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $newsletter);
     $newsletter = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="NT Code" />', $newsletter);
     $newsletter .= "<p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
     return html_entity_decode(htmlspecialchars_decode($newsletter));
 }
示例#17
0
 private static function _draw($call, $res, $color, $x, $y, $angle, $type, $datas, $width, $height)
 {
     $digit = '';
     $hri = '';
     $code = '';
     $crc = true;
     $rect = false;
     $b2d = false;
     if (is_array($datas)) {
         foreach (array('code' => '', 'crc' => true, 'rect' => false) as $v => $def) {
             ${$v} = isset($datas[$v]) ? $datas[$v] : $def;
         }
         $code = $code;
     } else {
         $code = $datas;
     }
     if ($code == '') {
         return false;
     }
     $code = (string) $code;
     $type = strtolower($type);
     switch ($type) {
         case 'std25':
         case 'int25':
             $digit = BarcodeI25::getDigit($code, $crc, $type);
             $hri = BarcodeI25::compute($code, $crc, $type);
             break;
         case 'ean8':
         case 'ean13':
             $digit = BarcodeEAN::getDigit($code, $type);
             $hri = BarcodeEAN::compute($code, $type);
             break;
         case 'upc':
             $digit = BarcodeUPC::getDigit($code);
             $hri = BarcodeUPC::compute($code);
             break;
         case 'code11':
             $digit = Barcode11::getDigit($code);
             $hri = $code;
             break;
         case 'code39':
             $digit = Barcode39::getDigit($code);
             $hri = $code;
             break;
         case 'code93':
             $digit = Barcode93::getDigit($code, $crc);
             $hri = $code;
             break;
         case 'code128':
             $digit = Barcode128::getDigit($code);
             $hri = $code;
             break;
         case 'codabar':
             $digit = BarcodeCodabar::getDigit($code);
             $hri = $code;
             break;
         case 'msi':
             $digit = BarcodeMSI::getDigit($code, $crc);
             $hri = BarcodeMSI::compute($code, $crc);
             break;
         case 'datamatrix':
             $digit = BarcodeDatamatrix::getDigit($code, $rect);
             $hri = $code;
             $b2d = true;
             break;
     }
     if ($digit == '') {
         return false;
     }
     if ($b2d) {
         $width = is_null($width) ? 5 : $width;
         $height = $width;
     } else {
         $width = is_null($width) ? 1 : $width;
         $height = is_null($height) ? 50 : $height;
         $digit = self::bitStringTo2DArray($digit);
     }
     if ($call == 'gd') {
         $result = self::digitToGDRenderer($res, $color, $x, $y, $angle, $width, $height, $digit);
     } else {
         if ($call == 'fpdf') {
             $result = self::digitToFPDFRenderer($res, $color, $x, $y, $angle, $width, $height, $digit);
         }
     }
     $result['hri'] = $hri;
     return $result;
 }
 protected function notifyReply($review_id, $product_id)
 {
     if (!$review_id) {
         return false;
     }
     $this->load->auto('email/mailer');
     $this->load->auto('store/product');
     $this->load->auto('account/customer');
     $this->load->auto('store/review');
     $this->load->auto('marketing/newsletter');
     $review_info = $this->modelReview->getById($review_id);
     $product_info = $this->modelProduct->getProduct($product_id);
     if ($this->config->get('marketing_email_new_reply') && $review_info) {
         $this->load->model("marketing/newsletter");
         $this->load->library('email/mailer');
         $this->load->library('BarcodeQR');
         $this->load->library('Barcode39');
         $mailer = new Mailer();
         $qr = new BarcodeQR();
         $barcode = new Barcode39(C_CODE);
         $qrStore = "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.png';
         $eanStore = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_barcode_39_order_id_" . $order_id) . '.gif';
         if (!file_exists(DIR_IMAGE . $qrStore)) {
             $qr->url(HTTP_HOME);
             $qr->draw(150, DIR_IMAGE . $qrStore);
         }
         if (!file_exists(DIR_IMAGE . $eanStore)) {
             $barcode->draw(DIR_IMAGE . $eanStore);
         }
         $customer_info = $this->modelCustomer->getCustomer($review_info['customer_id']);
         $result = $this->modelNewsletter->getById($this->config->get('marketing_email_new_reply'));
         $message = $result['htmlbody'];
         $message = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $message);
         $message = str_replace("{%store_url%}", HTTP_HOME, $message);
         $message = str_replace("{%store_owner%}", $this->config->get('config_owner'), $message);
         $message = str_replace("{%store_name%}", $this->config->get('config_name'), $message);
         $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
         $message = str_replace("{%store_email%}", $this->config->get('config_email'), $message);
         $message = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $message);
         $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
         $message = str_replace("{%product_url%}", Url::createUrl('store/product', array('product_id' => $product_id)), $message);
         $message = str_replace("{%url_account%}", Url::createUrl('account/review'), $message);
         $message = str_replace("{%product_name%}", $product_info['name'], $message);
         $message = str_replace("{%fullname%}", $customer_info['firstname'] . " " . $customer_info['lastname'], $message);
         $message = str_replace("{%company%}", $customer_info['company'], $message);
         $message = str_replace("{%email%}", $customer_info['email'], $message);
         $message = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $message);
         $message = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="QR Code" />', $message);
         $message .= "<p style=\"text-align:center\">Powered By <a href=\"http://www.necotienda.org\">Necotienda</a>&reg; " . date('Y') . "</p>";
         $subject = $this->config->get('config_owner') . " " . $this->language->get('text_new_reply');
         if ($this->config->get('config_smtp_method') == 'smtp') {
             $mailer->IsSMTP();
             $mailer->Host = $this->config->get('config_smtp_host');
             $mailer->Username = $this->config->get('config_smtp_username');
             $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
             $mailer->Port = $this->config->get('config_smtp_port');
             $mailer->Timeout = $this->config->get('config_smtp_timeout');
             $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
             $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
         } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
             $mailer->IsSendmail();
         } else {
             $mailer->IsMail();
         }
         $mailer->IsHTML();
         $mailer->AddAddress($customer_info['email'], $customer_info['author']);
         $mailer->AddBCC($this->config->get('config_email'), $this->config->get('config_name'));
         $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
         $mailer->Subject = $subject;
         $mailer->Body = html_entity_decode($message);
         $mailer->Send();
     }
 }
 public function process()
 {
     // check if session is active
     $session = new Session($this->sessionId);
     if ($session->sessionId > 0) {
         // update session
         $session->update();
         // process restricted functions
         switch ($this->f) {
             case 'checkLogin':
                 return Login::checkLogin($session->sessionId);
             case 'getSession':
                 return $session;
             case 'getWarehouse':
                 if (isset($this->data->update)) {
                     $warehouse = new Warehouse($session->warehouseId, $this->data->update);
                 } else {
                     $warehouse = new Warehouse($session->warehouseId);
                 }
                 $warehouse->dMail = $warehouse->getMail();
                 $warehouse->dDisableLocationLess = $warehouse->isLocationLessDisabled();
                 $warehouse->dDisablePaletteLess = $warehouse->isPaletteLessDisabled();
                 return $warehouse;
             case 'editWarehouse':
                 if (!$session->restricted) {
                     $data = $this->data;
                     $warehouse = new Warehouse($session->warehouseId);
                     // update warehouse data
                     if (isset($data->name)) {
                         $warehouse->name = $data->name;
                     }
                     if (isset($data->description)) {
                         $warehouse->description = $data->description;
                     }
                     if (isset($data->country)) {
                         $warehouse->country = $data->country;
                     }
                     if (isset($data->city)) {
                         $warehouse->city = $data->city;
                     }
                     if (isset($data->password)) {
                         $warehouse->setPassword($data->password);
                     }
                     if (isset($data->passwordRestricted)) {
                         $warehouse->setPasswordRestricted($data->passwordRestricted);
                     }
                     if (isset($data->mail)) {
                         $warehouse->setMail($data->mail);
                     }
                     if (isset($data->disableLocationLess)) {
                         $warehouse->setDisableLocationLess($data->disableLocationLess);
                     }
                     if (isset($data->disablePaletteLess)) {
                         $warehouse->setDisablePaletteLess($data->disablePaletteLess);
                     }
                     // update database entry
                     return $warehouse->edit();
                 }
                 break;
             case 'deleteWarehouse':
                 if (!$session->restricted) {
                     $warehouse = new Warehouse($session->warehouseId);
                     if ($warehouse->id > 0 && $warehouse->delete()) {
                         return $session->destroy();
                     }
                 }
                 break;
             case 'addCategory':
                 if (!$session->restricted && isset($this->data->name)) {
                     $category = new Category(null, $session->warehouseId);
                     $category->name = $this->data->name;
                     if (isset($this->data->parent)) {
                         $category->parent = $this->data->parent;
                     }
                     if ($category->edit()) {
                         return $category->id;
                     }
                 }
                 break;
             case 'getCategory':
                 if (isset($this->data->id) && isset($this->data->update)) {
                     return new Category($this->data->id, $session->warehouseId, $this->data->update);
                 } elseif (isset($this->data->id)) {
                     return new Category($this->data->id, $session->warehouseId);
                 }
                 break;
             case 'deleteCategory':
                 if (!$session->restricted && isset($this->data->id)) {
                     $category = new Category($this->data->id, $session->warehouseId);
                     return $category->delete();
                 }
                 break;
             case 'editCategory':
                 if (isset($this->data->id)) {
                     $data = $this->data;
                     $category = new Category($this->data->id, $session->warehouseId);
                     if (!$session->restricted) {
                         if (isset($data->name)) {
                             $category->name = $data->name;
                         }
                         if (isset($data->parent)) {
                             $category->parent = $data->parent;
                         }
                         if (isset($data->male)) {
                             $category->male = $data->male;
                         }
                         if (isset($data->female)) {
                             $category->female = $data->female;
                         }
                         if (isset($data->children)) {
                             $category->children = $data->children;
                         }
                         if (isset($data->baby)) {
                             $category->baby = $data->baby;
                         }
                         if (isset($data->summer)) {
                             $category->summer = $data->summer;
                         }
                         if (isset($data->winter)) {
                             $category->winter = $data->winter;
                         }
                     }
                     if (isset($data->demand)) {
                         $category->demand = $data->demand;
                     }
                     if (isset($data->weight)) {
                         $category->weight = $data->weight;
                     }
                     return $category->edit();
                 }
                 break;
             case 'getCategories':
                 if (isset($this->data->parent)) {
                     return Category::getCategories($session->warehouseId, $this->data->parent);
                 } else {
                     return Category::getCategories($session->warehouseId);
                 }
             case 'addLocation':
                 if (!$session->restricted && isset($this->data->name)) {
                     $location = new Location(null, $session->warehouseId);
                     $location->name = $this->data->name;
                     if ($location->edit()) {
                         return $location->id;
                     }
                     return true;
                 }
                 break;
             case 'getLocation':
                 if (isset($this->data->id) && isset($this->data->update)) {
                     return new Location($this->data->id, $session->warehouseId, $this->data->update);
                 } elseif (isset($this->data->id)) {
                     return new Location($this->data->id, $session->warehouseId);
                 }
                 break;
             case 'deleteLocation':
                 if (!$session->restricted && isset($this->data->id)) {
                     $location = new Location($this->data->id, $session->warehouseId);
                     return $location->delete();
                 }
                 break;
             case 'editLocation':
                 if (!$session->restricted && isset($this->data->id) && isset($this->data->name)) {
                     $location = new Location($this->data->id, $session->warehouseId);
                     $location->name = $this->data->name;
                     return $location->edit();
                 }
                 break;
             case 'getLocations':
                 return Location::getLocations($session->warehouseId);
             case 'addPalette':
                 $palette = new Palette(null, $session->warehouseId);
                 if (isset($this->data->locationId)) {
                     $palette->locationId = $this->data->locationId;
                 }
                 if ($palette->edit()) {
                     return $palette->id;
                 }
                 break;
             case 'getPalette':
                 if (isset($this->data->id) && isset($this->data->update)) {
                     return new Palette($this->data->id, $session->warehouseId, $this->data->update);
                 } elseif (isset($this->data->id)) {
                     return new Palette($this->data->id, $session->warehouseId);
                 }
                 break;
             case 'deletePalette':
                 if (isset($this->data->id)) {
                     $palette = new Palette($this->data->id, $session->warehouseId);
                     return $palette->delete();
                 }
                 break;
             case 'editPalette':
                 if (isset($this->data->id)) {
                     $palette = new Palette($this->data->id, $session->warehouseId);
                     if (isset($this->data->locationId)) {
                         $palette->locationId = $this->data->locationId;
                     }
                     return $palette->edit();
                 }
                 break;
             case 'getPalettes':
                 return Palette::getPalettes($session->warehouseId);
             case 'getCarton':
                 if (isset($this->data->id) && isset($this->data->update)) {
                     return new Carton($this->data->id, $session->warehouseId, null, null, $this->data->update);
                 } elseif (isset($this->data->id)) {
                     return new Carton($this->data->id, $session->warehouseId);
                 }
                 break;
             case 'addCarton':
                 $locationId = null;
                 $paletteId = null;
                 if (isset($this->data->location)) {
                     $locationId = $this->data->location;
                 }
                 if (isset($this->data->palette)) {
                     $paletteId = $this->data->palette;
                 }
                 $carton = new Carton(null, $session->warehouseId, $locationId, $paletteId);
                 return $carton->id;
             case 'deleteCarton':
                 if (isset($this->data->id)) {
                     $carton = new Carton($this->data->id, $session->warehouseId);
                     return $carton->delete();
                 }
                 break;
             case 'editCarton':
                 if (isset($this->data->id)) {
                     $carton = new Carton($this->data->id, $session->warehouseId);
                     if (isset($this->data->location)) {
                         $carton->locationId = $this->data->location;
                     } else {
                         $carton->locationId = null;
                     }
                     if (isset($this->data->palette)) {
                         $carton->paletteId = $this->data->palette;
                     } else {
                         $carton->paletteId = null;
                     }
                     return $carton->edit();
                 }
                 break;
             case 'addArticle':
                 if (isset($this->data->carton) && isset($this->data->category) && isset($this->data->amount)) {
                     return Stock::addArticle($this->data->carton, $this->data->category, isset($this->data->male) ? $this->data->male : false, isset($this->data->female) ? $this->data->female : false, isset($this->data->children) ? $this->data->children : false, isset($this->data->baby) ? $this->data->baby : false, isset($this->data->winter) ? $this->data->winter : false, isset($this->data->summer) ? $this->data->summer : false, $this->data->amount >= 0 ? $this->data->amount : 0, $this->data->amount < 0 ? $this->data->amount : 0);
                 }
                 break;
             case 'getStock':
                 return Stock::getStock($session->warehouseId, isset($this->data->carton) ? $this->data->carton : null, isset($this->data->category) ? $this->data->category : null, isset($this->data->palette) ? $this->data->palette : null, isset($this->data->location) ? $this->data->location : null, isset($this->data->male) ? $this->data->male : false, isset($this->data->female) ? $this->data->female : false, isset($this->data->children) ? $this->data->children : false, isset($this->data->baby) ? $this->data->male : false, isset($this->data->summer) ? $this->data->male : false, isset($this->data->winter) ? $this->data->male : false, isset($this->data->details) ? $this->data->details : false);
             case 'getBarcodeUri':
                 if (isset($this->data->text)) {
                     // create barcode object
                     $bc = new Barcode39($this->data->text);
                     if (isset($this->data->textSize)) {
                         $bc->barcode_text_size = $this->data->textSize;
                     }
                     if (isset($this->data->barThin)) {
                         $bc->barcode_bar_thin = $this->data->barThin;
                     }
                     if (isset($this->data->barThick)) {
                         $bc->barcode_bar_thick = $this->data->barThick;
                     }
                     // generate barcode image
                     $img = "barcode_" . mt_rand(0, 100) . ".png";
                     $bc->draw($img);
                     // get data uri
                     $uri = Barcode39::getDataURI($img);
                     unlink($img);
                     return $uri;
                 }
                 break;
         }
     } else {
         // process unrestricted function
         switch ($this->f) {
             case 'getActiveSessions':
                 return Session::getActiveSessionsNumber();
             case 'getWarehouses':
                 return Warehouse::getWarehouses();
             case 'addWarehouse':
                 $data = $this->data;
                 if (isset($data->name) && isset($data->description) && isset($data->country) && isset($data->city) && isset($data->password) && isset($data->mail)) {
                     $warehouse = new Warehouse();
                     Log::debug('new warehouse' . $warehouse->id);
                     $warehouse->name = $data->name;
                     $warehouse->description = $data->description;
                     $warehouse->country = $data->country;
                     $warehouse->city = $data->city;
                     $warehouse->setPassword($data->password);
                     $warehouse->setMail($data->mail);
                     return $warehouse->edit();
                 }
                 break;
             case 'getCountries':
                 return getCountries();
                 break;
             case 'getCountryCode':
                 $data = $this->data;
                 if (isset($data->name)) {
                     return getCountryCode(null, $data->name);
                 }
                 return false;
         }
     }
     return false;
 }
 public function getBarCode($orderIDBarCode, $orderID, $orderShipID)
 {
     //echo "This is the barcode: ".$this->barcodeImagePath."<br/>";
     //$targetDir  = 'images'.DIRECTORY_SEPARATOR.'shipping'.DIRECTORY_SEPARATOR.$orderID;
     $targetDir = $this->barcodeImagePath . '/' . $orderID;
     //$targetDir2 = 'images'.DIRECTORY_SEPARATOR.'shipping'.DIRECTORY_SEPARATOR.'test';
     if (!file_exists($targetDir)) {
         if (!mkdir($targetDir, 0777)) {
             die("Failed to create Folder");
         } else {
             chmod($this->barcodeImagePath . '/' . $orderID, 0777);
         }
         //@mkdir($targetDir2, 0777);
     }
     $bc = new Barcode39($orderIDBarCode);
     // set text size
     $bc->barcode_text_size = 5;
     // set barcode bar thickness (thick bars)
     $bc->barcode_bar_thick = 4;
     // set barcode bar thickness (thin bars)
     $bc->barcode_bar_thin = 2;
     //$data =    $bc->draw("images/shipping/$orderID/$orderShipID.gif");
     $data = $bc->draw($this->barcodeImagePath . '/' . $orderID . '/' . $orderShipID . ".gif");
     if ($data) {
         chmod($this->barcodeImagePath . '/' . $orderID . '/' . $orderShipID . ".gif", 0777);
     }
     //print_r($data);
 }
示例#21
0
 public static function raw($type, $datas)
 {
     $digit = '';
     $hri = '';
     $code = '';
     $crc = true;
     $rect = false;
     if (is_array($datas)) {
         foreach (array('code' => '', 'crc' => true, 'rect' => false) as $v => $def) {
             ${$v} = isset($datas[$v]) ? $datas[$v] : $def;
         }
         $code = $code;
     } else {
         $code = $datas;
     }
     if ($code == '') {
         return false;
     }
     $code = (string) $code;
     $type = strtolower($type);
     switch ($type) {
         case 'std25':
         case 'int25':
             $digit = BarcodeI25::getDigit($code, $crc, $type);
             $hri = BarcodeI25::compute($code, $crc, $type);
             break;
         case 'ean8':
         case 'ean13':
             $digit = BarcodeEAN::getDigit($code, $type);
             $hri = BarcodeEAN::compute($code, $type);
             break;
         case 'upc':
             $digit = BarcodeUPC::getDigit($code);
             $hri = BarcodeUPC::compute($code);
             break;
         case 'code11':
             $digit = Barcode11::getDigit($code);
             $hri = $code;
             break;
         case 'code39':
             $digit = Barcode39::getDigit($code);
             $hri = $code;
             break;
         case 'code93':
             $digit = Barcode93::getDigit($code, $crc);
             $hri = $code;
             break;
         case 'code128':
             $digit = Barcode128::getDigit($code);
             $hri = $code;
             break;
         case 'codabar':
             $digit = BarcodeCodabar::getDigit($code);
             $hri = $code;
             break;
         case 'msi':
             $digit = BarcodeMSI::getDigit($code, $crc);
             $hri = BarcodeMSI::compute($code, $crc);
             break;
         case 'datamatrix':
             $digit = BarcodeDatamatrix::getDigit($code, $rect);
             $hri = $code;
             break;
     }
     return array($digit, $hri);
 }
 public function index()
 {
     $Url = new Url($this->registry);
     if ($this->customer->isLogged()) {
         $this->redirect(Url::createUrl("account/account"));
     }
     $this->language->load('account/register');
     $this->document->title = $this->language->get('heading_title');
     $this->load->model('account/customer');
     if ($this->request->server['REQUEST_METHOD'] == 'POST' && $this->validate()) {
         $this->request->post['rif'] = $this->request->post['riftype'] . $this->request->post['rif'];
         $this->request->post['birthday'] = $this->request->post['bday'] . "/" . $this->request->post['bmonth'] . "/" . $this->request->post['byear'];
         if ($this->request->hasPost('referencedBy')) {
             $promotor = $this->modelCustomer->getCustomerByEmail($this->request->getPost('referencedBy'));
             $this->request->post['referenced_by'] = $promotor['customer_id'] ? $promotor['customer_id'] : 0;
         }
         $email = $this->request->getPost('email');
         $password = $this->request->getPost('password');
         $result = $this->modelCustomer->addCustomer($this->request->post);
         if ($result) {
             $this->session->clear('guest');
             if ($this->config->get('marketing_email_new_customer')) {
                 $this->load->model("marketing/newsletter");
                 $this->load->library('email/mailer');
                 $this->load->library('BarcodeQR');
                 $this->load->library('Barcode39');
                 $mailer = new Mailer();
                 $qr = new BarcodeQR();
                 $barcode = new Barcode39(C_CODE);
                 $qrStore = "cache/" . str_replace(".", "_", $this->config->get('config_owner')) . '.png';
                 $eanStore = "cache/" . str_replace(" ", "_", $this->config->get('config_owner') . "_barcode_39_order_id_" . $order_id) . '.gif';
                 if (!file_exists(DIR_IMAGE . $qrStore)) {
                     $qr->url(HTTP_HOME);
                     $qr->draw(150, DIR_IMAGE . $qrStore);
                 }
                 if (!file_exists(DIR_IMAGE . $eanStore)) {
                     $barcode->draw(DIR_IMAGE . $eanStore);
                 }
                 if ($this->config->get('config_customer_approval')) {
                     $result = $this->modelNewsletter->getById($this->config->get('marketing_email_new_customer'));
                     $message = $result['htmlbody'];
                 } else {
                     $result = $this->modelNewsletter->getById($this->config->get('marketing_email_activate_customer'));
                     $message = $result['htmlbody'];
                 }
                 $message = str_replace("{%store_logo%}", '<img src="' . HTTP_IMAGE . $this->config->get('config_logo') . '" alt="' . $this->config->get('config_name') . '" />', $message);
                 $message = str_replace("{%store_url%}", HTTP_HOME, $message);
                 $message = str_replace("{%url_login%}", Url::createUrl("account/login"), $message);
                 $message = str_replace("{%url_activate%}", Url::createUrl("account/activate", array('ac' => $this->request->post['activation_code'])), $message);
                 $message = str_replace("{%store_owner%}", $this->config->get('config_owner'), $message);
                 $message = str_replace("{%store_name%}", $this->config->get('config_name'), $message);
                 $message = str_replace("{%store_rif%}", $this->config->get('config_rif'), $message);
                 $message = str_replace("{%store_email%}", $this->config->get('config_email'), $message);
                 $message = str_replace("{%store_telephone%}", $this->config->get('config_telephone'), $message);
                 $message = str_replace("{%store_address%}", $this->config->get('config_address'), $message);
                 $message = str_replace("{%products%}", $product_html, $message);
                 $message = str_replace("{%fullname%}", $this->request->post['firstname'] . " " . $this->request->post['lastname'], $message);
                 $message = str_replace("{%rif%}", $this->request->post['rif'], $message);
                 $message = str_replace("{%company%}", $this->request->post['company'], $message);
                 $message = str_replace("{%email%}", $this->request->post['email'], $message);
                 $message = str_replace("{%password%}", $this->request->post['password'], $message);
                 $message = str_replace("{%date_added%}", date('d-m-Y h:i A'), $message);
                 $message = str_replace("{%ip%}", $_SERVER['REMOTE_ADDR'], $message);
                 $message = str_replace("{%qr_code_store%}", '<img src="' . HTTP_IMAGE . $qrStore . '" alt="QR Code" />', $message);
                 $message = str_replace("{%barcode_39_order_id%}", '<img src="' . HTTP_IMAGE . $eanStore . '" alt="NT Code" />', $message);
                 $message .= "<p style=\"text-align:center\">Powered By Necotienda&reg; " . date('Y') . "</p>";
                 $subject = $this->config->get('config_name') . " " . $this->language->get('text_welcome');
                 if ($this->config->get('config_smtp_method') == 'smtp') {
                     $mailer->IsSMTP();
                     $mailer->Host = $this->config->get('config_smtp_host');
                     $mailer->Username = $this->config->get('config_smtp_username');
                     $mailer->Password = base64_decode($this->config->get('config_smtp_password'));
                     $mailer->Port = $this->config->get('config_smtp_port');
                     $mailer->Timeout = $this->config->get('config_smtp_timeout');
                     $mailer->SMTPSecure = $this->config->get('config_smtp_ssl');
                     $mailer->SMTPAuth = $this->config->get('config_smtp_auth') ? true : false;
                 } elseif ($this->config->get('config_smtp_method') == 'sendmail') {
                     $mailer->IsSendmail();
                 } else {
                     $mailer->IsMail();
                 }
                 $mailer->IsHTML();
                 $mailer->AddAddress($this->request->post['email'], $this->request->post['company']);
                 $mailer->AddBCC($this->config->get('config_email'), $this->config->get('config_name'));
                 $mailer->SetFrom($this->config->get('config_email'), $this->config->get('config_name'));
                 $mailer->Subject = $subject;
                 $mailer->Body = html_entity_decode(htmlspecialchars_decode($message));
                 $mailer->Send();
             }
             if ($this->customer->login($email, $password) && $this->session->has('redirect')) {
                 $this->redirect($this->session->get('redirect'));
             } else {
                 $this->redirect(Url::createUrl("account/success"));
             }
         }
     }
     $this->document->breadcrumbs = array();
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("common/home"), 'text' => $this->language->get('text_home'), 'separator' => false);
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("account/account"), 'text' => $this->language->get('text_account'), 'separator' => $this->language->get('text_separator'));
     $this->document->breadcrumbs[] = array('href' => Url::createUrl("account/register"), 'text' => $this->language->get('text_create'), 'separator' => $this->language->get('text_separator'));
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_account_already'] = sprintf($this->language->get('text_account_already'), Url::createUrl("account/login"));
     $this->data['action'] = Url::createUrl("account/register");
     $this->data['error_warning'] = isset($this->error['warning']) ? $this->error['warning'] : "";
     $this->data['error_email'] = isset($this->error['email']) ? $this->error['email'] : "";
     $this->data['error_company'] = isset($this->error['company']) ? $this->error['company'] : "";
     $this->data['error_rif'] = isset($this->error['rif']) ? $this->error['rif'] : "";
     $this->data['error_password'] = isset($this->error['password']) ? $this->error['password'] : "";
     $this->data['error_confirm'] = isset($this->error['confirm']) ? $this->error['confirm'] : "";
     $this->data['error_captcha'] = isset($this->error['captcha']) ? $this->error['captcha'] : "";
     $this->data['error_recaptcha'] = isset($this->error['recaptcha']) ? $this->error['recaptcha'] : null;
     $this->setvar('company');
     $this->setvar('riftype');
     $this->setvar('rif');
     $this->setvar('lastname');
     $this->setvar('firstname');
     $this->setvar('email');
     $this->setvar('byear');
     $this->setvar('bmonth');
     $this->setvar('bday');
     $this->setvar('telephone');
     $this->setvar('referencedBy');
     $this->setvar('country_id');
     $this->setvar('zone_id');
     $this->setvar('address_1');
     $this->setvar('postcode');
     $this->setvar('street');
     $this->setvar('city');
     $this->load->model('localisation/country');
     $this->data['countries'] = $this->modelCountry->getCountries();
     $this->data['page_legal_terms_id'] = $this->config->get('config_account_id') ? $this->config->get('config_account_id') : 0;
     $this->data['page_privacy_terms_id'] = $this->config->get('config_account_id') ? $this->config->get('config_account_id') : 0;
     // javascript files
     $jspath = defined("CDN_JS") ? CDN_JS : HTTP_JS;
     $javascripts[] = $jspath . "necojs/neco.form.js";
     $javascripts[] = $jspath . "vendor/jquery-ui.min.js";
     $this->javascripts = array_merge($this->javascripts, $javascripts);
     // style files
     $csspath = defined("CDN_CSS") ? CDN_CSS : HTTP_CSS;
     $styles[] = array('media' => 'all', 'href' => $csspath . 'jquery-ui/jquery-ui.min.css');
     $styles[] = array('media' => 'all', 'href' => $csspath . 'neco.form.css');
     $this->styles = array_merge($this->styles, $styles);
     $this->loadWidgets();
     if ($scripts) {
         $this->scripts = array_merge($this->scripts, $scripts);
     }
     $this->children[] = 'common/column_left';
     $this->children[] = 'common/column_right';
     $this->children[] = 'common/nav';
     $this->children[] = 'common/header';
     $this->children[] = 'common/footer';
     $template = $this->config->get('default_view_account_register') ? $this->config->get('default_view_account_register') : 'account/register.tpl';
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/' . $template)) {
         $this->template = $this->config->get('config_template') . '/' . $template;
     } else {
         $this->template = 'choroni/' . $template;
     }
     $this->response->setOutput($this->render(true), $this->config->get('config_compression'));
 }