diff --git a/dev/skeletons/skeleton_card.php b/dev/skeletons/skeleton_card.php index 7f0ff1fc7d4..03f70955527 100644 --- a/dev/skeletons/skeleton_card.php +++ b/dev/skeletons/skeleton_card.php @@ -88,7 +88,7 @@ $extrafields = new ExtraFields($db); ********************************************************************/ $parameters=array(); -$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); if (empty($reshook)) diff --git a/dev/skeletons/skeleton_list.php b/dev/skeletons/skeleton_list.php index dec170ae169..834e0b07e2f 100644 --- a/dev/skeletons/skeleton_list.php +++ b/dev/skeletons/skeleton_list.php @@ -124,7 +124,7 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab ********************************************************************/ $parameters=array(); -$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks +$reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; diff --git a/htdocs/adherents/canvas/actions_adherentcard_common.class.php b/htdocs/adherents/canvas/actions_adherentcard_common.class.php index 06574f7ae10..8d629175902 100644 --- a/htdocs/adherents/canvas/actions_adherentcard_common.class.php +++ b/htdocs/adherents/canvas/actions_adherentcard_common.class.php @@ -98,7 +98,8 @@ abstract class ActionsAdherentCardCommon } /** - * Load data control + * doActions of a canvas is not the doActions of the hook + * @deprecated Use the doActions of hooks instead of this. * * @param string $action Type of action * @param int $id Id of object diff --git a/htdocs/contact/canvas/actions_contactcard_common.class.php b/htdocs/contact/canvas/actions_contactcard_common.class.php index 7e43270a32c..3d6b792d99b 100644 --- a/htdocs/contact/canvas/actions_contactcard_common.class.php +++ b/htdocs/contact/canvas/actions_contactcard_common.class.php @@ -94,7 +94,8 @@ abstract class ActionsContactCardCommon } /** - * Load data control + * doActions of a canvas is not the doActions of the hook + * @deprecated Use the doActions of hooks instead of this. * * @param string $action Type of action * @param int $id Id of object diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index dc2734b28a1..ac7411b49c3 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -36,7 +36,9 @@ $langs->load("companies"); $langs->load("suppliers"); // Security check +$id = GETPOST('id','int'); $contactid = GETPOST('id','int'); +$ref = ''; // There is no ref for contacts if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'contact', $contactid,''); @@ -150,13 +152,20 @@ if (is_array($extrafields->attribute_label) && count($extrafields->attribute_lab } } +$object=new Contact($db); +if (($id > 0 || ! empty($ref)) && $action != 'add') +{ + $result=$object->fetch($id,$ref); + if ($result < 0) dol_print_error($db); +} + /* * Actions */ $parameters=array(); -$reshook=$hookmanager->executeHooks('doActions',$parameters); // Note that $action and $object may have been modified by some hooks +$reshook=$hookmanager->executeHooks('doActions',$parameters, $object, $action); // Note that $action and $object may have been modified by some hooks if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors'); include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php'; diff --git a/htdocs/core/class/canvas.class.php b/htdocs/core/class/canvas.class.php index a8bb07e6ec6..6851c124743 100644 --- a/htdocs/core/class/canvas.class.php +++ b/htdocs/core/class/canvas.class.php @@ -179,13 +179,14 @@ class Canvas } /** - * Shared method for canvas to execute actions + * Shared method for canvas to execute actions. + * @deprecated Use the doActions of hooks instead of this. + * This function is called if you add a doActions class inside your canvas. Try to not + * do that and add action code into a hook instead. * * @param string $action Action string * @param int $id Object id * @return mixed Return return code of doActions of canvas - * @deprecated This function is called if you add a doActions class inside your canvas. Try to not - * do that and add action code into a hook instead. * @see http://wiki.dolibarr.org/index.php/Canvas_development */ function doActions(&$action='view', $id=0) diff --git a/htdocs/resource/class/actions_resource.class.php b/htdocs/resource/class/actions_resource.class.php deleted file mode 100644 index f8f0b5412f9..00000000000 --- a/htdocs/resource/class/actions_resource.class.php +++ /dev/null @@ -1,86 +0,0 @@ - - * -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation; either version 3 of the License, or -* (at your option) any later version. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with this program. If not, see . -*/ - -/** - * \file resource/class/actions_resource.class.php - * \brief Place module actions - */ - -/** - * Actions class file for resources - * - * TODO Remove this class and replace a method into commonobject - */ -class ActionsResource -{ - - var $db; - var $error; - var $errors=array(); - - /** - * Constructor - * - * @param DoliDB $db Database handler - */ - function __construct($db) - { - $this->db = $db; - } - - /** - * doActions for resource module - * - * @param array $parameters parameters - * @param Object $object object - * @param string $action action - * @return void - */ - /* Why a hook action ? TODO Remove this class and replace a method into commonobject - function doActions($parameters, &$object, &$action) - { - global $langs,$user; - $langs->load('resource'); - - if (in_array('resource_card',explode(':',$parameters['context']))) - { - if($action == 'confirm_delete_resource' && !GETPOST('cancel')) - { - $res = $object->fetch(GETPOST('id')); - if($res) - { - - $result = $object->delete(GETPOST('id')); - - if ($result >= 0) - { - setEventMessage($langs->trans('RessourceSuccessfullyDeleted')); - Header("Location: list.php"); - exit; - } - else { - setEventMessage($object->error,'errors'); - } - } - else - { - setEventMessage($object->error,'errors'); - } - } - } - }*/ -} diff --git a/htdocs/societe/canvas/actions_card_common.class.php b/htdocs/societe/canvas/actions_card_common.class.php index 0dd71b42baa..782a7f070c4 100644 --- a/htdocs/societe/canvas/actions_card_common.class.php +++ b/htdocs/societe/canvas/actions_card_common.class.php @@ -89,7 +89,8 @@ abstract class ActionsCardCommon } /** - * Load data control + * doActions of a canvas is not the doActions of the hook + * @deprecated Use the doActions of hooks instead of this. * * @param int $action Action code * @return void diff --git a/htdocs/societe/canvas/company/actions_card_company.class.php b/htdocs/societe/canvas/company/actions_card_company.class.php index c7ed03080f6..19f9a2fbdb8 100644 --- a/htdocs/societe/canvas/company/actions_card_company.class.php +++ b/htdocs/societe/canvas/company/actions_card_company.class.php @@ -68,7 +68,8 @@ class ActionsCardCompany extends ActionsCardCommon /** - * Execute actions + * doActions of a canvas is not the doActions of the hook + * @deprecated Use the doActions of hooks instead of this. * * @param string $action Type of action * @param int $id Id of object diff --git a/htdocs/societe/canvas/individual/actions_card_individual.class.php b/htdocs/societe/canvas/individual/actions_card_individual.class.php index f38d0d034ef..78064004e37 100644 --- a/htdocs/societe/canvas/individual/actions_card_individual.class.php +++ b/htdocs/societe/canvas/individual/actions_card_individual.class.php @@ -69,6 +69,7 @@ class ActionsCardIndividual extends ActionsCardCommon /** * Execute actions + * @deprecated Use the doActions of hooks instead of this. * * @param string $action Action * @param int $id Id of object (may be empty for creation)