Commit 3ff5a575 authored by Malcolm Blaney's avatar Malcolm Blaney

Fix missing call to Invite->AllBuyingGroups in AllProducts.

parent f37fc4cc
Pipeline #5471668 (#) passed with stage
in 1 minute and 46 seconds
......@@ -78,8 +78,7 @@ class Stock extends Base {
'<select id="stock-group-select">'.
'<option value="'.$default_group.'">'.
$this->Substitute('group-name', '', '', $default_group).'</option>';
for ($i = 0; $i < count($created); $i++) {
$group = $created[$i];
foreach ($created as $group) {
if ($group === $this->user->group) {
$content .= '<option selected="selected" value="'.$group.'">'.
$this->Substitute('group-name').'</option>';
......@@ -604,8 +603,8 @@ class Stock extends Base {
$group_query = '';
if ($purchase_group === '') {
$group_query .= $organiser->GroupQuery();
for ($i = 0; $i < count($groups); $i++) {
$group_query .= ' OR system_group = "'.$groups[$i].'"';
foreach ($invite->AllBuyingGroups() as $group) {
$group_query .= ' OR system_group = "'.$group.'"';
}
}
else if ($purchase_group === $this->user->group) {
......@@ -695,15 +694,13 @@ class Stock extends Base {
$object = [];
$organiser = new Organiser($this->user, $this->owner);
$invite = new Invite($this->user, $this->owner);
$groups = $invite->AllBuyingGroups();
$buying_group_query = '';
for ($i = 0; $i < count($groups); $i++) {
$buying_group_query .= ' OR system_group = "'.$groups[$i].'"';
$group_query = $organiser->GroupQuery();
foreach ($invite->AllBuyingGroups() as $group) {
$group_query .= ' OR system_group = "'.$group.'"';
}
$mysqli = connect_db();
$query = 'SELECT name, stock.user FROM stock LEFT JOIN users '.
'ON stock.user = users.user WHERE ('.$organiser->GroupQuery().
$buying_group_query.') AND taxable = 1';
$query = 'SELECT name, stock.user FROM stock LEFT JOIN users ON '.
'stock.user = users.user WHERE ('.$group_query.') AND taxable = 1';
if ($result = $mysqli->query($query)) {
while ($stock = $result->fetch_assoc()) {
$user = $stock['user'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment