diff --git a/local/modules/ClickAndCollect/Config/config.xml b/local/modules/ClickAndCollect/Config/config.xml index 233bbc6d..d8b3b077 100644 --- a/local/modules/ClickAndCollect/Config/config.xml +++ b/local/modules/ClickAndCollect/Config/config.xml @@ -27,6 +27,11 @@ + + + + + diff --git a/local/modules/ClickAndCollect/Hook/PdfHook.php b/local/modules/ClickAndCollect/Hook/PdfHook.php new file mode 100644 index 00000000..03132903 --- /dev/null +++ b/local/modules/ClickAndCollect/Hook/PdfHook.php @@ -0,0 +1,52 @@ +getArgument('order'); + $moduleId = OrderQuery::create()->findOneById($orderId)->getDeliveryModuleId(); + + if ((null !== $orderId) && $moduleId === ClickAndCollect::getModuleId()) { + + $order = OrderDeliveryScheduleQuery::create()->findOneByOrderId($orderId); + if (null !== $order) { + $selectedDay = $order->getDueDeliveryTimeStart(PlanificationLivraison::FORMAT_DATES); + $beginTime = $order->getDueDeliveryTimeStart(PlanificationLivraison::FORMAT_HEURE); + $endTime = $order->getDueDeliveryTimeEnd(PlanificationLivraison::FORMAT_HEURE); + $placeID = $order->getDeliveryPlaceId(); + $place = PdrPlacesQuery::create()->findOneById($placeID); + + if ((null !== $selectedDay) && (null !== $beginTime) && (null !== $endTime)) { + $event->add( + $this->render( + 'delivery-address.html', [ + 'day' => $selectedDay, + 'begin_time' => $beginTime, + 'end_time' => $endTime, + 'title' => $place->getTitle(), + 'address1' => $place->getAddress1(), + 'address2' => $place->getAddress2(), + 'zipcode' => $place->getZipcode(), + 'city' => $place->getCity() + ]) + ); + } else + throw new TheliaProcessException("ClickAndCollect : Impossible de récupérer les données"); + } + } + } + +} diff --git a/local/modules/ClickAndCollect/I18n/fr_FR.php b/local/modules/ClickAndCollect/I18n/fr_FR.php index 79dd7899..1c4c0ad6 100644 --- a/local/modules/ClickAndCollect/I18n/fr_FR.php +++ b/local/modules/ClickAndCollect/I18n/fr_FR.php @@ -42,6 +42,8 @@ return array( 'There is no order to deliver' => 'Aucune commande à déposer', 'There is no schedule for this place' => 'Aucun jour d\'ouverture pour ce point click and Collect', 'Title of config view' => 'Point Click and Collect - Configuration', + 'Withdrawal address' => 'Retrait à l\'adresse suivante : ', + 'Withdrawal date' => 'A retirer à partir du : ', 'Working day' => 'Jour d\'ouverture', 'Zipcode' => 'Code postal', '' => '', diff --git a/local/modules/ClickAndCollect/templates/pdf/default/delivery-address.html b/local/modules/ClickAndCollect/templates/pdf/default/delivery-address.html new file mode 100644 index 00000000..e5b92bae --- /dev/null +++ b/local/modules/ClickAndCollect/templates/pdf/default/delivery-address.html @@ -0,0 +1,12 @@ +
+
+

{intl l="Withdrawal date" d="clickandcollect"}{$day}

+

{intl l="Withdrawal address" d="clickandcollect"}
+ {$title}
+ {$address1}
+ {$address2}
+ {$zipcode} {$city} +
+

+
+
diff --git a/local/modules/PointRetrait/Config/config.xml b/local/modules/PointRetrait/Config/config.xml index 8a58a872..2f516c95 100644 --- a/local/modules/PointRetrait/Config/config.xml +++ b/local/modules/PointRetrait/Config/config.xml @@ -28,6 +28,10 @@ + + + + diff --git a/local/modules/PointRetrait/Hook/PdfHook.php b/local/modules/PointRetrait/Hook/PdfHook.php new file mode 100644 index 00000000..0876c226 --- /dev/null +++ b/local/modules/PointRetrait/Hook/PdfHook.php @@ -0,0 +1,52 @@ +getArgument('order'); + $moduleId = OrderQuery::create()->findOneById($orderId)->getDeliveryModuleId(); + + if ((null !== $orderId) && $moduleId === PointRetrait::getModuleId()) { + + $order = OrderDeliveryScheduleQuery::create()->findOneByOrderId($orderId); + if (null !== $order) { + $selectedDay = $order->getDueDeliveryTimeStart(PlanificationLivraison::FORMAT_DATES); + $beginTime = $order->getDueDeliveryTimeStart(PlanificationLivraison::FORMAT_HEURE); + $endTime = $order->getDueDeliveryTimeEnd(PlanificationLivraison::FORMAT_HEURE); + $placeID = $order->getDeliveryPlaceId(); + $place = PdrPlacesQuery::create()->findOneById($placeID); + + if ((null !== $selectedDay) && (null !== $beginTime) && (null !== $endTime)) { + $event->add( + $this->render( + 'delivery-address.html', [ + 'day' => $selectedDay, + 'begin_time' => $beginTime, + 'end_time' => $endTime, + 'title' => $place->getTitle(), + 'address1' => $place->getAddress1(), + 'address2' => $place->getAddress2(), + 'zipcode' => $place->getZipcode(), + 'city' => $place->getCity() + ]) + ); + } else + throw new TheliaProcessException("PointRetrait : Impossible de récupérer les données"); + } + } + } + +} diff --git a/local/modules/PointRetrait/I18n/fr_FR.php b/local/modules/PointRetrait/I18n/fr_FR.php index 2fdbdc3a..8e617ff3 100644 --- a/local/modules/PointRetrait/I18n/fr_FR.php +++ b/local/modules/PointRetrait/I18n/fr_FR.php @@ -47,6 +47,8 @@ return array( 'Withdrawal days' => 'Jours de retrait', 'Withdrawal ending time' => 'Fin du retrait', 'Withdrawal price' => 'Coût du retrait', + 'Withdrawal address' => 'Retrait à l\'adresse suivante : ', + 'Withdrawal date' => 'A retirer le : ', 'Zipcode' => 'Code postal', '' => '', ); diff --git a/local/modules/PointRetrait/templates/pdf/default/delivery-address.html b/local/modules/PointRetrait/templates/pdf/default/delivery-address.html new file mode 100644 index 00000000..f8251251 --- /dev/null +++ b/local/modules/PointRetrait/templates/pdf/default/delivery-address.html @@ -0,0 +1,12 @@ +
+
+

