/
Check missing table aliases in calculated fields [5.2.2-B1]

Check missing table aliases in calculated fields [5.2.2-B1]

In [in-commerce] Possible SQL error on order list in Admin Console [5.2.2-B1] discussion the "ord" unit was checked for missing table aliases in calculated field declaration. Need to do a system-wide search to find similar places in other units and fix them. I've recently found following code fragment in "promo-block" unit:

'CalculatedFields' => Array (
	'' => Array (
		'ConversionPercent' => 'IF(%1$s.NumberOfViews > 0, NumberOfClicks / NumberOfViews * 100, NULL)',
	),
),

Solution

  1. search for "CalculatedFields" word in all PHP files (not only unit configs)
  2. within found places determine if field used inside calculated field declaration is actually from DB table
  3. if that is so add corresponding table prefix

Related Discussions

Related Tasks