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

deprecated doActions of canvas and doActions of triggers.
This commit is contained in:
Laurent Destailleur 2015-12-17 14:01:22 +01:00
parent 9973315a07
commit ba3c8de785
10 changed files with 25 additions and 96 deletions

View File

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

View File

@ -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';

View File

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

View File

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

View File

@ -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';

View File

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

View File

@ -1,86 +0,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');
}
}
}
}*/
}

View File

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

View File

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

View File

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