Debug module datapolicy
This commit is contained in:
parent
231725e351
commit
89e1cdff61
@ -187,7 +187,7 @@ class modDataPolicy extends DolibarrModules {
|
|||||||
// Cronjobs (List of cron jobs entries to add when module is enabled)
|
// Cronjobs (List of cron jobs entries to add when module is enabled)
|
||||||
// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
|
// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
|
||||||
$this->cronjobs = array(
|
$this->cronjobs = array(
|
||||||
0 => array('label' => 'DATAPOLICY Cron', 'jobtype' => 'method', 'class' => '/datapolicy/class/datapolicyCron.class.php', 'objectname' => 'DataPolicyCron', 'method' => 'exec', 'parameters' => '', 'comment' => 'Clean data', 'frequency' => 1, 'unitfrequency' => 86400, 'status' => 1, 'test' => '$conf->datapolicy->enabled'),
|
0 => array('label' => 'DATAPOLICYJob', 'jobtype' => 'method', 'class' => 'datapolicy/class/datapolicycron.class.php', 'objectname' => 'DataPolicyCron', 'method' => 'cleanDataForDataPolicy', 'parameters' => '', 'comment' => 'Clean data', 'frequency' => 1, 'unitfrequency' => 86400, 'status' => 1, 'test' => '$conf->datapolicy->enabled'),
|
||||||
//1 => array('label' => 'DATAPOLICY Mailing', 'jobtype' => 'method', 'class' => '/datapolicy/class/datapolicyCron.class.php', 'objectname' => 'RgpdCron', 'method' => 'sendMailing', 'parameters' => '', 'comment' => 'Comment', 'frequency' => 1, 'unitfrequency' => 86400, 'status' => 0, 'test' => true)
|
//1 => array('label' => 'DATAPOLICY Mailing', 'jobtype' => 'method', 'class' => '/datapolicy/class/datapolicyCron.class.php', 'objectname' => 'RgpdCron', 'method' => 'sendMailing', 'parameters' => '', 'comment' => 'Comment', 'frequency' => 1, 'unitfrequency' => 86400, 'status' => 0, 'test' => true)
|
||||||
);
|
);
|
||||||
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true),
|
// Example: $this->cronjobs=array(0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>true),
|
||||||
|
|||||||
@ -30,6 +30,16 @@ include_once DOL_DOCUMENT_ROOT . '/adherents/class/adherent.class.php';
|
|||||||
*/
|
*/
|
||||||
class DataPolicy
|
class DataPolicy
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
public function __construct($db)
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getAllContactNotInformed
|
* getAllContactNotInformed
|
||||||
*
|
*
|
||||||
@ -200,7 +210,6 @@ class DataPolicy
|
|||||||
} else {
|
} else {
|
||||||
$result4 = $mailfile->sendfile();
|
$result4 = $mailfile->sendfile();
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
|
|
||||||
$resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "<br>";
|
$resultmasssend .= $langs->trans("MailSent") . ': ' . $sendto . "<br>";
|
||||||
$contact->array_options['options_datapolicy_send'] = date('Y-m-d', time());
|
$contact->array_options['options_datapolicy_send'] = date('Y-m-d', time());
|
||||||
$contact->update($contact->id);
|
$contact->update($contact->id);
|
||||||
@ -301,6 +310,10 @@ class DataPolicy
|
|||||||
|
|
||||||
$sendto = $adherent->email;
|
$sendto = $adherent->email;
|
||||||
|
|
||||||
|
// TODO Use a dolibarr email template
|
||||||
|
$s = 'TXTLINKDATAPOLICIESSUBJECT_' . $l;
|
||||||
|
$ma = 'TXTLINKDATAPOLICIESMESSAGE_' . $l;
|
||||||
|
|
||||||
$code= md5($adherent->email);
|
$code= md5($adherent->email);
|
||||||
if (!empty($adherent->default_lang)) {
|
if (!empty($adherent->default_lang)) {
|
||||||
$l = $adherent->default_lang;
|
$l = $adherent->default_lang;
|
||||||
|
|||||||
@ -27,12 +27,24 @@
|
|||||||
*/
|
*/
|
||||||
class DataPolicyCron
|
class DataPolicyCron
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
public function __construct($db)
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function exec
|
* Function exec
|
||||||
|
* CAN BE A CRON TASK
|
||||||
*
|
*
|
||||||
* @return boolean
|
* @return int 0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
|
||||||
*/
|
*/
|
||||||
public function exec()
|
public function cleanDataForDataPolicy()
|
||||||
{
|
{
|
||||||
global $conf, $db, $langs, $user;
|
global $conf, $db, $langs, $user;
|
||||||
|
|
||||||
@ -479,14 +491,10 @@ class DataPolicyCron
|
|||||||
$db->query($sql);
|
$db->query($sql);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (DOL_VERSION < 8) {
|
if ($object->element == 'adherent') {
|
||||||
$ret = $object->delete($obj->rowid, $user);
|
$ret = $object->delete($obj->rowid, $user);
|
||||||
} else {
|
} else {
|
||||||
if ($object->element == 'adherent') {
|
$ret = $object->delete($user);
|
||||||
$ret = $object->delete($obj->rowid);
|
|
||||||
} else {
|
|
||||||
$ret = $object->delete();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -495,7 +503,8 @@ class DataPolicyCron
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -81,3 +81,4 @@ JobDisabled=Job disabled
|
|||||||
MakeLocalDatabaseDumpShort=Local database backup
|
MakeLocalDatabaseDumpShort=Local database backup
|
||||||
MakeLocalDatabaseDump=Create a local database dump. Parameters are: compression ('gz' or 'bz' or 'none'), backup type ('mysql', 'pgsql', 'auto'), 1, 'auto' or filename to build, number of backup files to keep
|
MakeLocalDatabaseDump=Create a local database dump. Parameters are: compression ('gz' or 'bz' or 'none'), backup type ('mysql', 'pgsql', 'auto'), 1, 'auto' or filename to build, number of backup files to keep
|
||||||
WarningCronDelayed=Attention, for performance purpose, whatever is next date of execution of enabled jobs, your jobs may be delayed to a maximum of %s hours, before being run.
|
WarningCronDelayed=Attention, for performance purpose, whatever is next date of execution of enabled jobs, your jobs may be delayed to a maximum of %s hours, before being run.
|
||||||
|
DATAPOLICYJob=Data cleaner and anonymizer
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user