mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Fix not working subtraction option for infolog-value widget
This commit is contained in:
parent
dc2b48c43f
commit
e8bc6dcd19
@ -45,7 +45,7 @@ var et2_entry = et2_valueWidget.extend(
|
||||
},
|
||||
alternate_fields: {
|
||||
name: 'Alternate fields',
|
||||
description: 'colon (:) separated list of alternative fields. The first non-empty one is used if the selected field is empty',
|
||||
description: 'colon (:) separated list of alternative fields. The first non-empty one is used if the selected field is empty, (-) used for subtraction',
|
||||
type: 'string',
|
||||
default: et2_no_init
|
||||
},
|
||||
@ -134,7 +134,8 @@ var et2_entry = et2_valueWidget.extend(
|
||||
var fields = this.options.alternate_fields.split(':');
|
||||
for(var i = 0; i < fields.length; i++)
|
||||
{
|
||||
var value = this.getArrayMgr('content').getEntry(fields[i]);
|
||||
var value = (fields[i][0] == "-")? this.getArrayMgr('content').getEntry(fields[i].replace('-',''))*-1:
|
||||
this.getArrayMgr('content').getEntry(fields[i]);
|
||||
sum += parseFloat(value);
|
||||
if(value && this.options.field !== 'sum')
|
||||
{
|
||||
|
@ -10,6 +10,17 @@
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Infolog widget et2 representation:
|
||||
* Both infolog-value and infolog-fields widgets are using client-side et2_widget_entry
|
||||
* and the format to address them in template is as follows:
|
||||
*
|
||||
* <infolog-value id="fieldname" or value="@fieldname"
|
||||
* options="[field(e.g. sum), compare, alternate_fields(e.g. (-)#customfileds, use '-' if we need subtraction)]"
|
||||
* />
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* eTemplate extension: InfoLog widget
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user