diff --git a/admin-dev/themes/default/template/controllers/normal_products/prices.tpl b/admin-dev/themes/default/template/controllers/normal_products/prices.tpl index adb117128..7947be8ed 100644 --- a/admin-dev/themes/default/template/controllers/normal_products/prices.tpl +++ b/admin-dev/themes/default/template/controllers/normal_products/prices.tpl @@ -253,6 +253,7 @@ $(document).ready(function () { + {hook h='displayAdminProductPriceCalculationMethodAfter' product=$product} - {/if} + {/if} \ No newline at end of file diff --git a/admin-dev/themes/default/template/controllers/orders/_current_cart_details_data.tpl b/admin-dev/themes/default/template/controllers/orders/_current_cart_details_data.tpl index 441d0b84b..c2d410eae 100644 --- a/admin-dev/themes/default/template/controllers/orders/_current_cart_details_data.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_current_cart_details_data.tpl @@ -26,6 +26,7 @@
{l s='Cart Details'} + {hook h='displayAdminCartDetailsPanelTitleAfter'}
@@ -120,6 +121,7 @@
+ {hook h='displayAdminOrderCartRoomOccupancyAfter' data=$data} {/if} @@ -152,6 +154,7 @@ + {hook h='displayAdminCartDetailsDeleteActionAfter' data=$data}
 {l s='Services'} diff --git a/admin-dev/themes/default/template/controllers/orders/_product_line.tpl b/admin-dev/themes/default/template/controllers/orders/_product_line.tpl index 9576af251..17cf1903f 100644 --- a/admin-dev/themes/default/template/controllers/orders/_product_line.tpl +++ b/admin-dev/themes/default/template/controllers/orders/_product_line.tpl @@ -62,6 +62,7 @@ {/if} + {hook h='displayAdminOrderProductLineOccupancyAfter' data=$data}

diff --git a/admin-dev/themes/default/template/controllers/orders/form.tpl b/admin-dev/themes/default/template/controllers/orders/form.tpl index 92ce74054..18c66d79d 100644 --- a/admin-dev/themes/default/template/controllers/orders/form.tpl +++ b/admin-dev/themes/default/template/controllers/orders/form.tpl @@ -2316,6 +2316,7 @@ + {hook h="displayAdminOrderMessageBefore"}

@@ -2441,12 +2442,14 @@

{l s='Select or type the payment method using which payment for booking will be made.'}

+ {hook h="displayAdminOrderPaymentSelectionAfter"}
+ {hook h="displayAdminOrderFormFieldsAfter"}
diff --git a/admin-dev/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl b/admin-dev/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl index 16d509e92..2196ec084 100644 --- a/admin-dev/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl +++ b/admin-dev/themes/default/template/controllers/orders/modals/_extra_services_service_products_tab_content.tpl @@ -46,6 +46,7 @@ {l s='Total Price (tax excl.)'} {l s='Total Price (tax incl.)'} {l s='Action'} + {hook h="displayAdminOrderSelectedServicesHeading"} @@ -105,6 +106,7 @@ {displayPrice price=$service['total_price_tax_excl']|escape:'html':'UTF-8' currency=$orderCurrency} {displayPrice price=$service['total_price_tax_incl']|escape:'html':'UTF-8' currency=$orderCurrency} + {hook h="displayAdminOrderSelectedServicesData" id_service_product=$service['id_product'] id_htl_booking_detail=$id_booking_detail id_service_product_order_detail=$service['id_service_product_order_detail'] room_type_id_product=$additionalServices['room_type_id_product']} {/foreach} {else} @@ -135,6 +137,7 @@ {l s='Quantity'} {l s='Unit Price (tax excl.)'} + {hook h="displayAdminOrderAvailableServicesHeading"} @@ -183,6 +186,7 @@
+ {hook h="displayAdminOrderAvailableServicesData" id_service_product=$product['id_product'] id_htl_booking_detail=$id_booking_detail} {/foreach} @@ -313,6 +317,7 @@ {l s='Unit Price (tax excl.)'} {l s='Total Price (tax excl.)'} {l s='Total Price (tax incl.)'} + {hook h="displayAdminOrderViewServicesHeading"} @@ -361,6 +366,7 @@ {displayPrice price=$service['total_price_tax_incl'] currency=$orderCurrency} + {hook h="displayAdminOrderViewServicesData" id_service_product=$service['id_product'] id_htl_booking_detail=$id_booking_detail id_service_product_order_detail=$service['id_service_product_order_detail'] room_type_id_product=$additionalServices['room_type_id_product']} {/foreach} diff --git a/admin-dev/themes/default/template/controllers/products/informations.tpl b/admin-dev/themes/default/template/controllers/products/informations.tpl index 12b92de65..d0104b9fe 100644 --- a/admin-dev/themes/default/template/controllers/products/informations.tpl +++ b/admin-dev/themes/default/template/controllers/products/informations.tpl @@ -204,6 +204,7 @@
+ {hook h='displayAdminProductInformationAfter' item=$product} diff --git a/admin-dev/themes/default/template/helpers/kpi/row.tpl b/admin-dev/themes/default/template/helpers/kpi/row.tpl index 50090b691..3a4635eb9 100644 --- a/admin-dev/themes/default/template/helpers/kpi/row.tpl +++ b/admin-dev/themes/default/template/helpers/kpi/row.tpl @@ -23,6 +23,7 @@ * International Registered Trademark & Property of PrestaShop SA *} +{hook h='displayAdminKpiBefore'}
{foreach from=$kpis item=kpi} diff --git a/admin-dev/themes/default/template/helpers/list/list_content.tpl b/admin-dev/themes/default/template/helpers/list/list_content.tpl index 169041dc6..a1e846e6b 100644 --- a/admin-dev/themes/default/template/helpers/list/list_content.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_content.tpl @@ -158,17 +158,26 @@ {if $has_actions} {assign var='compiled_actions' value=array()} + {capture assign='row_actions_before_delete'}{hook h='displayAdminListRowActionsDeleteBefore' table=$table identifier=$identifier id=$tr.$identifier token=$token}{/capture} + {assign var='row_actions_before_delete_added' value=false} {foreach $actions AS $key => $action} {if isset($tr.$action)} {if $key == 0} {assign var='action' value=$action} {/if} - {if $action == 'delete' && $actions|@count > 2} - {$compiled_actions[] = 'divider'} + {if $action == 'delete'} + {if $row_actions_before_delete} + {$compiled_actions[] = $row_actions_before_delete} + {assign var='row_actions_before_delete_added' value=true} + {/if} + {if $actions|@count > 2} + {$compiled_actions[] = 'divider'} + {/if} {/if} {$compiled_actions[] = $tr.$action} {/if} {/foreach} + {if $row_actions_before_delete && !$row_actions_before_delete_added}{$compiled_actions[] = $row_actions_before_delete}{/if} {if $compiled_actions|count > 0} {if $compiled_actions|count > 1}
{/if}
diff --git a/classes/Cart.php b/classes/Cart.php index 928e532af..88d470356 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -1073,6 +1073,7 @@ class CartCore extends ObjectModel unset(self::$_totalWeight[$this->id]); } + $isCatalogMode = (Configuration::get('PS_CATALOG_MODE') && !defined('_PS_ADMIN_DIR_')); Hook::exec('actionBeforeCartUpdateQty', array( 'cart' => $this, 'product' => $product, @@ -1083,11 +1084,12 @@ class CartCore extends ObjectModel 'id_address_delivery' => $id_address_delivery, 'shop' => $shop, 'auto_add_cart_rule' => $auto_add_cart_rule, + 'enable_catalog_mode' => &$isCatalogMode )); if ((int)$quantity <= 0) { return $this->deleteProduct($id_product, $id_product_attribute, (int)$id_customization, 0, $auto_add_cart_rule); - } elseif (Configuration::get('PS_CATALOG_MODE') && !defined('_PS_ADMIN_DIR_')) { + } elseif ($isCatalogMode) { return false; } else { /* Check if the product is already in the cart */ diff --git a/classes/Mail.php b/classes/Mail.php index b11a45225..badf1153e 100644 --- a/classes/Mail.php +++ b/classes/Mail.php @@ -264,6 +264,13 @@ class MailCore extends ObjectModel $transport = new SendmailTransport(); } + // Allow modules to supply a different mail transport (e.g. a third-party + // email API provider) instead of the SMTP/sendmail transport chosen above. + Hook::exec('actionMailAlterTransportBeforeSend', array( + 'configuration' => $configuration, + 'transport' => &$transport, + )); + $mailer = new Mailer($transport); /* Get templates content */ $iso = Language::getIsoById((int)$id_lang); @@ -414,10 +421,11 @@ class MailCore extends ObjectModel $email->from(new Address($from, (string) $from_name)); // Hook to alter Symfony Mailer before sending mail - Hook::exec('actionMailAlterMessageBeforeSend', [ - 'message' => &$message, + Hook::exec('actionMailAlterMessageBeforeSend', array( + 'template' => &$template, 'message' => &$email, - ]); + 'template_vars' => &$template_vars, + )); $mailer->send($email); @@ -518,6 +526,12 @@ class MailCore extends ObjectModel $transport = new SendmailTransport(); } + // Same extension point as Send(), so the test email also uses the transport supplied by modules. + Hook::exec('actionMailAlterTransportBeforeSend', array( + 'configuration' => array('PS_MAIL_METHOD' => Configuration::get('PS_MAIL_METHOD')), + 'transport' => &$transport, + )); + $mailer = new Mailer($transport); $email = (new Email()) ->from($from) diff --git a/classes/Product.php b/classes/Product.php index 956c39bdf..27f9704bd 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -3321,6 +3321,14 @@ class ProductCore extends ObjectModel $sql->select('product_option.id_product_option, product_option.price_impact as option_impact_price'); $sql->leftJoin('product_option', 'product_option', '(product_option.id_product = p.id_product AND product_option.id_product_option = '.(int)$id_product_option.')'); } + + Hook::exec('actionAdminProductPriceSqlModifier', array( + 'id_product' => $id_product, + 'id_product_option' => $id_product_option, + 'id_shop' => $id_shop, + 'sql' => &$sql, + )); + $res = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); if (is_array($res) && count($res)) { @@ -3396,14 +3404,6 @@ class ProductCore extends ObjectModel } } - Hook::exec( - 'actionProductPriceModifier', - array( - 'price' => &$price, - 'type' => 'pre_tax' - ) - ); - // Tax $address->id_country = $id_country; $address->id_state = $id_state; @@ -3415,6 +3415,17 @@ class ProductCore extends ObjectModel $id_tax_rule_group = Product::getIdTaxRulesGroupByIdProduct((int)$id_product, $context); } + Hook::exec( + 'actionProductPriceModifier', + array( + 'price' => &$price, + 'type' => 'pre_tax', + 'id_product' => $id_product, + 'id_tax_rule_group' => &$id_tax_rule_group + + ) + ); + $tax_manager = TaxManagerFactory::getManager($address, $id_tax_rule_group); $product_tax_calculator = $tax_manager->getTaxCalculator(); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index b794ea2cd..bbed3db59 100644 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -632,6 +632,7 @@ class AdminOrdersControllerCore extends AdminController if (Context::getContext()->shop->getContext() != Shop::CONTEXT_SHOP && isset($this->toolbar_btn['new']) && Shop::isFeatureActive()) { unset($this->toolbar_btn['new']); } + return $res; } @@ -2217,6 +2218,11 @@ class AdminOrdersControllerCore extends AdminController } } + Hook::exec('actionAdminOrderValidateBefore', array( + 'cart' => $objCart, + 'errors' => &$this->errors + )); + if (!count($this->errors)) { // Set payment module details @@ -2298,6 +2304,11 @@ class AdminOrdersControllerCore extends AdminController } if ($objPaymentModule->currentOrder) { + Hook::exec('actionAdminOrderAddAfter', array( + 'cart' => $objCart, + 'order' => new Order((int) $objPaymentModule->currentOrder) + )); + Tools::redirectAdmin(self::$currentIndex.'&id_order='.$objPaymentModule->currentOrder.'&vieworder'.'&token='.$this->token.'&conf=3'); } } @@ -6732,6 +6743,14 @@ class AdminOrdersControllerCore extends AdminController } $this->sendChangedNotification($order); + + Hook::exec('actionHotelRoomBookingUpdateAfter', array( + 'id_order' => $id_order, + 'id_room' => $id_room, + 'date_from' => $new_date_from, + 'date_to' => $new_date_to + )); + die(json_encode(array( 'result' => $res, 'view' => $view, @@ -8977,6 +8996,11 @@ class AdminOrdersControllerCore extends AdminController { $idHotelBookingDetail = (int) Tools::getValue('id_hotel_booking_detail'); if (Validate::isLoadedObject($objHotelBookingDetail = new HotelBookingDetail($idHotelBookingDetail))) { + Hook::exec('actionAdminRoomStatusChangeAfter', array( + 'post_data' => Tools::getAllValues(), + 'errors' => &$this->errors + )); + $newStatus = (int) Tools::getValue('booking_order_status'); $statusRemark = Tools::getValue('status_remark'); // date choosen for the status change @@ -9034,6 +9058,15 @@ class AdminOrdersControllerCore extends AdminController } } + Hook::exec('actionRoomBookingStatusUpdateBefore', array( + 'id_hotel_booking_detail' => $objHotelBookingDetail->id, + 'id_order' => $objHotelBookingDetail->id_order, + 'id_room' => $objHotelBookingDetail->id_room, + 'new_status' => $newStatus, + 'status_date' => $statusDate, + 'errors' => &$this->errors + )); + if (empty($this->errors)) { $id_order = $objHotelBookingDetail->id_order; diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 58ec69bd6..28c922b64 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -151,6 +151,20 @@ class AdminProductsControllerCore extends AdminController } } + // Allow modules to override the labels of the product tabs + $tabNameOverrides = Hook::exec('actionAdminProductTabNameModifier', array('id_product' => (int) Tools::getValue('id_product')), null, true); + if (is_array($tabNameOverrides)) { + foreach ($tabNameOverrides as $moduleOverrides) { + if (is_array($moduleOverrides)) { + foreach ($moduleOverrides as $key => $newLabel) { + if (isset($this->available_tabs_lang[$key])) { + $this->available_tabs_lang[$key] = $newLabel; + } + } + } + } + } + if (Tools::getValue('productFilter_a!id_category_default') === '') { $this->context->cookie->id_category_room_types_filter = false; } diff --git a/modules/hotelreservationsystem/classes/HotelBookingDetail.php b/modules/hotelreservationsystem/classes/HotelBookingDetail.php index 055833d3c..da06f3240 100644 --- a/modules/hotelreservationsystem/classes/HotelBookingDetail.php +++ b/modules/hotelreservationsystem/classes/HotelBookingDetail.php @@ -838,6 +838,7 @@ class HotelBookingDetail extends ObjectModel $unavailableRoomTypes = array(); $avai_rooms = Db::getInstance()->executeS($sql); + if ($avai_rooms) { $availableRoomTypes = array( 'roomTypes' => array(), diff --git a/modules/hotelreservationsystem/classes/HotelRoomInformation.php b/modules/hotelreservationsystem/classes/HotelRoomInformation.php index 0dd39f3f0..2d695a71a 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomInformation.php +++ b/modules/hotelreservationsystem/classes/HotelRoomInformation.php @@ -153,6 +153,9 @@ class HotelRoomInformation extends ObjectModel 'status' => self::getRoomStatusTitle(HotelRoomInformation::STATUS_INACTIVE) ), ); + + Hook::exec('actionAdminRoomStatusModifier', array('status' => &$status)); + return $status; } @@ -166,6 +169,8 @@ class HotelRoomInformation extends ObjectModel HotelRoomInformation::STATUS_SEARCH_OCCUPANCY_UNSATISFIED => $moduleInstance->l('Occupancy exceeds room capacity', 'hotelreservationsystem'), ); + Hook::exec('actionAdminRoomStatusTitle', array('status' => &$status, 'id_status' => $idStatus)); + return isset($status[$idStatus]) ? $status[$idStatus] : ''; } diff --git a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php index c86d07afe..d068ec0b6 100644 --- a/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php +++ b/modules/hotelreservationsystem/classes/HotelRoomTypeFeaturePricing.php @@ -232,6 +232,12 @@ class HotelRoomTypeFeaturePricing extends ObjectModel $res &= $objFeaturePriceRestriction->deleteFeaturePriceRestrictionsById($existingFeaturePrices); } + Hook::exec('actionFeaturePriceRestrictionsSaveAfter', array( + 'id_feature_price' => $idFeaturePrice, + 'restrictions' => $restrictions, + 'existing_feature_prices' => $existingFeaturePrices + )); + return $res; } diff --git a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php index bcb41e8d3..409a7696e 100644 --- a/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php +++ b/modules/hotelreservationsystem/classes/RoomTypeServiceProduct.php @@ -454,4 +454,4 @@ class RoomTypeServiceProduct extends ObjectModel AND rsp.`id_product` = '.(int) $movedBlock['id_product'] )); } -} +} \ No newline at end of file diff --git a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php index b89b9fb0f..5930a7e37 100644 --- a/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php +++ b/modules/hotelreservationsystem/classes/ServiceProductCartDetail.php @@ -303,7 +303,7 @@ class ServiceProductCartDetail extends ObjectModel null, $product['htl_cart_booking_id'] ) / max($numDays, 1); - + $priceTaxExcl = Product::getServiceProductPrice( $objProduct->id, $product['id_product_option'], diff --git a/pdf/invoice.additinal-services-tab.tpl b/pdf/invoice.additinal-services-tab.tpl index 8cc48f80d..e7a848bb2 100644 --- a/pdf/invoice.additinal-services-tab.tpl +++ b/pdf/invoice.additinal-services-tab.tpl @@ -52,6 +52,7 @@ {/if} {$service['name']} + {hook h='displayInvoiceServiceProductNameAfter' id_service_product_order_detail=$service['id_service_product_order_detail']} {if isset($service['product_tax_label']) && $service['product_tax_label']}{$service['product_tax_label']}{else}{l s='No tax' pdf='true'}{/if} diff --git a/themes/hotel-reservation-theme/_partials/order-extra-services.tpl b/themes/hotel-reservation-theme/_partials/order-extra-services.tpl index f13ca1be1..8d4bfe473 100644 --- a/themes/hotel-reservation-theme/_partials/order-extra-services.tpl +++ b/themes/hotel-reservation-theme/_partials/order-extra-services.tpl @@ -68,6 +68,7 @@ {/capture} {include file='_partials/ui-tooltip.tpl' tooltip_content=$smarty.capture.htl_pcm_tooltip allow_html=true}
+ {hook h='displayOrderDetailServiceProductNameBlockAfter' product_order_detail=$additionalService}
diff --git a/themes/hotel-reservation-theme/_partials/order-room-detail.tpl b/themes/hotel-reservation-theme/_partials/order-room-detail.tpl index 1162c906d..ea6d4facd 100644 --- a/themes/hotel-reservation-theme/_partials/order-room-detail.tpl +++ b/themes/hotel-reservation-theme/_partials/order-room-detail.tpl @@ -90,6 +90,7 @@
{l s='Guests'}
{$rm_v.adults|string_format:'%02d'} {if $rm_v.adults > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if $rm_v.children}, {$rm_v.children|string_format:'%02d'} {if $rm_v.children > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if} + {hook h='displayOrderDetailOccupancyAfter' data=$data_v room=$rm_v id_order=$order->id}
diff --git a/themes/hotel-reservation-theme/_partials/room_type_list.tpl b/themes/hotel-reservation-theme/_partials/room_type_list.tpl index 6dd5d8152..0e547755d 100644 --- a/themes/hotel-reservation-theme/_partials/room_type_list.tpl +++ b/themes/hotel-reservation-theme/_partials/room_type_list.tpl @@ -178,6 +178,7 @@
{l s='No room available for this property!'}
+ {hook h='displayNoRoomAvailableBlockAfter'} {/if} {block name='displayRoomTypeListAfter'} diff --git a/themes/hotel-reservation-theme/cms.tpl b/themes/hotel-reservation-theme/cms.tpl index 5e656370c..12c497556 100644 --- a/themes/hotel-reservation-theme/cms.tpl +++ b/themes/hotel-reservation-theme/cms.tpl @@ -41,6 +41,7 @@
{$cms->content}
+ {hook h='displayCMSPageContentAfter' page=$cms} {elseif isset($cms_category)}

