mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
fix et2-date-duration showing NaN:NaN in timesheet
boolean attributes should not have a default of true, because DOM does NOT reflect false and we need to reflect for use in NM --> changed default for select_unit for r/o duration to false and set it in timesheet.index to true --> changing it for r/w too would require a lot of xet files to be updated (we don't need reflection there)
This commit is contained in:
parent
d7adf26ce6
commit
89613dd368
@ -76,8 +76,8 @@ function send_template()
|
|||||||
str_replace($type[0], '', $matches[0]);
|
str_replace($type[0], '', $matches[0]);
|
||||||
list($matches[1], $matches[2]) = explode('-', $type[1], 2);
|
list($matches[1], $matches[2]) = explode('-', $type[1], 2);
|
||||||
}
|
}
|
||||||
static $legacy_options = array(
|
static $legacy_options = array( // use "ignore" to ignore further comma-sep. values, otherwise they are all in last attribute
|
||||||
'select' => 'empty_label,dummy',
|
'select' => 'empty_label,ignore',
|
||||||
'box' => ',cellpadding,cellspacing,keep',
|
'box' => ',cellpadding,cellspacing,keep',
|
||||||
'hbox' => 'cellpadding,cellspacing,keep',
|
'hbox' => 'cellpadding,cellspacing,keep',
|
||||||
'vbox' => 'cellpadding,cellspacing,keep',
|
'vbox' => 'cellpadding,cellspacing,keep',
|
||||||
@ -85,7 +85,7 @@ function send_template()
|
|||||||
'checkbox' => 'selected_value,unselected_value,ro_true,ro_false',
|
'checkbox' => 'selected_value,unselected_value,ro_true,ro_false',
|
||||||
'radio' => 'set_value,ro_true,ro_false',
|
'radio' => 'set_value,ro_true,ro_false',
|
||||||
'customfields' => 'sub-type,use-private,field-names',
|
'customfields' => 'sub-type,use-private,field-names',
|
||||||
'date' => 'data_format', // Legacy option "mode" was never implemented in et2
|
'date' => 'data_format,ignore', // Legacy option "mode" was never implemented in et2
|
||||||
'description' => 'bold-italic,link,activate_links,label_for,link_target,link_popup_size,link_title',
|
'description' => 'bold-italic,link,activate_links,label_for,link_target,link_popup_size,link_title',
|
||||||
);
|
);
|
||||||
// prefer more specific type-subtype over just type
|
// prefer more specific type-subtype over just type
|
||||||
@ -99,6 +99,7 @@ function send_template()
|
|||||||
$values = array_merge($values, array_fill(count($values), count($names)-count($values), ''));
|
$values = array_merge($values, array_fill(count($values), count($names)-count($values), ''));
|
||||||
}
|
}
|
||||||
$attrs = array_diff(array_combine($names, $values), ['', null]);
|
$attrs = array_diff(array_combine($names, $values), ['', null]);
|
||||||
|
unset($attrs['ignore']);
|
||||||
// fix select options can be either multiple or empty_label
|
// fix select options can be either multiple or empty_label
|
||||||
if ($matches[1] === 'select' && !empty($attrs['empty_label']) && (int)$attrs['empty_label'] > 0)
|
if ($matches[1] === 'select' && !empty($attrs['empty_label']) && (int)$attrs['empty_label'] > 0)
|
||||||
{
|
{
|
||||||
|
@ -186,6 +186,7 @@ export class Et2DateDuration extends Et2InputWidget(FormControlMixin(LitElement)
|
|||||||
* Default is true
|
* Default is true
|
||||||
*/
|
*/
|
||||||
select_unit: {
|
select_unit: {
|
||||||
|
reflect: true,
|
||||||
type: Boolean
|
type: Boolean
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -451,7 +452,7 @@ export class Et2DateDuration extends Et2InputWidget(FormControlMixin(LitElement)
|
|||||||
_value = Math.floor(_value / 3600);
|
_value = Math.floor(_value / 3600);
|
||||||
return _highest ? _value : _value % this.hours_per_day;
|
return _highest ? _value : _value % this.hours_per_day;
|
||||||
case 'd':
|
case 'd':
|
||||||
return Math.floor(_value / 3600 * this.hours_per_day);
|
return Math.floor(_value / 3600 / this.hours_per_day);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -938,7 +938,7 @@ export class et2_date_duration extends et2_date
|
|||||||
_value = Math.floor(_value / 3600);
|
_value = Math.floor(_value / 3600);
|
||||||
return _highest ? _value : _value % this.options.hours_per_day;
|
return _highest ? _value : _value % this.options.hours_per_day;
|
||||||
case 'd':
|
case 'd':
|
||||||
return Math.floor(_value / 3600*this.options.hours_per_day);
|
return Math.floor(_value / 3600 / this.options.hours_per_day);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
|||||||
<menulist class="noWrap">
|
<menulist class="noWrap">
|
||||||
<menupopup type="select-cat" id="${row}[cat_id]" readonly="true"/>
|
<menupopup type="select-cat" id="${row}[cat_id]" readonly="true"/>
|
||||||
</menulist>
|
</menulist>
|
||||||
<date-duration id="${row}[ts_duration]" readonly="true" options=",h,,,1" align="right"/>
|
<date-duration id="${row}[ts_duration]" readonly="true" display_format="h" select_unit="true" align="right"/>
|
||||||
<textbox type="float" id="${row}[ts_quantity]" no_lang="1" readonly="true" precision="3"/>
|
<textbox type="float" id="${row}[ts_quantity]" no_lang="1" readonly="true" precision="3"/>
|
||||||
<description id="${row}[ts_unitprice]" no_lang="1"/>
|
<description id="${row}[ts_unitprice]" no_lang="1"/>
|
||||||
<textbox type="float" id="${row}[ts_total]" no_lang="1" readonly="true" precision="2"/>
|
<textbox type="float" id="${row}[ts_total]" no_lang="1" readonly="true" precision="2"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user