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

This commit is contained in:
Laurent Destailleur 2022-10-24 19:41:04 +02:00
commit 257e7f2191
3 changed files with 18 additions and 14 deletions

View File

@ -2426,9 +2426,10 @@ class Form
* @param string $morecss Add more css on select * @param string $morecss Add more css on select
* @param string $nooutput No print, return the output into a string * @param string $nooutput No print, return the output into a string
* @param int $forcecombo Force to use combo box * @param int $forcecombo Force to use combo box
* @param array $TProducts Add filter on a defined product
* @return void|string * @return void|string
*/ */
public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 1, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0) public function select_bom($selected = '', $htmlname = 'bom_id', $limit = 0, $status = 1, $type = 0, $showempty = '1', $morecss = '', $nooutput = '', $forcecombo = 0, $TProducts = [])
{ {
// phpcs:enable // phpcs:enable
global $conf, $user, $langs, $db; global $conf, $user, $langs, $db;
@ -2450,8 +2451,9 @@ class Form
$sql.= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b'; $sql.= ' FROM '.MAIN_DB_PREFIX.'bom_bom as b';
$sql.= ' WHERE b.entity IN ('.getEntity('bom').')'; $sql.= ' WHERE b.entity IN ('.getEntity('bom').')';
if (!empty($status)) $sql.= ' AND status = '. (int) $status; if (!empty($status)) $sql.= ' AND status = '. (int) $status;
if (!empty($type)) $sql.= ' AND status = '. (int) $type; if (!empty($type)) $sql.= ' AND bomtype = '. (int) $type;
if (!empty($limit)) $sql.= 'LIMIT '. (int) $limit; if (!empty($TProducts)) $sql .= ' AND fk_product IN ('.$this->db->sanitize(implode(',', $TProducts)).')';
if (!empty($limit)) $sql.= ' LIMIT '. (int) $limit;
$resql = $db->query($sql); $resql = $db->query($sql);
if ($resql) { if ($resql) {
if ($showempty) { if ($showempty) {
@ -2462,8 +2464,9 @@ class Form
while ($obj = $db->fetch_object($resql)) { while ($obj = $db->fetch_object($resql)) {
$product = new Product($db); $product = new Product($db);
$res = $product->fetch($obj->fk_product); $res = $product->fetch($obj->fk_product);
if ($obj->rowid == $selected) $out .= '<option value="'.$obj->rowid.'" selected>'.$obj->ref.' - '. $product->label .' - '.$obj->label.'</option>'; $out .= '<option value="'.$obj->rowid.'"';
$out .= '<option value="'.$obj->rowid.'">'.$obj->ref.' - '.$product->label .' - '. $obj->label.'</option>'; if ($obj->rowid == $selected) $out .= 'selected';
$out .= '>'.$obj->ref.' - '.$product->label .' - '. $obj->label.'</option>';
} }
} else { } else {
$error++; $error++;

View File

@ -1226,13 +1226,14 @@ function projectLinesPerAction(&$inc, $parent, $fuser, $lines, &$level, &$projec
print convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin'); print convertSecondToTime($lines[$i]->timespent_duration, 'allhourmin');
$modeinput = 'hours'; // Comment for avoid unnecessary multiple calculation
/*$modeinput = 'hours';
print '<script type="text/javascript">'; print '<script type="text/javascript">';
print "jQuery(document).ready(function () {\n"; print "jQuery(document).ready(function () {\n";
print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });"; print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });";
print "})\n"; print "})\n";
print '</script>'; print '</script>';*/
print '</td>'; print '</td>';
@ -1613,13 +1614,14 @@ function projectLinesPerDay(&$inc, $parent, $fuser, $lines, &$level, &$projectsr
//$tableCell.='&nbsp;<input type="submit" class="button"'.($disabledtask?' disabled':'').' value="'.$langs->trans("Add").'">'; //$tableCell.='&nbsp;<input type="submit" class="button"'.($disabledtask?' disabled':'').' value="'.$langs->trans("Add").'">';
print $tableCell; print $tableCell;
$modeinput = 'hours'; // Comment for avoid unnecessary multiple calculation
/*$modeinput = 'hours';
print '<script type="text/javascript">'; print '<script type="text/javascript">';
print "jQuery(document).ready(function () {\n"; print "jQuery(document).ready(function () {\n";
print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });"; print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });";
print "})\n"; print "})\n";
print '</script>'; print '</script>';*/
print '</td>'; print '</td>';

View File

@ -795,12 +795,12 @@ print '</div>';
print '</form>'; print '</form>';
$modeinput = 'hours'; if (!empty($conf->use_javascript_ajax)) {
$modeinput = 'hours';
if ($conf->use_javascript_ajax) {
print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n"; print "\n<!-- JS CODE TO ENABLE Tooltips on all object with class classfortooltip -->\n";
print '<script type="text/javascript">'."\n"; print '<script type="text/javascript">'."\n";
print "jQuery(document).ready(function () {\n"; print "jQuery(document).ready(function () {\n";
print " updateTotal(0,\''.$modeinput.'\');\n";
print ' jQuery(".timesheetalreadyrecorded").tooltip({ print ' jQuery(".timesheetalreadyrecorded").tooltip({
show: { collision: "flipfit", effect:\'toggle\', delay:50 }, show: { collision: "flipfit", effect:\'toggle\', delay:50 },
hide: { effect:\'toggle\', delay: 50 }, hide: { effect:\'toggle\', delay: 50 },
@ -809,8 +809,7 @@ if ($conf->use_javascript_ajax) {
return \''.dol_escape_js($langs->trans("TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).'\'; return \''.dol_escape_js($langs->trans("TimeAlreadyRecorded", $usertoprocess->getFullName($langs))).'\';
} }
});'."\n"; });'."\n";
print " jQuery('.inputhour, .inputminute').bind('keyup', function(e) { updateTotal(0, '".$modeinput."') });";
print ' updateTotal(0,\''.$modeinput.'\');';
print "\n});\n"; print "\n});\n";
print '</script>'; print '</script>';
} }