2
0
forked from Wavyzz/dolibarr

Update functions.lib.php

FIX : Duplicate entry in array
FIX : Unasigned variable
FIX : Type mismatch
FIX : Wrong variable
This commit is contained in:
fr69400
2021-10-26 15:27:12 +02:00
parent 34187d53f6
commit e4b3dda7f0

View File

@@ -2390,7 +2390,7 @@ function dol_print_date($time, $format = '', $tzoutput = 'auto', $outputlangs =
// Analyze date
$reg = array();
if (preg_match('/^([0-9][0-9][0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])([0-9][0-9])$/i', $time, $reg)) { // Deprecated. Ex: 1970-01-01, 1970-01-01 01:00:00, 19700101010000
dol_print_error("Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]);
dol_print_error('',"Functions.lib::dol_print_date function called with a bad value from page ".$_SERVER["PHP_SELF"]);
return '';
} elseif (preg_match('/^([0-9]+)\-([0-9]+)\-([0-9]+) ?([0-9]+)?:?([0-9]+)?:?([0-9]+)?/i', $time, $reg)) { // Still available to solve problems in extrafields of type date
// This part of code should not be used anymore.
@@ -3659,9 +3659,9 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'member'=>'user-alt', 'meeting'=>'chalkboard-teacher', 'mrp'=>'cubes', 'next'=>'arrow-alt-circle-right',
'trip'=>'wallet', 'expensereport'=>'wallet', 'group'=>'users', 'movement'=>'people-carry',
'sign-out'=>'sign-out-alt',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star', 'bookmark'=>'star',
'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'edit'=>'pencil-alt', 'filter'=>'filter',
'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarmonth'=>'calendar-alt', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table',
'switch_off'=>'toggle-off', 'switch_on'=>'toggle-on', 'switch_on_red'=>'toggle-on', 'check'=>'check', 'bookmark'=>'star',
'bank'=>'university', 'close_title'=>'times', 'delete'=>'trash', 'filter'=>'filter',
'list-alt'=>'list-alt', 'calendar'=>'calendar-alt', 'calendarmonth'=>'calendar-alt', 'calendarweek'=>'calendar-week', 'calendarday'=>'calendar-day', 'calendarperuser'=>'table',
'intervention'=>'ambulance', 'invoice'=>'file-invoice-dollar', 'multicurrency'=>'dollar-sign', 'order'=>'file-invoice',
'error'=>'exclamation-triangle', 'warning'=>'exclamation-triangle',
'other'=>'square',
@@ -3671,7 +3671,7 @@ function img_picto($titlealt, $picto, $moreatt = '', $pictoisfullpath = false, $
'resize'=>'crop', 'supplier_order'=>'dol-order_supplier', 'supplier_proposal'=>'file-signature',
'refresh'=>'redo', 'region'=>'map-marked', 'resource'=>'laptop-house',
'state'=>'map-marked-alt', 'security'=>'key', 'salary'=>'wallet', 'shipment'=>'dolly', 'stock'=>'box-open', 'stats' => 'chart-bar', 'split'=>'code-branch', 'stripe'=>'stripe-s',
'supplier'=>'building', 'supplier_invoice'=>'file-invoice-dollar', 'technic'=>'cogs', 'ticket'=>'ticket-alt',
'supplier'=>'building', 'technic'=>'cogs',
'timespent'=>'clock', 'title_setup'=>'tools', 'title_accountancy'=>'money-check-alt', 'title_bank'=>'university', 'title_hrm'=>'umbrella-beach',
'title_agenda'=>'calendar-alt',
'uncheck'=>'times', 'uparrow'=>'share', 'vcard'=>'address-card',
@@ -4462,7 +4462,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss
$result = ($nodiv ? '' : '<div class="'.$class.' hideonsmartphone'.($morecss ? ' '.$morecss : '').($textfordropdown ? ' hidden' : '').'">').'<span class="fa fa-info-circle" title="'.dol_escape_htmltag($admin ? $langs->trans('InfoAdmin') : $langs->trans('Note')).'"></span> '.$text.($nodiv ? '' : '</div>');
if ($textfordropdown) {
$tmpresult .= '<span class="'.$class.'text opacitymedium cursorpointer">'.$langs->trans($textfordropdown).' '.img_picto($langs->trans($textfordropdown), '1downarrow').'</span>';
$tmpresult = '<span class="'.$class.'text opacitymedium cursorpointer">'.$langs->trans($textfordropdown).' '.img_picto($langs->trans($textfordropdown), '1downarrow').'</span>';
$tmpresult .= '<script type="text/javascript" language="javascript">
jQuery(document).ready(function() {
jQuery(".'.$class.'text").click(function() {
@@ -4485,7 +4485,7 @@ function info_admin($text, $infoonimgalt = 0, $nodiv = 0, $admin = '1', $morecss
* This function must be called when a blocking technical error is encountered.
* However, one must try to call it only within php pages, classes must return their error through their property "error".
*
* @param DoliDB $db Database handler
* @param DoliDB? $db Database handler
* @param string|string[] $error String or array of errors strings to show
* @param array $errors Array of errors
* @return void
@@ -4813,7 +4813,6 @@ function getTitleFieldOfList($name, $thead = 0, $file = "", $field = "", $begin
* Show a title.
*
* @param string $title Title to show
* @return string Title to show
* @deprecated Use load_fiche_titre instead
* @see load_fiche_titre()
*/
@@ -5180,7 +5179,7 @@ function vatrate($rate, $addpercent = false, $info_bits = 0, $usestarfornpr = 0)
*
* @param float $amount Amount to format
* @param integer $form Type of format, HTML or not (not by default)
* @param Translate $outlangs Object langs for output
* @param Translate? $outlangs Object langs for output
* @param int $trunc 1=Truncate if there is more decimals than MAIN_MAX_DECIMALS_SHOWN (default), 0=Does not truncate. Deprecated because amount are rounded (to unit or total amount accurancy) before beeing inserted into database or after a computation, so this parameter should be useless.
* @param int $rounding Minimum number of decimal to show. If 0, no change, if -1, we use min($conf->global->MAIN_MAX_DECIMALS_UNIT,$conf->global->MAIN_MAX_DECIMALS_TOT)
* @param int $forcerounding Force the number of decimal to forcerounding decimal (-1=do not force)
@@ -5839,7 +5838,7 @@ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournpric
$ret .= ' ('.$obj->default_vat_code.')';
}
}
$db->free($sql);
$db->free($resql);
} else {
dol_print_error($db);
}
@@ -8804,7 +8803,6 @@ function dolExplodeIntoArray($string, $delimiter = ';', $kv = '=')
* Set focus onto field with selector (similar behaviour of 'autofocus' HTML5 tag)
*
* @param string $selector Selector ('#id' or 'input[name="ref"]') to use to find the HTML input field that must get the autofocus. You must use a CSS selector, so unique id preceding with the '#' char.
* @return string HTML code to set focus
*/
function dol_set_focus($selector)
{