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' && !empty($object)) {
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 = ".((int) $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;Firstname;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;Firstname;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;Firstname;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.
';';
201 } elseif ($parameters[
'currentcontext'] ==
'contactcard' && $action ==
'send_datapolicy') {
204 require_once DOL_DOCUMENT_ROOT.
'/contact/class/contact.class.php';
205 require_once DOL_DOCUMENT_ROOT.
'/datapolicy/class/datapolicy.class.php';
207 } elseif ($parameters[
'currentcontext'] ==
'membercard' && $action ==
'send_datapolicy') {
209 require_once DOL_DOCUMENT_ROOT.
'/adherents/class/adherent.class.php';
210 require_once DOL_DOCUMENT_ROOT.
'/datapolicy/class/datapolicy.class.php';
212 } elseif ($parameters[
'currentcontext'] ==
'thirdpartycard' && $action ==
'send_datapolicy') {
213 $object->fetch(
GETPOST(
'socid'));
214 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
215 require_once DOL_DOCUMENT_ROOT.
'/datapolicy/class/datapolicy.class.php';
221 $this->results = array(
'myreturn' => 999);
222 $this->resprints =
'A text to show';
225 $this->errors[] =
'Error message';
239 public function doMassActions($parameters, &$object, &$action, $hookmanager)
241 global $conf, $user, $langs;
254 $this->results = array(
'myreturn' => 999);
255 $this->resprints =
'A text to show';
258 $this->errors[] =
'Error message';
274 global $conf, $user, $langs;
279 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
280 $this->resprints =
'<option value="0"'.($disabled ?
' disabled="disabled"' :
'').
'>'.$langs->trans(
"datapolicyMassAction").
'</option>';
286 $this->errors[] =
'Error message';
303 global $conf, $user, $langs;
306 $outputlangs = $langs;
310 dol_syslog(get_class($this).
'::executeHooks action='.$action);
313 if (in_array($parameters[
'currentcontext'], array(
'somecontext1',
'somecontext2'))) {
331 global $conf, $user, $langs;
332 $langs->load(
'datapolicy@datapolicy');
334 if (!empty($conf->global->DATAPOLICY_ENABLE_EMAILS)) {
335 $dialog =
'<div id="dialogdatapolicy" style="display:none;" title="'.$langs->trans(
'DATAPOLICY_PORTABILITE_TITLE').
'">';
336 $dialog .=
'<div class="confirmmessage">'.img_help(
'',
'').
' '.$langs->trans(
'DATAPOLICY_PORTABILITE_CONFIRMATION').
'</div>';
340 $("#rpgpdbtn").on("click", function(){
341 var href = $(this).attr("href");
342 $( "#dialogdatapolicy" ).dialog({
347 $( this ).dialog( "close" );
349 "' . $langs->trans(
"Cancel").
'": function() {
350 $( this ).dialog( "close" );
361 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) {
362 echo
'<div class="inline-block divButAction"><a target="_blank" rel="noopener noreferrer" id="rpgpdbtn" class="butAction" href="'.$_SERVER[
"PHP_SELF"].
"?socid=".$object->id.
'&action=datapolicy_portabilite" title="'.$langs->trans(
'DATAPOLICY_PORTABILITE_TITLE').
'">'.$langs->trans(
"DATAPOLICY_PORTABILITE").
'</a></div>';
363 } elseif ($parameters[
'currentcontext'] ==
'membercard') {
364 echo
'<div class="inline-block divButAction"><a target="_blank" rel="noopener noreferrer" id="rpgpdbtn" class="butAction" href="'.$_SERVER[
"PHP_SELF"].
"?rowid=".$object->id.
'&action=datapolicy_portabilite" title="'.$langs->trans(
'DATAPOLICY_PORTABILITE_TITLE').
'">'.$langs->trans(
"DATAPOLICY_PORTABILITE").
'</a></div>';
365 } elseif ($parameters[
'currentcontext'] ==
'contactcard') {
366 echo
'<div class="inline-block divButAction"><a target="_blank" rel="noopener noreferrer" id="rpgpdbtn" class="butAction" href="'.$_SERVER[
"PHP_SELF"].
"?id=".$object->id.
'&action=datapolicy_portabilite" title="'.$langs->trans(
'DATAPOLICY_PORTABILITE_TITLE').
'">'.$langs->trans(
"DATAPOLICY_PORTABILITE").
'</a></div>';
368 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) {
369 echo
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
"?socid=".$object->id.
'&action=send_datapolicy" title="'.$langs->trans(
'DATAPOLICY_SEND').
'">'.$langs->trans(
"DATAPOLICY_SEND").
'</a></div>';
370 } elseif (!empty($object->mail) && empty($object->array_options[
'options_datapolicy_send']) && $parameters[
'currentcontext'] ==
'membercard') {
371 echo
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
"?rowid=".$object->id.
'&action=send_datapolicy" title="'.$langs->trans(
'DATAPOLICY_SEND').
'">'.$langs->trans(
"DATAPOLICY_SEND").
'</a></div>';
372 } elseif (!empty($object->mail) && empty($object->array_options[
'options_datapolicy_send']) && $parameters[
'currentcontext'] ==
'contactcard') {
373 echo
'<div class="inline-block divButAction"><a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
"?id=".$object->id.
'&action=send_datapolicy" title="'.$langs->trans(
'DATAPOLICY_SEND').
'">'.$langs->trans(
"DATAPOLICY_SEND").
'</a></div>';
389 global $conf, $user, $langs;
392 if ($parameters[
'currentcontext'] ==
'thirdpartycard') {
394 $jsscript .=
'<script>';
395 $jsscript .=
"var elementToHide = 'tr.societe_extras_datapolicy_consentement, tr.societe_extras_datapolicy_opposition_traitement, tr.societe_extras_datapolicy_opposition_prospection';".PHP_EOL;
396 $jsscript .=
"var forme_juridique = [".PHP_EOL;
397 $jsscript .=
"11, 12, 13, 15, 17, 18, 19, 35, 60, 200, 311, 312, 316, 401, 600, 700, 1005".PHP_EOL;
398 $jsscript .=
"];".PHP_EOL;
399 $jsscript .=
"function hideRgPD() {".PHP_EOL;
400 $jsscript .=
" if ($('#typent_id').val() == 8 || forme_juridique.indexOf(parseInt($('#forme_juridique_code').val())) > -1) {".PHP_EOL;
401 $jsscript .=
" console.log(elementToHide);".PHP_EOL;
402 $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;
403 $jsscript .=
"hideRgPD();".PHP_EOL;
404 $jsscript .=
"$('#forme_juridique_code, #typent_id').change(function(){ hideRgPD(); });".PHP_EOL;
405 $jsscript .=
'</script>';
406 } elseif (
GETPOST(
'action') ==
'confirm_delete' &&
GETPOST(
'confirm') ==
'yes' &&
GETPOST(
'socid') > 0) {
408 require_once DOL_DOCUMENT_ROOT.
'/societe/class/societe.class.php';
410 $societe->fetch(
GETPOST(
'socid'));
412 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'))) {
413 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.form.class.php';
415 echo
$form->formconfirm($_SERVER[
"PHP_SELF"].
"?socid=".
GETPOST(
'socid'), substr($langs->trans(
"DATAPOLICY_POPUP_ANONYME_TITLE"), 0, strlen($langs->trans(
"DATAPOLICY_POPUP_ANONYME_TITLE")) - 2), $langs->trans(
"DATAPOLICY_POPUP_ANONYME_TEXTE"),
'anonymiser',
'',
'', 1);
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;
getNomUrl($parameters, &$object, &$action)
Execute action.
doActions($parameters, &$object, &$action, $hookmanager)
Overloading the doActions function : replacing the parent's function with the one below.
doMassActions($parameters, &$object, &$action, $hookmanager)
Overloading the doActions function : replacing the parent's function with the one below.
beforePDFCreation($parameters, &$object, &$action)
Execute action.
__construct($db)
Constructor.
addMoreActionsButtons($parameters, &$object, &$action, $hookmanager)
addMoreActionsButtons
addMoreMassActions($parameters, &$object, &$action, $hookmanager)
Overloading the addMoreMassActions function : replacing the parent's function with the one below.
printCommonFooter($parameters, &$object, &$action, $hookmanager)
printCommonFooter
static sendMailDataPolicyAdherent($adherent)
sendMailDataPolicyAdherent
static sendMailDataPolicyContact($contact)
sendMailDataPolicyContact
static sendMailDataPolicyCompany($societe)
sendMailDataPolicyCompany
Class to manage third parties objects (customers, suppliers, prospects...)
if($cancel &&! $id) if($action=='add' &&! $cancel) if($action=='delete') if($id) $form
Actions.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='')
Set event messages in dol_events session object.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs='', $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
$conf db
API class for accounts.