Fixed: The noticies on the Admin controllers when the identifier provided manually by editing the url does not exists in the database

This commit is contained in:
vishalsingh.qlo325
2024-05-07 13:07:36 +05:30
parent 8dcfc9e892
commit 646f45c783
8 changed files with 27 additions and 16 deletions

View File

@@ -1804,7 +1804,7 @@ class OrderCore extends ObjectModel
SELECT opd.`amount` as `real_paid_amount`, opd.*, op.*
FROM `'._DB_PREFIX_.'order_payment_detail` opd
INNER JOIN `'._DB_PREFIX_.'order_payment` op ON (opd.`id_order_payment` = op.`id_order_payment`)
WHERE `id_order` = '.$this->id
WHERE `id_order` = '.(int) $this->id
);
}

View File

@@ -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 {

View File

@@ -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) {

View File

@@ -398,6 +398,12 @@ class AdminNormalProductsControllerCore extends AdminController
$bo_theme = 'default';
}
Media::addJsDef(
array(
'tb_pathToImage' => '../img/loadingAnimation.gif'
)
);
$this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.iframe-transport.js');
$this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload.js');
$this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload-process.js');

View File

@@ -482,8 +482,7 @@ class AdminOrdersControllerCore extends AdminController
{
if ($this->display == 'view') {
/** @var Order $order */
$order = $this->loadObject();
$order = new Order(Tools::getValue($this->identifier));
// hotel link in header
if ($idHotel = HotelBookingDetail::getIdHotelByIdOrder($order->id)) {
$this->toolbar_btn['hotel'] = array(
@@ -997,7 +996,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(true)) {
$this->addJS(_PS_JS_DIR_.'admin/orders.js');
}
// $this->addJS(_PS_JS_DIR_.'admin/orders-product-event.js');
// $this->addJS(_PS_JS_DIR_.'admin/orders-room-event.js');
$this->addJS(_PS_JS_DIR_.'tools.js');
@@ -2477,11 +2478,10 @@ class AdminOrdersControllerCore extends AdminController
{
$order = new Order(Tools::getValue('id_order'));
if (!Validate::isLoadedObject($order)) {
$this->errors[] = Tools::displayError('The order cannot be found within your database.');
return false;
}
$this->content .= $this->renderKpis();
$customer = new Customer($order->id_customer);
$carrier = new Carrier($order->id_carrier);
$products = $this->getProducts($order);

View File

@@ -468,6 +468,12 @@ class AdminProductsControllerCore extends AdminController
$bo_theme = 'default';
}
Media::addJsDef(
array(
'tb_pathToImage' => '../img/loadingAnimation.gif'
)
);
$this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.iframe-transport.js');
$this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload.js');
$this->addJs(__PS_BASE_URI__.$this->admin_webpath.'/themes/'.$bo_theme.'/js/jquery.fileupload-process.js');

View File

@@ -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) {

View File

@@ -135,7 +135,7 @@ class AdminOrderRefundRequestsController extends ModuleAdminController
public function renderView()
{
if (!($objOrderReturn = $this->loadObject(true))) {
if (!($objOrderReturn = $this->loadObject())) {
return;
}
$refundStatuses = OrderReturnStateCore::getOrderReturnStates($this->context->language->id);