$permissions["$permission[productid]"] = $permission['mask'];
}
- $products_fetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "product WHERE !componentmother ORDER BY displayorder ASC");
+ $products_fetch = $db->query("SELECT * FROM " . TABLE_PREFIX . "product WHERE !parentid ORDER BY displayorder ASC");
while ($product = $db->fetch_array($products_fetch))
{
$groupid = $group['usergroupid'];
if ($_REQUEST['do'] == 'killproduct')
{
$bugsys->input_clean('productid', TYPE_UINT);
- $allprods = $db->query("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $bugsys->in['productid'] . " OR componentmother = " . $bugsys->in['productid']);
+ $allprods = $db->query("SELECT * FROM " . TABLE_PREFIX . "product WHERE productid = " . $bugsys->in['productid'] . " OR parentid = " . $bugsys->in['productid']);
while ($prod = $db->fetch_array($allprods))
{
$list[] = $prod['productid'];
$db->query("
INSERT INTO " . TABLE_PREFIX . "product
- (title, componentmother, description, displayorder)
+ (title, parentid, description, displayorder)
VALUES
- ('" . $bugsys->input_escape('title') . "', " . $bugsys->input_clean('componentmother', TYPE_UINT) . ",
+ ('" . $bugsys->input_escape('title') . "', " . $bugsys->input_clean('parentid', TYPE_UINT) . ",
'" . $bugsys->input_escape('description') . "', " . $bugsys->input_clean('displayorder', TYPE_UINT) . "
)"
);
$admin->page_start(_('Add New Product'));
$admin->form_start('product.php', 'insertproduct');
- $admin->form_hidden_field('componentmother', $bugsys->in['productid']);
+ $admin->form_hidden_field('parentid', $bugsys->in['productid']);
$admin->table_start();
$admin->table_head(_('Add Product'));
$admin->row_input(_('Title'), 'title');
$products = array();
while ($prod = $db->fetch_array($products_get))
{
- if (!$prod['componentmother'])
+ if (!$prod['parentid'])
{
$products["$prod[productid]"] = $prod;
}
else
{
- $components["$prod[componentmother]"][] = $prod;
+ $components["$prod[parentid]"][] = $prod;
}
$version["$prod[productid]"] = array();
}
ALTER TABLE `comment` ADD parselinks BOOL NULL;
ALTER TABLE user ADD columnoptions TEXT NULL;
+
+ALTER TABLE product CHANGE componentmother parentid int(10) UNSIGNED NULL;
foreach ($bugsys->datastore['product'] AS $product)
{
- if ($product['componentmother'])
+ if ($product['parentid'])
{
$components["$product[componentmother]"]["$product[productid]"] = $product;
}
{
if ($this->values['component'] != 0)
{
- $component = $this->registry->datastore['product'][ $this->values['component'] ];
+ $component = $this->registry->datastore['component'][ $this->values['component'] ];
$product = $this->registry->datastore['product'][ $this->values['product'] ];
$version = $this->registry->datastore['version'][ $this->values['version'] ];
- if ($component['componentmother'] != $product['productid'])
+ if ($component['parentid'] != $product['productid'])
{
return false;
}
{
foreach ($bugsys->datastore['product'] AS $id => $product)
{
- if (!$product['componentmother'])
- {
- $onbits["$id"] = $id;
- }
+ $onbits["$id"] = $id;
}
}
$bug['bgcolor'] = ($bugsys->userinfo['showcolors'] ? $bugsys->datastore['status']["$bug[status]"]['color'] : $color);
$bug['product'] = $bugsys->datastore['product']["$bug[product]"]['title'];
$bug['version'] = $bugsys->datastore['version']["$bug[version]"]['version'];
- $bug['component'] = $bugsys->datastore['product']["$bug[component]"]['title'];
+ $bug['component'] = $bugsys->datastore['component']["$bug[component]"]['title'];
$bug['status'] = $bugsys->datastore['status']["$bug[status]"]['status'];
$bug['resolution'] = $bugsys->datastore['resolution']["$bug[resolution]"]['resolution'];
$bug['priority'] = $bugsys->datastore['priority']["$bug[priority]"]['priority'];
$products = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "product ORDER BY displayorder ASC");
while ($product = $bugsys->db->fetch_array($products))
{
- $tempstore["$product[productid]"] = $product;
+ if ($product['parentid'])
+ {
+ $tempstore['component']["$product[productid]"] = $product;
+ }
+ else
+ {
+ $tempstore['product']["$product[productid]"] = $product;
+ }
}
$bugsys->db->query("
### replacing product / component cache ###
REPLACE INTO " . TABLE_PREFIX . "datastore (title, data)
- VALUES ('product', '" . $bugsys->escape(serialize($tempstore)) . "')"
+ VALUES
+ ('product', '" . $bugsys->escape(serialize($tempstore['product'])) . "'),
+ ('component', '" . $bugsys->escape(serialize($tempstore['component'])) . "')"
);
- $bugsys->datastore['product'] = $tempstore;
+ $bugsys->datastore['product'] = $tempstore['product'];
+ $bugsys->datastore['component'] = $tempstore['component'];
}
// ##################### Start build_permissions #####################
$output = '';
- // index all of the products by parent and ID
- $products = array();
- foreach ($bugsys->datastore['product'] AS $id => $prod)
+ // index all of the components by parent and ID
+ $components = array();
+ foreach ($bugsys->datastore['component'] AS $id => $prod)
{
- $products["$prod[componentmother]"]["$id"] = $prod;
+ $components["$prod[parentid]"]["$id"] = $prod;
}
// these are products
- foreach ($products['0'] AS $productid => $product)
+ foreach ($bugsys->datastore['product'] AS $productid => $product)
{
if (!can_perform($action, $product['productid']) OR !can_perform('canviewbugs', $product['productid']))
{
$output .= ConstructOptionGroup($product['title'], ConstructVersionSelect($productid, $select));
// these are components
- foreach ($products["$productid"] AS $componentid => $component)
+ foreach ($components["$productid"] AS $componentid => $component)
{
$output .= ConstructOptionGroup($product['title'] . '/' . $component['title'], ConstructVersionSelect($componentid, $select));
}
$build = '';
// this is a component
- if ($product['componentmother'])
+ if ($product == null)
{
- $component = $bugsys->datastore['product']["$productid"];
- $product = $bugsys->datastore['product']["$component[componentmother]"];
+ $component = $bugsys->datastore['component']["$productid"];
+ $product = $bugsys->datastore['product']["$component[parentid]"];
}
foreach ($bugsys->datastore['version'] AS $versionid => $version)