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

This commit is contained in:
Laurent Destailleur 2023-11-29 21:02:05 +01:00
commit 2eec78ccea
5 changed files with 17 additions and 6 deletions

View file

@ -953,7 +953,7 @@ while ($i < min($num, $limit)) {
if (!empty($arrayfields['t.doc_ref']['checked'])) { $colspan++; }
if (!empty($arrayfields['t.label_operation']['checked'])) { $colspan++; }
if (!empty($arrayfields['t.date_export']['checked'])) { $colspanend++; }
if (!empty($arrayfields['t.date_validating']['checked'])) { $colspanend++; }
if (!empty($arrayfields['t.date_validated']['checked'])) { $colspanend++; }
if (!empty($arrayfields['t.lettering_code']['checked'])) { $colspanend++; }
if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) {
$colspan++;

View file

@ -315,6 +315,12 @@ if (empty($reshook)) {
// Validation
$object->fetch($id);
if ((preg_match('/^[\(]?PROV/i', $object->ref) || empty($object->ref)) && // empty should not happened, but when it occurs, the test save life
!empty($conf->global->FAC_FORCE_DATE_VALIDATION) // If option enabled, we force invoice date
) {
$object->date = dol_now();
}
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
$last_of_type = $object->willBeLastOfSameType(true);
if (empty($object->date_validation) && !$last_of_type[0]) {

View file

@ -3228,6 +3228,12 @@ class Facture extends CommonInvoice
dol_syslog(get_class($this)."::validate ".$this->error.' MAIN_USE_ADVANCED_PERMS='.$conf->global->MAIN_USE_ADVANCED_PERMS, LOG_ERR);
return -1;
}
if ((preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) && // empty should not happened, but when it occurs, the test save life
!empty($conf->global->FAC_FORCE_DATE_VALIDATION) // If option enabled, we force invoice date
) {
$this->date = dol_now();
$this->date_lim_reglement = $this->calculate_date_lim_reglement();
}
if (!empty($conf->global-> INVOICE_CHECK_POSTERIOR_DATE)) {
$last_of_type = $this->willBeLastOfSameType(true);
if (!$last_of_type[0]) {
@ -3340,10 +3346,6 @@ class Facture extends CommonInvoice
if ($force_number) {
$num = $force_number;
} elseif (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref)) { // empty should not happened, but when it occurs, the test save life
if (!empty($conf->global->FAC_FORCE_DATE_VALIDATION)) { // If option enabled, we force invoice date
$this->date = dol_now();
$this->date_lim_reglement = $this->calculate_date_lim_reglement();
}
$num = $this->getNextNumRef($this->thirdparty);
} else {
$num = $this->ref;

View file

@ -585,7 +585,7 @@ class DolibarrModules // Can not be abstract, because we need to instantiate it
}
// Run complementary sql requests
$num = count($array_sql);
$num = count((array) $array_sql);
for ($i = 0; $i < $num; $i++) {
if (!$err) {
dol_syslog(get_class($this)."::_remove", LOG_DEBUG);

View file

@ -1142,6 +1142,9 @@ class User extends CommonObject
}
$sql .= " AND ur.fk_user= ".((int) $this->id);
$sql .= " AND r.perms IS NOT NULL";
if (!getDolGlobalString('MAIN_USE_ADVANCED_PERMS')) {
$sql .= " AND r.perms NOT LIKE '%_advance'"; // Hide advanced perms if option is not enabled
}
if ($moduletag) {
$sql .= " AND r.module = '".$this->db->escape($moduletag)."'";
}