43 public $errors = array();
48 public $results = array();
75 public function getNomUrl($parameters, &$object, &$action)
77 global $db, $langs, $conf, $user;
78 $this->resprints =
'';
91 public function doActions($parameters, &$object, &$action, $hookmanager)
93 global $conf, $user, $langs;
94 $langs->load(
'datapolicy@datapolicy');
97 if (
GETPOST(
'socid') && $parameters[
'currentcontext'] ==
'thirdpartycard') {
98 $object->fetch(
GETPOST(
'socid'));
102 if ($parameters[
'currentcontext'] ==
'thirdpartycard' && $action ==
'anonymiser' && (in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8)) {
104 if ($object->isObjectUsed(
GETPOST(
'socid'))) {
105 $object->name = $langs->trans(
'ANONYME');
106 $object->name_bis =
'';
107 $object->name_alias =
'';
108 $object->address =
'';
116 $object->country =
'';
117 $object->state_id =
'';
119 $object->country_id =
'';
120 $object->note_private = $object->note_private.
'<br/>'.$langs->trans(
'ANONYMISER_AT',
dol_print_date(time()));
122 if ($object->update($object->id, $user, 0)) {
124 $sql =
"DELETE FROM ".MAIN_DB_PREFIX.
"socpeople WHERE fk_soc = ".$object->id;
125 $this->
db->query($sql);
128 header(
'Location:'.
$_SERVER[
"PHP_SELF"].
"?socid=".$object->id);
131 } elseif ($parameters[
'currentcontext'] ==
'thirdpartycard' && $action ==
'datapolicy_portabilite') {
132 header(
'Content-Type: application/csv');
133 header(
'Content-Disposition: attachment; filename=datapolicy_portabilite.csv');
134 header(
'Pragma: no-cache');
135 $object->fetch(
GETPOST(
'socid'));
136 echo
'Name;Fistname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
137 echo $object->name.
';';
142 echo $object->address.
';';
143 echo $object->zip.
';';
144 echo $object->town.
';';
145 echo $object->state.
';';
146 echo $object->country.
';';
147 echo $object->email.
';';
148 echo $object->phone.
';';
151 echo $object->skype.
';';
154 } elseif ($parameters[
'currentcontext'] ==
'membercard' && $action ==
'datapolicy_portabilite') {
155 header(
'Content-Type: application/csv');
156 header(
'Content-Disposition: attachment; filename=datapolicy_portabilite.csv');
157 header(
'Pragma: no-cache');
158 $soc = $object->fetch_thirdparty();
160 echo
'Name;Fistname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
161 echo $object->lastname.
';';
162 echo $object->firstname.
';';
163 echo $object->getCivilityLabel().
';';
164 echo ($soc != -1 ? $object->thirdparty->name :
'').
';';
166 echo $object->address.
';';
167 echo $object->zip.
';';
168 echo $object->town.
';';
169 echo $object->state.
';';
170 echo $object->country.
';';
171 echo $object->email.
';';
172 echo $object->phone.
';';
173 echo $object->phone_perso.
';';
174 echo $object->phone_mobile.
';';
175 echo $object->skype.
';';
178 } elseif ($parameters[
'currentcontext'] ==
'contactcard' && $action ==
'datapolicy_portabilite') {
180 header(
'Content-Type: application/csv');
181 header(
'Content-Disposition: attachment; filename=datapolicy_portabilite.csv');
182 header(
'Pragma: no-cache');
183 $soc = $object->fetch_thirdparty();
184 echo
'Name;Fistname;Civility;Thirdparty;Function;Address;ZipCode;City;Department;Country;Email;Pro Phone;Perso Phone;Mobile Phone;Instant Mail;Birthday;'.PHP_EOL;
185 echo $object->lastname.
';';
186 echo $object->firstname.
';';
187 echo $object->getCivilityLabel().
';';
188 echo ($soc != -1 ? $object->thirdparty->name :
'').
';';
189 echo $object->poste.
';';
190 echo $object->address.
';';
191 echo $object->zip.
';';
192 echo $object->town.
';';
193 echo $object->state.
';';
194 echo $object->country.
';';
195 echo $object->email.
';';
196 echo $object->phone_pro.
';';
197 echo $object->phone_perso.
';';
198 echo $object->phone_mobile.
';';
199 echo $object->jabberid.
';';
202 } elseif ($parameters[
'currentcontext'] ==
'contactcard' && $action ==
'send_datapolicy') {
205 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
206 require_once DOL_DOCUMENT_ROOT.
'/datapolicy/class/datapolicy.class.php';
208 } elseif ($parameters[
'currentcontext'] ==
'membercard' && $action ==
'send_datapolicy') {
210 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
211 require_once DOL_DOCUMENT_ROOT.
'/datapolicy/class/datapolicy.class.php';
213 } elseif ($parameters[
'currentcontext'] ==
'thirdpartycard' && $action ==
'send_datapolicy') {
214 $object->fetch(
GETPOST(
'socid'));
215 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
216 require_once DOL_DOCUMENT_ROOT.
'/datapolicy/class/datapolicy.class.php';
222 $this->results = array(
'myreturn' => 999);
223 $this->resprints =
'A text to show';
226 $this->errors[] =
'Error message';
240 public function doMassActions($parameters, &$object, &$action, $hookmanager)
242 global $conf, $user, $langs;
255 $this->results = array(
'myreturn' => 999);
256 $this->resprints =
'A text to show';
259 $this->errors[] =
'Error message';
275 global $conf, $user, $langs;
280 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
281 $this->resprints =
'<option value="0"'.($disabled ?
' disabled="disabled"' :
'').
'>'.$langs->trans(
"datapolicyMassAction").
'</option>';
287 $this->errors[] =
'Error message';
304 global $conf, $user, $langs;
307 $outputlangs = $langs;
311 dol_syslog(get_class($this).
'::executeHooks action='.$action);
314 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
332 global $conf, $user, $langs;
333 $langs->load(
'datapolicy@datapolicy');
335 if (!empty($conf->global->DATAPOLICIES_ENABLE_EMAILS))
337 $dialog =
'<div id="dialogdatapolicy" style="display:none;" title="'.$langs->trans(
'DATAPOLICIES_PORTABILITE_TITLE').
'">';
338 $dialog .=
'<div class="confirmmessage">'.img_help(
'',
'').
' '.$langs->trans(
'DATAPOLICIES_PORTABILITE_CONFIRMATION').
'</div>';
342 $("#rpgpdbtn").on("click", function(){
343 var href = $(this).attr("href");
344 $( "#dialogdatapolicy" ).dialog({
349 $( this ).dialog( "close" );
351 "' . $langs->trans(
"Cancel").
'": function() {
352 $( this ).dialog( "close" );
363 if ($parameters[
'currentcontext'] ==
'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) {
364 echo
'<div class="inline-block divButAction"><a target="_blank" id="rpgpdbtn" class="butAction" href="'.$_SERVER[
"PHP_SELF"].
"?socid=".$object->id.
'&action=datapolicy_portabilite" title="'.$langs->trans(
'DATAPOLICIES_PORTABILITE_TITLE').
'">'.$langs->trans(
"DATAPOLICIES_PORTABILITE").
'</a></div>';
365 } elseif ($parameters[
'currentcontext'] ==
'membercard') {
366 echo
'<div class="inline-block divButAction"><a target="_blank" id="rpgpdbtn" class="butAction" href="'.$_SERVER[
"PHP_SELF"].
"?rowid=".$object->id.
'&action=datapolicy_portabilite" title="'.$langs->trans(
'DATAPOLICIES_PORTABILITE_TITLE').
'">'.$langs->trans(
"DATAPOLICIES_PORTABILITE").
'</a></div>';
367 } elseif ($parameters[
'currentcontext'] ==
'contactcard') {
368 echo
'<div class="inline-block divButAction"><a target="_blank" id="rpgpdbtn" class="butAction" href="'.$_SERVER[
"PHP_SELF"].
"?id=".$object->id.
'&action=datapolicy_portabilite" title="'.$langs->trans(
'DATAPOLICIES_PORTABILITE_TITLE').
'">'.$langs->trans(
"DATAPOLICIES_PORTABILITE").
'</a></div>';
370 if (!empty($object->mail) && empty($object->array_options[
'options_datapolicy_send']) && $parameters[
'currentcontext'] ==
'thirdpartycard' && in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $object->typent_id == 8) {
371 echo
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
"?socid=".$object->id.
'&action=send_datapolicy" title="'.$langs->trans(
'DATAPOLICIES_SEND').
'">'.$langs->trans(
"DATAPOLICIES_SEND").
'</a></div>';
372 } elseif (!empty($object->mail) && empty($object->array_options[
'options_datapolicy_send']) && $parameters[
'currentcontext'] ==
'membercard') {
373 echo
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
"?rowid=".$object->id.
'&action=send_datapolicy" title="'.$langs->trans(
'DATAPOLICIES_SEND').
'">'.$langs->trans(
"DATAPOLICIES_SEND").
'</a></div>';
374 } elseif (!empty($object->mail) && empty($object->array_options[
'options_datapolicy_send']) && $parameters[
'currentcontext'] ==
'contactcard') {
375 echo
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
"?id=".$object->id.
'&action=send_datapolicy" title="'.$langs->trans(
'DATAPOLICIES_SEND').
'">'.$langs->trans(
"DATAPOLICIES_SEND").
'</a></div>';
391 global $conf, $user, $langs;
394 if ($parameters[
'currentcontext'] ==
'thirdpartycard') {
396 $jsscript .=
'<script>';
397 $jsscript .=
"var elementToHide = 'tr.societe_extras_datapolicy_consentement, tr.societe_extras_datapolicy_opposition_traitement, tr.societe_extras_datapolicy_opposition_prospection';".PHP_EOL;
398 $jsscript .=
"var forme_juridique = [".PHP_EOL;
399 $jsscript .=
"11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005".PHP_EOL;
400 $jsscript .=
"];".PHP_EOL;
401 $jsscript .=
"function hideRgPD() {".PHP_EOL;
402 $jsscript .=
" if ($('#typent_id').val() == 8 || forme_juridique.indexOf(parseInt($('#forme_juridique_code').val())) > -1) {".PHP_EOL;
403 $jsscript .=
" console.log(elementToHide);".PHP_EOL;
404 $jsscript .=
" $('tr.societe_extras_datapolicy_consentement, tr.societe_extras_datapolicy_opposition_traitement, tr.societe_extras_datapolicy_opposition_prospection').show(); } else { $('tr.societe_extras_datapolicy_consentement, tr.societe_extras_datapolicy_opposition_traitement, tr.societe_extras_datapolicy_opposition_prospection').hide(); }}".PHP_EOL;
405 $jsscript .=
"hideRgPD();".PHP_EOL;
406 $jsscript .=
"$('#forme_juridique_code, #typent_id').change(function(){ hideRgPD(); });".PHP_EOL;
407 $jsscript .=
'</script>';
408 } elseif (
GETPOST(
'action') ==
'confirm_delete' &&
GETPOST(
'confirm') ==
'yes' &&
GETPOST(
'socid') > 0) {
410 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
412 $societe->fetch(
GETPOST(
'socid'));
414 if ((in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) || $societe->typent_id == 8) && $societe->isObjectUsed(
GETPOST(
'socid'))) {
415 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
416 $form =
new Form($this->
db);
417 echo $form->formconfirm(
$_SERVER[
"PHP_SELF"].
"?socid=".
GETPOST(
'socid'), substr($langs->trans(
"DATAPOLICIES_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans(
"DATAPOLICIES_POPUP_ANONYME_TITLE")) - 2), $langs->trans(
"DATAPOLICIES_POPUP_ANONYME_TEXTE"),
'anonymiser',
'',
'', 1);
422 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
424 $societe->fetch(
GETPOST(
'socid'));
426 if (!in_array($object->forme_juridique_code, array(11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005)) && $societe->typent_id != 8) {
427 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
428 $jsscript .=
'<script>';
429 $jsscript .=
"var elementToHide = 'td.societe_extras_datapolicy_opposition_traitement, td.societe_extras_datapolicy_opposition_prospection, td.societe_extras_datapolicy_consentement';".PHP_EOL;
430 $jsscript .=
"$(elementToHide).parent('tr').hide();".PHP_EOL;
431 $jsscript .=
'</script>';
434 } elseif ($parameters[
'currentcontext'] ==
'contactcard') {
435 if (
GETPOST(
'action') ==
'create' ||
GETPOST(
'action') ==
'edit') {
436 $jsscript .=
'<script>';
437 $jsscript .=
"$('#options_datapolicy_opposition_traitement, #options_datapolicy_opposition_prospection, input[name=\"options_datapolicy_opposition_traitement\"], input[name=\"options_datapolicy_opposition_prospection\"]').change(function(){
438 if($('#options_datapolicy_opposition_traitement').prop('checked') == true || $('input[name=options_datapolicy_opposition_traitement]').prop('checked') || $('#options_datapolicy_opposition_prospection').prop('checked') || $('input[name=options_datapolicy_opposition_prospection]').prop('checked')) {
439 $('#no_email').val(1);
442 $jsscript .=
'</script>';
446 $this->resprint = $jsscript;
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
doMassActions($parameters, &$object, &$action, $hookmanager)
Overloading the doActions function : replacing the parent's function with the one below...
__construct($db)
Constructor.
doActions($parameters, &$object, &$action, $hookmanager)
Overloading the doActions function : replacing the parent's function with the one below...
addMoreMassActions($parameters, &$object, &$action, $hookmanager)
Overloading the addMoreMassActions function : replacing the parent's function with the one below...
beforePDFCreation($parameters, &$object, &$action)
Execute action.
static sendMailDataPolicyContact($contact)
sendMailDataPolicyContact
$conf db
API class for accounts.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
Class to manage third parties objects (customers, suppliers, prospects...)
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename= '', $restricttologhandler= '', $logcontext=null)
Write log message into outputs.
addMoreActionsButtons($parameters, &$object, &$action, $hookmanager)
addMoreActionsButtons
static sendMailDataPolicyAdherent($adherent)
sendMailDataPolicyAdherent
static sendMailDataPolicyCompany($societe)
sendMailDataPolicyCompany
print $_SERVER["PHP_SELF"]
Edit parameters.
getNomUrl($parameters, &$object, &$action)
Execute action.
dol_print_date($time, $format= '', $tzoutput= 'auto', $outputlangs= '', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
printCommonFooter($parameters, &$object, &$action, $hookmanager)
printCommonFooter