DD-303 : do not force unlist when associating listings, let the 1 version folder policy apply, prompt user only if it doesn't

master
Merov Linden 2015-02-03 23:43:15 -08:00
parent ab91c83881
commit fe4f5f13da
2 changed files with 10 additions and 2 deletions

View File

@ -636,6 +636,15 @@ void LLFloaterMarketplaceListings::onChanged()
// LLFloaterAssociateListing
//-----------------------------------------------------------------------------
// Tell if a listing has one only version folder
bool hasUniqueVersionFolder(const LLUUID& folder_id)
{
LLInventoryModel::cat_array_t* categories;
LLInventoryModel::item_array_t* items;
gInventory.getDirectDescendentsOf(folder_id, categories, items);
return (categories->size() == 1);
}
LLFloaterAssociateListing::LLFloaterAssociateListing(const LLSD& key)
: LLFloater(key)
, mUUID()
@ -703,7 +712,7 @@ void LLFloaterAssociateListing::apply(BOOL user_confirm)
// Check if the id exists in the merchant SLM DB: note that this record might exist in the LLMarketplaceData
// structure even if unseen in the UI, for instance, if its listing_uuid doesn't exist in the merchant inventory
LLUUID listing_uuid = LLMarketplaceData::instance().getListingFolder(id);
if (listing_uuid.notNull() && user_confirm && LLMarketplaceData::instance().getActivationState(listing_uuid))
if (listing_uuid.notNull() && user_confirm && LLMarketplaceData::instance().getActivationState(listing_uuid) && !hasUniqueVersionFolder(mUUID))
{
// Look for user confirmation before unlisting
LLNotificationsUtil::add("ConfirmMerchantUnlist", LLSD(), LLSD(), boost::bind(&LLFloaterAssociateListing::callback_apply, this, _1, _2));

View File

@ -1348,7 +1348,6 @@ void LLMarketplaceData::associateSLMListing(const LLUUID& folder_id, S32 listing
// Note : we're assuming that sending unchanged info won't break anything server side...
root["listing"]["id"] = listing_id;
root["listing"]["is_listed"] = false;
root["listing"]["inventory_info"]["listing_folder_id"] = folder_id.asString();
root["listing"]["inventory_info"]["version_folder_id"] = version_id.asString();
root["listing"]["inventory_info"]["count_on_hand"] = -1;