Skip to content

Commit

Permalink
Merge branch 'develop' of [email protected]:Dolibarr/dolibarr.git into
Browse files Browse the repository at this point in the history
develop
  • Loading branch information
eldy committed Apr 8, 2024
2 parents bc8e4c1 + 40815ec commit 0a48d1a
Show file tree
Hide file tree
Showing 10 changed files with 97 additions and 44 deletions.
9 changes: 6 additions & 3 deletions htdocs/categories/class/categorie.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
* Copyright (C) 2015 Raphaël Doursenaud <[email protected]>
* Copyright (C) 2016 Charlie Benke <[email protected]>
* Copyright (C) 2018-2024 Frédéric France <[email protected]>
* Copyright (C) 2023 Benjamin Falière <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
* Copyright (C) 2023-2024 Benjamin Falière <[email protected]>
* Copyright (C) 2024 MDW <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -1167,6 +1167,7 @@ public function get_full_arbo($type, $markafterid = 0, $include = 0)
}

$this->cats = array();
$nbcateg = 0;

// Init this->motherof that is array(id_son=>id_parent, ...)
$this->load_motherof();
Expand All @@ -1188,6 +1189,8 @@ public function get_full_arbo($type, $markafterid = 0, $include = 0)
$resql = $this->db->query($sql);
if ($resql) {
$i = 0;
$nbcateg = $this->db->num_rows($resql);

while ($obj = $this->db->fetch_object($resql)) {
$this->cats[$obj->rowid]['rowid'] = $obj->rowid;
$this->cats[$obj->rowid]['id'] = $obj->rowid;
Expand All @@ -1210,7 +1213,7 @@ public function get_full_arbo($type, $markafterid = 0, $include = 0)
dol_syslog(get_class($this)."::get_full_arbo call to buildPathFromId", LOG_DEBUG);
foreach ($this->cats as $key => $val) {
//print 'key='.$key.'<br>'."\n";
$this->buildPathFromId($key, 0); // Process a branch from the root category key (this category has no parent)
$this->buildPathFromId($key, $nbcateg); // Process a branch from the root category key (this category has no parent)
}

// Include or exclude leaf including $markafterid from tree
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/actions_addupdatedelete.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
}

$object->$key = $value;
if ($val['notnull'] > 0 && $object->$key == '' && is_null($val['default'])) {
if ($val['notnull'] > 0 && $object->$key == '' && (!isset($val['default']) || is_null($val['default']))) {
$error++;
setEventMessages($langs->trans("ErrorFieldRequired", $langs->transnoentitiesnoconv($val['label'])), null, 'errors');
}
Expand Down
1 change: 1 addition & 0 deletions htdocs/core/class/extrafields.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ public function update($attrname, $label, $type, $length, $elementtype, $unique
$lengthdb = '255';
} elseif ($type == 'html') {
$typedb = 'text';
$lengthdb = $length;
} elseif ($type == 'link') {
$typedb = 'int';
$lengthdb = '11';
Expand Down
6 changes: 5 additions & 1 deletion htdocs/core/class/html.formwebsite.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,17 @@ public function selectTypeOfContainer($htmlname, $selected = '', $useempty = 0,

while ($i < $num) {
$obj = $this->db->fetch_object($result);

if ($selected == $obj->rowid || $selected == $obj->code) {
print '<option value="'.$obj->code.'" selected>';
} else {
print '<option value="'.$obj->code.'">';
}
print $langs->trans($obj->label);
print '</option>';

$conf->cache['type_of_container'][$obj->code] = $obj->label;

$i++;
}
print "</select>";
Expand Down Expand Up @@ -170,7 +174,7 @@ public function selectTypeOfContainer($htmlname, $selected = '', $useempty = 0,
*/
public function selectSampleOfContainer($htmlname, $selected = '', $useempty = 0, $moreattrib = '', $addjscombo = 0, $morecss = 'minwidth200')
{
global $langs, $conf, $user;
global $langs, $user;

$langs->load("admin");

Expand Down
2 changes: 1 addition & 1 deletion htdocs/langs/zh_CN/other.lang
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ DemoCompanyManufacturing=Company manufacturing products
DemoCompanyAll=公司有多项活动(所有主要模块)
CreatedBy=创建者 %s
ModifiedBy=修改者 %s
ValidatedBy=由%验证s
ValidatedBy=由%s验证
SignedBy=Signed by %s
ClosedBy=由%闭s
CreatedById=创建的用户ID号
Expand Down
15 changes: 7 additions & 8 deletions htdocs/main.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2576,8 +2576,8 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
if (!getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER')) {
$btnUser = '<!-- div for user link -->
<div id="topmenu-login-dropdown" class="userimg atoplogin dropdown user user-menu inline-block">
<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="dropdown-toggle login-dropdown-a" data-toggle="dropdown">
'.$userImage.(empty($user->photo) ? '<span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone paddingleft">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).'</span>' : '').'
<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="dropdown-toggle login-dropdown-a valignmiddle" data-toggle="dropdown">
'.$userImage.(empty($user->photo) ? '<span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone paddingleft valignmiddle small">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).'</span>' : '').'
</a>
<div class="dropdown-menu">
<!-- User image -->
Expand Down Expand Up @@ -2623,10 +2623,9 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
} else {
$btnUser = '<!-- div for user link -->
<div id="topmenu-login-dropdown" class="userimg atoplogin dropdown user user-menu inline-block">
<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" alt="'.$langs->trans("MyUserCard").'">
'.$userImage.'
<span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).'</span>
</a>
<a href="'.DOL_URL_ROOT.'/user/card.php?id='.$user->id.'" class="valignmiddle" alt="'.$langs->trans("MyUserCard").'">
'.$userImage.(empty($user->photo) ? '<span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone paddingleft small">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).'</span>' : '').'
</a>
</div>';
}

Expand All @@ -2649,7 +2648,7 @@ function closeTopMenuLoginDropdown() {
';


if ($conf->theme != 'md') {
//if ($conf->theme != 'md') {
$btnUser .= '
jQuery("#topmenu-login-dropdown .dropdown-toggle").on("click", function(event) {
console.log("Click on #topmenu-login-dropdown .dropdown-toggle");
Expand All @@ -2666,7 +2665,7 @@ function closeTopMenuLoginDropdown() {
console.log("Click on #topmenuloginmoreinfo-btn");
jQuery("#topmenuloginmoreinfo").slideToggle();
});';
}
//}

$btnUser .= '
});
Expand Down
6 changes: 6 additions & 0 deletions htdocs/theme/eldy/global.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -3169,6 +3169,12 @@
color: var(--colortextbackhmenu);
display: inline-block;
}
div.login_block a .atoploginusername {
display: inline-block;
overflow: hidden;
max-width: 60px;
text-overflow: ellipsis;
}
div.login_block span.aversion {
color: var(--colortextbackhmenu);
filter: contrast(0.7);
Expand Down
13 changes: 9 additions & 4 deletions htdocs/theme/md/dropdown.inc.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<?php
if (!defined('ISLOADEDBYSTEELSHEET')) {
die('Must be call by steelsheet');
} ?>
}

// When no photo, we show the login name, so we need an offset to output picto at a fixed position.
$atoploginusername = empty($user->photo) ? 52 : 0;

?>
/* <style type="text/css" > don't remove this line it's an ide hack */
/*
* Dropdown of user popup
Expand All @@ -27,17 +32,17 @@

div#topmenu-global-search-dropdown {
position: fixed;
<?php echo $right; ?>: 125px;
<?php echo $right; ?>: <?php echo (125 + $atoploginusername); ?>px;
top: 0px;
}
div#topmenu-quickadd-dropdown {
position: fixed;
<?php echo $right; ?>: 90px;
<?php echo $right; ?>: <?php echo (90 + $atoploginusername); ?>px;
top: 0px;
}
div#topmenu-bookmark-dropdown {
position: fixed;
<?php echo $right; ?>: <?php print empty($user->conf->MAIN_OPTIMIZEFORTEXTBROWSER) ? 55 : 85; ?>px;
<?php echo $right; ?>: <?php print !getDolGlobalString('MAIN_OPTIMIZEFORTEXTBROWSER') ? (55 + $atoploginusername) : 85; ?>px;
top: 0px;
}
div#topmenu-login-dropdown {
Expand Down
7 changes: 7 additions & 0 deletions htdocs/theme/md/style.css.php
Original file line number Diff line number Diff line change
Expand Up @@ -3259,6 +3259,13 @@
color: var(--colortexthmenu);
display: inline-block;
}
div.login_block a .atoploginusername {
color: var(--colortextbackhmenu);
display: inline-block;
overflow: hidden;
max-width: 50px;
text-overflow: ellipsis;
}
div.login_block span.aversion {
color: var(--colortexthmenu);
filter: contrast(0.7);
Expand Down
80 changes: 54 additions & 26 deletions htdocs/website/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4957,6 +4957,8 @@ function switchEditorOnline(forceenable)
print getTitleFieldOfList("Categories", 0, $_SERVER['PHP_SELF']);
print getTitleFieldOfList("Language", 0, $_SERVER['PHP_SELF'], 'lang', '', $param, '', $sortfield, $sortorder, 'center ')."\n";
print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']);
print getTitleFieldOfList("UserCreation", 0, $_SERVER['PHP_SELF'], 'fk_user_creat', '', $param, '', $sortfield, $sortorder, '')."\n";
print getTitleFieldOfList("DateCreation", 0, $_SERVER['PHP_SELF'], 'date_creation', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; // Date creation
print getTitleFieldOfList("DateLastModification", 0, $_SERVER['PHP_SELF'], 'tms', '', $param, '', $sortfield, $sortorder, 'center ')."\n"; // Date last modif
print getTitleFieldOfList("", 0, $_SERVER['PHP_SELF']);
print getTitleFieldOfList($selectedfields, 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
Expand All @@ -4969,21 +4971,37 @@ function switchEditorOnline(forceenable)

foreach ($listofpages['list'] as $answerrecord) {
if (is_object($answerrecord) && get_class($answerrecord) == 'WebsitePage') {
$param = '?mode=replacesite';
$param .= '&websiteid='.$website->id;
$param .= '&optioncontent='.GETPOST('optioncontent', 'aZ09');
$param .= '&optionmeta='.GETPOST('optionmeta', 'aZ09');
$param .= '&optionsitefiles='.GETPOST('optionsitefiles', 'aZ09');
$param .= '&optioncontainertype='.GETPOST('optioncontainertype', 'aZ09');
$param .= '&optionlanguage='.GETPOST('optionlanguage', 'aZ09');
$param .= '&optioncategory='.GETPOST('optioncategory', 'aZ09');
$param .= '&searchstring='.urlencode($searchkey);

print '<tr>';

// Type of container
print '<td class="nowraponall">'.$langs->trans("Container").' - ';
print $langs->trans($answerrecord->type_container); // TODO Use label of container
print '<td class="nowraponall">';
//print $langs->trans("Container").'<br>';
if (!empty($conf->cache['type_of_container'][$answerrecord->type_container])) {
print $langs->trans($conf->cache['type_of_container'][$answerrecord->type_container]);
} else {
print $langs->trans($answerrecord->type_container);
}
print '</td>';

// Container url and label
print '<td>';
$titleofpage = ($answerrecord->title ? $answerrecord->title : $langs->trans("NoTitle"));
print '<td class="tdoverflowmax300" title="'.dol_escape_htmltag($titleofpage).'">';
print $answerrecord->getNomUrl(1);
print ' <span class="opacitymedium">('.($answerrecord->title ? $answerrecord->title : $langs->trans("NoTitle")).')</span>';
print ' <span class="opacitymedium">('.dol_escape_htmltag($titleofpage).')</span>';
//print '</td>';
//print '<td class="tdoverflow100">';
print '<br>';
print '<span class="opacitymedium">'.$answerrecord->description.'</span>';
print '<span class="opacitymedium">'.dol_escape_htmltag($answerrecord->description ? $answerrecord->description : '&nbsp;').'</span>';
print '</td>';

// Categories - Tags
Expand All @@ -5001,17 +5019,6 @@ function switchEditorOnline(forceenable)
//var_dump($existing);
print '</td>';


$param = '?mode=replacesite';
$param .= '&websiteid='.$website->id;
$param .= '&optioncontent='.GETPOST('optioncontent', 'aZ09');
$param .= '&optionmeta='.GETPOST('optionmeta', 'aZ09');
$param .= '&optionsitefiles='.GETPOST('optionsitefiles', 'aZ09');
$param .= '&optioncontainertype='.GETPOST('optioncontainertype', 'aZ09');
$param .= '&optionlanguage='.GETPOST('optionlanguage', 'aZ09');
$param .= '&optioncategory='.GETPOST('optioncategory', 'aZ09');
$param .= '&searchstring='.urlencode($searchkey);

// Language
print '<td class="center">';
print picto_from_langcode($answerrecord->lang, $answerrecord->lang);
Expand All @@ -5028,6 +5035,25 @@ function switchEditorOnline(forceenable)
}
print '</td>';

// Author
print '<td class="tdoverflowmax125">';
if (!empty($answerrecord->fk_user_creat)) {
if (empty($conf->cache['user'][$answerrecord->fk_user_creat])) {
$tmpuser = new User($db);
$tmpuser->fetch($answerrecord->fk_user_creat);
$conf->cache['user'][$answerrecord->fk_user_creat] = $tmpuser;
} else {
$tmpuser = $conf->cache['user'][$answerrecord->fk_user_creat];
}
print $tmpuser->getNomUrl(-1, '', 0, 0, 0, 0, 'login');
}
print '</td>';

// Date creation
print '<td class="center nowraponall">';
print dol_print_date($answerrecord->date_creation, 'dayhour');
print '</td>';

// Date last modification
print '<td class="center nowraponall">';
print dol_print_date($answerrecord->date_modification, 'dayhour');
Expand Down Expand Up @@ -5071,6 +5097,16 @@ function switchEditorOnline(forceenable)

print '</tr>';
} else {
$param = '?mode=replacesite';
$param .= '&websiteid='.$website->id;
$param .= '&optioncontent='.GETPOST('optioncontent', 'aZ09');
$param .= '&optionmeta='.GETPOST('optionmeta', 'aZ09');
$param .= '&optionsitefiles='.GETPOST('optionsitefiles', 'aZ09');
$param .= '&optioncontainertype='.GETPOST('optioncontainertype', 'aZ09');
$param .= '&optionlanguage='.GETPOST('optionlanguage', 'aZ09');
$param .= '&optioncategory='.GETPOST('optioncategory', 'aZ09');
$param .= '&searchstring='.urlencode($searchkey);

print '<tr>';

// Type of container
Expand All @@ -5084,23 +5120,15 @@ function switchEditorOnline(forceenable)
'website_readme' => 'WEBSITE_README',
'website_manifestjson' => 'WEBSITE_MANIFEST_JSON'
);
print '<span class="opacitymedium">';
if (!empty($translateofrecordtype[$answerrecord['type']])) {
print $langs->trans($translateofrecordtype[$answerrecord['type']]);
} else {
print $answerrecord['type'];
}
print '</span>';
print '</td>';

$param = '?mode=replacesite';
$param .= '&websiteid='.$website->id;
$param .= '&optioncontent='.GETPOST('optioncontent', 'aZ09');
$param .= '&optionmeta='.GETPOST('optionmeta', 'aZ09');
$param .= '&optionsitefiles='.GETPOST('optionsitefiles', 'aZ09');
$param .= '&optioncontainertype='.GETPOST('optioncontainertype', 'aZ09');
$param .= '&optionlanguage='.GETPOST('optionlanguage', 'aZ09');
$param .= '&optioncategory='.GETPOST('optioncategory', 'aZ09');
$param .= '&searchstring='.urlencode($searchkey);

// Container url and label
print '<td>';
$backtopageurl = $_SERVER["PHP_SELF"].$param;
Expand Down

0 comments on commit 0a48d1a

Please sign in to comment.