diff --git a/etemplate/js/et2_widget_entry.js b/etemplate/js/et2_widget_entry.js index 26cfbdbecf..8bc24fdf88 100644 --- a/etemplate/js/et2_widget_entry.js +++ b/etemplate/js/et2_widget_entry.js @@ -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') { diff --git a/infolog/inc/class.infolog_widget.inc.php b/infolog/inc/class.infolog_widget.inc.php index 4fcb0b147a..990774a395 100644 --- a/infolog/inc/class.infolog_widget.inc.php +++ b/infolog/inc/class.infolog_widget.inc.php @@ -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: + * + * + * + */ + /** * eTemplate extension: InfoLog widget *