Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2022-11-02 17:08:51 +01:00
commit 57feb24f4a
5 changed files with 52 additions and 74 deletions

View File

@ -146,7 +146,7 @@ function dolEncrypt($chain, $key = '', $ciphering = "AES-256-CTR")
}
$ivseed = dolGetRandomBytes($ivlen);
$newchain = openssl_encrypt($chain, $ciphering, $key, null, $ivseed);
$newchain = openssl_encrypt($chain, $ciphering, $key, 0, $ivseed);
return 'dolcrypt:'.$ciphering.':'.$ivseed.':'.$newchain;
} else {
return $chain;
@ -180,9 +180,9 @@ function dolDecrypt($chain, $key = '')
if (function_exists('openssl_decrypt')) {
$tmpexplode = explode(':', $reg[2]);
if (!empty($tmpexplode[1]) && is_string($tmpexplode[0])) {
$newchain = openssl_decrypt($tmpexplode[1], $ciphering, $key, null, $tmpexplode[0]);
$newchain = openssl_decrypt($tmpexplode[1], $ciphering, $key, 0, $tmpexplode[0]);
} else {
$newchain = openssl_decrypt($tmpexplode[0], $ciphering, $key, null, null);
$newchain = openssl_decrypt($tmpexplode[0], $ciphering, $key, 0, null);
}
} else {
$newchain = 'Error function openssl_decrypt() not available';

View File

@ -181,6 +181,20 @@ if ($action == "setaccountancycodecustomerinvoicemandatory") {
}
}
//Activate Set vat id unique
if ($action == "setvatintraunique") {
$setvatintraunique = GETPOST('value', 'int');
$res = dolibarr_set_const($db, "SOCIETE_VAT_INTRA_UNIQUE", $setvatintraunique, 'yesno', 0, '', $conf->entity);
if (!($res > 0)) {
$error++;
}
if (!$error) {
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
} else {
setEventMessages($langs->trans("Error"), null, 'errors');
}
}
//Activate Set ref in list
if ($action == "setaddrefinlist") {
$setaddrefinlist = GETPOST('value', 'int');
@ -731,6 +745,22 @@ if (isModEnabled('accounting')) {
print "</tr>\n";
}
// VAT ID
print '<tr class="oddeven">';
print '<td colspan="2">'.$langs->trans('VATIntra')."</td>\n";
if (!empty($conf->global->SOCIETE_VAT_INTRA_UNIQUE)) {
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setvatintraunique&token='.newToken().'&value=0">';
print img_picto($langs->trans("Activated"), 'switch_on');
print '</a></td>';
} else {
print '<td class="center"><a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=setvatintraunique&token='.newToken().'&value=1">';
print img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '<td colspan="2"></td>';
print "</tr>\n";
print "</table>\n";
print '</div>';

View File

@ -1171,7 +1171,7 @@ class Societe extends CommonObject
}
// Check for duplicate or mandatory fields defined into setup
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL');
$array_to_check = array('IDPROF1', 'IDPROF2', 'IDPROF3', 'IDPROF4', 'IDPROF5', 'IDPROF6', 'EMAIL', 'TVA_INTRA');
foreach ($array_to_check as $key) {
$keymin = strtolower($key);
$i = (int) preg_replace('/[^0-9]/', '', $key);
@ -1216,6 +1216,14 @@ class Societe extends CommonObject
$error++; $this->errors[] = $langs->trans('Email')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')';
}
}
} elseif ($key == 'TVA_INTRA') {
// Check for unicity
if ($vallabel && !empty($conf->global->SOCIETE_VAT_INTRA_UNIQUE)) {
if ($this->id_prof_exists($keymin, $vallabel, ($this->id > 0 ? $this->id : 0))) {
$langs->load("errors");
$error++; $this->errors[] = $langs->trans('VATIntra')." ".$langs->trans("ErrorProdIdAlreadyExist", $vallabel).' ('.$langs->trans("ForbiddenBySetupRules").')';
}
}
}
}
}

View File

@ -93,75 +93,6 @@ print '<form action="'.$_SERVER["PHP_SELF"].'?terminal='.(empty($terminal) ? 1 :
print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set">';
print load_fiche_titre($langs->trans("PrintMethod"), '', '');
print '<div class="div-table-responsive-no-min">';
print '<table class="noborder centpercent">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Name").'</td><td>'.$langs->trans("Description").'</td><td class="right">'.$langs->trans("Status").'</td>';
print "</tr>\n";
// Browser method
print '<tr class="oddeven"><td>';
print $langs->trans('Browser');
print '<td>';
print $langs->trans('BrowserMethodDescription');
print '</td><td class="right">';
if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "browser") {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmethod&token='.newToken().'&value=browser">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
}
print "</td></tr>\n";
// Receipt printer module
print '<tr class="oddeven"><td>';
print $langs->trans('DolibarrReceiptPrinter');
print '<td>';
print $langs->trans('ReceiptPrinterMethodDescription');
if (isModEnabled('receiptprinter')) {
if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") {
print '<br>';
print img_picto('', 'printer', 'class="paddingright"').'<a href="'.DOL_URL_ROOT.'/admin/receiptprinter.php">'.$langs->trans("Setup").'</a>';
}
}
print '</td><td class="right">';
if (isModEnabled('receiptprinter')) {
if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "receiptprinter") {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmethod&token='.newToken().'&value=receiptprinter">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
}
} else {
print '<span class="opacitymedium">';
print $langs->trans("ModuleReceiptPrinterMustBeEnabled");
print '</span>';
}
print "</td></tr>\n";
// TakePOS Connector
print '<tr class="oddeven"><td>';
print "TakePOS Connector";
print '<td>';
print $langs->trans('TakeposConnectorMethodDescription');
if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
print '<br>';
print $langs->trans("URL")." / ".$langs->trans("IPAddress").' (<a href="http://en.takepos.com/connector" target="_blank" rel="noopener noreferrer external">'.$langs->trans("TakeposConnectorNecesary").'</a>)';
print ' <input type="text" class="minwidth200" id="TAKEPOS_PRINT_SERVER" name="TAKEPOS_PRINT_SERVER" value="'.getDolGlobalString('TAKEPOS_PRINT_SERVER').'">';
}
print '</td><td class="right">';
if (getDolGlobalString('TAKEPOS_PRINT_METHOD') == "takeposconnector") {
print img_picto($langs->trans("Activated"), 'switch_on');
} else {
print '<a class="reposition" href="'.$_SERVER["PHP_SELF"].'?action=setmethod&token='.newToken().'&value=takeposconnector">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
}
print "</td></tr>\n";
print '</table>';
print '</div>';
print load_fiche_titre($langs->trans("Receipt"), '', '');
print '<div class="div-table-responsive-no-min">';
@ -285,6 +216,13 @@ print $form->buttonsSaveCancel("Save", '');
print "</form>\n";
print load_fiche_titre($langs->trans("Preview"), '', '');
print '<div style="width: 50%; float:center;background-color:#606060">';
print '<center>';
print '<iframe id="iframe" allowtransparency="true" style="background: #FFFFFF;" src="../receipt.php" width="80%" height="600"></iframe>';
print '</center>';
print '</div>';
print '<br>';
llxFooter();

View File

@ -330,7 +330,9 @@ if (!empty($conf->global->TAKEPOS_FOOTER) || !empty($conf->global->{$constFreeTe
?>
<script type="text/javascript">
window.print();
<?php
if ($facid) print 'window.print();'; //Avoid print when is specimen
?>
</script>
</body>