{intl l="Withdrawal date" d="pointretrait"}{$day} entre {format_date date=$begin_time format="H\hi"} et {format_date date=$end_time format="H\hi"}

+

{intl l="Withdrawal address" d="pointretrait"}
+ {$title}
+ {$address1}
+ {$address2}
+ {$zipcode} {$city} +
+

+
+
diff --git a/templates/pdf/custom/assets/img/logo.png b/templates/pdf/custom/assets/img/logo.png new file mode 100644 index 00000000..768b18a1 Binary files /dev/null and b/templates/pdf/custom/assets/img/logo.png differ diff --git a/templates/pdf/custom/invoice.html b/templates/pdf/custom/invoice.html new file mode 100644 index 00000000..e89b0a61 --- /dev/null +++ b/templates/pdf/custom/invoice.html @@ -0,0 +1,369 @@ +{*************************************************************************************/ +/* This file is part of the Thelia package. */ +/* */ +/* Copyright (c) OpenStudio */ +/* email : dev@thelia.net */ +/* web : http://www.thelia.net */ +/* */ +/* For the full copyright and license information, please view the LICENSE.txt */ +/* file that was distributed with this source code. */ +/*************************************************************************************} + +{* Set the default translation domain, that will be used by {intl} when the 'd' parameter is not set *} +{default_translation_domain domain='pdf.default'} +{literal} + +{/literal} + + + {hook name="invoice.header" order=$order_id} + + + + {hook name="invoice.footer-top" order=$order_id} + + + + + + + + + +
+ {hook name="invoice.imprint" order=$order_id} + {elsehook rel="invoice.imprint"} + + {config key="store_name"} + {$addresses="{config key="store_address1"} {config key="store_address2"} {config key="store_address3"}"} + {$city="{config key="store_zipcode"} {config key="store_city"}"} + {if $addresses != " "}- {$addresses}{/if} + {if $city != " " }- {$city}{/if} + {if {config key="store_country"} } + {loop type="country" visible="*" name="address.country.title" id={config key="store_country"}} - {$TITLE}{/loop} + {/if} + {if {config key="store_business_id"} } + - {config key="store_business_id"} + {/if} +
+ {if {config key="store_phone"} } + {intl l="Phone: "}{config key="store_phone"} + {/if} + {if {config key="store_email"} } + {intl l="Email: "}{config key="store_email"} + {/if} + {/elsehook} +
{intl l="page"} [[page_cu]]/[[page_nb]]
+ {hook name="invoice.footer-bottom" order=$order_id} +
+ + {$taxes = []} + + {loop name="order.invoice" type="order" id=$order_id customer="*"} + + + + + + + + + + + + + + + {hookblock name="invoice.information" order=$order_id fields="title,value"} + {forhook rel="invoice.information"} + + + + {/forhook} + {/hookblock} +
+

{intl l="INVOICE"}

+

{intl l="Invoice date"} : {format_date date=$INVOICE_DATE output="date"}

{intl l="Invoice REF"} : {$REF}

{intl l="Customer Number"} : {loop type="customer" name="customer.invoice" id=$CUSTOMER current="0"}{$REF}{/loop}

{$title} : {$value}

+ + {hook name="invoice.after-information" order=$order_id} + + + + + + + + +
+

{intl l="Delivery address"}

+ {ifhook rel="invoice.delivery-address"} + {* delivery module can customize the delivery address *} + {hook name="invoice.delivery-address" module={$DELIVERY_MODULE} order=$order_id} + {/ifhook} + {elsehook rel="invoice.delivery-address"} + {format_address order_address=$DELIVERY_ADDRESS locale=$locale} + {/elsehook} +
+

{intl l="Invoice address"}

+ {format_address order_address=$INVOICE_ADDRESS locale=$locale} +
+ + {hook name="invoice.after-addresses" order=$order_id} + + + + + + + + + + + + + + + + + + {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} + {assign "realTotalPrice" $TOTAL_TAXED_PROMO_PRICE} + {else} + {assign "realPrice" $PRICE} + {assign "realTax" $PRICE_TAX} + {assign "realTaxedPrice" $TAXED_PRICE} + {assign "realTotalPrice" $TOTAL_TAXED_PRICE} + {/if} + + {$taxes[{$TAX_RULE_TITLE}][] = floatval($realTax) * $QUANTITY} + + + + + + + + + + + {hook name="invoice.order-product" order={$order_id} order_product={$ID}} + {/loop} +

{intl l="Product"}

{intl l="Unit. price"}

{intl l="Tax"}

{intl l="Unit taxed price"}

{intl l="Quantity"}

{intl l="Taxed total"}

+

{$TITLE}

+

+ {intl l="Product ref : "}{$REF}
+ {intl l="Combination ref : "}{$PRODUCT_SALE_ELEMENTS_REF} +

+ {ifloop rel="combinations"} + {loop type="order_product_attribute_combination" name="combinations" order_product=$ID} + {$ATTRIBUTE_TITLE} - {$ATTRIBUTE_AVAILABILITY_TITLE}
+ {/loop} + {/ifloop} + {hook name="invoice.product-list" order_product=$ID order=$order_id} +

{format_money number=$realPrice currency_id=$CURRENCY}

{format_money number=$realTax currency_id=$CURRENCY}

{format_money number=$realTaxedPrice currency_id=$CURRENCY}

{$QUANTITY}

{format_money number=$realTotalPrice currency_id=$CURRENCY}

+ +{hook name="invoice.after-products" order=$order_id} + + + + + + + + +
+ +

{intl l="Payment module"}

+

+ {loop name="payment-module" type="module" id=$PAYMENT_MODULE}{$TITLE}{/loop} +

+ + {hook name="invoice.after-payment-module" order=$order_id module_id=$PAYMENT_MODULE} + + +

{intl l="Delivery module"}

+

+ {loop name="delivery-module" type="module" id=$DELIVERY_MODULE}{$TITLE}{/loop} +

+ + {hook name="invoice.after-delivery-module" order=$order_id module_id=$DELIVERY_MODULE} + +
+ + + + + + + + + {capture name="tax"}{strip} + {foreach $taxes as $name=>$prices} + {assign var="_price_taxe_" value="0"} + {foreach $prices as $price} + {$_price_taxe_= $_price_taxe_ + $price} + {/foreach} + {if $_price_taxe_ != 0} + + + + + {/if} + {/foreach} + {/strip}{/capture} + + {if $smarty.capture.tax ne ""} + {$smarty.capture.tax nofilter} + {/if} + + + + + {if $DISCOUNT > 0} + + + + + {/if} + + + + + + + + +

{intl l="Total without tax"}

{format_money number={$TOTAL_ITEMS_AMOUNT} currency_id=$CURRENCY}

{$name}

{format_money number=$_price_taxe_ currency_id=$CURRENCY}

{intl l="Total with tax"}

{format_money number={$TOTAL_TAXED_ITEMS_AMOUNT} currency_id=$CURRENCY}

+

+ {intl l="Discount with tax"} +
{intl l="Tax: %tax" tax={format_money number=$DISCOUNT_TAX currency_id=$CURRENCY}} +

+

-{format_money number=$DISCOUNT currency_id=$CURRENCY}

+

+ {intl l="Postage"} + {if $POSTAGE_TAX != 0} +
{intl l="Tax %name: %tax" name=$POSTAGE_TAX_RULE_TITLE tax={format_money number=$POSTAGE_TAX currency_id=$CURRENCY}} + {/if} +

+

{format_money number=$POSTAGE currency_id=$CURRENCY}

{intl l="Total"}

{format_money number=$TOTAL_TAXED_AMOUNT currency_id=$CURRENCY}

+
+ +{hook name="invoice.after-summary" order=$order_id} + +{/loop} +