Skip to content
Snippets Groups Projects
Commit ba3c8de7 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Update doc comment to make things cleaner to avoid confusion between old

deprecated doActions of canvas and doActions of triggers.
parent 9973315a
No related branches found
No related tags found
No related merge requests found
......@@ -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))
......
......@@ -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';
......
......@@ -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
......
......@@ -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
......
......@@ -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';
......
......@@ -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)
......
<?php
/* Copyright (C) 2013 Jean-François FERRY <jfefe@aternatik.fr>
*
* 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 <http://www.gnu.org/licenses/>.
*/
/**
* \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');
}
}
}
}*/
}
......@@ -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
......
......@@ -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
......
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment