From fffc4430c537e42684db76d2684535f00980cec9 Mon Sep 17 00:00:00 2001 From: TheCoreDev Date: Wed, 24 Feb 2021 15:36:09 +0100 Subject: [PATCH] Il manquait un bout de PlanificationLivraison en conf --- .../LivraisonParSecteurs/Config/config.xml | 2 + .../LivraisonParSecteurs/Hook/AdminHook.php | 26 + .../LivraisonParSecteurs/Hook/EmailHook.php | 1 - .../LivraisonParSecteurs/I18n/fr_FR.php | 1 + .../backOffice/default/delivery-address.html | 8 + .../email/default/delivery-address.html | 2 +- .../frontOffice/default/delivery-address.html | 2 +- .../Model/OrderDeliverySchedule.php | 20 + .../Model/OrderDeliveryScheduleQuery.php | 20 + templates/backOffice/custom/order-edit.html | 906 ++++++++++++++++++ 10 files changed, 985 insertions(+), 3 deletions(-) create mode 100644 local/modules/LivraisonParSecteurs/templates/backOffice/default/delivery-address.html create mode 100644 local/modules/PlanificationLivraison/Model/OrderDeliverySchedule.php create mode 100644 local/modules/PlanificationLivraison/Model/OrderDeliveryScheduleQuery.php create mode 100644 templates/backOffice/custom/order-edit.html diff --git a/local/modules/LivraisonParSecteurs/Config/config.xml b/local/modules/LivraisonParSecteurs/Config/config.xml index 829d4782..ba000b1e 100644 --- a/local/modules/LivraisonParSecteurs/Config/config.xml +++ b/local/modules/LivraisonParSecteurs/Config/config.xml @@ -22,6 +22,8 @@ + + diff --git a/local/modules/LivraisonParSecteurs/Hook/AdminHook.php b/local/modules/LivraisonParSecteurs/Hook/AdminHook.php index dd59ca07..b7306849 100644 --- a/local/modules/LivraisonParSecteurs/Hook/AdminHook.php +++ b/local/modules/LivraisonParSecteurs/Hook/AdminHook.php @@ -34,4 +34,30 @@ class AdminHook extends BaseHook } } + public function displayDeliveryDate(HookRenderEvent $event) + { + + $moduleId = $event->getArgument('module'); + $orderId = $event->getArgument('order_id'); + + if ((null !== $orderId) && ($moduleId == LivraisonParSecteurs::getModuleId())) + { + $selectedDay = $this->getSession()->get(LivraisonParSecteurs::LPS_DELIVERY_DATE); + $beginTime = $this->getSession()->get(LivraisonParSecteurs::LPS_DELIVERY_BEGIN_TIME); + $endTime = $this->getSession()->get(LivraisonParSecteurs::LPS_DELIVERY_END_TIME); + + if ( (null !== $selectedDay) && (null !== $beginTime) && (null !== $endTime) ) + { + $event->add( + $this->render( + 'delivery-address.html', [ + 'day' => $selectedDay, + 'begin_time' => $beginTime, + 'end_time' => $endTime + ]) + ); + } + } + } + } diff --git a/local/modules/LivraisonParSecteurs/Hook/EmailHook.php b/local/modules/LivraisonParSecteurs/Hook/EmailHook.php index d63b10ce..e9963b91 100644 --- a/local/modules/LivraisonParSecteurs/Hook/EmailHook.php +++ b/local/modules/LivraisonParSecteurs/Hook/EmailHook.php @@ -5,7 +5,6 @@ namespace LivraisonParSecteurs\Hook; use LivraisonParSecteurs\LivraisonParSecteurs; use Thelia\Core\Event\Hook\HookRenderEvent; use Thelia\Core\Hook\BaseHook; -use Thelia\Model\Order; class EmailHook extends BaseHook { diff --git a/local/modules/LivraisonParSecteurs/I18n/fr_FR.php b/local/modules/LivraisonParSecteurs/I18n/fr_FR.php index 9be62270..a31a0e48 100644 --- a/local/modules/LivraisonParSecteurs/I18n/fr_FR.php +++ b/local/modules/LivraisonParSecteurs/I18n/fr_FR.php @@ -31,6 +31,7 @@ return array( 'Remove this city' => 'Retirer cette commune', 'Save' => 'Sauvegarder', 'Schedule' => 'Horaires de livraison', + 'Scheduled date' => 'Livraison prĂ©vue le', 'There is no city delivered in this area' => 'Aucune commune desservie dans ce secteur', 'There is no schedule for this area' => 'Aucune livraison actuellement sur ce secteur', 'Title of config view' => 'Module LivraisonParSecteurs - Confiwguration', diff --git a/local/modules/LivraisonParSecteurs/templates/backOffice/default/delivery-address.html b/local/modules/LivraisonParSecteurs/templates/backOffice/default/delivery-address.html new file mode 100644 index 00000000..a4768c65 --- /dev/null +++ b/local/modules/LivraisonParSecteurs/templates/backOffice/default/delivery-address.html @@ -0,0 +1,8 @@ +  + + + {intl l="Scheduled date" d="livraisonparsecteurs"} + {$day} entre {format_date date=$begin_time format="H:i"} et {format_date date=$end_time format="H:i"} + + +  diff --git a/local/modules/LivraisonParSecteurs/templates/email/default/delivery-address.html b/local/modules/LivraisonParSecteurs/templates/email/default/delivery-address.html index e55fb76f..10fdff76 100644 --- a/local/modules/LivraisonParSecteurs/templates/email/default/delivery-address.html +++ b/local/modules/LivraisonParSecteurs/templates/email/default/delivery-address.html @@ -1,5 +1,5 @@
-
{intl l="Delivery day" d="livraisonparsecteurs"}
+
{intl l="Scheduled date" d="livraisonparsecteurs"}
{$day} entre {format_date date=$begin_time format="H:i"} et {format_date date=$end_time format="H:i"}
diff --git a/local/modules/LivraisonParSecteurs/templates/frontOffice/default/delivery-address.html b/local/modules/LivraisonParSecteurs/templates/frontOffice/default/delivery-address.html index 1685cce3..2f0e5a9d 100644 --- a/local/modules/LivraisonParSecteurs/templates/frontOffice/default/delivery-address.html +++ b/local/modules/LivraisonParSecteurs/templates/frontOffice/default/delivery-address.html @@ -20,7 +20,7 @@
{/loop} -
{intl l="Delivery day" d="livraisonparsecteurs"}
+
{intl l="Scheduled date" d="livraisonparsecteurs"}
{$day} entre {format_date date=$begin_time format="H:i"} et {format_date date=$end_time format="H:i"}
diff --git a/local/modules/PlanificationLivraison/Model/OrderDeliverySchedule.php b/local/modules/PlanificationLivraison/Model/OrderDeliverySchedule.php new file mode 100644 index 00000000..7db0e604 --- /dev/null +++ b/local/modules/PlanificationLivraison/Model/OrderDeliverySchedule.php @@ -0,0 +1,20 @@ + + +
+ + + + {hook name="order-edit.top" order_id=$order_id} + +
+
+ +
+ + {ifloop rel='the-order'} + + {loop type="order" name="the-order" id=$order_id customer="*" with_prev_next_info="true" backend_context="1"} + + {loop type="currency" name="order-currency" id=$CURRENCY} + {$orderCurrency=$SYMBOL} + {/loop} + +
+
+
{intl l='Order %ref - ID %id' id={$ID} ref={$REF}}
+

{intl l='Order placed on %order_date at %order_time' order_date={format_date date=$CREATE_DATE output='date'} order_time={format_date date=$CREATE_DATE output='time'}}

+
+ +
+
+ +
+ +
+ +
+
+
+
+ +
+ {if $HAS_PREVIOUS != 0} + + {else} + + {/if} + + {if $HAS_NEXT != 0} + + {else} + + {/if} +
+
+ + {hookblock name="order.tab" id={$order_id} fields="id,title,href,content"} + + {capture "order_tab_tab"} + {forhook rel="order.tab"} +
  • + {$title} + +
  • + {/forhook} + {/capture} + + {capture "order_tab_content"} + {forhook rel="order.tab"} +
    + {if $href} + {* ajax *} +
    {intl l="Please wait, loading"}
    + {else} + {$content nofilter} + {/if} +
    + {/forhook} + {/capture} + + {/hookblock} + + + + +
    +
    + + {hook name="order-edit.cart-top" location="order-edit-cart-top" order_id=$order_id} + +
    + {if $smarty.get.update_status_error_message} +
    + {$smarty.get.update_status_error_message} +
    + {/if} + + {hook name="order-edit.before-order-product-list" location="before-order-product-list" order_id=$order_id} + + + + + + + {hook name="order-edit.order-product-table-header" location="order_edit_table_header" } + + + + + + + + + + + + {$taxes = []} + + {loop type="order_product" name="order-products" order=$ID} + {if ! isset($taxes[{$TAX_RULE_TITLE}])} + {$taxes[{$TAX_RULE_TITLE}] = 0} + {/if} + + {$taxes[{$TAX_RULE_TITLE}] = $taxes[{$TAX_RULE_TITLE}] + $REAL_PRICE_TAX * $QUANTITY} + + {hook name="order-edit.before-order-product-row" location="before-order-product-row" order_id=$order_id order_product_id=$ID} + + + {hook name="order-edit.order-product-table-row" location="order_edit_table_row" order_product_id={$ID} } + + + + + + + + + {hook name="order-edit.after-order-product-row" location="after-order-product-row" order_id=$order_id order_product_id=$ID} + {/loop} + +
    + {intl l='Cart - Prices in %currency' currency={$orderCurrency}} +
    {intl l="Product"}{intl l="Unit. price"}{intl l="Tax"}{intl l="Unit taxed price"}{intl l="Quantity"}{intl l="Untaxed total"}{intl l="Tax total"}{intl l="Taxed total"}
    + {ifloop rel="my_product_loop"} + {loop type="product" name="my_product_loop" visible="*" ref=$REF return_url=false} + {$REF} - {$TITLE} + {if $VIRTUAL}{/if} + {/loop} +
    +
    {intl l='Combination reference'}
    +
    {$PRODUCT_SALE_ELEMENTS_REF}
    +
    + {/ifloop} + {elseloop rel="my_product_loop"} + {* The product doesn't exist anymore *} + {$TITLE} + {if $VIRTUAL}{/if} + {/elseloop} + {ifloop rel="combinations"} +
    + {loop type="order_product_attribute_combination" name="combinations" order_product=$ID} +
    {$ATTRIBUTE_TITLE}
    +
    {$ATTRIBUTE_AVAILABILITY_TITLE}
    + {/loop} +
    + {/ifloop} + {hook name="order-edit.product-list" location="order-product-list" order_id=$order_id order_product_id=$ID} +
    {format_money number=$REAL_PRICE currency_id=$CURRENCY}{format_money number=$REAL_PRICE_TAX currency_id=$CURRENCY}{format_money number=$REAL_TAXED_PRICE currency_id=$CURRENCY}{$QUANTITY}{format_money number=$REAL_TOTAL_PRICE currency_id=$CURRENCY}{format_money number=$REAL_TOTAL_PRICE_TAX currency_id=$CURRENCY}{format_money number=$REAL_TOTAL_TAXED_PRICE currency_id=$CURRENCY}
    +
    + +
    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    {intl l="Total without tax"}{format_money number=$TOTAL_ITEMS_AMOUNT currency_id=$CURRENCY}
    {intl l="Total with taxes before discount"}{format_money number=$TOTAL_TAXED_AMOUNT-$POSTAGE+$DISCOUNT currency_id=$CURRENCY}
    {intl l="Discount with taxes"}{if $DISCOUNT > 0}-{/if}{format_money number=$DISCOUNT currency_id=$CURRENCY}
    {intl l="Total with taxes after discount"}{format_money number=$TOTAL_TAXED_AMOUNT-$POSTAGE currency_id=$CURRENCY}
    {intl l="Shipping with taxes"}{format_money number=$POSTAGE currency_id=$CURRENCY}
    {intl l="ORDER TOTAL WITH TAXES"}{format_money number=$TOTAL_TAXED_AMOUNT currency_id=$CURRENCY}
    +
    +
    + +
    +
    +
    +

    {intl l='Taxes'}

    +
    + + + + + + + + {$tmp = 0} + {foreach $taxes as $name => $amount} + {if $amount != 0} + + + + + {$tmp = $tmp + $amount} + {/if} + {/foreach} + {if $tmp == 0} + + + + {/if} + + + + + + {if $POSTAGE_TAX != 0} + + + {else} + + {/if} + + + + + + + + {if $DISCOUNT_TAX != 0} + + + {else} + + {/if} + + + + + + + +
    {intl l='Items taxes'}
    {$name} + {format_money number=$amount currency_id=$CURRENCY} +
    {intl l="None"}
    {intl l='Shipping taxes'}
    {$POSTAGE_TAX_RULE_TITLE} + {format_money number=$POSTAGE_TAX currency_id=$CURRENCY} + {intl l="None"}
    {intl l='Discount tax'}
    {intl l='Average rate'} + -{format_money number=$DISCOUNT_TAX currency_id=$CURRENCY} + {intl l="None"}
    {intl l="Taxes total"}{format_money number=$TOTAL_TAX currency_id=$CURRENCY}
    +
    + +
    + + + + + + + + + + + + +
    {intl l="Coupon code"} + {loop type="order_coupon" name="couponcode" order=$ID} + {$CODE}{if $LOOP_COUNT != $LOOP_TOTAL}, {/if} + {/loop} + {elseloop rel="couponcode"} + {intl l='No coupon for this order'} + {/elseloop} +
    {intl l="Weight"} + {format_number number=$WEIGHT} {intl l="Kg"} +
    +
    + +
    +
    + + {hook name="order-edit.after-order-product-list" location="after-order-product-list" order_id=$order_id} + + {loop type="order_address" name="order-invoice-address" id=$INVOICE_ADDRESS} + {assign "orderInvoiceFirstName" $FIRSTNAME} + {assign "orderInvoiceLastName" $LASTNAME} + {assign "orderInvoiceCompany" $COMPANY} + {/loop} + +
    +
    +

    + {intl l='Customer information'} +

    +
    + + + + + + + + + + + {if $orderInvoiceCompany} + + + + + {/if} + +
    {intl l="Customer"}{$orderInvoiceFirstName|ucwords} {$orderInvoiceLastName|upper}
    {intl l="Email"}{loop type="customer" name="customer" id=$CUSTOMER backend_context="on" current="false"}{$EMAIL}{/loop}
    {intl l="Company"}{$orderInvoiceCompany}
    + + {hook name="order-edit.customer-information-bottom" order_id=$order_id customer_id=$CUSTOMER} +
    + +
    +
    +

    + {intl l='Payment information'} +

    +
    + + + + + + + + + + + +
    {intl l="Payment module"}{loop name="payment-module" type="module" id=$PAYMENT_MODULE order="code"}{$CODE} - {$TITLE}{/loop}
    {intl l="Transaction reference"} + {if $TRANSACTION_REF} + {$TRANSACTION_REF} + {else} + {intl l='No transaction for this order'} + {/if} +
    + + {hook name="order-edit.payment-module-bottom" order_id=$order_id module_id=$PAYMENT_MODULE} +
    + + {hook name="order-edit.cart-bottom" location="order-edit-cart-bottom" order_id=$order_id} +
    + +
    + + {hook name="order-edit.bill-top" location="order-edit-bill-top" order_id=$order_id} + +
    + {intl l='Delivery information'} +
    + +
    +
    +
    +
    +

    {intl l='Delivery module'}

    +
    +
    + {loop name="delivery-module" type="module" id=$DELIVERY_MODULE order="code"} +

    {$CODE} - {$TITLE}

    + + {if $DESCRIPTION} +
    {$DESCRIPTION nofilter}
    + {/if} + {/loop} +
    + + {hook name="order-edit.delivery-module-bottom" order_id=$order_id module_id=$DELIVERY_MODULE} +
    +
    + +
    +
    +
    +

    {intl l='tracking reference'}

    +
    +
    +
    + +
    + + + + +
    +
    +
    +
    +
    +
    + + {if $smarty.get.update_status_error_message} +
    + {$smarty.get.update_status_error_message} +
    + {/if} + +
    +
    +
    +
    +

    {intl l='Invoice informations'}

    +
    +
    + {include file='renderer/buttons.html' with_text=false buttons=[ + [ + 'type' => 'view', + 'title' => {intl l='View invoice PDF'}, + 'href' => {url path="/admin/order/pdf/invoice/%id/%browser" browser=1 id=$ID}, + 'attr' => ['target' => '_blank'] + ], + [ + 'type' => 'download', + 'title' => {intl l='Download invoice as PDF'}, + 'href' => {url path="/admin/order/pdf/invoice/%id/%browser" browser=0 id=$ID} + ], + [ + 'type' => 'print', + 'class' => 'js-action-print', + 'title' => {intl l='Print invoice'}, + 'href' => {url path="/admin/order/pdf/invoice/%id/%browser" browser=1 id=$ID}, + 'data' => [ + 'type' => "invoice" + ] + ] + ]} + +
    + {include file='renderer/buttons.html' with_text=false buttons=[ + [ + 'type' => 'edit', + 'class' => 'js-update-order-address', + 'title' => {intl l='Edit invoice address'}, + 'href' => "#edit_order_address_dialog", + 'data' => [ + 'address-id' => $INVOICE_ADDRESS, + 'toggle' => 'modal' + ] + ] + ]} +
    +
    + + + + + + + + + + + + + {loop type="order_address" name="order-invoice-address" id=$INVOICE_ADDRESS} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {/loop} + +
    {intl l="Invoice reference"}{if $INVOICE_REF} + {$INVOICE_REF} + {else} + {intl l="None"} + {/if} +
    {intl l="Invoice date"}{format_date date=$INVOICE_DATE output="date"}
    {intl l="Company"}{$COMPANY}
    {intl l="Title"}{loop type="title" name="order-invoice-address-title" id=$TITLE}{$LONG}{/loop}
    {intl l="Firstname"}{$FIRSTNAME}
    {intl l="Lastname"}{$LASTNAME}
    {intl l="Street address"}{$ADDRESS1}
    {intl l="Additional address"}{$ADDRESS2}
    {intl l="Additional address"}{$ADDRESS3}
    {intl l="Zip code"}{$ZIPCODE}
    {intl l="City"}{$CITY}
    {intl l="Country"}{loop type="country" name="order-invoice-address-country" id=$COUNTRY visible="*"}{$TITLE}{/loop}
    {intl l="State"} + {if $STATE} + {loop type="state" name="order-invoice-address-state" id=$STATE visible="*"}{$TITLE}{/loop} + {else} + - + {/if} +
    {intl l="Phone"}{$PHONE}
    {intl l="Cellphone"}{$CELLPHONE}
    {intl l="Email"}{loop type="customer" name="customer" id=$CUSTOMER backend_context="on" current="false"}{$EMAIL}{/loop}
    +
    +
    + +
    +
    +
    +

    {intl l='Delivery address'}

    +
    + +
    + {include file='renderer/buttons.html' with_text=false buttons=[ + [ + 'type' => 'view', + 'title' => {intl l='View purchase order as PDF'}, + 'href' => {url path="/admin/order/pdf/delivery/%id/%browser" browser=1 id=$ID}, + 'attr' => ['target' => '_blank'] + ], + [ + 'type' => 'download', + 'title' => {intl l='Download purchase order as PDF'}, + 'href' => {url path="/admin/order/pdf/delivery/%id/%browser" browser=0 id=$ID} + ], + [ + 'type' => 'print', + 'class' => 'js-action-print', + 'title' => {intl l='Print purchase order'}, + 'href' => {url path="/admin/order/pdf/delivery/%id/%browser" browser=1 id=$ID}, + 'data' => [ + 'type' => "purchase" + ] + ] + ]} + +
    + {include file='renderer/buttons.html' with_text=false buttons=[ + [ + 'type' => 'edit', + 'class' => 'js-update-order-address', + 'title' => {intl l='Edit delivery address'}, + 'href' => "#edit_order_address_dialog", + 'data' => [ + 'address-id' => $DELIVERY_ADDRESS, + 'toggle' => 'modal' + ] + ] + ]} +
    +
    + + + + {loop type="order_address" name="order-delivery-address" id=$DELIVERY_ADDRESS} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {ifhook rel="order-edit.bill-delivery-address"} + {hook name="order-edit.bill-delivery-address" module="$DELIVERY_MODULE" order_id={$order_id}} + {/ifhook} + {/loop} + +
     
     
    {intl l="Company"}{$COMPANY}
    {intl l="Title"}{loop type="title" name="order-delivery-address-title" id=$TITLE}{$LONG}{/loop}
    {intl l="Firstname"}{$FIRSTNAME}
    {intl l="Lastname"}{$LASTNAME}
    {intl l="Street address"}{$ADDRESS1}
    {intl l="Additional address"}{$ADDRESS2}
    {intl l="Additional address"}{$ADDRESS3}
    {intl l="Zip code"}{$ZIPCODE}
    {intl l="City"}{$CITY}
    {intl l="Country"}{loop type="country" name="order-delivery-address-country" id=$COUNTRY visible="*"}{$TITLE}{/loop}
    {intl l="State"} + {if $STATE} + {loop type="state" name="order-delivery-address-state" id=$STATE visible="*"}{$TITLE}{/loop} + {else} + - + {/if} +
    {intl l="Phone"}{$PHONE}
    {intl l="Cellphone"}{$CELLPHONE}
    +
    +
    +
    + + {hook name="order-edit.bill-bottom" location="order-edit-bill-bottom" order_id=$order_id} + +
    + + {$smarty.capture.order_tab_content nofilter} + +
    + {* ugly fix : {hook name="order.tab-content"} *} + {include file="includes/module-tab-content.html" hook="order.tab-content" location="order-edit" id=$order_id view="order-edit"} +
    +
    + {/loop} + + {/ifloop} + {elseloop rel="the-order"} + + DOES NOT EXISTS + + {/elseloop} + +
    + +
    +
    + + {hook name="order-edit.bottom" order_id=$order_id} + +
    + + + {* Update an Address *} + + {form name="thelia.order.update.address"} + + {* Capture the dialog body, to pass it to the generic dialog *} + {capture "edit_order_address_dialog"} + + {form_hidden_fields} + + {form_field field='id'} + + {/form_field} + + {render_form_field field='company' extra_class="js-company"} + + {custom_render_form_field field='title'} + + {/custom_render_form_field} + +
    +
    {render_form_field field="firstname" extra_class="js-firstname"}
    +
    {render_form_field field='lastname' extra_class="js-lastname"}
    +
    + + {render_form_field field='address1' extra_class="js-address1"} + {render_form_field field='address2' extra_class="js-address2" show_label=false} + {render_form_field field='address3' extra_class="js-address3" show_label=false} + +
    +
    {render_form_field field='zipcode' extra_class="js-zipcode"}
    +
    {render_form_field field='city' extra_class="js-city"}
    +
    + +
    +
    + {custom_render_form_field field='country'} + + {$countryFieldId=$label_attr.for} + {/custom_render_form_field} +
    + +
    + {custom_render_form_field field='state'} + + {/custom_render_form_field} +
    +
    + +
    +
    {render_form_field field='phone' extra_class="js-phone"}
    +
    {render_form_field field='cellphone' extra_class="js-cellphone"}
    +
    + {/capture} + + {include + file = "includes/generic-create-dialog.html" + + dialog_id = "edit_order_address_dialog" + dialog_title = {intl l="Edit order address"} + dialog_body = {$smarty.capture.edit_order_address_dialog nofilter} + + dialog_ok_label = {intl l="Confirm changes"} + dialog_cancel_label = {intl l="Cancel"} + + form_action = {url path="/admin/order/update/%id/address" id=$order_id} + form_enctype = {form_enctype} + form_error_message = $form_error_message + form_id = 'updateOrderAddressForm' + } + + {/form} + +{/block} + +{block name="javascript-initialization"} + + {javascripts file='assets/js/bootstrap-select/bootstrap-select.js'} + + {/javascripts} + + {javascripts file='assets/js/thelia-states.js'} + + {/javascripts} + + + +{/block} + +{block name="javascript-last-call"} + {hook name="order.edit-js" location="order-edit-js" order_id={$order_id} } +{/block}