NEW Can add profid2 in addition with profid1
This commit is contained in:
parent
538b685de6
commit
1cfed6e5cf
6 changed files with 34 additions and 4 deletions
|
|
@ -96,7 +96,11 @@ if ($action == 'update') {
|
|||
$error++;
|
||||
}
|
||||
if (!GETPOST("BLOCKEDLOG_REGISTRATION_IDPROF1")) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->trans("BLOCKEDLOG_REGISTRATION_IDPROF1")), null, 'errors');
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transcountry("ProfId1", $mysoc->country_code)), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
if (!GETPOST("BLOCKEDLOG_REGISTRATION_IDPROF2")) {
|
||||
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transcountry("ProfId2", $mysoc->country_code)), null, 'errors');
|
||||
$error++;
|
||||
}
|
||||
|
||||
|
|
@ -105,6 +109,7 @@ if ($action == 'update') {
|
|||
$tmpthirdparty->country_code = $country_code;
|
||||
$tmpthirdparty->country_id = getCountry($country_code, '3', $db, $langs, 0);
|
||||
$tmpthirdparty->idprof1 = GETPOST("BLOCKEDLOG_REGISTRATION_IDPROF1");
|
||||
$tmpthirdparty->idprof2 = GETPOST("BLOCKEDLOG_REGISTRATION_IDPROF2");
|
||||
|
||||
// Check validity of email
|
||||
if (!isValidEmail(GETPOST("BLOCKEDLOG_REGISTRATION_EMAIL"))) {
|
||||
|
|
@ -123,6 +128,7 @@ if ($action == 'update') {
|
|||
$company_email = GETPOST("BLOCKEDLOG_REGISTRATION_EMAIL");
|
||||
$company_country_code = GETPOST("BLOCKEDLOG_REGISTRATION_COUNTRY_CODE");
|
||||
$company_idprof1 = GETPOST("BLOCKEDLOG_REGISTRATION_IDPROF1");
|
||||
$company_idprof2 = GETPOST("BLOCKEDLOG_REGISTRATION_IDPROF2");
|
||||
$company_address = GETPOST("BLOCKEDLOG_REGISTRATION_ADDRESS");
|
||||
$company_state = GETPOST("BLOCKEDLOG_REGISTRATION_STATE");
|
||||
$company_zip = GETPOST("BLOCKEDLOG_REGISTRATION_ZIP");
|
||||
|
|
@ -155,6 +161,10 @@ if ($action == 'update') {
|
|||
if ($res <= 0) {
|
||||
$error++;
|
||||
}
|
||||
$res = dolibarr_set_const($db, "BLOCKEDLOG_REGISTRATION_IDPROF2", $company_idprof2, 'chaine', 0, '', $conf->entity);
|
||||
if ($res <= 0) {
|
||||
$error++;
|
||||
}
|
||||
$res = dolibarr_set_const($db, "BLOCKEDLOG_REGISTRATION_ADDRESS", $company_address, 'chaine', 0, '', $conf->entity);
|
||||
if ($res <= 0) {
|
||||
$error++;
|
||||
|
|
@ -363,6 +373,7 @@ if ($mode == "forceregistration") {
|
|||
'company_name' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_NAME', $mysoc->name),
|
||||
'company_email' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_EMAIL', $mysoc->email),
|
||||
'company_idprof1' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_IDPROF1', $mysoc->idprof1),
|
||||
'company_idprof2' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_IDPROF2', $mysoc->idprof2),
|
||||
'company_address' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_ADDRESS', $mysoc->address),
|
||||
'company_state' => $company_state,
|
||||
'company_zip' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_ZIP', $mysoc->zip),
|
||||
|
|
@ -435,6 +446,14 @@ if (empty($mode)) {
|
|||
$item->defaultFieldValue = (GETPOSTISSET('BLOCKEDLOG_REGISTRATION_IDPROF1') ? GETPOST('BLOCKEDLOG_REGISTRATION_IDPROF1') : getDolGlobalString('BLOCKEDLOG_REGISTRATION_IDPROF1', $mysoc->idprof1));
|
||||
$item->helpText = $langs->trans("Example").': 732 829 320';
|
||||
$item->fieldParams['isMandatory'] = 1;
|
||||
$item->nameText = $langs->transcountry("ProfId1", $mysoc->country_code);
|
||||
|
||||
//Company IDPROF2
|
||||
$item = $formSetup->newItem('BLOCKEDLOG_REGISTRATION_IDPROF2');
|
||||
$item->defaultFieldValue = (GETPOSTISSET('BLOCKEDLOG_REGISTRATION_IDPROF2') ? GETPOST('BLOCKEDLOG_REGISTRATION_IDPROF2') : getDolGlobalString('BLOCKEDLOG_REGISTRATION_IDPROF2', $mysoc->idprof2));
|
||||
$item->helpText = $langs->trans("Example").': 732 829 320 00010';
|
||||
$item->fieldParams['isMandatory'] = 1;
|
||||
$item->nameText = $langs->transcountry("ProfId2", $mysoc->country_code);
|
||||
|
||||
//Company country code
|
||||
$country_code = getDolGlobalString('BLOCKEDLOG_REGISTRATION_COUNTRY_CODE', $mysoc->country_code);
|
||||
|
|
|
|||
|
|
@ -90,5 +90,10 @@ if ($element === 'facture') { // Test on permission done in top of page
|
|||
$facture->call_trigger($action, $user);
|
||||
}
|
||||
|
||||
print 'Object '.$element.' logged with action code = '.$action." pos_print_counter is now ".$facture->pos_print_counter;
|
||||
if ($facture->errors) {
|
||||
http_response_code(500);
|
||||
print implode("\n", $facture->errors);
|
||||
} else {
|
||||
print 'Object '.$element.' logged with action code = '.$action." pos_print_counter is now ".$facture->pos_print_counter;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -142,9 +142,10 @@ function isRegistrationDataSaved()
|
|||
$companyemail = getDolGlobalString('BLOCKEDLOG_REGISTRATION_EMAIL', $mysoc->email);
|
||||
$companycountrycode = getDolGlobalString('BLOCKEDLOG_REGISTRATION_COUNTRY_CODE', $mysoc->country_code);
|
||||
$companyidprof1 = getDolGlobalString('BLOCKEDLOG_REGISTRATION_IDPROF1', $mysoc->idprof1);
|
||||
$companyidprof2 = getDolGlobalString('BLOCKEDLOG_REGISTRATION_IDPROF2', $mysoc->idprof2);
|
||||
//$companytel = getDolGlobalString('BLOCKEDLOG_REGISTRATION_TEL', $mysoc->phone);
|
||||
|
||||
if (empty($companyname) || empty($companycountrycode) || empty($companyidprof1) || empty($companyemail)) {
|
||||
if (empty($companyname) || empty($companycountrycode) || empty($companyidprof1) || empty($companyidprof2) || empty($companyemail)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -80,6 +80,7 @@ BLOCKEDLOG_REGISTRATION_NAME=Company name
|
|||
BLOCKEDLOG_REGISTRATION_EMAIL=Company email
|
||||
BLOCKEDLOG_REGISTRATION_COUNTRY_CODE=Company country
|
||||
BLOCKEDLOG_REGISTRATION_IDPROF1=Company Prof Id 1 (SIREN)
|
||||
BLOCKEDLOG_REGISTRATION_IDPROF2=Company Prof Id 2 (SIRET)
|
||||
BLOCKEDLOG_REGISTRATION_ADDRESS=Company address
|
||||
BLOCKEDLOG_REGISTRATION_STATE=Company state/province
|
||||
BLOCKEDLOG_REGISTRATION_ZIP=Company zip
|
||||
|
|
|
|||
|
|
@ -3960,6 +3960,7 @@ if (!function_exists("llxFooter")) {
|
|||
'company_name' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_NAME', $mysoc->name),
|
||||
'company_email' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_EMAIL', $mysoc->email),
|
||||
'company_idprof1' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_IDPROF1', $mysoc->idprof1),
|
||||
'company_idprof2' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_IDPROF2', $mysoc->idprof2),
|
||||
'company_address' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_ADDRESS', $mysoc->address),
|
||||
'company_state' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_STATE', $mysoc->state),
|
||||
'company_zip' => getDolGlobalString('BLOCKEDLOG_REGISTRATION_ZIP', $mysoc->zip),
|
||||
|
|
|
|||
|
|
@ -130,7 +130,10 @@ if (!GETPOST('specimen') && empty($nojs)) {
|
|||
lang: '".dol_escape_js($langs->defaultlang)."',
|
||||
token: '".currentToken()."'
|
||||
}
|
||||
);
|
||||
).fail(function(jqXHR, textStatus, errorThrown) {
|
||||
console.error('Error AJAX :', textStatus, errorThrown);
|
||||
console.error('Answer server :', jqXHR.responseText);
|
||||
});
|
||||
</script>";
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue