2
0
forked from Wavyzz/dolibarr

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

This commit is contained in:
Laurent Destailleur
2024-09-12 01:43:43 +02:00
9 changed files with 44 additions and 21 deletions

View File

@@ -377,8 +377,9 @@ foreach ($dirmodels as $reldir) {
$facture = new Facture($db); $facture = new Facture($db);
$facture->initAsSpecimen(); $facture->initAsSpecimen();
// Example for standard invoice
$htmltooltip = ''; $htmltooltip = '';
// Example for standard invoice
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>'; $htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
$facture->type = 0; $facture->type = 0;
$nextval = $module->getNextValue($mysoc, $facture); $nextval = $module->getNextValue($mysoc, $facture);
@@ -393,21 +394,22 @@ foreach ($dirmodels as $reldir) {
$htmltooltip .= $langs->trans($module->error).'<br>'; $htmltooltip .= $langs->trans($module->error).'<br>';
} }
} }
// Example for replacement // Example for replacement invoice
$facture->type = 1; if (!getDolGlobalString('INVOICE_DISABLE_REPLACEMENT')) {
$nextval = $module->getNextValue($mysoc, $facture); $facture->type = 1;
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval $nextval = $module->getNextValue($mysoc, $facture);
$htmltooltip .= $langs->trans("NextValueForReplacements").': '; if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
if ($nextval) { $htmltooltip .= $langs->trans("NextValueForReplacements").': ';
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') { if ($nextval) {
$nextval = $langs->trans($nextval); if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
$nextval = $langs->trans($nextval);
}
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
} }
$htmltooltip .= $nextval.'<br>';
} else {
$htmltooltip .= $langs->trans($module->error).'<br>';
} }
} }
// Example for credit invoice // Example for credit invoice
$facture->type = 2; $facture->type = 2;
$nextval = $module->getNextValue($mysoc, $facture); $nextval = $module->getNextValue($mysoc, $facture);

View File

@@ -57,8 +57,16 @@ print '<tr class="oddeven"><td width="300">'.$langs->trans("DriverType").'</td><
// @phan-suppress-next-line PhanTypeSuspiciousStringExpression (user is defined in the stdClass) // @phan-suppress-next-line PhanTypeSuspiciousStringExpression (user is defined in the stdClass)
print '<tr class="oddeven"><td width="300">'.$langs->trans("User").'</td><td>'.$conf->db->user.'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("User").'</td><td>'.$conf->db->user.'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $dolibarr_main_db_pass).'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("Password").'</td><td>'.preg_replace('/./i', '*', $dolibarr_main_db_pass).'</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("DBStoringCharset").'</td><td>'.$db->getDefaultCharacterSetDatabase().'</td></tr>'."\n"; print '<tr class="oddeven"><td width="300">'.$langs->trans("DBStoringCharset").'</td><td>'.$db->getDefaultCharacterSetDatabase();
print '<tr class="oddeven"><td width="300">'.$langs->trans("DBSortingCharset").'</td><td>'.$db->getDefaultCollationDatabase().'</td></tr>'."\n"; if ($db->type == 'mysqli') {
print ' '.$form->textwithpicto('', $langs->transnoentitiesnoconv("HelpMariaDBToGetPossibleValues", "SHOW CHARACTER SET"));
}
print '</td></tr>'."\n";
print '<tr class="oddeven"><td width="300">'.$langs->trans("DBSortingCharset").'</td><td>'.$db->getDefaultCollationDatabase();
if ($db->type == 'mysqli') {
print ' '.$form->textwithpicto('', $langs->transnoentitiesnoconv("HelpMariaDBToGetPossibleValues", "SHOW COLLATION"));
}
print '</td></tr>'."\n";
print '</table>'; print '</table>';
print '</div>'; print '</div>';

View File

@@ -2573,7 +2573,7 @@ if ($action == 'create') {
$filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')"; $filtercreditnote = "fk_facture_source IS NOT NULL AND (description NOT LIKE '(DEPOSIT)%' OR description LIKE '(EXCESS RECEIVED)%')";
} }
print '<tr><td class="titlefield">'.$langs->trans('Discounts').'</td><td>'; print '<tr><td>'.$langs->trans('Discounts').'</td><td>';
$absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount); $absolute_discount = $soc->getAvailableDiscounts('', $filterabsolutediscount);
$absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote); $absolute_creditnote = $soc->getAvailableDiscounts('', $filtercreditnote);

View File

@@ -122,8 +122,10 @@ class DoliDBMysqli extends DoliDB
$disableforcecharset = 0; // Set to 1 to test without charset forcing $disableforcecharset = 0; // Set to 1 to test without charset forcing
if (empty($disableforcecharset) && $this->db->character_set_name() != $clientmustbe) { if (empty($disableforcecharset) && $this->db->character_set_name() != $clientmustbe) {
try { try {
//print "You should set the \$dolibarr_main_db_character_set and \$dolibarr_main_db_collation for the PHP to the one of the database ".$this->db->character_set_name(); //print "You should set the \$dolibarr_main_db_character_set and \$dolibarr_main_db_collation for the PHP to the one of the database, so to ".$this->db->character_set_name();
dol_syslog(get_class($this)."::DoliDBMysqli You should set the \$dolibarr_main_db_character_set and \$dolibarr_main_db_collation for the PHP to the one of the database ".$this->db->character_set_name(), LOG_WARNING); dol_syslog(get_class($this)."::DoliDBMysqli You should set the \$dolibarr_main_db_character_set and \$dolibarr_main_db_collation for the PHP to the one of the database, so to ".$this->db->character_set_name(), LOG_WARNING);
//
$this->db->set_charset($clientmustbe); // This set charset, but with a bad collation $this->db->set_charset($clientmustbe); // This set charset, but with a bad collation
} catch (Exception $e) { } catch (Exception $e) {
print 'Failed to force character_set_client to '.$clientmustbe." (according to setup) to match the one of the server database.<br>\n"; print 'Failed to force character_set_client to '.$clientmustbe." (according to setup) to match the one of the server database.<br>\n";

View File

@@ -1000,12 +1000,12 @@ function get_next_value($db, $mask, $table, $field, $where = '', $objsoc = '', $
$maskuser_value = ''; $maskuser_value = '';
} }
// Personalized field {XXX-1} à {XXX-9} // Personalized field {XXX-1} à {XXX-99}
$maskperso = array(); $maskperso = array();
$maskpersonew = array(); $maskpersonew = array();
$tmpmask = $mask; $tmpmask = $mask;
$regKey = array(); $regKey = array();
while (preg_match('/\{([A-Z]+)\-([1-9])\}/', $tmpmask, $regKey)) { while (preg_match('/\{([A-Z]+)\-([0-9]+)\}/', $tmpmask, $regKey)) {
$maskperso[$regKey[1]] = '{'.$regKey[1].'-'.$regKey[2].'}'; $maskperso[$regKey[1]] = '{'.$regKey[1].'-'.$regKey[2].'}';
// @phan-suppress-next-line PhanParamSuspiciousOrder // @phan-suppress-next-line PhanParamSuspiciousOrder
$maskpersonew[$regKey[1]] = str_pad('', (int) $regKey[2], '_', STR_PAD_RIGHT); $maskpersonew[$regKey[1]] = str_pad('', (int) $regKey[2], '_', STR_PAD_RIGHT);

View File

@@ -200,6 +200,9 @@ function dolDecrypt($chain, $key = '')
//var_dump('key='.$key); //var_dump('key='.$key);
$reg = array(); $reg = array();
if (preg_match('/^dolcrypt:([^:]+):(.+)$/', $chain, $reg)) { if (preg_match('/^dolcrypt:([^:]+):(.+)$/', $chain, $reg)) {
// Do not enable this log, except during debug
//dol_syslog("We try to decrypt the chain: ".$chain, LOG_DEBUG);
$ciphering = $reg[1]; $ciphering = $reg[1];
if (function_exists('openssl_decrypt')) { if (function_exists('openssl_decrypt')) {
if (empty($key)) { if (empty($key)) {

View File

@@ -208,7 +208,7 @@ if ($permission) {
// Prepare list // Prepare list
// TODO: replace this with direct SQL string to use $db->sort($sortfield, $sortorder) // TODO: replace this with 1 single direct SQL (for both eyernal and external string to use $db->sort($sortfield, $sortorder)
$list = array(); $list = array();
foreach (array('internal', 'external') as $source) { foreach (array('internal', 'external') as $source) {
if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) { if (($object->element == 'shipping' || $object->element == 'reception') && is_object($objectsrc)) {

View File

@@ -2555,3 +2555,4 @@ MenuDict=Dictionary
AddMoreParams=Add more parameters for connection (cookies, tokens, ...)<br> Example: token : value token AddMoreParams=Add more parameters for connection (cookies, tokens, ...)<br> Example: token : value token
ParamName=Name of parameter ParamName=Name of parameter
ParamValue=Value of parameter ParamValue=Value of parameter
HelpMariaDBToGetPossibleValues=You can get a list of possible values by running the following SQL command: %s

View File

@@ -268,6 +268,13 @@ if (GETPOST('search_usage_event_organization')) {
} }
$arrayfields['p.fk_project']['enabled'] = 0; $arrayfields['p.fk_project']['enabled'] = 0;
// Force this field to be visible
if ($contextpage == 'lead') {
$arrayfields['p.fk_opp_status']['enabled'] = 1;
$arrayfields['p.fk_opp_status']['visible'] = 1;
}
$object->fields = dol_sort_array($object->fields, 'position'); $object->fields = dol_sort_array($object->fields, 'position');
$arrayfields = dol_sort_array($arrayfields, 'position'); $arrayfields = dol_sort_array($arrayfields, 'position');
'@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan '@phan-var-force array<string,array{label:string,checked?:int<0,1>,position?:int,help?:string}> $arrayfields'; // dol_sort_array looses type for Phan