diff --git a/htdocs/datapolicy/class/actions_datapolicy.class.php b/htdocs/datapolicy/class/actions_datapolicy.class.php index a99613097c9..e15867ae590 100644 --- a/htdocs/datapolicy/class/actions_datapolicy.class.php +++ b/htdocs/datapolicy/class/actions_datapolicy.class.php @@ -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') { diff --git a/htdocs/datapolicy/class/datapolicy.class.php b/htdocs/datapolicy/class/datapolicy.class.php index 92580fbb785..8f02b9bb42a 100644 --- a/htdocs/datapolicy/class/datapolicy.class.php +++ b/htdocs/datapolicy/class/datapolicy.class.php @@ -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 .= '
'.$mailfile->error.'
'; } else {