diff --git a/composer.json b/composer.json
index cbd57676d..0a4fc0629 100755
--- a/composer.json
+++ b/composer.json
@@ -39,7 +39,7 @@
"symfony/icu": "1.0",
"swiftmailer/swiftmailer": "5.0.*",
"symfony/serializer": "2.3.*",
- "dompdf/dompdf": "dev-master"
+ "ensepar/html2pdf": "1.0.1"
},
"require-dev" : {
"phpunit/phpunit": "3.7.*",
diff --git a/composer.lock b/composer.lock
index 3539bd208..f50fb4a4d 100755
--- a/composer.lock
+++ b/composer.lock
@@ -3,30 +3,31 @@
"This file locks the dependencies of your project to a known state",
"Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
],
- "hash": "39e5fa13bfa3de21f03854c90a076713",
+ "hash": "852879ecc2e39e5cf283a3b1c5051a8e",
"packages": [
{
- "name": "dompdf/dompdf",
- "version": "dev-master",
+ "name": "ensepar/html2pdf",
+ "version": "1.0.1",
"source": {
"type": "git",
- "url": "https://github.com/dompdf/dompdf.git",
- "reference": "3a8a09240159ac084f0c4b607eb12ca83ddbe318"
+ "url": "https://github.com/OwlyCode/html2pdf.git",
+ "reference": "b53a27430cc35b29bbe2faaa55ed4a7d5c156cd3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/dompdf/dompdf/zipball/3a8a09240159ac084f0c4b607eb12ca83ddbe318",
- "reference": "3a8a09240159ac084f0c4b607eb12ca83ddbe318",
+ "url": "https://api.github.com/repos/OwlyCode/html2pdf/zipball/b53a27430cc35b29bbe2faaa55ed4a7d5c156cd3",
+ "reference": "b53a27430cc35b29bbe2faaa55ed4a7d5c156cd3",
"shasum": ""
},
"require": {
- "phenx/php-font-lib": "0.2.*"
+ "ensepar/tcpdf": "5.0.003",
+ "php": ">=5.2"
},
"type": "library",
"autoload": {
- "classmap": [
- "include/"
- ]
+ "psr-0": {
+ "HTML2PDF": "."
+ }
},
"notification-url": "https://packagist.org/downloads/",
"license": [
@@ -34,17 +35,79 @@
],
"authors": [
{
- "name": "Fabien Ménager",
- "email": "fabien.menager@gmail.com"
+ "name": "Spipu",
+ "homepage": "http://sourceforge.net/users/spipu",
+ "role": "Developer"
},
{
- "name": "Brian Sweeney",
- "email": "eclecticgeek@gmail.com"
+ "name": "OwlyCode",
+ "homepage": "http://www.github.com/OwlyCode",
+ "role": "Developer"
}
],
- "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter",
- "homepage": "https://github.com/dompdf/dompdf",
- "time": "2013-09-04 20:59:58"
+ "description": "Unofficial fork of 'html2pdf' with Composer support. (Fixed composer dependency problem)",
+ "homepage": "https://github.com/jwronsky/html2pdf",
+ "keywords": [
+ "html",
+ "html2pdf",
+ "pdf"
+ ],
+ "time": "2013-09-13 12:23:43"
+ },
+ {
+ "name": "ensepar/tcpdf",
+ "version": "5.0.003",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/OwlyCode/tcpdf.git",
+ "reference": "ae578409e9454fdf6c794cce6f063b0c95bfa518"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/OwlyCode/tcpdf/zipball/ae578409e9454fdf6c794cce6f063b0c95bfa518",
+ "reference": "ae578409e9454fdf6c794cce6f063b0c95bfa518",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=5.3.0"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "fonts",
+ "config/lang",
+ "config",
+ "2dbarcodes.php",
+ "barcodes.php",
+ "htmlcolors.php",
+ "qrcode.php",
+ "tcpdf.php",
+ "unicode_data.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPLv3"
+ ],
+ "authors": [
+ {
+ "name": "Nicola Asuni",
+ "email": "info@tecnick.com",
+ "homepage": "http://nicolaasuni.tecnick.com"
+ },
+ {
+ "name": "Tristan Maindron",
+ "email": "tmaindron@gmail.com",
+ "homepage": "http://www.github.com/OwlyCode"
+ }
+ ],
+ "description": "TCPDF is a PHP class for generating PDF documents.",
+ "homepage": "http://www.tcpdf.org/",
+ "keywords": [
+ "TCPDF",
+ "pdf"
+ ],
+ "time": "2013-09-12 17:00:40"
},
{
"name": "imagine/imagine",
@@ -249,40 +312,6 @@
"homepage": "http://leafo.net/lessphp/",
"time": "2013-08-09 17:09:19"
},
- {
- "name": "phenx/php-font-lib",
- "version": "0.2.1",
- "source": {
- "type": "git",
- "url": "https://github.com/PhenX/php-font-lib.git",
- "reference": "42a1ca6d19f14076911a118705b771c3a5a8b179"
- },
- "dist": {
- "type": "zip",
- "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/42a1ca6d19f14076911a118705b771c3a5a8b179",
- "reference": "42a1ca6d19f14076911a118705b771c3a5a8b179",
- "shasum": ""
- },
- "type": "library",
- "autoload": {
- "classmap": [
- "classes/"
- ]
- },
- "notification-url": "https://packagist.org/downloads/",
- "license": [
- "LGPL"
- ],
- "authors": [
- {
- "name": "Fabien Ménager",
- "email": "fabien.menager@gmail.com"
- }
- ],
- "description": "A library to read, parse, export and make subsets of different types of font files.",
- "homepage": "https://github.com/PhenX/php-font-lib",
- "time": "2013-02-22 23:30:49"
- },
{
"name": "propel/propel",
"version": "dev-master",
@@ -1838,6 +1867,40 @@
],
"time": "2013-09-11 13:01:19"
},
+ {
+ "name": "phenx/php-font-lib",
+ "version": "0.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/PhenX/php-font-lib.git",
+ "reference": "42a1ca6d19f14076911a118705b771c3a5a8b179"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/42a1ca6d19f14076911a118705b771c3a5a8b179",
+ "reference": "42a1ca6d19f14076911a118705b771c3a5a8b179",
+ "shasum": ""
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "classes/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL"
+ ],
+ "authors": [
+ {
+ "name": "Fabien Ménager",
+ "email": "fabien.menager@gmail.com"
+ }
+ ],
+ "description": "A library to read, parse, export and make subsets of different types of font files.",
+ "homepage": "https://github.com/PhenX/php-font-lib",
+ "time": "2013-02-22 23:30:49"
+ },
{
"name": "phpunit/php-code-coverage",
"version": "1.2.12",
@@ -2218,7 +2281,6 @@
"ptachoire/cssembed": 20,
"simplepie/simplepie": 20,
"imagine/imagine": 20,
- "dompdf/dompdf": 20,
"fzaninotto/faker": 20,
"maximebf/debugbar": 20
},
diff --git a/core/bootstrap.php b/core/bootstrap.php
index f722b355f..a75190704 100755
--- a/core/bootstrap.php
+++ b/core/bootstrap.php
@@ -12,7 +12,6 @@ define('THELIA_MODULE_DIR' , THELIA_LOCAL_DIR . 'modules/');
define('THELIA_WEB_DIR' , THELIA_ROOT . 'web/');
define('THELIA_TEMPLATE_DIR' , THELIA_ROOT . 'templates/');
define('DS', DIRECTORY_SEPARATOR);
-define('DOMPDF_ENABLE_AUTOLOAD', false);
$loader = require __DIR__ . "/vendor/autoload.php";
diff --git a/core/lib/Thelia/Action/Pdf.php b/core/lib/Thelia/Action/Pdf.php
index e24626655..385f948fb 100644
--- a/core/lib/Thelia/Action/Pdf.php
+++ b/core/lib/Thelia/Action/Pdf.php
@@ -37,13 +37,13 @@ class Pdf extends BaseAction implements EventSubscriberInterface
public function generatePdf(PdfEvent $event)
{
- require_once THELIA_ROOT . '/core/vendor/dompdf/dompdf/dompdf_config.inc.php';
- $domPdf = new \DOMPDF();
- $domPdf->load_html($event->getContent());
- $domPdf->render();
+ $html2pdf = new \HTML2PDF('P', 'A4', 'fr', true, 'UTF-8', array(0,0,0,0));
- $event->setPdf($domPdf->output());
+ $html2pdf->pdf->SetDisplayMode('real');
+
+ $html2pdf->writeHTML($event->getContent());
+ $event->setPdf($html2pdf->output(null, 'S'));
}
/**
diff --git a/core/lib/Thelia/Controller/Admin/OrderController.php b/core/lib/Thelia/Controller/Admin/OrderController.php
index 7f1f0c56c..ececff6e8 100644
--- a/core/lib/Thelia/Controller/Admin/OrderController.php
+++ b/core/lib/Thelia/Controller/Admin/OrderController.php
@@ -226,7 +226,7 @@ class OrderController extends BaseAdminController
}
} catch (\Exception $e) {
- \Thelia\Log\Tlog::getInstance()->error(sprintf('error during generating invoice pdf for order id : %d', $order_id));
+ \Thelia\Log\Tlog::getInstance()->error(sprintf('error during generating invoice pdf for order id : %d with message "%s"', $order_id, $e->getMessage()));
}
diff --git a/templates/pdf/invoice.html b/templates/pdf/invoice.html
index e563f30b8..3ad552d9a 100644
--- a/templates/pdf/invoice.html
+++ b/templates/pdf/invoice.html
@@ -1,9 +1,245 @@
-
-
-
- REF
-
-
- generate invoice
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ |
+ {intl l="Page"} [[page_cu]]/[[page_nb]] |
+
+
+
+
+{loop name="order.invoice" type="order" id=$order_id customer="*"}
+ {loop name="currency.order" type="currency" id=$CURRENCY}
+ {assign "orderCurrency" $SYMBOL}
+ {/loop}
+
+
+
+
+
+
+ #VARIABLE(nomsite)
+
+ {intl l="invoice"} {$INVOICE_REF}
+
+
+
+
+ | {intl l="invoice ref"} |
+ {intl l="customer number"} |
+ {intl l="invoice date"} |
+
+
+
+ | {$REF} |
+ {loop type="customer" name="customer.invoice" id=$CUSTOMER}$REF{/loop} |
+ {format_date date=$INVOICE_DATE} |
+
+
+ |
+
+
+
+
+
+ | {intl l="delivery address"} |
+
+
+
+
+ {loop type="order_address" name="delivery_address" id=$DELIVERY_ADDRESS}
+ {loop type="title" name="order-invoice-address-title" id=$TITLE}{$LONG}{/loop}{$FIRSTNAME} {$LASTNAME}
+ {$ADDRESS1} {$ADDRESS2} {$ADDRESS3}
+ {$ZIPCODE} {$COUNTRY}
+ {loop type="country" name="country_delivery" id=$COUNTRY}{$TITLE}{/loop}
+ {/loop}
+ |
+
+
+
+
+
+ | {intl l="invoice address"} |
+
+
+
+
+ {loop type="order_address" name="delivery_address" id=$INVOICE_ADDRESS}
+ {loop type="title" name="order-invoice-address-title" id=$TITLE}{$LONG}{/loop}{$FIRSTNAME} {$LASTNAME}
+ {$ADDRESS1} {$ADDRESS2} {$ADDRESS3}
+ {$ZIPCODE} {$COUNTRY}
+ {loop type="country" name="country_delivery" id=$COUNTRY}{$TITLE}{/loop}
+ {/loop}
+ |
+
+
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | {intl l="Product"} |
+ {intl l="Unit. price"} |
+ {intl l="Tax"} |
+ {intl l="Unit taxed price"} |
+ {intl l="Quantity"} |
+ {intl l="Taxed total"} |
+
+
+
+
+
+ {loop type="order_product" name="order-products" order=$ID}
+ {if $WAS_IN_PROMO == 1}
+ {assign "realPrice" $PROMO_PRICE}
+ {assign "realTax" $PROMO_PRICE_TAX}
+ {assign "realTaxedPrice" $TAXED_PROMO_PRICE}
+ {else}
+ {assign "realPrice" $PRICE}
+ {assign "realTax" $PRICE_TAX}
+ {assign "realTaxedPrice" $TAXED_PRICE}
+ {/if}
+
+
+ {$TITLE}
+ {ifloop rel="combinations"}
+ {loop type="order_product_attribute_combination" name="combinations" order_product=$ID}
+ {$ATTRIBUTE_TITLE} - {$ATTRIBUTE_AVAILABILITY_TITLE}
+ {/loop}
+ {/ifloop}
+ |
+ {$orderCurrency} {$realPrice} |
+ {$orderCurrency} {$realTax} |
+ {$orderCurrency} {$realTaxedPrice} |
+ {$QUANTITY} |
+ {$orderCurrency} {$realTaxedPrice * $QUANTITY} |
+
+ {/loop}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ | ::Mode de règlement:: |
+ #PAIEMENTTITRE |
+
+
+ | ::Mode de livraison:: |
+ #TRANSPORTTITRE |
+
+
+
+
+
+
+
+
+ | ::Zone de correspondance:: |
+
+
+ |
+
+
+
+ |
+
+
+
+
+
+
+
+
+
+ | {intl l="Total without tax"} |
+ {$orderCurrency} {$TOTAL_AMOUNT} |
+
+
+
+ | {intl l="Total with tax"} |
+ {$orderCurrency} {$TOTAL_TAXED_AMOUNT - $POSTAGE} |
+
+
+
+ | {intl l="Postage"} |
+ {$orderCurrency} {$POSTAGE} |
+
+
+
+ | {intl l="Total"} |
+ {$orderCurrency} {$TOTAL_TAXED_AMOUNT} |
+
+
+
+ |
+
+
+
+
+{/loop}
+