mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Clean code
This commit is contained in:
parent
f94e316e61
commit
bfc8a76567
|
|
@ -21,7 +21,6 @@
|
|||
* \ingroup datapolicy
|
||||
* \brief Example hook overload.
|
||||
*/
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/commonhookactions.class.php';
|
||||
|
||||
/**
|
||||
|
|
@ -76,8 +75,8 @@ class ActionsDatapolicy extends CommonHookActions
|
|||
*/
|
||||
public function getNomUrl($parameters, &$object, &$action)
|
||||
{
|
||||
global $db, $langs, $conf, $user;
|
||||
$this->resprints = '';
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -92,7 +91,8 @@ class ActionsDatapolicy extends CommonHookActions
|
|||
*/
|
||||
public function doActions($parameters, &$object, &$action, $hookmanager)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $user, $langs;
|
||||
|
||||
$langs->load('datapolicy@datapolicy');
|
||||
$error = 0; // Error counter
|
||||
|
||||
|
|
@ -147,7 +147,6 @@ class ActionsDatapolicy extends CommonHookActions
|
|||
DataPolicy::sendMailDataPolicyCompany($object);
|
||||
}
|
||||
|
||||
|
||||
if (!$error) {
|
||||
$this->results = array('myreturn' => 999);
|
||||
$this->resprints = 'A text to show';
|
||||
|
|
@ -169,8 +168,6 @@ class ActionsDatapolicy extends CommonHookActions
|
|||
*/
|
||||
public function doMassActions($parameters, &$object, &$action, $hookmanager)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
|
||||
$error = 0; // Error counter
|
||||
|
||||
/* print_r($parameters); print_r($object); echo "action: " . $action; */
|
||||
|
|
@ -202,7 +199,7 @@ class ActionsDatapolicy extends CommonHookActions
|
|||
*/
|
||||
public function addMoreMassActions($parameters, &$object, &$action, $hookmanager)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $langs;
|
||||
|
||||
$error = 0; // Error counter
|
||||
|
||||
|
|
@ -219,34 +216,6 @@ class ActionsDatapolicy extends CommonHookActions
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute action
|
||||
*
|
||||
* @param array $parameters Array of parameters
|
||||
* @param Object $object Object output on PDF
|
||||
* @param string $action 'add', 'update', 'view'
|
||||
* @return int <0 if KO,
|
||||
* =0 if OK but we want to process standard actions too,
|
||||
* >0 if OK and we want to replace standard actions.
|
||||
*/
|
||||
public function beforePDFCreation($parameters, &$object, &$action)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $hookmanager;
|
||||
|
||||
$outputlangs = $langs;
|
||||
|
||||
$ret = 0;
|
||||
$deltemp = array();
|
||||
dol_syslog(get_class($this).'::executeHooks action='.$action);
|
||||
|
||||
/* print_r($parameters); print_r($object); echo "action: " . $action; */
|
||||
if (in_array($parameters['currentcontext'], array('somecontext1', 'somecontext2'))) { // do something only for the context 'somecontext1' or 'somecontext2'
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* addMoreActionsButtons
|
||||
|
|
@ -259,7 +228,7 @@ class ActionsDatapolicy extends CommonHookActions
|
|||
*/
|
||||
public function addMoreActionsButtons($parameters, &$object, &$action, $hookmanager)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $conf, $langs;
|
||||
$langs->load('datapolicy@datapolicy');
|
||||
|
||||
if (!empty($conf->global->DATAPOLICY_ENABLE_EMAILS)) {
|
||||
|
|
@ -311,7 +280,7 @@ class ActionsDatapolicy extends CommonHookActions
|
|||
*/
|
||||
public function printCommonFooter($parameters, &$object, &$action, $hookmanager)
|
||||
{
|
||||
global $conf, $user, $langs;
|
||||
global $langs;
|
||||
|
||||
$jsscript = '';
|
||||
if ($parameters['currentcontext'] == 'thirdpartycard') {
|
||||
|
|
|
|||
|
|
@ -372,6 +372,8 @@ class DataPolicy
|
|||
// Send mail
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/CMailFile.class.php';
|
||||
$mailfile = new CMailFile($subject, $sendto, $from, $message, $filepath, $mimetype, $filename, $sendtocc, $sendtobcc, $deliveryreceipt, -1);
|
||||
|
||||
$resultmasssend = '';
|
||||
if ($mailfile->error) {
|
||||
$resultmasssend .= '<div class="error">'.$mailfile->error.'</div>';
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user