Skip to content

Commit

Permalink
Merge branch '20.0' into 20_add_fields_array_to_categories_class
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy authored Jul 25, 2024
2 parents b73258a + c7f5be1 commit 372cd8a
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 32 deletions.
1 change: 1 addition & 0 deletions dev/tools/phan/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@

'PhanCompatibleNegativeStringOffset', // return false positive
'PhanPluginConstantVariableBool', // a lot of false positive, in most cases, we want to keep the code as it is
'PhanPluginUnknownArrayPropertyType', // this option costs more time to be supported than it solves time
'PhanTypeArraySuspiciousNullable', // this option costs more time to be supported than it solves time
'PhanTypeInvalidDimOffset', // this option costs more time to be supported than it solves time
'PhanTypeObjectUnsetDeclaredProperty',
Expand Down
1 change: 1 addition & 0 deletions dev/tools/phan/config_extended.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@

'PhanCompatibleNegativeStringOffset', // return false positive
'PhanPluginConstantVariableBool', // a lot of false positive, in most cases, we want to keep the code as it is
'PhanPluginUnknownArrayPropertyType', // this option costs more time to be supported than it solves time
'PhanTypeArraySuspiciousNullable', // this option costs more time to be supported than it solves time
'PhanTypeInvalidDimOffset', // this option costs more time to be supported than it solves time
'PhanTypeObjectUnsetDeclaredProperty',
Expand Down
2 changes: 1 addition & 1 deletion htdocs/comm/action/class/actioncomm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1896,7 +1896,7 @@ public function getTypePicto($morecss = 'pictofixedwidth paddingright valignmidd
/**
* Return label of type of event
*
* @param string $mode 0=Mode short, 1=Mode long
* @param int $mode 0=Mode short, 1=Mode long
* @return string HTML String
*/
public function getTypeLabel($mode = 0)
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/class/commonobject.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ abstract class CommonObject


/**
* @var array<string,array{type:string,label:string,enabled:int<0,2>|string,position:int,notnull?:int,visible:int,noteditable?:int,default?:string,index?:int,foreignkey?:string,searchall?:int,isameasure?:int,css?:string,csslist?:string,help?:string,showoncombobox?:int,disabled?:int,arrayofkeyval?:array<int,string>,comment?:string}> Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
* @var array Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
*/
public $fields = array();

Expand Down
17 changes: 9 additions & 8 deletions htdocs/core/lib/functions.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ function getMultidirVersion($object, $module = '', $forobject = 0)
/**
* Return dolibarr global constant string value
*
* @param string $key key to return value, return $default if not set
* @param string $default value to return
* @return string
* @param string $key Key to return value, return $default if not set
* @param string|int|float $default Value to return if not defined
* @return string Value returned
* @see getDolUserString()
*/
function getDolGlobalString($key, $default = '')
Expand All @@ -236,10 +236,11 @@ function getDolGlobalInt($key, $default = 0)
/**
* Return Dolibarr user constant string value
*
* @param string $key key to return value, return '' if not set
* @param string $default value to return
* @param User $tmpuser To get another user than current user
* @param string $key Key to return value, return '' if not set
* @param string|int|float $default Value to return
* @param User $tmpuser To get another user than current user
* @return string
* @see getDolGlobalString()
*/
function getDolUserString($key, $default = '', $tmpuser = null)
{
Expand All @@ -254,8 +255,8 @@ function getDolUserString($key, $default = '', $tmpuser = null)
/**
* Return Dolibarr user constant int value
*
* @param string $key key to return value, return 0 if not set
* @param int $default value to return
* @param string $key Key to return value, return 0 if not set
* @param int $default Value to return
* @param User $tmpuser To get another user than current user
* @return int
*/
Expand Down
4 changes: 4 additions & 0 deletions htdocs/core/modules/modBom.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,10 @@ public function init($options = '')
//$result4=$extrafields->addExtraField('myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'mrp', '$conf->bom->enabled');
//$result5=$extrafields->addExtraField('myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', 0, 0, '', '', 'mrp', '$conf->bom->enabled');

$result = $this->_load_tables('/install/mysql/', 'bom');
if ($result < 0) {
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
}

// Permissions
$this->remove($options);
Expand Down
2 changes: 1 addition & 1 deletion htdocs/core/modules/modHoliday.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ public function __construct($db)
$this->export_sql_start[$r] = 'SELECT DISTINCT ';
$this->export_sql_end[$r] = ' FROM '.MAIN_DB_PREFIX.'holiday as d';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'holiday_extrafields as extra on d.rowid = extra.fk_object';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_holiday_types as t ON t.rowid = d.fk_type';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'c_holiday_types as t ON t.rowid = d.fk_type AND t.entity IN ('.getEntity('c_holiday_types').')';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user as ua ON ua.rowid = d.fk_validator,';
$this->export_sql_end[$r] .= ' '.MAIN_DB_PREFIX.'user as u';
$this->export_sql_end[$r] .= ' LEFT JOIN '.MAIN_DB_PREFIX.'user_extrafields as extrau ON u.rowid = extrau.fk_object';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1382,7 +1382,7 @@ protected function _pagehead(&$pdf, $object, $showaddress, $outputlangs)
} else {
$arrayidcontact = array_merge($object->getIdContact('external', 'CUSTOMER'), $object->getIdContact('external', 'BILLING'));
}
if (count($arrayidcontact) > 0) {
if (is_array($arrayidcontact) && count($arrayidcontact) > 0) {
$usecontact = true;
$result = $object->fetch_contact($arrayidcontact[0]);
}
Expand Down
7 changes: 4 additions & 3 deletions htdocs/holiday/class/holiday.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -755,7 +755,7 @@ public function validate($user = null, $notrigger = 0)
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
$error = 0;

$checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type);
$checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type, true);

