Esempio n. 1
0
    if (!empty($objects[$type])) {
        if (!empty($numeric_objects[$type]) && !is_numeric($prefix)) {
            $prefix = '';
        }
        $code = $prefix . $id;
        require Registry::get('config.dir.addons') . 'barcode/lib/barcodegenerator/' . fn_strtolower($objects[$type]) . '.php';
        $obj = new $objects[$type]($width, $height, $style, $code);
        if ($obj) {
            $obj->SetFont($font);
            $obj->DrawObject($xres);
            $obj->FlushObject();
            $obj->DestroyObject();
            unset($obj);
        }
    } else {
        __DEBUG__("Need bar code type ex. C39");
    }
    exit;
}
function fn_spsr_pre_check_invoice_create($order_id, $section, $spsr_shipments = array())
{
    $shipping = array();
    if (empty($order_id)) {
        return array(CONTROLLER_STATUS_REDIRECT, "orders.manage");
    }
    $order_info = fn_get_order_info($order_id, false, true, true, true);
    if (!empty($order_info)) {
        list($_shipments) = fn_get_shipments_info(array('order_id' => $order_id, 'advanced_info' => true));
        if (!empty($_shipments)) {
            $shipments = array();
            foreach ($_shipments as $shipment) {
Esempio n. 2
0
 function DrawObject($xres)
 {
     $len = strlen($this->mValue);
     if (($size = $this->GetSize($xres)) == 0) {
         __DEBUG__("GetSize: failed");
         return false;
     }
     if ($this->mStyle & BCS_ALIGN_CENTER) {
         $sPos = (int) (($this->mWidth - $size) / 2);
     } else {
         if ($this->mStyle & BCS_ALIGN_RIGHT) {
             $sPos = $this->mWidth - $size;
         } else {
             $sPos = 0;
         }
     }
     /* Total height of bar code -Bars only- */
     if ($this->mStyle & BCS_DRAW_TEXT) {
         $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont);
     } else {
         $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2;
     }
     /* Draw text */
     if ($this->mStyle & BCS_DRAW_TEXT) {
         if ($this->mStyle & BCS_STRETCH_TEXT) {
             for ($i = 0; $i < $len; $i++) {
                 $this->DrawChar($this->mFont, $sPos + (2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + BCD_C128_BAR_4 * $xres) + $size / $len * $i, $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]);
             }
         } else {
             /* Center */
             $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue);
             $this->DrawText($this->mFont, $sPos + ($size - $text_width) / 2 + (2 * BCD_C128_BAR_2 * $xres + 3 * BCD_C128_BAR_1 * $xres + BCD_C128_BAR_4 * $xres), $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue);
         }
     }
     $cPos = 0;
     $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres);
     do {
         $c = $this->GetCharIndex($this->mValue[$cPos]);
         $cset = $this->mCharSet[$c];
         $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[0], $xres), $ysize);
         $DrawPos += $this->GetBarSize($cset[0], $xres);
         $DrawPos += $this->GetBarSize($cset[1], $xres);
         $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[2], $xres), $ysize);
         $DrawPos += $this->GetBarSize($cset[2], $xres);
         $DrawPos += $this->GetBarSize($cset[3], $xres);
         $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $this->GetBarSize($cset[4], $xres), $ysize);
         $DrawPos += $this->GetBarSize($cset[4], $xres);
         $DrawPos += $this->GetBarSize($cset[5], $xres);
         $cPos++;
     } while ($cPos < $len);
     $DrawPos = $this->DrawCheckChar($DrawPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres);
     $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres);
     return true;
 }
Esempio n. 3
0
 function FlushObject2EnFile()
 {
     if ($this->mStyle & BCS_BORDER) {
         $this->DrawBorder();
     }
     if ($this->mStyle & BCS_IMAGE_PNG) {
         ImagePng($this->mImg, '../../cache/barcodes/en_temp.png');
     } else {
         if ($this->mStyle & BCS_IMAGE_JPEG) {
             ImagePng($this->mImg, '../../cache/barcodes/en_temp.jpg');
         } else {
             __DEBUG__("FlushObject: No output type");
         }
     }
 }
