[*] PROJECT : New Module API (part 1)

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9790 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
fSerny
2011-11-02 10:49:01 +00:00
parent 953cb8b872
commit 0ba4fe9c7e
53 changed files with 640 additions and 339 deletions
@@ -517,7 +517,7 @@ class AdminCustomersControllerCore extends AdminController
'messages' => $messages,
// Display hook specified to this page : AdminCustomers
'hook' => Module::hookExec('adminCustomers', array('id_customer' => $customer->id)),
'hook' => Hook::exec('adminCustomers', array('id_customer' => $customer->id)),
// Groups
'groups' => $groups,
+1 -1
View File
@@ -554,7 +554,7 @@ class AdminHomeControllerCore extends AdminController
$tpl_vars['last_orders'] =$this->getLastOrders();
$tpl_vars['tips_optimization'] = $this->_displayOptimizationTips();
$HOOK_BACKOFFICEHOME = Module::hookExec('backOfficeHome');
$HOOK_BACKOFFICEHOME = Hook::exec('backOfficeHome');
$tpl_vars['HOOK_BACKOFFICEHOME'] = $HOOK_BACKOFFICEHOME;
$smarty->assign($tpl_vars);
+1 -1
View File
@@ -206,7 +206,7 @@ class AdminMetaControllerCore extends AdminController
else
$_POST['url_rewrite_'.$lang['id_lang']] = Tools::getValue('url_rewrite_1');
}
Module::hookExec('afterSaveAdminMeta');
Hook::exec('afterSaveAdminMeta');
}
return parent::postProcess();
+5 -5
View File
@@ -364,14 +364,14 @@ class AdminOrdersControllerCore extends AdminController
$updProduct['stock_quantity'] = (int)($newProductQty);
$product['stock_quantity'] = $updProduct['stock_quantity'];
}
Hook::updateQuantity($product, $order);
Hook::exec('updateQuantity', array('product' => $product, 'order' => $order));
}
}
// Delete product
if (!$order->deleteProduct($order, $orderDetail, $qtyCancelProduct))
$this->_errors[] = Tools::displayError('An error occurred during deletion of the product.').' <span class="bold">'.$orderDetail->product_name.'</span>';
Module::hookExec('cancelProduct', array('order' => $order, 'id_order_detail' => $id_order_detail));
Hook::exec('cancelProduct', array('order' => $order, 'id_order_detail' => $id_order_detail));
}
if (!sizeof($this->_errors) AND $customizationList)
foreach ($customizationList AS $id_customization => $id_order_detail)
@@ -397,7 +397,7 @@ class AdminOrdersControllerCore extends AdminController
$this->_errors[] = Tools::displayError('Cannot generate credit slip');
else
{
Module::hookExec('orderSlip', array('order' => $order, 'productList' => $full_product_list, 'qtyList' => $full_quantity_list));
Hook::exec('orderSlip', array('order' => $order, 'productList' => $full_product_list, 'qtyList' => $full_quantity_list));
@Mail::Send((int)$order->id_lang, 'credit_slip', Mail::l('New credit slip regarding your order', $order->id_lang),
$params, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, NULL, NULL,
_PS_MAIL_DIR_, true);
@@ -547,8 +547,8 @@ class AdminOrdersControllerCore extends AdminController
// Assign Hook
$this->context->smarty->assign(array(
'HOOK_INVOICE' => Module::hookExec('invoice', array('id_order' => $order->id)),
'HOOK_ADMIN_ORDER' => Module::hookExec('adminOrder', array('id_order' => $order->id))
'HOOK_INVOICE' => Hook::exec('invoice', array('id_order' => $order->id)),
'HOOK_ADMIN_ORDER' => Hook::exec('adminOrder', array('id_order' => $order->id))
));
}
public function ajaxProcessSearchCustomers()
@@ -328,7 +328,7 @@ class AdminProductsController extends AdminController
$this->_errors[] = Tools::displayError('An error occurred while copying images.');
else
{
Hook::addProduct($product);
Hook::exec('addProduct', array('product' => $product));
Search::indexation(false, $product->id);
Tools::redirectAdmin(self::$currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=19&token='.($token ? $token : $this->token));
}
@@ -561,7 +561,7 @@ class AdminProductsController extends AdminController
if (!$product->addStockMvt(Tools::getValue('attribute_mvt_quantity'), $id_reason, $id_product_attribute, null, $this->context->employee->id))
$this->_errors[] = Tools::displayError('An error occurred while updating qty.');
}
Hook::updateProductAttribute((int)$id_product_attribute);
Hook::exec('updateProductAttribute', array('id_product_attribute' => (int)$id_product_attribute));
$this->updateDownloadProduct($product, 1, $id_product_attribute);
}
else
@@ -1081,7 +1081,7 @@ if (false)
}
@unlink($tmpName);
Module::hookExec('watermark', array('id_image' => $id_image, 'id_product' => $id_product));
Hook::exec('watermark', array('id_image' => $id_image, 'id_product' => $id_product));
}
}
@@ -1195,7 +1195,7 @@ if (false)
else if ($id_image = $this->addProductImage($object, Tools::getValue('resizer')))
{
self::$currentIndex .= '&image_updated='.(int)Tools::getValue('id_image');
Hook::updateProduct($object);
Hook::exec('updateProduct', array('product' => $object));
Search::indexation(false, $object->id);
if (Tools::getValue('resizer') == 'man' && isset($id_image) && is_int($id_image) && $id_image)
Tools::redirectAdmin(self::$currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&edit='.strval(Tools::getValue('productCreated')).'&id_image='.$id_image.'&imageresize&toconf=4&submitAddAndStay='.((Tools::isSubmit('submitAdd'.$this->table.'AndStay') || Tools::getValue('productCreated') == 'on') ? 'on' : 'off').'&token='.(($token ? $token : $this->token)));
@@ -1253,7 +1253,7 @@ if (false)
$this->_errors[] = Tools::displayError('An error occurred while adding tags.');
else if ($id_image = $this->addProductImage($object))
{
Hook::addProduct($object);
Hook::exec('addProduct', array('product' => $object));
Search::indexation(false, $object->id);
// Save and preview