if ($checkBalance > 0) {
$balance = $this->getCPforUser($this->fk_user, $this->fk_type);
Expand Down Expand Up @@ -878,7 +878,7 @@ public function approve($user = null, $notrigger = 0)
{
$error = 0;

$checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type);
$checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type, true);

if ($checkBalance > 0) {
$balance = $this->getCPforUser($this->fk_user, $this->fk_type);
Expand Down Expand Up @@ -1006,7 +1006,7 @@ public function update($user = null, $notrigger = 0)
global $conf, $langs;
$error = 0;

$checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type);
$checkBalance = getDictionaryValue('c_holiday_types', 'block_if_negative', $this->fk_type, true);

if ($checkBalance > 0 && $this->status != self::STATUS_DRAFT) {
$balance = $this->getCPforUser($this->fk_user, $this->fk_type);
Expand Down Expand Up @@ -2277,6 +2277,7 @@ public function getTypes($active = -1, $affect = -1)
$sql = "SELECT rowid, code, label, affect, delay, newbymonth";
$sql .= " FROM ".MAIN_DB_PREFIX."c_holiday_types";
$sql .= " WHERE (fk_country IS NULL OR fk_country = ".((int) $mysoc->country_id).')';
$sql .= " AND entity IN (".getEntity('c_holiday_types').")";
if ($active >= 0) {
$sql .= " AND active = ".((int) $active);
}
Expand Down
3 changes: 1 addition & 2 deletions htdocs/install/mysql/migration/19.0.0-20.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,5 @@ UPDATE llx_c_units SET short_label = 'mn' WHERE short_label = 'i' AND code = 'MI

-- missing entity field
ALTER TABLE llx_c_holiday_types DROP INDEX uk_c_holiday_types;
ALTER TABLE llx_socpeople ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
ALTER TABLE llx_c_holiday_types ADD COLUMN entity integer DEFAULT 1 NOT NULL AFTER rowid;
ALTER TABLE llx_c_holiday_types ADD UNIQUE INDEX uk_c_holiday_types (entity, code);

4 changes: 2 additions & 2 deletions htdocs/main.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2681,7 +2681,7 @@ function top_menu_user($hideloginname = 0, $urllogout = '')
$btnUser = '<!-- div for user link text browser -->
<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="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>' : '').'
'.$userImage.(empty($user->photo) ? '<span class="hidden-xs maxwidth200 atoploginusername hideonsmartphone paddingleft small valignmiddle">'.dol_trunc($user->firstname ? $user->firstname : $user->login, 10).'</span>' : '').'
</a>
</div>';
}
Expand Down Expand Up @@ -3091,7 +3091,7 @@ function top_menu_bookmark()
}