Esempio n. 4
0
 function DrawObject($xres)
 {
     $len = strlen($this->mValue);
     $narrow = BCD_C39_NARROW_BAR * $xres;
     $wide = BCD_C39_WIDE_BAR * $xres;
     if (($size = $this->GetSize($xres)) == 0) {
         __DEBUG__("GetSize: failed");
         return false;
     }
     $cPos = 0;
     if ($this->mStyle & BCS_ALIGN_CENTER) {
         $sPos = (int) (($this->mWidth - $size) / 2);
     } else {
         if ($this->mStyle & BCS_ALIGN_RIGHT) {
             $sPos = $this->mWidth - $size;
         } else {
             $sPos = 0;
         }
     }
     /* Total height of bar code -Bars only- */
     if ($this->mStyle & BCS_DRAW_TEXT) {
         $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont);
     } else {
         $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2;
     }
     /* Draw text */
     if ($this->mStyle & BCS_DRAW_TEXT) {
         if ($this->mStyle & BCS_STRETCH_TEXT) {
             for ($i = 0; $i < $len; $i++) {
                 $this->DrawChar($this->mFont, $sPos + ($narrow * 6 + $wide * 3) + $size / $len * $i, $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]);
             }
         } else {
             /* Center */
             $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue);
             $this->DrawText($this->mFont, $sPos + ($size - $text_width) / 2 + ($narrow * 6 + $wide * 3), $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue);
         }
     }
     $DrawPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres);
     do {
         $c = $this->GetCharIndex($this->mValue[$cPos]);
         $cset = $this->mCharSet[$c];
         $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $cset[0] == '0' ? $narrow : $wide, $ysize);
         $DrawPos += $cset[0] == '0' ? $narrow : $wide;
         $DrawPos += $cset[1] == '0' ? $narrow : $wide;
         $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $cset[2] == '0' ? $narrow : $wide, $ysize);
         $DrawPos += $cset[2] == '0' ? $narrow : $wide;
         $DrawPos += $cset[3] == '0' ? $narrow : $wide;
         $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $cset[4] == '0' ? $narrow : $wide, $ysize);
         $DrawPos += $cset[4] == '0' ? $narrow : $wide;
         $DrawPos += $cset[5] == '0' ? $narrow : $wide;
         $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $cset[6] == '0' ? $narrow : $wide, $ysize);
         $DrawPos += $cset[6] == '0' ? $narrow : $wide;
         $DrawPos += $cset[7] == '0' ? $narrow : $wide;
         $this->DrawSingleBar($DrawPos, BCD_DEFAULT_MAR_Y1, $cset[8] == '0' ? $narrow : $wide, $ysize);
         $DrawPos += $cset[8] == '0' ? $narrow : $wide;
         $DrawPos += $narrow;
         /* Space between chars */
         $cPos++;
     } while ($cPos < $len);
     $DrawPos = $this->DrawStop($DrawPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres);
     return true;
 }
Esempio n. 5
0
 function DrawObject($xres)
 {
     $len = strlen($this->mValue);
     if (($size = $this->GetSize($xres)) == 0) {
         __DEBUG__("GetSize: failed");
         return false;
     }
     $cPos = 0;
     if ($this->mStyle & BCS_DRAW_TEXT) {
         $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2 - $this->GetFontHeight($this->mFont);
     } else {
         $ysize = $this->mHeight - BCD_DEFAULT_MAR_Y1 - BCD_DEFAULT_MAR_Y2;
     }
     if ($this->mStyle & BCS_ALIGN_CENTER) {
         $sPos = (int) (($this->mWidth - $size) / 2);
     } else {
         if ($this->mStyle & BCS_ALIGN_RIGHT) {
             $sPos = $this->mWidth - $size;
         } else {
             $sPos = 0;
         }
     }
     if ($this->mStyle & BCS_DRAW_TEXT) {
         if ($this->mStyle & BCS_STRETCH_TEXT) {
             /* Stretch */
             for ($i = 0; $i < $len; $i++) {
                 $this->DrawChar($this->mFont, $sPos + BCD_I25_NARROW_BAR * 4 * $xres + $size / $len * $i, $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue[$i]);
             }
         } else {
             /* Center */
             $text_width = $this->GetFontWidth($this->mFont) * strlen($this->mValue);
             $this->DrawText($this->mFont, $sPos + ($size - $text_width) / 2 + BCD_I25_NARROW_BAR * 4 * $xres, $ysize + BCD_DEFAULT_MAR_Y1 + BCD_DEFAULT_TEXT_OFFSET, $this->mValue);
         }
     }
     $sPos = $this->DrawStart($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres);
     do {
         $c1 = $this->mValue[$cPos];
         $c2 = $this->mValue[$cPos + 1];
         $cset1 = $this->mCharSet[$c1];
         $cset2 = $this->mCharSet[$c2];
         for ($i = 0; $i < 5; $i++) {
             $type1 = $cset1[$i] == 0 ? BCD_I25_NARROW_BAR * $xres : BCD_I25_WIDE_BAR * $xres;
             $type2 = $cset2[$i] == 0 ? BCD_I25_NARROW_BAR * $xres : BCD_I25_WIDE_BAR * $xres;
             $this->DrawSingleBar($sPos, BCD_DEFAULT_MAR_Y1, $type1, $ysize);
             $sPos += $type1 + $type2;
         }
         $cPos += 2;
     } while ($cPos < $len);
     $sPos = $this->DrawStop($sPos, BCD_DEFAULT_MAR_Y1, $ysize, $xres);
     return true;
 }
Esempio n. 6
0
 function FlushObject()
 {
     if ($this->mStyle & BCS_BORDER) {
         $this->DrawBorder();
     }
     if ($this->mStyle & BCS_IMAGE_PNG) {
         Header("Content-Type: image/png");
         ImagePng($this->mImg);
     } else {
         if ($this->mStyle & BCS_IMAGE_JPEG) {
             Header("Content-Type: image/jpeg");
             ImageJpeg($this->mImg);
         } else {
             __DEBUG__("FlushObject: No output type");
         }
     }
 }