add dev mode
This commit is contained in:
parent
f9a0dd11e2
commit
d49135f6ee
@ -69,12 +69,13 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
{
|
||||
$oPdf = oxNew(Html2Pdf::class, ...$this->getPdfProperties());
|
||||
$oPdf->setTestIsImage(false);
|
||||
$oPdf->writeHTML($this->getHTMLContent($iSelLang));
|
||||
$htmlContent = $this->getHTMLContent($iSelLang);
|
||||
$oPdf->writeHTML($htmlContent);
|
||||
$oPdf->pdf->SetAuthor(Registry::getConfig()->getActiveShop()->getFieldData('oxname'));
|
||||
$oPdf->pdf->SetTitle(Registry::getLang()->translateString($this->getTitleIdent()));
|
||||
$oPdf->pdf->SetCreator('D³ PDF Documents for OXID eShop');
|
||||
$oPdf->pdf->SetSubject(NULL);
|
||||
return $oPdf->output($sFilename, $target);
|
||||
return $this->output($oPdf, $sFilename, $target, $htmlContent);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -179,7 +180,14 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
*/
|
||||
public function getPdfProperties()
|
||||
{
|
||||
return [self::PDF_ORIENTATION_PORTRAIT, 'A4', 'de'];
|
||||
$orientation = self::PDF_ORIENTATION_PORTRAIT;
|
||||
$format = 'A4';
|
||||
$lang = 'de';
|
||||
$unicode = true;
|
||||
$encoding = 'UTF-8';
|
||||
$margins = [0, 0, 0, 0];
|
||||
$pdfa = true;
|
||||
return [$orientation, $format, $lang, $unicode, $encoding, $margins, $pdfa];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -243,4 +251,91 @@ abstract class pdfdocumentsGeneric extends Base implements genericInterface
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public function output(Html2Pdf $oPdf, $sFilename, $target, $html)
|
||||
{
|
||||
if ((bool) Registry::getConfig()->getConfigParam('d3PdfDocumentsbDev') === true) {
|
||||
return $this->outputDev($oPdf, $sFilename, $target, $html);
|
||||
} else {
|
||||
return $oPdf->output($sFilename, $target);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Html2Pdf $oPdf
|
||||
* @param $sFilename
|
||||
* @param $target
|
||||
* @param $html
|
||||
* @return mixed
|
||||
*/
|
||||
public function outputDev(Html2Pdf $oPdf, $sFilename, $target, $html)
|
||||
{
|
||||
$sFilename = str_replace('.pdf', '.html', $sFilename);
|
||||
|
||||
switch($target) {
|
||||
case 'I': {
|
||||
// Send PDF to the standard output
|
||||
if (ob_get_contents()) {
|
||||
$oPdf->pdf->Error('Some data has already been output, can\'t send PDF file');
|
||||
}
|
||||
if (php_sapi_name() != 'cli') {
|
||||
//We send to a browser
|
||||
header('Content-Type: text/html');
|
||||
if (headers_sent()) {
|
||||
$oPdf->pdf->Error('Some data has already been output to browser, can\'t send PDF file');
|
||||
}
|
||||
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
|
||||
header('Pragma: public');
|
||||
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
header('Content-Length: '.strlen($html));
|
||||
header('Content-Disposition: inline; filename="'.basename($sFilename).'";');
|
||||
}
|
||||
echo $html;
|
||||
break;
|
||||
}
|
||||
case 'D': {
|
||||
// Download PDF as file
|
||||
if (ob_get_contents()) {
|
||||
$oPdf->pdf->Error('Some data has already been output, can\'t send PDF file');
|
||||
}
|
||||
header('Content-Description: File Transfer');
|
||||
if (headers_sent()) {
|
||||
$oPdf->pdf->Error('Some data has already been output to browser, can\'t send PDF file');
|
||||
}
|
||||
header('Cache-Control: public, must-revalidate, max-age=0'); // HTTP/1.1
|
||||
header('Pragma: public');
|
||||
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
|
||||
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
||||
// force download dialog
|
||||
header('Content-Type: application/force-download');
|
||||
header('Content-Type: application/octet-stream', false);
|
||||
header('Content-Type: application/download', false);
|
||||
header('Content-Type: text/html', false);
|
||||
// use the Content-Disposition header to supply a recommended filename
|
||||
header('Content-Disposition: attachment; filename="'.basename($sFilename).'";');
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
header('Content-Length: '.strlen($html));
|
||||
echo $html;
|
||||
break;
|
||||
}
|
||||
case 'F': {
|
||||
// Save PDF to a local file
|
||||
$f = fopen($sFilename, 'wb');
|
||||
if (!$f) {
|
||||
$oPdf->pdf->Error('Unable to create output file: '.$sFilename);
|
||||
}
|
||||
fwrite($f, $html, strlen($html));
|
||||
fclose($f);
|
||||
break;
|
||||
}
|
||||
case 'S': {
|
||||
// Returns PDF as a string
|
||||
return $html;
|
||||
}
|
||||
default: {
|
||||
$oPdf->pdf->Error('Incorrect output destination: '.$target);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -15,6 +15,10 @@
|
||||
$sLangName = "Deutsch";
|
||||
$aLang = array(
|
||||
'charset' => 'utf-8',
|
||||
|
||||
'SHOP_MODULE_GROUP_d3PdfDocumentsmain' => 'Grundeinstellungen',
|
||||
'SHOP_MODULE_d3PdfDocumentsbDev' => 'Entwicklermodus',
|
||||
|
||||
'ORDER_OVERVIEW_PDF_auftragsbestaetigung' => 'Auftragsbestätigung',
|
||||
'ORDER_OVERVIEW_PDF_auftragsbestaetigung_TEXTAREA' => 'Text für Auftragsbestätigung',
|
||||
'ORDER_OVERVIEW_PDF_AUFTRAGSNUMMER' => 'Auftragsbestätigung:',
|
@ -1,18 +0,0 @@
|
||||
.deliverynote_width_amount{
|
||||
width: 20px;
|
||||
}
|
||||
.deliverynote_width_artnum{
|
||||
width: 80px;
|
||||
}
|
||||
.deliverynote_width_desc{
|
||||
width: 469.5px;
|
||||
}
|
||||
.textAlignLeft{
|
||||
text-align: left;
|
||||
}
|
||||
.paddingLeft{
|
||||
padding-left: 2.4px;
|
||||
}
|
||||
.deliveryNote_paddingTop20{
|
||||
padding-top: 20px;
|
||||
}
|
@ -1,24 +0,0 @@
|
||||
.offers_subTitle_font14{
|
||||
font-size: 14px;
|
||||
}
|
||||
.helvetica{
|
||||
font-family: helvetica;
|
||||
}
|
||||
.offers_width50{
|
||||
width: 50%;
|
||||
}
|
||||
.offers_width100{
|
||||
width: 100%;
|
||||
}
|
||||
.offers_margin_top20{
|
||||
margin-top: 20px;
|
||||
}
|
||||
.offers_margin_bottom20{
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.offers_pstThank_margin_top20{
|
||||
margin-top: 20px;
|
||||
}
|
||||
.offers_pstThank_font20{
|
||||
font-size: 20px;
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
.invoiceCorrection_width_40{
|
||||
width: 40%;
|
||||
}
|
||||
.invoiceCorrection_width_60{
|
||||
width: 60%;
|
||||
}
|
||||
.invoiceCorrection_font8{
|
||||
font-size: 8px;
|
||||
}
|
||||
.invoiceCorrection_font9{
|
||||
font-size: 9px;
|
||||
}
|
||||
.invoiceCorrection_tableMarginTop15{
|
||||
margin-top: 15px;
|
||||
}
|
||||
.invoiceCorrection_spacingLeft20{
|
||||
margin-left: 73.6px;
|
||||
}
|
||||
|
||||
.invoiceCorrectionPaddingTop4{
|
||||
padding-top: 4px;
|
||||
}
|
||||
.invoiceCorrectionPaddingTop5{
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
.invoiceCorrectionPaddingBottom20{
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
.invoiceCorrectionPaddingBottom16{
|
||||
padding-bottom: 16px;
|
||||
}
|
@ -1,173 +0,0 @@
|
||||
/*debug hilfe*/
|
||||
.eraseBug{
|
||||
border: dashed blueviolet 1px;
|
||||
}
|
||||
|
||||
table{
|
||||
font-family: "helvetica";
|
||||
}
|
||||
.aligning{
|
||||
text-align: right;
|
||||
}
|
||||
.vertical-a{
|
||||
vertical-align: top;
|
||||
}
|
||||
.fontSize12{
|
||||
font-size: 12px;
|
||||
}
|
||||
.order_sum{
|
||||
margin-left: 181px;
|
||||
}
|
||||
.order_sumNum{
|
||||
margin-right: -2.2px;
|
||||
}
|
||||
.border-bottom{
|
||||
border-bottom: solid 0.15mm #000;
|
||||
}
|
||||
.paddingTop{
|
||||
padding-top: 5px;
|
||||
}
|
||||
.paddingBottom{
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.spacing_order_info{
|
||||
padding-bottom: 5px;
|
||||
padding-top: 5px;
|
||||
}
|
||||
|
||||
/*pdf_header*/
|
||||
.pdf_header_positioning{
|
||||
position: absolute;
|
||||
top: 30px;
|
||||
right: 44px;
|
||||
}
|
||||
|
||||
/*pdf_footer*/
|
||||
.pdf_footer_table{
|
||||
width: 688px;
|
||||
font-size: 9px;
|
||||
margin: 0 30px 0 30px;
|
||||
border-top: solid 1px #000;
|
||||
}
|
||||
|
||||
/*pdf_heading*/
|
||||
.pdf_heading_table{
|
||||
width: 100%;
|
||||
margin-top: 8mm;
|
||||
}
|
||||
.pdf_heading_width35{
|
||||
width: 35%;
|
||||
}
|
||||
.pdf_heading_fontSize8{
|
||||
font-size: 8px;
|
||||
}
|
||||
.pdf_heading_width65{
|
||||
width: 65%;
|
||||
}
|
||||
.pdf_heading_fontSize12{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/*heading_order_information*/
|
||||
.heading_order_paddingTop10{
|
||||
padding-top: 10px;
|
||||
}
|
||||
.heading_order_width35{
|
||||
width: 35%;
|
||||
}
|
||||
.heading_order_paddingTopSub5{
|
||||
padding-top: -5px;
|
||||
}
|
||||
.heading_order_paddingTop1{
|
||||
padding-top: 1mm;
|
||||
}
|
||||
.heading_order_fontSize15{
|
||||
font-size: 15px;
|
||||
}
|
||||
.heading_order_paddingTop22{
|
||||
padding-top: 22px;
|
||||
}
|
||||
.heading_order_paddingBottom8{
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
.heading_order_paddingBottom15{
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
.heading_order_fontSize10{
|
||||
font-size: 10px;
|
||||
}
|
||||
.heading_order_paddingTopSub5{
|
||||
padding-top: -5px;
|
||||
}
|
||||
.heading_order_width65{
|
||||
width: 65%;
|
||||
}
|
||||
|
||||
/*order_article_listing*/
|
||||
.order_article_listing_width_amount{
|
||||
width: 20px;
|
||||
}
|
||||
.order_article_listing_width_desc{
|
||||
width: 398px;
|
||||
}
|
||||
.order_article_listing_width_ust{
|
||||
width: 10px;
|
||||
}
|
||||
.order_article_listing_width_unitPrice{
|
||||
width: 90px;
|
||||
}
|
||||
.order_article_listing_width_total_Price{
|
||||
width: 100px;
|
||||
}
|
||||
.order_article_listing_paddingRight52{
|
||||
padding-right: 52.1px;
|
||||
}
|
||||
.order_article_listing_fontSize{
|
||||
font-size: 11px;
|
||||
}
|
||||
.order_article_PaddingBottom5{
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
.order_article_PaddingTop5{
|
||||
padding-top: 5px;
|
||||
}
|
||||
.order_article_marginTop10{
|
||||
margin-top: 10px;
|
||||
}
|
||||
.order_article_costs_marginLeftSub3{
|
||||
margin-left: -3px;
|
||||
}
|
||||
.order_article_costs_paddingRight66{
|
||||
padding-right: 65.9px;
|
||||
}
|
||||
.order_article_listing_fontSize9{
|
||||
font-size: 9px;
|
||||
}
|
||||
.order_article_listing_fontSize12{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/* order_article_costs */
|
||||
.article_costs_table{
|
||||
width: 100%;
|
||||
border-top: solid 0.15mm #000;
|
||||
}
|
||||
.article_costs_table_td_width50{
|
||||
width: 50%;
|
||||
}
|
||||
.article_costs_table_paddingRight{
|
||||
padding-right: -3px;
|
||||
}
|
||||
.order_article_costs_fontSize12{
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
/*order_shop_past_thank*/
|
||||
.past_thank_width100{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* footer styling */
|
||||
.footer_parts{
|
||||
width: 33.33%;
|
||||
}
|
@ -72,7 +72,10 @@ $aModule = [
|
||||
[
|
||||
'template' => 'order_overview.tpl',
|
||||
'block' => 'admin_order_overview_export',
|
||||
'file' => 'views/admin/blocks/order_overview.tpl'
|
||||
'file' => 'Application/views/admin/blocks/order_overview.tpl'
|
||||
],
|
||||
],
|
||||
'settings' => [
|
||||
['group' => $sModuleId.'main', 'name' => $sModuleId.'bDev', 'type' => 'bool', 'value' => false],
|
||||
]
|
||||
];
|
||||
|
Loading…
Reference in New Issue
Block a user