summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2015-04-09 16:48:27 -0700
committerMerov Linden <merov@lindenlab.com>2015-04-09 16:48:27 -0700
commit47a3aecc97faa6ecb5267dde4274f0fe417e8409 (patch)
tree9d45b92c7416716e0e4b3ecd627f5eb80b9b6539 /indra/newview
parent68771449157d27309ea77119d50dd8da31db1b23 (diff)
parent137185c2a9d2662a34813f83ec9971d00fa5af13 (diff)
VMM merge
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llmarketplacefunctions.cpp52
-rwxr-xr-xindra/newview/llmarketplacefunctions.h4
2 files changed, 30 insertions, 26 deletions
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index d634a252d9..5d8bab5833 100755
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -1265,26 +1265,17 @@ void LLMarketplaceData::getSLMListing(S32 listing_id)
LLHTTPClient::get(url, new LLSLMGetListingResponder(folder_id), headers);
}
-void LLMarketplaceData::createSLMListing(const LLUUID& folder_id)
+void LLMarketplaceData::createSLMListing(const LLUUID& folder_id, const LLUUID& version_id, S32 count)
{
LLSD headers = LLSD::emptyMap();
headers["Accept"] = "application/json";
headers["Content-Type"] = "application/json";
- LLViewerInventoryCategory* category = gInventory.getCategory(folder_id);
-
- // Get the version folder: if there is only one subfolder, we will set it as a version folder immediately
- S32 count = -1;
- LLUUID version_id = getVersionFolderIfUnique(folder_id);
- if (version_id.notNull())
- {
- count = compute_stock_count(version_id, true);
- }
-
// Build the json message
Json::Value root;
Json::FastWriter writer;
+ LLViewerInventoryCategory* category = gInventory.getCategory(folder_id);
root["listing"]["name"] = category->getName();
root["listing"]["inventory_info"]["listing_folder_id"] = folder_id.asString();
root["listing"]["inventory_info"]["version_folder_id"] = version_id.asString();
@@ -1341,20 +1332,12 @@ void LLMarketplaceData::updateSLMListing(const LLUUID& folder_id, S32 listing_id
LLHTTPClient::putRaw(url, data, size, new LLSLMUpdateListingsResponder(folder_id, is_listed, version_id), headers);
}
-void LLMarketplaceData::associateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& source_folder_id)
+void LLMarketplaceData::associateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, const LLUUID& source_folder_id)
{
LLSD headers = LLSD::emptyMap();
headers["Accept"] = "application/json";
headers["Content-Type"] = "application/json";
- // Get the version folder: if there is only one subfolder, we will set it as a version folder immediately
- S32 count = -1;
- LLUUID version_id = getVersionFolderIfUnique(folder_id);
- if (version_id.notNull())
- {
- count = compute_stock_count(version_id, true);
- }
-
Json::Value root;
Json::FastWriter writer;
@@ -1362,7 +1345,6 @@ void LLMarketplaceData::associateSLMListing(const LLUUID& folder_id, S32 listing
root["listing"]["id"] = listing_id;
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"] = count;
std::string json_str = writer.write(root);
@@ -1437,8 +1419,16 @@ bool LLMarketplaceData::createListing(const LLUUID& folder_id)
return false;
}
+ // Get the version folder: if there is only one subfolder, we will set it as a version folder immediately
+ S32 count = -1;
+ LLUUID version_id = getVersionFolderIfUnique(folder_id);
+ if (version_id.notNull())
+ {
+ count = compute_stock_count(version_id, true);
+ }
+
// Post the listing creation request to SLM
- createSLMListing(folder_id);
+ createSLMListing(folder_id, version_id, count);
return true;
}
@@ -1585,9 +1575,23 @@ bool LLMarketplaceData::associateListing(const LLUUID& folder_id, const LLUUID&
return false;
}
- // Post the listing update request to SLM
- associateSLMListing(folder_id, listing_id, source_folder_id);
+ // Get the version folder: if there is only one subfolder, we will set it as a version folder immediately
+ LLUUID version_id = getVersionFolderIfUnique(folder_id);
+
+ // Post the listing associate request to SLM
+ associateSLMListing(folder_id, listing_id, version_id, source_folder_id);
+ // Update the other values as required
+ bool is_listed = getActivationState(source_folder_id); // Use the activation state of the source listing
+ S32 count = -1; // count on hand must be set according to the new active version folder if any
+ if (version_id.notNull())
+ {
+ count = compute_stock_count(version_id, true); // Use the stock count of the new listing
+ }
+
+ // Post the listing update request to SLM
+ updateSLMListing(folder_id, listing_id, version_id, is_listed, count);
+
return true;
}
diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h
index 34b650b0ce..38ffdeb498 100755
--- a/indra/newview/llmarketplacefunctions.h
+++ b/indra/newview/llmarketplacefunctions.h
@@ -253,10 +253,10 @@ private:
bool setCountOnHand(const LLUUID& folder_id, S32 count, bool update = true);
// Private SLM API : package data and get/post/put requests to the SLM Server through the SLM API
- void createSLMListing(const LLUUID& folder_id);
+ void createSLMListing(const LLUUID& folder_id, const LLUUID& version_id, S32 count);
void getSLMListing(S32 listing_id);
void updateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed, S32 count);
- void associateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id);
+ void associateSLMListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, const LLUUID& source_folder_id);
void deleteSLMListing(S32 listing_id);
std::string getSLMConnectURL(const std::string& route);