{$cms_category->name|escape:'html':'UTF-8'}

diff --git a/themes/hotel-reservation-theme/contact-form.tpl b/themes/hotel-reservation-theme/contact-form.tpl index ccb17211a..ae6e29ace 100644 --- a/themes/hotel-reservation-theme/contact-form.tpl +++ b/themes/hotel-reservation-theme/contact-form.tpl @@ -191,6 +191,7 @@
+ {hook h='displayContactFormSubmitButtonAfter'} {/block}
diff --git a/themes/hotel-reservation-theme/order-confirmation.tpl b/themes/hotel-reservation-theme/order-confirmation.tpl index 27364e1dd..9e68ecd77 100644 --- a/themes/hotel-reservation-theme/order-confirmation.tpl +++ b/themes/hotel-reservation-theme/order-confirmation.tpl @@ -95,6 +95,7 @@ {$data_v['name']}

+ {hook h='displayOrderConfirmationRoomTypeNameAfter' id_product=$data_v['id_product']} @@ -126,6 +127,7 @@
{l s='Guests'}
{$rm_v.adults|string_format:'%02d'} {if $rm_v.adults > 1}{l s='Adults'}{else}{l s='Adult'}{/if}{if $rm_v.children}, {$rm_v.children|string_format:'%02d'} {if $rm_v.children > 1}{l s='Children'}{else}{l s='Child'}{/if}{/if} + {hook h='displayOrderConfirmationOccupancyAfter' data=$data_v room=$rm_v}
diff --git a/themes/hotel-reservation-theme/order-opc-new-account.tpl b/themes/hotel-reservation-theme/order-opc-new-account.tpl index 323534547..30ee05ec7 100644 --- a/themes/hotel-reservation-theme/order-opc-new-account.tpl +++ b/themes/hotel-reservation-theme/order-opc-new-account.tpl @@ -419,6 +419,7 @@
+ {hook h='displayCustomerAccountFormBottom'} {/block} diff --git a/themes/hotel-reservation-theme/order-opc.tpl b/themes/hotel-reservation-theme/order-opc.tpl index 03bc35fd6..5cbb76425 100644 --- a/themes/hotel-reservation-theme/order-opc.tpl +++ b/themes/hotel-reservation-theme/order-opc.tpl @@ -177,6 +177,7 @@ {/if} {/block} + {hook h='displayCheckoutGuestDetailsAfter'} {* proceed only if no order restrict errors are there *} {if !$orderRestrictErr}