Merge branch 'develop' into gli-2217
This commit is contained in:
@@ -85,6 +85,7 @@ class AdminCmsContentControllerCore extends AdminController
|
||||
|
||||
public function initContent()
|
||||
{
|
||||
$this->loadObject(true);
|
||||
$this->initTabModuleList();
|
||||
$this->renderPageHeaderToolbar();
|
||||
|
||||
@@ -151,8 +152,9 @@ class AdminCmsContentControllerCore extends AdminController
|
||||
|
||||
if (Tools::getValue('addcms') !== false) {
|
||||
$this->toolbar_title[] = $this->l('Add new');
|
||||
} elseif ($id_cms_page) {
|
||||
$cms_page = new CMS($id_cms_page);
|
||||
} elseif ($id_cms_page
|
||||
&& Validate::isLoadedObject($cms_page = new CMS($id_cms_page))
|
||||
) {
|
||||
$this->toolbar_title[] = sprintf($this->l('Edit: %s'), $cms_page->meta_title[$this->context->employee->id_lang]);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -170,6 +170,11 @@ class AdminCustomersControllerCore extends AdminController
|
||||
'type' => 'datetime',
|
||||
'search' => false,
|
||||
'havingFilter' => true
|
||||
),
|
||||
'deleted' => array(
|
||||
'title' => $this->l('Banned'),
|
||||
'type' => 'bool',
|
||||
'displayed' => false,
|
||||
)
|
||||
));
|
||||
|
||||
@@ -218,6 +223,12 @@ class AdminCustomersControllerCore extends AdminController
|
||||
}
|
||||
|
||||
parent::postProcess();
|
||||
// Added this to check if the filter for the banned(deleted) is used, since $this->delete = true will not display the deleted customers.
|
||||
$prefix = $this->getCookieFilterPrefix();
|
||||
$filters = $this->context->cookie->getFamily($prefix.$this->table.'Filter_');
|
||||
if (isset($filters[$prefix.$this->table.'Filter_deleted']) && $filters[$prefix.$this->table.'Filter_deleted'] == 1) {
|
||||
$this->deleted = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function initContent()
|
||||
@@ -753,6 +764,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
$helper->color = 'color2';
|
||||
$helper->title = $this->l('Banned Customers', null, null, false);
|
||||
$helper->subtitle = $this->l('All Time', null, null, false);
|
||||
$helper->href = $this->context->link->getAdminLink('AdminCustomers').'&customerFilter_deleted=1';
|
||||
$helper->source = $this->context->link->getAdminLink('AdminStats').'&ajax=1&action=getKpi&kpi=total_banned_customers';
|
||||
$helper->tooltip = $this->l('The total number of banned customers.', null, null, false);
|
||||
$kpis[] = $helper;
|
||||
@@ -962,7 +974,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
if (Validate::isLoadedObject($objCustomer = $this->loadObject())) {
|
||||
if ($this->delete_mode == 'real' && Order::getCustomerOrders($objCustomer->id, true)) {
|
||||
$objCustomer->email = 'anonymous'.'-'.$objCustomer->id.'@'.Tools::link_rewrite(Configuration::get('PS_SHOP_NAME')).'_anonymous.com';
|
||||
$objCustomer->deleted = 1;
|
||||
$objCustomer->deleted = Customer::STATUS_DELETED;
|
||||
if (!$objCustomer->update()) {
|
||||
$this->errors[] = Tools::displayError('Some error ocurred while deleting the Customer');
|
||||
return;
|
||||
@@ -1003,7 +1015,7 @@ class AdminCustomersControllerCore extends AdminController
|
||||
// check if customer has orders for email change else customer will be deleted
|
||||
if (Order::getCustomerOrders($objCustomer->id, true)) {
|
||||
$objCustomer->email = 'anonymous'.'-'.$objCustomer->id.'@'.Tools::getShopDomain();
|
||||
$objCustomer->deleted = 1;
|
||||
$objCustomer->deleted = Customer::STATUS_DELETED;
|
||||
if ($objCustomer->update()) {
|
||||
// unset the customer which is processed
|
||||
// not processed customers will be deleted with default process if no errors are there
|
||||
|
||||
@@ -452,10 +452,9 @@ class AdminFeaturesControllerCore extends AdminController
|
||||
$this->initToolbar();
|
||||
$this->initPageHeaderToolbar();
|
||||
if ($this->display == 'edit' || $this->display == 'add') {
|
||||
if (!$this->loadObject(true)) {
|
||||
return;
|
||||
if ($this->loadObject(true)) {
|
||||
$this->content .= $this->renderForm();
|
||||
}
|
||||
$this->content .= $this->renderForm();
|
||||
} elseif ($this->display == 'view') {
|
||||
// Some controllers use the view action without an object
|
||||
if ($this->className) {
|
||||
|
||||
@@ -208,7 +208,6 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
// show the list of the product according to the booking or service products
|
||||
$this->_where .= ' AND a.`booking_product` = 0';
|
||||
|
||||
$this->_use_found_rows = false;
|
||||
$this->_group = 'GROUP BY a.`id_product`';
|
||||
|
||||
$this->fields_list = array();
|
||||
@@ -1393,7 +1392,10 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
parent::postProcess();
|
||||
}
|
||||
|
||||
if ($this->display == 'edit' || $this->display == 'add') {
|
||||
if (in_array($this->display, array('add', 'edit'))
|
||||
&& $this->tabAccess[$this->display] == '1'
|
||||
&& $this->loadObject(true)
|
||||
) {
|
||||
$this->addJqueryUI(array(
|
||||
'ui.core',
|
||||
'ui.widget'
|
||||
@@ -2815,9 +2817,7 @@ class AdminNormalProductsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
// let's calculate this once for all
|
||||
if (!Validate::isLoadedObject($this->object) && Tools::getValue('id_product')) {
|
||||
$this->errors[] = 'Unable to load object';
|
||||
} else {
|
||||
if ($this->loadObject(true)) {
|
||||
$this->_displayDraftWarning($this->object->active);
|
||||
|
||||
// if there was an error while saving, we don't want to lose posted data
|
||||
|
||||
@@ -617,11 +617,23 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$payment_methods[] = $module->displayName;
|
||||
}
|
||||
}
|
||||
|
||||
// Set the order currency at first element of currencies
|
||||
if ($currencies = Currency::getCurrenciesByIdShop($objOrder->id_shop)) {
|
||||
foreach ($currencies as $key => $currency) {
|
||||
if ($currency['id_currency'] == $objOrder->id_currency) {
|
||||
unset($currencies[$key]);
|
||||
array_unshift($currencies, $currency);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->context->smarty->assign(
|
||||
array(
|
||||
'current_index' => self::$currentIndex,
|
||||
'order' => $objOrder,
|
||||
'currencies' => Currency::getCurrenciesByIdShop($objOrder->id_shop),
|
||||
'currencies' => $currencies,
|
||||
'payment_methods' => $payment_methods,
|
||||
'payment_types' => $this->getPaymentsTypes(),
|
||||
'invoices_collection' => $objOrder->getInvoicesCollection(),
|
||||
@@ -754,6 +766,33 @@ class AdminOrdersControllerCore extends AdminController
|
||||
die(Tools::jsonEncode($response));
|
||||
}
|
||||
|
||||
public function ajaxProcessInitRoomAllotmentCommentModal()
|
||||
{
|
||||
$response['hasError'] = 1;
|
||||
if (Validate::isLoadedObject($objBookingDetail = new HotelBookingDetail(Tools::getValue('id_hotel_booking')))) {
|
||||
if ($objBookingDetail->booking_type == HotelBookingDetail::ALLOTMENT_MANUAL) {
|
||||
// get booking information by order
|
||||
$this->context->smarty->assign('comment', $objBookingDetail->comment);
|
||||
|
||||
$title = $objBookingDetail->room_num.' - '.$objBookingDetail->room_type_name.' ('.
|
||||
Tools::displayDate($objBookingDetail->date_from).' - '.Tools::displayDate($objBookingDetail->date_to).')';
|
||||
$modal = array(
|
||||
'modal_id' => 'room-allotment-comment-modal',
|
||||
'modal_class' => 'modal-md order_detail_modal',
|
||||
'modal_title' => '<i class="icon icon-comment"></i>  '.$title,
|
||||
'modal_content' => $this->context->smarty->fetch('controllers/orders/modals/_room_allotment_comment.tpl'),
|
||||
'modal_actions' => array(),
|
||||
);
|
||||
|
||||
$this->context->smarty->assign($modal);
|
||||
$response['hasError'] = 0;
|
||||
$response['modalHtml'] = $this->context->smarty->fetch('modal.tpl');
|
||||
}
|
||||
}
|
||||
|
||||
die(Tools::jsonEncode($response));
|
||||
}
|
||||
|
||||
public function ajaxProcessInitRoomReallocationModal()
|
||||
{
|
||||
// set modal details
|
||||
@@ -980,7 +1019,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->addJS(_PS_JS_DIR_.'vendor/d3.v3.min.js');
|
||||
|
||||
if ($this->tabAccess['edit'] == 1 && $this->display == 'view') {
|
||||
$this->addJS(_PS_JS_DIR_.'admin/orders.js');
|
||||
if ($this->loadObject()) {
|
||||
$this->addJS(_PS_JS_DIR_.'admin/orders.js');
|
||||
}
|
||||
// add js for reallocation process
|
||||
$this->addJS(_PS_JS_DIR_.'admin/reallocation.js');
|
||||
// $this->addJS(_PS_JS_DIR_.'admin/orders-product-event.js');
|
||||
@@ -2845,6 +2886,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
$this->tpl_view_vars = array(
|
||||
'totalRefundedRooms' => $totalRefundedRooms,
|
||||
'orderOverBookings' => $orderOverBookings,
|
||||
// refund info
|
||||
'refund_allowed' => (int) $order->isReturnable(),
|
||||
'applicable_refund_policies' => $applicableRefundPolicies,
|
||||
'returns' => OrderReturn::getOrdersReturn($order->id_customer, $order->id),
|
||||
@@ -2937,9 +2979,9 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'customer' => $customer)
|
||||
),
|
||||
'orderDocuments' => $order->getDocuments(),
|
||||
'ROOM_STATUS_ALLOTED' => HotelBookingDetail::STATUS_ALLOTED,
|
||||
'ROOM_STATUS_CHECKED_IN' => HotelBookingDetail::STATUS_CHECKED_IN,
|
||||
'ROOM_STATUS_CHECKED_OUT' => HotelBookingDetail::STATUS_CHECKED_OUT,
|
||||
'ALLOTMENT_MANUAL' => HotelBookingDetail::ALLOTMENT_MANUAL,
|
||||
);
|
||||
|
||||
return parent::renderView();
|
||||
@@ -4809,6 +4851,7 @@ class AdminOrdersControllerCore extends AdminController
|
||||
'tax_excl' => $totalRoomPriceAfterTE,
|
||||
'tax_incl' => $totalRoomPriceAfterTI,
|
||||
);
|
||||
|
||||
if ($update_htl_tables = $obj_booking_detail->UpdateHotelCartHotelOrderOnOrderEdit(
|
||||
$id_order,
|
||||
$id_room,
|
||||
@@ -6912,4 +6955,4 @@ class AdminOrdersControllerCore extends AdminController
|
||||
|
||||
$this->ajaxDie(json_encode($result));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1486,6 +1486,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
|
||||
if (in_array($this->display, array('add', 'edit'))
|
||||
&& $this->tabAccess[$this->display] == '1'
|
||||
&& $this->loadObject(true)
|
||||
) {
|
||||
$this->addJqueryUI(array(
|
||||
'ui.core',
|
||||
@@ -2862,9 +2863,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
// let's calculate this once for all
|
||||
if (!Validate::isLoadedObject($this->object) && Tools::getValue('id_product')) {
|
||||
$this->errors[] = 'Unable to load object';
|
||||
} else {
|
||||
if ($this->loadObject(true)) {
|
||||
$this->_displayDraftWarning($this->object->active);
|
||||
|
||||
// if there was an error while saving, we don't want to lose posted data
|
||||
|
||||
@@ -283,11 +283,9 @@ class AdminRequestSqlControllerCore extends AdminController
|
||||
$this->initToolbar();
|
||||
$this->initPageHeaderToolbar();
|
||||
if ($this->display == 'edit' || $this->display == 'add') {
|
||||
if (!$this->loadObject(true)) {
|
||||
return;
|
||||
if ($this->loadObject(true)) {
|
||||
$this->content .= $this->renderForm();
|
||||
}
|
||||
|
||||
$this->content .= $this->renderForm();
|
||||
} elseif ($this->display == 'view') {
|
||||
// Some controllers use the view action without an object
|
||||
if ($this->className) {
|
||||
|
||||
@@ -186,8 +186,8 @@ class AdminThemesControllerCore extends AdminController
|
||||
'thumb' => $this->context->link->getMediaLink(_PS_IMG_.Configuration::get('PS_FAVICON').(Tools::getValue('conf') ? sprintf('?%04d', rand(0, 9999)) : ''))
|
||||
),
|
||||
'PS_STORES_ICON' => array(
|
||||
'title' => $this->l('Store icon'),
|
||||
'hint' => $this->l('Will appear on the store locator (inside Google Maps).').'<br />'.$this->l('Suggested size: 30x30, transparent GIF.'),
|
||||
'title' => $this->l('Map icon'),
|
||||
'hint' => $this->l('This icon will be displayed at hotel locations on Google Maps.').'<br />'.$this->l('Suggested size: 30x30, transparent GIF.'),
|
||||
'type' => 'file',
|
||||
'name' => 'PS_STORES_ICON',
|
||||
'tab' => 'icons',
|
||||
|
||||
@@ -954,7 +954,7 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
*
|
||||
* @throws PrestaShopException
|
||||
*/
|
||||
protected function findAndWriteTranslationsIntoFile($file_name, $files, $theme_name, $module_name, $dir = false)
|
||||
protected function findAndWriteTranslationsIntoFile($file_name, $files, $theme_name, $module_name, $dir = false, $copyExistingTranslations = false)
|
||||
{
|
||||
// These static vars allow to use file to write just one time.
|
||||
static $cache_file = array();
|
||||
@@ -964,7 +964,12 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
|
||||
// Set file_name in static var, this allow to open and wright the file just one time
|
||||
if (!isset($cache_file[$theme_name.'-'.$file_name])) {
|
||||
require $file_name;
|
||||
if (file_exists($file_name)) {
|
||||
require $file_name;
|
||||
} else {
|
||||
$_MODULE = array();
|
||||
}
|
||||
|
||||
$module_existing_translations = $_MODULE;
|
||||
$str_write = '';
|
||||
$cache_file[$theme_name.'-'.$file_name] = true;
|
||||
@@ -1010,25 +1015,26 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
}
|
||||
|
||||
if (array_key_exists($post_key, $_POST) && !in_array($pattern, $array_check_duplicate)) {
|
||||
$array_check_duplicate[] = $pattern;
|
||||
if ($_POST[$post_key] == '') {
|
||||
continue;
|
||||
}
|
||||
$array_check_duplicate[] = $pattern;
|
||||
$str_write .= '$_MODULE['.$pattern.'] = \''.pSQL(str_replace(array("\r\n", "\r", "\n"), ' ', $_POST[$post_key])).'\';'."\n";
|
||||
$this->total_expression++;
|
||||
}
|
||||
}
|
||||
foreach ($module_existing_translations as $key => $value) {
|
||||
if (!in_array('\''.$key.'\'', $array_check_duplicate)) {
|
||||
$str_write .= '$_MODULE[\''.$key.'\'] = \''.pSQL(str_replace(array("\r\n", "\r", "\n"), ' ', $value)).'\';'."\n";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($cache_file[$theme_name.'-'.$file_name]) && $str_write != "<?php\n\nglobal \$_MODULE;\n\$_MODULE = array();\n") {
|
||||
if ($copyExistingTranslations) {
|
||||
foreach ($module_existing_translations as $key => $value) {
|
||||
if (!in_array('\''.$key.'\'', $array_check_duplicate)) {
|
||||
$str_write .= '$_MODULE[\''.$key.'\'] = \''.pSQL(str_replace(array("\r\n", "\r", "\n"), ' ', $value)).'\';'."\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($cache_file[$theme_name.'-'.$file_name])) {
|
||||
file_put_contents($file_name, $str_write);
|
||||
}
|
||||
}
|
||||
@@ -1056,6 +1062,8 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
unset($files[$key]);
|
||||
} elseif ($type_clear === 'directory' && (!is_dir($path.$file) || in_array($file, $arr_exclude))) {
|
||||
unset($files[$key]);
|
||||
} else if ($file == 'index.php') {
|
||||
unset($files[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1468,8 +1476,15 @@ class AdminTranslationsControllerCore extends AdminController
|
||||
$arr_files = $this->getAllModuleFiles($modules, null, $this->lang_selected->iso_code, true);
|
||||
|
||||
// Find and write all translation modules files
|
||||
foreach ($arr_files as $value) {
|
||||
$this->findAndWriteTranslationsIntoFile($value['file_name'], $value['files'], $value['theme'], $value['module'], $value['dir']);
|
||||
foreach ($arr_files as $key => $value) {
|
||||
$copyExistingTranslations = false;
|
||||
if (!isset($arr_files[$key + 1])
|
||||
|| ($arr_files[$key + 1]['module'] != $value['module'])
|
||||
) {
|
||||
$copyExistingTranslations = true;
|
||||
}
|
||||
|
||||
$this->findAndWriteTranslationsIntoFile($value['file_name'], $value['files'], $value['theme'], $value['module'], $value['dir'], $copyExistingTranslations);
|
||||
}
|
||||
|
||||
// Clear modules cache
|
||||
|
||||
Reference in New Issue
Block a user