/**
* Build the tooltip on top menu tsearch
* Build the tooltip on top menu search
*
* @return string HTML content
*/
Expand Down
5 changes: 3 additions & 2 deletions htdocs/product/card.php
Original file line number Diff line number Diff line change
Expand Up @@ -2121,7 +2121,7 @@
// Description (used in invoice, propal...)
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td>';

// We use dolibarr_details as type of DolEditor here, because we must not accept images as description is included into PDF and not accepted by TCPDF.
// We use dolibarr_details as type of DolEditor here, because we must not accept images, as description is included into PDF and external links are not accepted by TCPDF.
$doleditor = new DolEditor('desc', GETPOSTISSET('desc') ? GETPOST('desc', 'restricthtml') : $object->description, '', 160, 'dolibarr_details', '', false, true, getDolGlobalInt('FCKEDITOR_ENABLE_DETAILS'), ROWS_4, '90%');
$doleditor->Create();

Expand Down Expand Up @@ -2643,7 +2643,8 @@
}

// Description
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td><td class="wordbreakimp wrapimp">'.(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)).'</td></tr>';
print '<tr><td class="tdtop">'.$langs->trans("Description").'</td>';
print '<td class="wordbreakimp wrapimp"><div class="longmessagecut">'.(dol_textishtml($object->description) ? $object->description : dol_nl2br($object->description, 1, true)).'</div></td></tr>';

