2008-08-23, 08:15 AM
In file inc/tasks/promotions.php, version:
* $Id: promotions.php 3883 2008-06-05 00:38:28Z Tikitiki $
There is a bug, that causes all but the first active user group promotion to be processed.
Essential parts of the code:
The problem here is, that $query variable gets overwritten in the inner loop, preventing the fetch_array($query) in the outer loop from returning the next promotion rule to be processed. The $query variable in the inner loop must thus be changed into something else, like $query2.
Solution: change the following 2 lines of code like this
* $Id: promotions.php 3883 2008-06-05 00:38:28Z Tikitiki $
There is a bug, that causes all but the first active user group promotion to be processed.
Essential parts of the code:
17: $query = $db->simple_select("promotions", "*", "enabled = '1'");
18: while($promotion = $db->fetch_array($query))
19: {
...: <find the userid's matching this promotion rule>
93: $query = $db->simple_select("users", "uid,{$usergroup_select}", $sql_where);
94: while($user = $db->fetch_array($query))
95: {
...: <do the promotion>
139: }
...
153: }
The problem here is, that $query variable gets overwritten in the inner loop, preventing the fetch_array($query) in the outer loop from returning the next promotion rule to be processed. The $query variable in the inner loop must thus be changed into something else, like $query2.
Solution: change the following 2 lines of code like this
93: $query2 = $db->simple_select("users", "uid,{$usergroup_select}", $sql_where);
94: while($user = $db->fetch_array($query2))