Fix: Preserve advance payment setting for duplicate rooms
Co-authored-by: Name <azharbhat.qlo098@webkul.in>
This commit is contained in:
@@ -937,6 +937,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
&& Product::duplicateCustomizationFields($id_product_old, $product->id)
|
||||
&& Product::duplicateTags($id_product_old, $product->id)
|
||||
&& Product::duplicateDownload($id_product_old, $product->id)
|
||||
&& HotelAdvancedPayment::duplicateAdvancePayment($id_product_old, $product->id)
|
||||
) {
|
||||
$obj_hotel_room_type = new HotelRoomType();
|
||||
$room_type_info = $obj_hotel_room_type->getRoomTypeInfoByIdProduct($id_product_old);
|
||||
|
||||
@@ -79,6 +79,31 @@ class HotelAdvancedPayment extends ObjectModel
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Duplicate the advance payment configuration of a room type for its duplicate
|
||||
*
|
||||
* @param int $id_product_old Id of the room type (product) being duplicated
|
||||
* @param int $id_product_new Id of the newly duplicated room type (product)
|
||||
* @return bool
|
||||
*/
|
||||
public static function duplicateAdvancePayment($id_product_old, $id_product_new)
|
||||
{
|
||||
$row = Db::getInstance()->getRow(
|
||||
'SELECT * FROM `'._DB_PREFIX_.'htl_advance_payment` WHERE `id_product` = '.(int)$id_product_old
|
||||
);
|
||||
|
||||
if (!$row) {
|
||||
return true;
|
||||
}
|
||||
|
||||
unset($row['id']);
|
||||
$row['id_product'] = (int)$id_product_new;
|
||||
$row['date_add'] = date('Y-m-d H:i:s');
|
||||
$row['date_upd'] = date('Y-m-d H:i:s');
|
||||
|
||||
return Db::getInstance()->insert('htl_advance_payment', $row);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the advance payment amount of the room type in the cart
|
||||
* @param [int] $idCart : cart id
|
||||
|
||||
Reference in New Issue
Block a user