29require
'../../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/blockedlog/lib/blockedlog.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/blockedlog/class/blockedlog.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/modules/modBlockedLog.class.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/core/lib/profid.lib.php';
43require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formcompany.class.php';
44require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsetup.class.php';
47$langs->loadLangs(array(
'admin',
'blockedlog',
'other'));
50$action =
GETPOST(
'action',
'aZ09');
51$backtopage =
GETPOST(
'backtopage',
'alpha');
54$withtab = GETPOSTISSET(
'withtab') ?
GETPOSTINT(
'withtab') : 1;
69 header(
"Location: ".DOL_URL_ROOT.
'/blockedlog/admin/blockedlog_archives.php');
73if ($cancel && $origin ==
'initmodule') {
74 header(
"Location: ".DOL_URL_ROOT.
"/admin/modules.php");
81if ($action ==
'update') {
86 if (!
GETPOST(
"BLOCKEDLOG_REGISTRATION_NAME")) {
87 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->trans(
"BLOCKEDLOG_REGISTRATION_NAME")),
null,
'errors');
90 if (!
GETPOST(
"BLOCKEDLOG_REGISTRATION_EMAIL")) {
91 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->trans(
"BLOCKEDLOG_REGISTRATION_EMAIL")),
null,
'errors');
94 if (!
GETPOST(
"BLOCKEDLOG_REGISTRATION_COUNTRY_ID")) {
95 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->trans(
"BLOCKEDLOG_REGISTRATION_COUNTRY_CODE")),
null,
'errors');
98 if (!
GETPOST(
"BLOCKEDLOG_REGISTRATION_IDPROF1")) {
99 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transcountry(
"ProfId1",
$mysoc->country_code)),
null,
'errors');
102 if (!
GETPOST(
"BLOCKEDLOG_REGISTRATION_IDPROF2")) {
103 setEventMessages($langs->trans(
"ErrorFieldRequired", $langs->transcountry(
"ProfId2",
$mysoc->country_code)),
null,
'errors');
110 if (!empty($tmparray[
'id'])) {
112 include_once DOL_DOCUMENT_ROOT.
'/blockedlog/lib/blockedlog.lib.php';
115 $langs->load(
"blockedlog");
116 setEventMessages($langs->trans(
"BlockedLogCountryChangeNotAllowedFR"),
null,
'errors');
119 $mysoc->country_id = $tmparray[
'id'];
120 $mysoc->country_code = $tmparray[
'code'];
121 $mysoc->country_label = $tmparray[
'label'];
126 $tmpthirdparty->country_code =
$mysoc->country_code;
127 $tmpthirdparty->country_id =
$mysoc->country_id;
128 $tmpthirdparty->country_label =
$mysoc->country_label;
129 $tmpthirdparty->idprof1 =
GETPOST(
"BLOCKEDLOG_REGISTRATION_IDPROF1");
130 $tmpthirdparty->idprof2 =
GETPOST(
"BLOCKEDLOG_REGISTRATION_IDPROF2");
132 activateModulesRequiredByCountry(
$mysoc->country_code);
143 if ($tmpthirdparty->idprof1 &&
GETPOST(
'BLOCKEDLOG_REGISTRATION_IDPROF1') != $tmpthirdparty->idprof1 &&
isValidProfIds(1, $tmpthirdparty, 1) <= 0) {
144 $langs->loadLangs(array(
"errors",
"companies"));
145 setEventMessages($langs->trans(
"ErrorBadValueForParameter", $tmpthirdparty->idprof1, $langs->transcountry(
"ProfId1Short", $tmpthirdparty->country_code)),
null,
'errors');
148 if ($tmpthirdparty->idprof2 &&
GETPOST(
'BLOCKEDLOG_REGISTRATION_IDPROF2') != $tmpthirdparty->idprof2 &&
isValidProfIds(2, $tmpthirdparty, 1) <= 0) {
149 $langs->loadLangs(array(
"errors",
"companies"));
150 setEventMessages($langs->trans(
"ErrorBadValueForParameter", $tmpthirdparty->idprof2, $langs->transcountry(
"ProfId2Short", $tmpthirdparty->country_code)),
null,
'errors');
156 $langs->load(
"blockedlog");
157 setEventMessages($langs->trans(
"BlockedLogProfID1ChangeNotAllowedFR"),
null,
'errors');
161 $company_name =
GETPOST(
"BLOCKEDLOG_REGISTRATION_NAME");
162 $company_email =
GETPOST(
"BLOCKEDLOG_REGISTRATION_EMAIL");
163 $company_country_code = $tmparray[
'code'];
164 $company_idprof1 =
GETPOST(
"BLOCKEDLOG_REGISTRATION_IDPROF1");
165 $company_idprof2 =
GETPOST(
"BLOCKEDLOG_REGISTRATION_IDPROF2");
166 $company_address =
GETPOST(
"BLOCKEDLOG_REGISTRATION_ADDRESS");
167 $company_state =
GETPOST(
"BLOCKEDLOG_REGISTRATION_STATE");
168 $company_zip =
GETPOST(
"BLOCKEDLOG_REGISTRATION_ZIP");
169 $company_town =
GETPOST(
"BLOCKEDLOG_REGISTRATION_TOWN");
171 $provider_name =
GETPOST(
"MAIN_INFO_ITPROVIDER_NAME");
172 $provider_email =
GETPOST(
"MAIN_INFO_ITPROVIDER_MAIL");
173 $provider_country_id =
GETPOST(
"MAIN_INFO_ITPROVIDER_COUNTRY");
174 $provider_idprof1 =
GETPOST(
"MAIN_INFO_ITPROVIDER_IDPROF1");
175 $provider_idprof2 =
GETPOST(
"MAIN_INFO_ITPROVIDER_IDPROF2");
176 $provider_address =
GETPOST(
"MAIN_INFO_ITPROVIDER_ADDRESS");
177 $provider_state =
GETPOST(
"MAIN_INFO_ITPROVIDER_STATE");
178 $provider_zip =
GETPOST(
"MAIN_INFO_ITPROVIDER_ZIP");
179 $provider_town =
GETPOST(
"MAIN_INFO_ITPROVIDER_TOWN");
258 unset($_SESSION[
'obfuscationkey_'.((
int)
$conf->entity)]);
259 unset(
$conf->cache[
'obfuscationkey_'.((int)
$conf->entity)]);
261 require_once DOL_DOCUMENT_ROOT .
'/blockedlog/class/blockedlog.class.php';
267 if (empty($hmac_encoded_secret_key)) {
269 $randomsecret = bin2hex(random_bytes(32));
271 $hmac_secret_key =
'BLOCKEDLOGHMAC'.$randomsecret;
274 $obfuscationkey =
'';
277 $obfuscationkey = $b->getObfuscationKey();
282 $obfuscationkey =
'';
284 if (empty($obfuscationkey)) {
286 $url_for_ping =
getDolGlobalString(
'MAIN_URL_FOR_PING',
"https://ping.dolibarr.org/");
287 setEventMessages($langs->trans(
'FailedToGetRemoteObfuscationKeyReTryLater', $url_for_ping),
null,
'errors');
292 $result = $b->saveHMACSecretKey($hmac_secret_key,
'dolobfuscationv1-'.
$mysoc->idprof1, $obfuscationkey);
299 $result = $b->saveHMACSecretKey($hmac_secret_key,
'dolcrypt', $obfuscationkey);
316 $urltouse = $_SERVER[
"PHP_SELF"].
"?mode=forceregistration";
317 $urltouse .= (($withtab &&
GETPOST(
'origin')) ?
'&withtab='.$withtab :
'');
318 $urltouse .= (
GETPOST(
'origin') ?
'&origin='.GETPOST(
'origin') :
'');
320 header(
"Location: ".$urltouse);
337$block_static->loadTrackedEvents();
340 $title = $langs->trans(
"ModuleSetup").
' '.$langs->trans(
'BlockedLog');
342 $title = $langs->trans(
"BrowseBlockedLog");
345$help_url =
"EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable";
347llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-blockedlog page-admin_blockedlog');
350 $linkback =
'<a href="'.dolBuildUrl($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
360 $texttop =
'<small class="opacitymedium">'.$langs->trans(
"RegistrationNumber").
':</small> <small>'.
dol_trunc($registrationnumber, 10).
'</small>';
366print
load_fiche_titre($title.
'<br>'.$texttop, $linkback,
'blockedlog', 0,
'',
'', $morehtmlcenter);
375print
'<span class="opacitymedium">'.$langs->trans(
"BlockedLogDesc").
"</span><br>\n";
379$versionbadge =
'<span class="badge-text badge-secondary">'.getBlockedLogVersionToShow().
'</span>';
384if (
$mysoc->country_code ==
'FR') {
389 $infotoshow = $langs->trans(
"LNECandidateVersionForCertificationFR", $versionbadge);
391 $infotoshow = $langs->trans(
"LNECertifiedVersionFR", $versionbadge);
394 $infotoshow = $langs->trans(
"NotCertifiedVersionFR", $versionbadge);
397 $infotoshow .=
' - <a href="'.DOL_URL_ROOT.
'/blockedlog/admin/filecheck.php">'.
img_picto(
'',
'url',
'class="pictofixedwidth"').$langs->trans(
"FileCheck").
'</a>';
401if (in_array(
$mysoc->country_code, array(
'FR'))) {
402 $organization_for_ping =
getDolGlobalString(
'MAIN_ORGANIZATION_FOR_PING',
"Association Dolibarr");
403 $dataprivacy_url =
getDolGlobalString(
'MAIN_ORGANIZATION_URL_PRIVACY',
"https://www.dolibarr.org/legal-privacy-gdpr.php");
411 print
'<center><span class="error"><br>'.$langs->trans(
"RegistrationRequired").
'<br><br></span></center>';
415 $htmltext .= $langs->trans(
"UnalterableLogToolRegistrationFR").
'<br>';
416 $htmltext .= $langs->trans(
"InformationWillBePublishedTo");
417 $htmltext .=
'<br>'.$langs->trans(
"InformationWillBePublishedTo2", $organization_for_ping, $dataprivacy_url);
419 $htmltext .=
'<br>'.$langs->trans(
"InformationWillBePublishedTo3");
429 if (
$mysoc->country_code ===
'FR') {
430 $htmltext .= $langs->trans(
"UnalterableLogTool1FR", $langs->transnoentitiesnoconv(
"Archives")).
'<br>';
436 print
'<center><span class="ok"><br>'.$langs->trans(
"ApplicationHasBeenRegistered").
'<br><br></span></center>';
439 $htmltext = ($infotoshow ? $infotoshow.
'<br>' :
'');
440 $htmltext .= $langs->trans(
"ApplicationHasBeenRegistered");
441 $htmltext .=
' '.$langs->trans(
"RegistrationNumber").
': <span class="badge-text badge-secondary" title="Flag stored into MAIN_FIRST_REGISTRATION_OK_DATE. Registered data saved into BLOCKEDLOG_REGISTRATION_...">'.
dol_trunc($registrationnumber, 10).
'</span>';
443 $htmltext .= $langs->trans(
"LastRegistrationDate").
' : ';
450 $htmltext = $langs->trans(
"UnalterableLogTool1FR", $langs->transnoentitiesnoconv(
"Archives")).
'<br>';
459if ($mode ==
"forceregistration") {
460 $company_state =
$mysoc->state;
464 $arrayofdata = array(
465 'action' =>
'dolibarrregistration',
472 'company_state' => $company_state,
475 'country_code' =>
$mysoc->country_code,
491 printCodeForPing(
"MAIN_LAST_REGISTRATION_KO_DATE",
"MAIN_FIRST_REGISTRATION_OK_DATE", $arrayofdata, 1);
495 $res = $modblckedlog->init(
'forceinit');
504 if ($mode ==
"forceregistration") {
505 print
'<div class="center">';
506 print
img_picto(
'',
'tick',
'class="large"');
507 print
'<br>'.$langs->trans(
"RegistrationDoneAndModuleEnabled", $langs->transnoentitiesnoconv(
"BlockedLog"));
510 if (
GETPOST(
'origin') ==
'initmodule') {
514 print
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php">'.$langs->trans(
"BackToModuleList").
'</a>';
520 if ($origin !=
'initmodule') {
522 print
'<span class="opacitymedium">'.$langs->trans(
"UseThisFormToUpdate").
'</span><br><br>';
525 $formSetup->newItem(
'Company')->setAsTitle();
528 $item = $formSetup->newItem(
'BLOCKEDLOG_REGISTRATION_NAME');
530 $item->fieldParams[
'isMandatory'] = 1;
533 $item = $formSetup->newItem(
'BLOCKEDLOG_REGISTRATION_EMAIL');
534 $item->defaultFieldValue = (GETPOSTISSET(
'BLOCKEDLOG_REGISTRATION_EMAIL') ?
GETPOST(
'BLOCKEDLOG_REGISTRATION_EMAIL') :
getDolGlobalString(
'BLOCKEDLOG_REGISTRATION_EMAIL',
$mysoc->
email));
536 $item->fieldParams[
'isMandatory'] = 1;
537 $item->cssClass =
"minwidth300 maxwidth500 widthcentpercentminusx";
540 $item = $formSetup->newItem(
'BLOCKEDLOG_REGISTRATION_IDPROF1');
543 $item->helpText = $langs->trans(
"Example").
': 732 829 320';
544 $item->fieldParams[
'isMandatory'] = 1;
545 $item->nameText = $langs->transcountry(
"ProfId1",
$mysoc->country_code);
548 $item = $formSetup->newItem(
'BLOCKEDLOG_REGISTRATION_IDPROF2');
551 $item->helpText = $langs->trans(
"Example").
': 732 829 320 00074';
552 $item->fieldParams[
'isMandatory'] = 1;
553 $item->nameText = $langs->transcountry(
"ProfId2",
$mysoc->country_code);
557 $item = $formSetup->newItem(
'BLOCKEDLOG_REGISTRATION_COUNTRY_CODE');
558 $item->fieldInputOverride = $form->select_country($country_id,
"BLOCKEDLOG_REGISTRATION_COUNTRY_ID",
'', 0,
'minwidth300');
559 $item->fieldParams[
'isMandatory'] = 1;
562 $item = $formSetup->newItem(
'BLOCKEDLOG_REGISTRATION_ADDRESS');
564 $item->setAsTextarea();
567 $item = $formSetup->newItem(
'BLOCKEDLOG_REGISTRATION_STATE');
573 $stateid =
getDolGlobalInt(
'BLOCKEDLOG_REGISTRATION_STATE', (
int) $state_id);
574 $item->fieldInputOverride = $formcompany->select_state($stateid,
$mysoc->country_code,
"BLOCKEDLOG_REGISTRATION_STATE");
577 $item = $formSetup->newItem(
'BLOCKEDLOG_REGISTRATION_ZIP');
579 $item->cssClass =
"width100";
582 $item = $formSetup->newItem(
'BLOCKEDLOG_REGISTRATION_TOWN');
585 $formSetup->newItem(
'ITProvider')->setAsTitle();
588 $item = $formSetup->newItem(
'MAIN_INFO_ITPROVIDER_NAME');
592 $item = $formSetup->newItem(
'MAIN_INFO_ITPROVIDER_MAIL');
595 $item->cssClass =
"minwidth300 maxwidth500 widthcentpercentminusx";
598 $item = $formSetup->newItem(
'MAIN_INFO_ITPROVIDER_IDPROF1');
602 $item = $formSetup->newItem(
'MAIN_INFO_ITPROVIDER_IDPROF2');
606 $item = $formSetup->newItem(
'MAIN_INFO_ITPROVIDER_COUNTRY');
608 $item->fieldInputOverride = $form->select_country(
getDolGlobalString(
'MAIN_INFO_ITPROVIDER_COUNTRY'),
'MAIN_INFO_ITPROVIDER_COUNTRY');
611 $item = $formSetup->newItem(
'MAIN_INFO_ITPROVIDER_ADDRESS');
613 $item->setAsTextarea();
616 $item = $formSetup->newItem(
'MAIN_INFO_ITPROVIDER_STATE');
617 $item->fieldInputOverride = $formcompany->select_state(
getDolGlobalInt(
'MAIN_INFO_ITPROVIDER_STATE'),
getDolGlobalString(
'MAIN_INFO_ITPROVIDER_COUNTRY'),
"MAIN_INFO_ITPROVIDER_STATE");
620 $item = $formSetup->newItem(
'MAIN_INFO_ITPROVIDER_ZIP');
622 $item->cssClass =
"width100";
625 $item = $formSetup->newItem(
'MAIN_INFO_ITPROVIDER_TOWN');
628 $formSetup->formHiddenInputs[
'origin'] =
GETPOST(
'origin');
629 $formSetup->formHiddenInputs[
'withtab'] = $withtab;
632 $formSetup->htmlButtonLabel =
'SaveUpdate';
634 $formSetup->htmlButtonLabel =
'SaveAndEnableModule';
637 print $formSetup->generateOutput(2,
true,
'',
'');
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
getBlockedLogVersionToShow()
Define head array for tabs of blockedlog tools setup pages.
isALNEQualifiedVersion($ignoredev=0, $ignoremodule=0)
Return if the version is a candidate version to get the LNE certification and if the prerequisites ar...
userIsTaxAuditor()
Call remote API service to push the last counter and signature.
blockedlogadmin_prepare_head($withtabsetup)
Define head array for tabs of blockedlog tools setup pages.
isRegistrationDataSavedAndPushed()
Return if the KYC mandatory parameters are set AND pushed/registered centralized server.
getHashUniqueIdOfRegistration($algo='sha256')
Return a hash unique identifier of the registration (used to identify the registration of instance wi...
isALNERunningVersion($blockedlogtestalreadydone=0, $blockedlogmodulealreadydone=0)
Return if the application is executed with the LNE requirements on.
Class to manage Blocked Log.
Class to manage third parties objects (customers, suppliers, prospects...)
Class to describe a BlockedLog module.
getCountry($searchkey, $withcode='', $dbtouse=null, $outputlangs=null, $entconv=1, $searchlabel='')
Return country label, code or id from an id, code or label.
getState($id, $withcode='0', $dbtouse=null, $withregion=0, $outputlangs=null, $entconv=1)
Return state translated from an id.
print $script_file $mode $langs defaultlang(is_numeric($duration_value) ? " delay=". $duration_value :"").(is_numeric($duration_value2) ? " after cd cd cd description as p label as s rowid as s nom as s email
Sender: Who sends the email ("Sender" has sent emails on behalf of "From").
printCodeForPing($constanttosavelastko, $constanttosavefirstok, $arrayofdata=array(), $forceping=0)
Function to output HTML to make an ajax call to make registration.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
isValidEmail($address, $acceptsupervisorkey=0, $acceptuserkey=0)
Return true if email syntax is ok.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
isValidProfIds($idprof, $thirdparty, $lenghtonly=0)
Check the validity of a professional identifier according to the properties (country) of the company ...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.