Merge branch '21.0' into patch-11

This commit is contained in:
Frédéric FRANCE
2025-02-04 20:27:00 +01:00
committed by GitHub
11 changed files with 44 additions and 20 deletions

View File

@@ -477,7 +477,7 @@ if ($mode == 'show_day') {
$picto = 'calendarday';
}
if (empty($conf->dol_optimize_smallscreen)) {
$nav .= ' &nbsp; <a href="?year='.$nowyear.'&month='.$nowmonth.'&day='.$nowday.$param.'" class="datenowlink">'.$langs->trans("Today").'</a> ';
$nav .= ' <a href="?year='.$nowyear.'&month='.$nowmonth.'&day='.$nowday.$param.'" class="datenowlink marginleftonly marginrightonly">'.$langs->trans("Today").'</a> ';
}
$nav .= '</div>';
@@ -581,7 +581,6 @@ if ($user->hasRight('agenda', 'myactions', 'create') || $user->hasRight('agenda'
// Define the legend/list of calendard to show
$s = '';
$link = '';
$showextcals = $listofextcals;
@@ -726,14 +725,14 @@ if (!empty($conf->use_javascript_ajax)) { // If javascript on
if (!preg_match('/showbirthday=/i', $newparam)) {
$newparam .= '&showbirthday=1';
}
$link = '<a href="'.$_SERVER['PHP_SELF'].'?'.dol_escape_htmltag($newparam);
$link .= '">';
$s = '<a href="'.$_SERVER['PHP_SELF'].'?'.dol_escape_htmltag($newparam);
$s .= '">';
if (empty($showbirthday)) {
$link .= $langs->trans("AgendaShowBirthdayEvents");
$s .= $langs->trans("AgendaShowBirthdayEvents");
} else {
$link .= $langs->trans("AgendaHideBirthdayEvents");
$s .= $langs->trans("AgendaHideBirthdayEvents");
}
$link .= '</a>';
$s .= '</a>';
}

View File

@@ -433,7 +433,7 @@ $nav .= " <span id=\"month_name\">".dol_print_date(dol_mktime(0, 0, 0, $first_mo
$nav .= " </span>\n";
$nav .= " &nbsp; <a href=\"?year=".$next_year."&amp;month=".$next_month."&amp;day=".$next_day.$param."\"><i class=\"fa fa-chevron-right\" title=\"".dol_escape_htmltag($langs->trans("Next"))."\"></i></a>\n";
if (empty($conf->dol_optimize_smallscreen)) {
$nav .= ' &nbsp; <a href="?year='.$nowyear.'&month='.$nowmonth.'&day='.$nowday.$param.'" class="datenowlink">'.$langs->trans("Today").'</a> ';
$nav .= ' <a href="?year='.$nowyear.'&month='.$nowmonth.'&day='.$nowday.$param.'" class="datenowlink marginleftonly marginrightonly">'.$langs->trans("Today").'</a> ';
}
$nav .= '</div>';
$nav .= $form->selectDate($dateselect, 'dateselect', 0, 0, 1, '', 1, 0);

View File

@@ -334,9 +334,17 @@ if ($action == 'update' && !empty($permissiontoadd)) {
}
$object->$key = $value;
if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && (!isset($val['default']) || is_null($val['default']))) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
if ($key == 'pass_crypted' && property_exists($object, 'pass')) {
if (GETPOST("pass", "password")) { // If not provided, we do not change it. We never erase a password with empty.
$object->pass = GETPOST("pass", "password");
}
// TODO Manadatory for password not yet managed
} else {
if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && (!isset($val['default']) || is_null($val['default']))) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
}
}
// Validation of fields values

View File

@@ -300,7 +300,7 @@ if ($type == 'directory') {
// Automatic list
if (in_array($module, $automodules)) {
$param .= '&module='.$module;
$param .= '&module='.urlencode($module);
if (isset($search_doc_ref) && $search_doc_ref != '') {
$param .= '&search_doc_ref='.urlencode($search_doc_ref);
}

View File

@@ -10677,6 +10677,14 @@ abstract class CommonObject
if (array_key_exists('user_modification_id', $fieldvalues) && !($fieldvalues['user_modification_id'] > 0)) {
$fieldvalues['user_modification_id'] = $user->id;
}
if (array_key_exists('pass_crypted', $fieldvalues) && property_exists($this, 'pass') && !empty($this->pass)) {
// @phan-suppress-next-line PhanUndeclaredProperty
$tmparray = dol_hash($this->pass, '0', 0, 1);
$fieldvalues['pass_crypted'] = $tmparray['pass_encrypted'];
if (array_key_exists('pass_encoding', $fieldvalues) && property_exists($this, 'pass_encoding')) {
$fieldvalues['pass_encoding'] = $tmparray['pass_encoding'];
}
}
if (array_key_exists('ref', $fieldvalues)) {
$fieldvalues['ref'] = dol_string_nospecial($fieldvalues['ref']); // If field is a ref, we sanitize data
}

View File

@@ -250,7 +250,7 @@ function dol_dir_list($utf8_path, $types = "all", $recursive = 0, $filter = "",
* Scan a directory and return a list of files/directories.
* Content for string is UTF8 and dir separator is "/".
*
* @param string $path Starting path from which to search. Example: 'produit/MYPROD'
* @param string $path Starting path from which to search. Example: 'produit/MYPROD' or 'produit/%'
* @param string $filter Regex filter to restrict list. This regex value must be escaped for '/', since this char is used for preg_match function
* @param string[]|null $excludefilter Array of Regex for exclude filter (example: array('(\.meta|_preview.*\.png)$','^\.'))
* @param string $sortcriteria Sort criteria ("","fullname","name","date","size")
@@ -272,9 +272,9 @@ function dol_dir_list_in_database($path, $filter = "", $excludefilter = null, $s
$sql .= ", description";
}
$sql .= " FROM ".MAIN_DB_PREFIX."ecm_files";
$sql .= " WHERE entity = ".$conf->entity;
$sql .= " WHERE entity = ".((int) $conf->entity);
if (preg_match('/%$/', $path)) {
$sql .= " AND filepath LIKE '".$db->escape($path)."'";
$sql .= " AND (filepath LIKE '".$db->escape($path)."' OR filepath = '".$db->escape(preg_replace('/\/%$/', '', $path))."')";
} else {
$sql .= " AND filepath = '".$db->escape($path)."'";
}

View File

@@ -50,7 +50,7 @@ foreach ($object->fields as $key => $val) {
// Discard if field is a hidden field on form
// Ensure $val['visible'] is treated as an integer
$visible = (int) $val['visible'];
if (abs($visible) != 1 && abs($visible) != 3) {
if (abs($visible) != 1 && abs($visible) != 3 && abs($visible) != 6) {
continue;
}

View File

@@ -83,7 +83,7 @@ class MyObject extends CommonObject
* 'enabled' is a condition when the field must be managed (Example: 1 or 'getDolGlobalInt("MY_SETUP_PARAM")' or 'isModEnabled("multicurrency")' ...)
* 'position' is the sort order of field.
* 'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form (not create). 5=Visible on list and view form (not create/not update). 6=visible on list and update/view form (not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
* 'noteditable' says if field is not editable (1 or 0)
* 'alwayseditable' says if field can be modified also when status is not draft ('1' or '0')
* 'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.

View File

@@ -104,7 +104,7 @@ class SocieteAccount extends CommonObject
'pass_encoding' => array('type' => 'varchar(24)', 'label' => 'PassEncoding', 'visible' => 0, 'enabled' => 1, 'position' => 30),
'pass_crypted' => array('type' => 'password', 'label' => 'Password', 'visible' => -1, 'enabled' => 1, 'position' => 31, 'notnull' => 1),
'pass_temp' => array('type' => 'varchar(128)', 'label' => 'Temp', 'visible' => 0, 'enabled' => 0, 'position' => 32, 'notnull' => -1,),
'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'visible' => 1, 'enabled' => 1, 'position' => 40, 'notnull' => -1, 'index' => 1, 'picto' => 'company', 'css' => 'maxwidth300 widthcentpercentminusxx'),
'fk_soc' => array('type' => 'integer:Societe:societe/class/societe.class.php', 'label' => 'ThirdParty', 'visible' => -6, 'enabled' => 1, 'position' => 40, 'notnull' => -1, 'index' => 1, 'picto' => 'company', 'css' => 'maxwidth300 widthcentpercentminusxx'),
'site' => array('type' => 'varchar(128)', 'label' => 'WebsiteTypeLabel', 'visible' => 0, 'enabled' => 0, 'position' => 41, 'notnull' => 1, 'default' => '', 'help' => 'Name of the website or service if this is account on an external website or service', 'csslist' => 'tdoverflowmax150', 'arrayofkeyval' => array(/* For static analysis, filled in constructor */)),
'fk_website' => array('type' => 'integer:Website:website/class/website.class.php', 'label' => 'WebSite', 'visible' => 0, 'enabled' => 0, 'position' => 42, 'notnull' => -1, 'index' => 1, 'picto' => 'website', 'css' => 'maxwidth300 widthcentpercentminusxx', 'csslist' => 'tdoverflowmax150'),
'site_account' => array('type' => 'varchar(128)', 'label' => 'ExternalSiteAccount', 'visible' => 0, 'enabled' => 1, 'position' => 44, 'help' => 'A key to identify the account on external web site if this is an account on an external website'),
@@ -148,6 +148,10 @@ class SocieteAccount extends CommonObject
* @var string
*/
public $pass_crypted;
/**
* @var string
*/
public $pass;
/**
* @var string
*/

View File

@@ -472,10 +472,10 @@ $objecttmp = new SocieteAccount($db);
$trackid = 'thi'.$object->id;
include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
/*if ($sall)
/*if ($search_all)
{
foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val);
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $sall) . join(', ', $fieldstosearchall).'</div>';
print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all) . join(', ', $fieldstosearchall).'</div>';
}*/
$moreforfilter = '';

View File

@@ -415,6 +415,11 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea
print dolGetButtonAction('', $langs->trans('SendMail'), 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&token='.newToken().'&mode=init#formmailbeforetitle');
}
// Modify
if ($permissiontoadd) {
print dolGetButtonAction('', $langs->trans('Modify'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : '').'&action=edit&token='.newToken(), '', $permissiontoadd);
}
// Clone
if ($permissiontoadd) {
print dolGetButtonAction('', $langs->trans('ToClone'), 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid) ? '&socid='.$object->socid : '').'&action=clone&token='.newToken(), '', $permissiontoadd);