// Public URL
if (!getDolGlobalString('PRODUCT_DISABLE_PUBLIC_URL')) {
Expand Down
21 changes: 13 additions & 8 deletions htdocs/theme/eldy/global.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,7 @@
.minwidth75 { min-width: 75px; }
.nominwidth { min-width: fit-content !important; }
/* rule for not too small screen only */
@media only screen and (min-width: <?php echo !getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC3') ? round($nbtopmenuentries * 47, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) /* reduction 3 */
@media only screen and (min-width: <?php echo getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC3', round($nbtopmenuentries * 47, 0) + 130); ?>px) /* reduction 3 */
{
.width20 { width: 20px; }
.width25 { width: 25px; }
Expand Down Expand Up @@ -2334,8 +2334,9 @@
}


/* rule to reduce top menu - 3rd reduction: The menu for user is on left */
@media only screen and (max-width: <?php echo !getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC3') ? round($nbtopmenuentries * 47, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) /* reduction 3 */
/* rule to reduce top menu - 3rd reduction: We hide the left menu */
<?php if (!getDolUserInt('MAIN_OPTIMIZEFORTEXTBROWSER')) { ?>
@media only screen and (max-width: <?php echo getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC3', round($nbtopmenuentries * 47, 0) + 130); ?>px) /* reduction 3 */
{
/* no side-nav */
body.sidebar-collapse .side-nav {
Expand Down Expand Up @@ -2392,13 +2393,14 @@
}
}

@media only screen and (min-width: 768px) and (max-width: <?php echo !getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC3') ? round($nbtopmenuentries * 47, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) /* reduction 3 */
@media only screen and (min-width: 768px) and (max-width: <?php echo getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC3', round($nbtopmenuentries * 47, 0) + 130); ?>px) /* reduction 3 */
{
div.fiche {
margin-<?php print $left; ?>: 13px !important;
margin-<?php print $right; ?>: 14px !important;
}
}
<?php } ?>


div.fiche {
Expand Down Expand Up @@ -8190,7 +8192,7 @@

/* nboftopmenuentries = <?php echo $nbtopmenuentries ?>, fontsize=<?php echo is_numeric($fontsize) ? $fontsize.'px' : $fontsize ?> */
/* rule to reduce top menu - 1st reduction: Reduce width of top menu icons */
@media only screen and (max-width: <?php echo !getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC1') ? round($nbtopmenuentries * 90, 0) + 340 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC1; ?>px) /* reduction 1 */
@media only screen and (max-width: <?php echo getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC1', round($nbtopmenuentries * 90, 0) + 340); ?>px) /* reduction 1 */
{
div.tmenucenter {
width: <?php echo round(52); ?>px; /* size of viewport */
Expand Down Expand Up @@ -8230,7 +8232,7 @@
}
}
/* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again (<?php echo $nbtopmenuentries ?> menu entries) */
@media only screen and (max-width: <?php echo !getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC2') ? round($nbtopmenuentries * 69, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2; ?>px) /* reduction 2 */
@media only screen and (max-width: <?php echo getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC2', round($nbtopmenuentries * 69, 0) + 130); ?>px) /* reduction 2 */
{
li.tmenucompanylogo {
display: none;
Expand Down Expand Up @@ -8260,8 +8262,9 @@
max-width: 300px;
}
}
/* rule to reduce top menu - 3rd reduction: The menu for user is on left */
@media only screen and (max-width: <?php echo !getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC3') ? round($nbtopmenuentries * 47, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px) /* reduction 3 */
/* rule to reduce top menu - 3rd reduction: The menu for user is now on left */
<?php if (!getDolUserInt('MAIN_OPTIMIZEFORTEXTBROWSER')) { ?>
@media only screen and (max-width: <?php echo getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC3', round($nbtopmenuentries * 47, 0) + 130); ?>px) /* reduction 3 */
{
<?php if (getDolGlobalInt('THEME_TOPMENU_DISABLE_IMAGE') == 2) { ?>
.tmenudiv:hover .tmenuimage:not(.menuhider), .tmenudiv:hover .tmenuimage:not(.menuhider):before {
Expand Down Expand Up @@ -8446,6 +8449,8 @@
margin-top: 30px;
}
}
<?php } ?>


@media only screen and (max-width: 320px)
{
Expand Down
6 changes: 3 additions & 3 deletions htdocs/theme/md/style.css.php
Original file line number Diff line number Diff line change
Expand Up @@ -1961,7 +1961,7 @@
.minwidth75 { min-width: 75px; }
.nominwidth { min-width: fit-content !important; }
/* rule for not too small screen only */
@media only screen and (min-width: <?php echo !getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC3') ? round($nbtopmenuentries * 47, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC3; ?>px)
@media only screen and (min-width: <?php echo getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC3', round($nbtopmenuentries * 47, 0) + 130); ?>px)
{
.width20 { width: 20px; }
.width25 { width: 25px; }
Expand Down Expand Up @@ -8094,7 +8094,7 @@

/* nboftopmenuentries = <?php echo $nbtopmenuentries ?>, fontsize=<?php echo is_numeric($fontsize) ? $fontsize.'px' : $fontsize ?> */
/* rule to reduce top menu - 1st reduction: Reduce width of top menu icons */
@media only screen and (max-width: <?php echo !getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC1') ? round($nbtopmenuentries * 90, 0) + 340 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC1; ?>px) /* reduction 1 */
@media only screen and (max-width: <?php echo getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC1', round($nbtopmenuentries * 90, 0) + 340); ?>px) /* reduction 1 */
{
div.tmenucenter {
max-width: 56px; /* size of viewport */
Expand Down Expand Up @@ -8123,7 +8123,7 @@
}
}
/* rule to reduce top menu - 2nd reduction: Reduce width of top menu icons again */
@media only screen and (max-width: <?php echo !getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC2') ? round($nbtopmenuentries * 69, 0) + 130 : $conf->global->THEME_ELDY_WITDHOFFSET_FOR_REDUC2; ?>px) /* reduction 2 */
@media only screen and (max-width: <?php echo getDolGlobalString('THEME_ELDY_WITDHOFFSET_FOR_REDUC2', round($nbtopmenuentries * 69, 0) + 130); ?>px) /* reduction 2 */
{
li.tmenucompanylogo {
display: none;
Expand Down

0 comments on commit 372cd8a

Please sign in to comment.