00001 <?php
00002
00006 class InvoicepdfOxOrder extends InvoicepdfOxOrder_parent
00007 {
00008
00014 protected $_iSelectedLang = 0;
00015
00021 protected $_oActShop = null;
00022
00028 protected $_aVATs = array();
00029
00035 protected $_oCur = null;
00036
00037
00043 public function setSelectedLang($iLang)
00044 {
00045 $this->_iSelectedLang = $iLang;
00046 }
00047
00053 protected function _getActShop()
00054 {
00055
00056 if ($this->_oActShop !== null) {
00057 return $this->_oActShop;
00058 }
00059
00060 $this->_oActShop = oxNew('oxshop');
00061 $this->_oActShop->load($this->getConfig()->getShopId());
00062
00063 return $this->_oActShop;
00064 }
00065
00073 public function translate($sString)
00074 {
00075 return oxRegistry::getLang()->translateString($sString, $this->getSelectedLang());
00076 }
00077
00083 public function pdfFooter($oPdf)
00084 {
00085
00086 $oShop = $this->_getActShop();
00087
00088 $oPdf->line(15, 272, 195, 272);
00089
00090 $oPdfBlock = new InvoicepdfBlock();
00091
00092 $oPdf->setFont($oPdfBlock->getFont(), '', 7);
00093 $oPdf->text(15, 275, strip_tags($oShop->oxshops__oxcompany->getRawValue()));
00094 $oPdf->text(15, 278, strip_tags($oShop->oxshops__oxfname->getRawValue()) . ' ' . strip_tags($oShop->oxshops__oxlname->getRawValue()));
00095 $oPdf->text(15, 281, strip_tags($oShop->oxshops__oxstreet->getRawValue()));
00096 $oPdf->text(15, 284, strip_tags($oShop->oxshops__oxzip->value) . ' ' . strip_tags($oShop->oxshops__oxcity->getRawValue()));
00097 $oPdf->text(15, 287, strip_tags($oShop->oxshops__oxcountry->getRawValue()));
00098
00099
00100 $oPdf->text(85, 275, $this->translate('ORDER_OVERVIEW_PDF_PHONE') . strip_tags($oShop->oxshops__oxtelefon->value));
00101 $oPdf->text(85, 278, $this->translate('ORDER_OVERVIEW_PDF_FAX') . strip_tags($oShop->oxshops__oxtelefax->value));
00102 $oPdf->text(85, 281, strip_tags($oShop->oxshops__oxurl->value));
00103 $oPdf->text(85, 284, strip_tags($oShop->oxshops__oxorderemail->value));
00104
00105
00106 $oPdf->text(150, 275, strip_tags($oShop->oxshops__oxbankname->getRawValue()));
00107 $oPdf->text(150, 278, $this->translate('ORDER_OVERVIEW_PDF_ACCOUNTNR') . strip_tags($oShop->oxshops__oxbanknumber->value));
00108 $oPdf->text(150, 281, $this->translate('ORDER_OVERVIEW_PDF_BANKCODE') . strip_tags($oShop->oxshops__oxbankcode->value));
00109 $oPdf->text(150, 284, $this->translate('ORDER_OVERVIEW_PDF_VATID') . strip_tags($oShop->oxshops__oxvatnumber->value));
00110 $oPdf->text(150, 287, $this->translate('ORDER_OVERVIEW_PDF_TAXID') . strip_tags($oShop->oxshops__oxtaxnumber->value));
00111 }
00112
00120 public function pdfHeaderPlus($oPdf)
00121 {
00122
00123
00124 $this->pdfHeader($oPdf);
00125
00126 $oPdfBlock = new InvoicepdfBlock();
00127
00128 $oPdf->setFont($oPdfBlock->getFont(), '', 8);
00129 $oPdf->text(15, 50, $this->translate('ORDER_OVERVIEW_PDF_AMOUNT'));
00130 $oPdf->text(30, 50, $this->translate('ORDER_OVERVIEW_PDF_ARTID'));
00131 $oPdf->text(45, 50, $this->translate('ORDER_OVERVIEW_PDF_DESC'));
00132 $oPdf->text(160, 50, $this->translate('ORDER_OVERVIEW_PDF_UNITPRICE'));
00133 $sText = $this->translate('ORDER_OVERVIEW_PDF_ALLPRICE');
00134 $oPdf->text(195 - $oPdf->getStringWidth($sText), 50, $sText);
00135
00136
00137 $oPdf->line(15, 52, 195, 52);
00138
00139 return 56;
00140 }
00141
00149 public function pdfHeader($oPdf)
00150 {
00151
00152 $oPdf->addPage();
00153
00154
00155 $oShop = $this->_getActShop();
00156
00157
00158 $myConfig = $this->getConfig();
00159 $aSize = getimagesize($myConfig->getImageDir() . '/pdf_logo.jpg');
00160 $iMargin = 195 - $aSize[0] * 0.2;
00161 $oPdf->setLink($oShop->oxshops__oxurl->value);
00162 $oPdf->image($myConfig->getImageDir() . '/pdf_logo.jpg', $iMargin, 10, $aSize[0] * 0.2, $aSize[1] * 0.2, '', $oShop->oxshops__oxurl->value);
00163
00164 return 14 + $aSize[1] * 0.2;
00165 }
00166
00173 public function genPdf($sFilename, $iSelLang = 0)
00174 {
00175
00176 $this->setSelectedLang($iSelLang);
00177
00178 $blIsNewOrder = 0;
00179
00180 if (!$this->oxorder__oxbillnr->value) {
00181 $this->oxorder__oxbillnr->setValue($this->getNextBillNum());
00182 $blIsNewOrder = 1;
00183 }
00184
00185 if ($this->oxorder__oxbilldate->value == '0000-00-00') {
00186 $this->oxorder__oxbilldate->setValue(date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y'))));
00187 $blIsNewOrder = 1;
00188 }
00189
00190 if ($blIsNewOrder) {
00191 $this->save();
00192 }
00193
00194
00195 $oPdf = oxNew('oxPDF');
00196 $oPdf->setPrintHeader(false);
00197 $oPdf->open();
00198
00199
00200 $this->pdfHeader($oPdf);
00201
00202
00203 switch (oxRegistry::getConfig()->getRequestParameter('pdftype')) {
00204 case 'dnote':
00205 $this->exportDeliveryNote($oPdf);
00206 break;
00207 default:
00208 $this->exportStandart($oPdf);
00209 }
00210
00211
00212 $this->pdfFooter($oPdf);
00213
00214
00215 $oPdf->output($sFilename, 'I');
00216 }
00217
00218
00224 protected function _setBillingAddressToPdf($oPdf)
00225 {
00226 $oLang = oxRegistry::getLang();
00227 $sSal = $this->oxorder__oxbillsal->value;
00228 try {
00229 $sSal = $oLang->translateString($this->oxorder__oxbillsal->value, $this->getSelectedLang());
00230 } catch (Exception $e) {
00231 }
00232 $oPdfBlock = new InvoicepdfBlock();
00233 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00234 $oPdf->text(15, 59, $sSal);
00235 $oPdf->text(15, 63, $this->oxorder__oxbillfname->getRawValue() . ' ' . $this->oxorder__oxbilllname->getRawValue());
00236 $oPdf->text(15, 67, $this->oxorder__oxbillcompany->getRawValue());
00237 $oPdf->text(15, 71, $this->oxorder__oxbillstreet->getRawValue() . ' ' . $this->oxorder__oxbillstreetnr->value);
00238 $oPdf->setFont($oPdfBlock->getFont(), 'B', 10);
00239 $oPdf->text(15, 75, $this->oxorder__oxbillzip->value . ' ' . $this->oxorder__oxbillcity->getRawValue());
00240 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00241 $oPdf->text(15, 79, $this->oxorder__oxbillcountry->getRawValue());
00242 }
00243
00249 protected function _setDeliveryAddressToPdf($oPdf)
00250 {
00251 $oLang = oxRegistry::getLang();
00252 $sSal = $this->oxorder__oxdelsal->value;
00253 try {
00254 $sSal = $oLang->translateString($this->oxorder__oxdelsal->value, $this->getSelectedLang());
00255 } catch (Exception $e) {
00256 }
00257 $oPdfBlock = new InvoicepdfBlock();
00258 $oPdf->setFont($oPdfBlock->getFont(), '', 6);
00259 $oPdf->text(15, 87, $this->translate('ORDER_OVERVIEW_PDF_DELIVERYADDRESS'));
00260 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00261 $oPdf->text(15, 91, $sSal);
00262 $oPdf->text(15, 95, $this->oxorder__oxdellname->getRawValue() . ' ' . $this->oxorder__oxdelfname->getRawValue());
00263 $oPdf->text(15, 99, $this->oxorder__oxdelcompany->getRawValue());
00264 $oPdf->text(15, 103, $this->oxorder__oxdelstreet->getRawValue() . ' ' . $this->oxorder__oxdelstreetnr->value);
00265 $oPdf->setFont($oPdfBlock->getFont(), 'B', 10);
00266 $oPdf->text(15, 107, $this->oxorder__oxdelzip->value . ' ' . $this->oxorder__oxdelcity->getRawValue());
00267 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00268 $oPdf->text(15, 111, $this->oxorder__oxdelcountry->getRawValue());
00269 }
00270
00278 protected function _setOrderArticlesToPdf($oPdf, &$iStartPos, $blShowPrice = true)
00279 {
00280 if (!$this->_oArticles) {
00281 $this->_oArticles = $this->getOrderArticles(true);
00282 }
00283
00284 $oCurr = $this->getCurrency();
00285 $oPdfBlock = new InvoicepdfBlock();
00286
00287 foreach ($this->_oArticles as $key => $oOrderArt) {
00288
00289
00290 if ($iStartPos > 243) {
00291 $this->pdffooter($oPdf);
00292 $iStartPos = $this->pdfheaderplus($oPdf);
00293 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00294 } else {
00295 $iStartPos = $iStartPos + 4;
00296 }
00297
00298
00299 $oPdf->text(20 - $oPdf->getStringWidth($oOrderArt->oxorderarticles__oxamount->value), $iStartPos, $oOrderArt->oxorderarticles__oxamount->value);
00300
00301
00302 $oPdf->setFont($oPdfBlock->getFont(), '', 8);
00303 $oPdf->text(28, $iStartPos, $oOrderArt->oxorderarticles__oxartnum->value);
00304
00305
00306 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00307 $oPdf->text(45, $iStartPos, substr(strip_tags($this->_replaceExtendedChars($oOrderArt->oxorderarticles__oxtitle->getRawValue(), true)), 0, 58));
00308
00309 if ($blShowPrice) {
00310 $oLang = oxRegistry::getLang();
00311
00312
00313 $oPdf->text(140 - $oPdf->getStringWidth($oOrderArt->oxorderarticles__oxvat->value), $iStartPos, $oOrderArt->oxorderarticles__oxvat->value);
00314
00315
00316
00317 $dUnitPrice = ($this->isNettoMode()) ? $oOrderArt->oxorderarticles__oxnprice->value : $oOrderArt->oxorderarticles__oxbprice->value;
00318 $dTotalPrice = ($this->isNettoMode()) ? $oOrderArt->oxorderarticles__oxnetprice->value : $oOrderArt->oxorderarticles__oxbrutprice->value;
00319
00320 $sText = $oLang->formatCurrency($dUnitPrice, $this->_oCur) . ' ' . $this->_oCur->name;
00321 $oPdf->text(163 - $oPdf->getStringWidth($sText), $iStartPos, $sText);
00322
00323
00324 $sText = $oLang->formatCurrency($dTotalPrice, $this->_oCur) . ' ' . $this->_oCur->name;
00325 $oPdf->text(195 - $oPdf->getStringWidth($sText), $iStartPos, $sText);
00326
00327 }
00328
00329
00330 if ($oOrderArt->oxorderarticles__oxselvariant->value) {
00331 $iStartPos = $iStartPos + 4;
00332 $oPdf->text(45, $iStartPos, substr($oOrderArt->oxorderarticles__oxselvariant->value, 0, 58));
00333 }
00334
00335 }
00336 }
00337
00343 public function exportStandart($oPdf)
00344 {
00345
00346 $myConfig = $this->getConfig();
00347 $oPdfBlock = new InvoicepdfBlock();
00348
00349 $this->_oCur = $myConfig->getCurrencyObject($this->oxorder__oxcurrency->value);
00350 if (!$this->_oCur) {
00351 $this->_oCur = $myConfig->getActShopCurrencyObject();
00352 }
00353
00354
00355 $oShop = $this->_getActShop();
00356
00357
00358 $oPdf->setFont($oPdfBlock->getFont(), '', 6);
00359 $oPdf->text(15, 55, $oShop->oxshops__oxname->getRawValue() . ' - ' . $oShop->oxshops__oxstreet->getRawValue() . ' - ' . $oShop->oxshops__oxzip->value . ' - ' . $oShop->oxshops__oxcity->getRawValue());
00360
00361
00362 $this->_setBillingAddressToPdf($oPdf);
00363
00364
00365 if ($this->oxorder__oxdelsal->value) {
00366 $this->_setDeliveryAddressToPdf($oPdf);
00367 }
00368
00369
00370 $oUser = oxNew('oxuser');
00371 $oUser->load($this->oxorder__oxuserid->value);
00372
00373
00374 $sText = $this->translate('ORDER_OVERVIEW_PDF_FILLONPAYMENT');
00375 $oPdf->setFont($oPdfBlock->getFont(), '', 5);
00376 $oPdf->text(195 - $oPdf->getStringWidth($sText), 55, $sText);
00377
00378
00379 $sCustNr = $this->translate('ORDER_OVERVIEW_PDF_CUSTNR') . ' ' . $oUser->oxuser__oxcustnr->value;
00380 $oPdf->setFont($oPdfBlock->getFont(), '', 7);
00381 $oPdf->text(195 - $oPdf->getStringWidth($sCustNr), 59, $sCustNr);
00382
00383
00384 if ($this->oxorder__oxdelsal->value) {
00385 $iTop = 115;
00386 } else {
00387 $iTop = 91;
00388 }
00389
00390
00391 $sText = $oShop->oxshops__oxcity->getRawValue() . ', ' . date('d.m.Y', strtotime($this->oxorder__oxbilldate->value));
00392 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00393 $oPdf->text(195 - $oPdf->getStringWidth($sText), $iTop + 8, $sText);
00394
00395
00396 if ($oShop->oxshops__oxvatnumber->value) {
00397 $sText = $this->translate('ORDER_OVERVIEW_PDF_TAXIDNR') . ' ' . $oShop->oxshops__oxvatnumber->value;
00398 $oPdf->text(195 - $oPdf->getStringWidth($sText), $iTop + 12, $sText);
00399 $iTop += 8;
00400 } else {
00401 $iTop += 4;
00402 }
00403
00404
00405 $sText = $this->translate('ORDER_OVERVIEW_PDF_COUNTNR') . ' ' . $this->oxorder__oxbillnr->value;
00406 $oPdf->text(195 - $oPdf->getStringWidth($sText), $iTop + 8, $sText);
00407
00408
00409 if ($this->oxorder__oxstorno->value == 1) {
00410 $this->oxorder__oxordernr->setValue($this->oxorder__oxordernr->getRawValue() . ' ' . $this->translate('ORDER_OVERVIEW_PDF_STORNO'), oxField::T_RAW);
00411 }
00412
00413
00414 $oPdf->setFont($oPdfBlock->getFont(), '', 12);
00415 $oPdf->text(15, $iTop, $this->translate('ORDER_OVERVIEW_PDF_PURCHASENR') . ' ' . $this->oxorder__oxordernr->value);
00416
00417
00418 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00419 $aOrderDate = explode(' ', $this->oxorder__oxorderdate->value);
00420 $sOrderDate = oxRegistry::get("oxUtilsDate")->formatDBDate($aOrderDate[0]);
00421 $oPdf->text(15, $iTop + 8, $this->translate('ORDER_OVERVIEW_PDF_ORDERSFROM') . $sOrderDate . $this->translate('ORDER_OVERVIEW_PDF_ORDERSAT') . $oShop->oxshops__oxurl->value);
00422 $iTop += 16;
00423
00424
00425 $oPdf->setFont($oPdfBlock->getFont(), '', 8);
00426 $oPdf->text(15, $iTop, $this->translate('ORDER_OVERVIEW_PDF_AMOUNT'));
00427 $oPdf->text(30, $iTop, $this->translate('ORDER_OVERVIEW_PDF_ARTID'));
00428 $oPdf->text(45, $iTop, $this->translate('ORDER_OVERVIEW_PDF_DESC'));
00429 $oPdf->text(135, $iTop, $this->translate('ORDER_OVERVIEW_PDF_VAT'));
00430 $oPdf->text(148, $iTop, $this->translate('ORDER_OVERVIEW_PDF_UNITPRICE'));
00431 $sText = $this->translate('ORDER_OVERVIEW_PDF_ALLPRICE');
00432 $oPdf->text(195 - $oPdf->getStringWidth($sText), $iTop, $sText);
00433
00434
00435 $iTop += 2;
00436 $oPdf->line(15, $iTop, 195, $iTop);
00437
00438
00439 $siteH = $iTop;
00440 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00441
00442
00443 $this->_setOrderArticlesToPdf($oPdf, $siteH, true);
00444
00445
00446 $oArtSumm = new InvoicepdfArticleSummary($this, $oPdf);
00447 $iHeight = $oArtSumm->generate($siteH);
00448 if ($siteH + $iHeight > 258) {
00449 $this->pdfFooter($oPdf);
00450 $iTop = $this->pdfHeader($oPdf);
00451 $oArtSumm->ajustHeight($iTop - $siteH);
00452 $siteH = $iTop;
00453 }
00454
00455 $oArtSumm->run($oPdf);
00456 $siteH += $iHeight + 8;
00457
00458 $oPdf->text(15, $siteH, $this->translate('ORDER_OVERVIEW_PDF_GREETINGS'));
00459 }
00460
00466 public function exportDeliveryNote($oPdf)
00467 {
00468 $myConfig = $this->getConfig();
00469 $oShop = $this->_getActShop();
00470 $oPdfBlock = new InvoicepdfBlock();
00471
00472 $oLang = oxRegistry::getLang();
00473 $sSal = $this->oxorder__oxdelsal->value;
00474 try {
00475 $sSal = $oLang->translateString($this->oxorder__oxdelsal->value, $this->getSelectedLang());
00476 } catch (Exception $e) {
00477 }
00478
00479
00480 $this->_oCur = $myConfig->getCurrencyObject($this->oxorder__oxcurrency->value);
00481 if (!isset($this->_oCur)) {
00482 $this->_oCur = $myConfig->getActShopCurrencyObject();
00483 }
00484
00485
00486 $oPdf->setFont($oPdfBlock->getFont(), '', 6);
00487 $oPdf->text(15, 55, $oShop->oxshops__oxname->getRawValue() . ' - ' . $oShop->oxshops__oxstreet->getRawValue() . ' - ' . $oShop->oxshops__oxzip->value . ' - ' . $oShop->oxshops__oxcity->getRawValue());
00488
00489
00490 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00491 if ($this->oxorder__oxdelsal->value) {
00492 $oPdf->text(15, 59, $sSal);
00493 $oPdf->text(15, 63, $this->oxorder__oxdellname->getRawValue() . ' ' . $this->oxorder__oxdelfname->getRawValue());
00494 $oPdf->text(15, 67, $this->oxorder__oxdelcompany->getRawValue());
00495 $oPdf->text(15, 71, $this->oxorder__oxdelstreet->getRawValue() . ' ' . $this->oxorder__oxdelstreetnr->value);
00496 $oPdf->setFont($oPdfBlock->getFont(), 'B', 10);
00497 $oPdf->text(15, 75, $this->oxorder__oxdelzip->value . ' ' . $this->oxorder__oxdelcity->getRawValue());
00498 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00499 $oPdf->text(15, 79, $this->oxorder__oxdelcountry->getRawValue());
00500 } else {
00501
00502 $this->_setBillingAddressToPdf($oPdf);
00503 }
00504
00505
00506 $oUser = oxNew('oxuser');
00507 $oUser->load($this->oxorder__oxuserid->value);
00508
00509
00510 $sText = $this->translate('ORDER_OVERVIEW_PDF_FILLONPAYMENT');
00511 $oPdf->setFont($oPdfBlock->getFont(), '', 5);
00512 $oPdf->text(195 - $oPdf->getStringWidth($sText), 70, $sText);
00513
00514
00515 $sCustNr = $this->translate('ORDER_OVERVIEW_PDF_CUSTNR') . ' ' . $oUser->oxuser__oxcustnr->value;
00516 $oPdf->setFont($oPdfBlock->getFont(), '', 7);
00517 $oPdf->text(195 - $oPdf->getStringWidth($sCustNr), 73, $sCustNr);
00518
00519
00520 $sText = $oShop->oxshops__oxcity->getRawValue() . ', ' . date('d.m.Y');
00521 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00522 $oPdf->text(195 - $oPdf->getStringWidth($sText), 95, $sText);
00523
00524 $iTop = 99;
00525
00526 if ($oShop->oxshops__oxvatnumber->value) {
00527 $sText = $this->translate('ORDER_OVERVIEW_PDF_TAXIDNR') . ' ' . $oShop->oxshops__oxvatnumber->value;
00528 $oPdf->text(195 - $oPdf->getStringWidth($sText), $iTop, $sText);
00529 $iTop += 4;
00530 }
00531
00532
00533 $sText = $this->translate('ORDER_OVERVIEW_PDF_COUNTNR') . ' ' . $this->oxorder__oxbillnr->value;
00534 $oPdf->text(195 - $oPdf->getStringWidth($sText), $iTop, $sText);
00535
00536
00537 if ($this->oxorder__oxstorno->value == 1) {
00538 $this->oxorder__oxordernr->setValue($this->oxorder__oxordernr->getRawValue() . ' ' . $this->translate('ORDER_OVERVIEW_PDF_STORNO'), oxField::T_RAW);
00539 }
00540
00541
00542 $oPdf->setFont($oPdfBlock->getFont(), '', 12);
00543 $oPdf->text(15, 108, $this->translate('ORDER_OVERVIEW_PDF_DELIVNOTE') . ' ' . $this->oxorder__oxordernr->value);
00544
00545
00546 $aOrderDate = explode(' ', $this->oxorder__oxorderdate->value);
00547 $sOrderDate = oxRegistry::get("oxUtilsDate")->formatDBDate($aOrderDate[0]);
00548 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00549 $oPdf->text(15, 119, $this->translate('ORDER_OVERVIEW_PDF_ORDERSFROM') . $sOrderDate . $this->translate('ORDER_OVERVIEW_PDF_ORDERSAT') . $oShop->oxshops__oxurl->value);
00550
00551
00552 $oPdf->setFont($oPdfBlock->getFont(), '', 8);
00553 $oPdf->text(15, 128, $this->translate('ORDER_OVERVIEW_PDF_AMOUNT'));
00554 $oPdf->text(30, 128, $this->translate('ORDER_OVERVIEW_PDF_ARTID'));
00555 $oPdf->text(45, 128, $this->translate('ORDER_OVERVIEW_PDF_DESC'));
00556
00557
00558 $oPdf->line(15, 130, 195, 130);
00559
00560
00561 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00562 $siteH = 130;
00563
00564
00565 $this->_setOrderArticlesToPdf($oPdf, $siteH, false);
00566
00567
00568 $oPdf->line(15, $siteH + 2, 195, $siteH + 2);
00569 $siteH += 4;
00570
00571
00572 $oPdf->setFont($oPdfBlock->getFont(), '', 10);
00573 $text = $this->translate('ORDER_OVERVIEW_PDF_PAYUPTO') . date('d.m.Y', strtotime('+' . $this->getPaymentTerm() . ' day', strtotime($this->oxorder__oxbilldate->value)));
00574 $oPdf->text(15, $siteH + 4, $text);
00575 }
00576
00586 protected function _replaceExtendedChars($sValue, $blReverse = false)
00587 {
00588
00589
00590
00591
00592
00593
00594 $aReplace = array(chr(169) => "©", chr(128) => "€", "\"" => """, "'" => "'");
00595
00596
00597
00598 if ($blReverse) {
00599
00600 if (version_compare(PHP_VERSION, '5.3.4') >= 0) {
00601 $aTransTbl = get_html_translation_table(HTML_ENTITIES, ENT_COMPAT, 'ISO-8859-1');
00602 } else {
00603 $aTransTbl = get_html_translation_table(HTML_ENTITIES, ENT_COMPAT);
00604 }
00605
00606 $aTransTbl = array_flip($aTransTbl) + array_flip($aReplace);
00607 $sValue = strtr($sValue, $aTransTbl);
00608 $sValue = getStr()->preg_replace('/\&\#([0-9]+)\;/me', "chr('\\1')", $sValue);
00609 }
00610
00611 return $sValue;
00612 }
00613
00619 public function getVats()
00620 {
00621
00622 return $this->getProductVats(false);
00623 }
00624
00630 public function getCurrency()
00631 {
00632 return $this->_oCur;
00633 }
00634
00640 public function getSelectedLang()
00641 {
00642 return $this->_iSelectedLang;
00643 }
00644
00650 public function getPaymentTerm()
00651 {
00652 if (null === $iPaymentTerm = $this->getConfig()->getConfigParam('iPaymentTerm')) {
00653 $iPaymentTerm = 7;
00654 }
00655
00656 return $iPaymentTerm;
00657 }
00658 }