diff options
author | Merov Linden <merov@lindenlab.com> | 2015-04-07 15:22:32 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2015-04-07 15:22:32 -0700 |
commit | 79b891a688c0ebd329118a7ebc1a527c72d8f83f (patch) | |
tree | b1b3789192145d697ad5a86d2cba56b7625b1237 /indra/newview/llinventoryfunctions.cpp | |
parent | 32e5d99c9d4b14116eb12a49e9349ee7b1802ee4 (diff) |
DD-382 : Set count_on_hand correctly when creating or assigning a listing
Diffstat (limited to 'indra/newview/llinventoryfunctions.cpp')
-rwxr-xr-x | indra/newview/llinventoryfunctions.cpp | 55 |
1 files changed, 30 insertions, 25 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp index 1a7b804d44..aeee3738f9 100755 --- a/indra/newview/llinventoryfunctions.cpp +++ b/indra/newview/llinventoryfunctions.cpp @@ -1014,7 +1014,7 @@ LLUUID nested_parent_id(LLUUID cur_uuid, S32 depth) return cur_uuid; } -S32 compute_stock_count(LLUUID cat_uuid) +S32 compute_stock_count(LLUUID cat_uuid, bool force_count /* false */) { // Handle the case of the folder being a stock folder immediately LLViewerInventoryCategory* cat = gInventory.getCategory(cat_uuid); @@ -1033,36 +1033,41 @@ S32 compute_stock_count(LLUUID cat_uuid) return item_array->size(); } - // Grab marketplace data for this folder - S32 depth = depth_nesting_in_marketplace(cat_uuid); - LLUUID listing_uuid = nested_parent_id(cat_uuid, depth); - if (!LLMarketplaceData::instance().isListed(listing_uuid)) + // When force_count is true, we do not do any verification of the marketplace status and simply compute + // the stock amount based on the descendent hierarchy. This is used specifically when creating a listing. + if (!force_count) { - // If not listed, the notion of stock is meaningless so it won't be computed for any level - return -1; - } - - LLUUID version_folder_uuid = LLMarketplaceData::instance().getVersionFolder(listing_uuid); - // Handle the case of the first 2 levels : listing and version folders - if (depth == 1) - { - if (version_folder_uuid.notNull()) + // Grab marketplace data for this folder + S32 depth = depth_nesting_in_marketplace(cat_uuid); + LLUUID listing_uuid = nested_parent_id(cat_uuid, depth); + if (!!LLMarketplaceData::instance().isListed(listing_uuid)) { - // If there is a version folder, the stock value for the listing is the version folder stock - return compute_stock_count(version_folder_uuid); + // If not listed, the notion of stock is meaningless so it won't be computed for any level + return -1; } - else + + LLUUID version_folder_uuid = LLMarketplaceData::instance().getVersionFolder(listing_uuid); + // Handle the case of the first 2 levels : listing and version folders + if (depth == 1) { - // If there's no version folder associated, the notion of stock count has no meaning - return -1; + if (version_folder_uuid.notNull()) + { + // If there is a version folder, the stock value for the listing is the version folder stock + return compute_stock_count(version_folder_uuid); + } + else + { + // If there's no version folder associated, the notion of stock count has no meaning + return -1; + } } - } - else if (depth == 2) - { - if (version_folder_uuid.notNull() && (version_folder_uuid != cat_uuid)) + else if (depth == 2) { - // If there is a version folder but we're not it, our stock count is meaningless - return -1; + if (version_folder_uuid.notNull() && (version_folder_uuid != cat_uuid)) + { + // If there is a version folder but we're not it, our stock count is meaningless + return -1; + } } } |