Bug #2960


CB 1.7.1 substitution check uses language string value instead of stored field value

Added by nant about 10 years ago. Updated almost 10 years ago.

Target version:
Start date:
06 November 2011
Due date:
% Done:


Estimated time:
2:00 h


As described here:

Verified on my local testing.

[cb:if cb_sex="_MALE"] Mr.[/cb:if][cb:if cb_sex="_FEMALE"] Mrs[/cb:if]

Looks like the comparison is testing cb_sex against the translated value of _MALE instead of the database stored value of _MALE.


2960.patch (1.31 KB) 2960.patch krileon, 01 February 2012 18:43
2960_rev1.patch (1.35 KB) 2960_rev1.patch krileon, 01 February 2012 18:47

Related issues

Related to CB - Bug #3156: API: getField for radio and single-select field types: PHP, XML and JSON modes return array of the values instead of the valueClosedbeat18 January 2012

Actions #1

Updated by nant about 10 years ago

  • Status changed from New to Assigned
  • Assignee set to krileon
Actions #2

Updated by beat about 10 years ago

  • Target version set to CB 1.8

The translation is done in PHP mode in cb.core.php line 737 and 742 of r1650 . Maybe those should be not translated. Affects all uses of the getField, so needs a review.

Actions #3

Updated by krileon almost 10 years ago

The only getField usage where PHP output is used is in the substitutions. Seams safe to remove the translation of values for PHP getField usage.

Actions #4

Updated by krileon almost 10 years ago

  • File 2960.patch 2960.patch added
  • Status changed from Assigned to Resolved
  • Assignee changed from krileon to beat
  • % Done changed from 0 to 100

Further review it appears that select fields are the only fields where the values are translated for PHP output, all the others output raw.

Actions #5

Updated by krileon almost 10 years ago

Noticed PHP and CSV had same formatting changes; rev1 added to just use it.

Actions #6

Updated by beat almost 10 years ago

  • Status changed from Resolved to Closed
  • Estimated time set to 2:00 h


Fixed in r1722 .

Kept code, with check for $reason finishing with ":translated", that way maybe some uses in substitutions will work like e.g. : reason="profile:translated" for those fields.

Ohterwise falling through like suggested to csv method.


Also available in: Atom PDF