summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2014-11-07 16:47:19 -0800
committerMerov Linden <merov@lindenlab.com>2014-11-07 16:47:19 -0800
commit2939a542f97c5643457f0087915c733b949a0eb9 (patch)
treecdf70032255389cd07f2e9b5db5ddbcfb06b511b /indra
parent1f23a35a2c397ba53fc338187a4d3e74dac44589 (diff)
DD-272 : Be more consistent when updating the count on hand in SLM, also prevent multiple folder update when receiving data from SLM
Diffstat (limited to 'indra')
-rwxr-xr-xindra/newview/app_settings/settings.xml2
-rwxr-xr-xindra/newview/llmarketplacefunctions.cpp102
-rwxr-xr-xindra/newview/llmarketplacefunctions.h16
3 files changed, 76 insertions, 44 deletions
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 2d835fb2f7..dca2062211 100755
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -4718,7 +4718,7 @@
<key>Type</key>
<string>U32</string>
<key>Value</key>
- <integer>100</integer>
+ <integer>200</integer>
</map>
<key>InventorySortOrder</key>
<map>
diff --git a/indra/newview/llmarketplacefunctions.cpp b/indra/newview/llmarketplacefunctions.cpp
index d7a85de062..6ee81df792 100755
--- a/indra/newview/llmarketplacefunctions.cpp
+++ b/indra/newview/llmarketplacefunctions.cpp
@@ -225,14 +225,18 @@ public:
std::string edit_url = listing["edit_url"].asString();
std::string folder_uuid_string = listing["inventory_info"]["listing_folder_id"].asString();
std::string version_uuid_string = listing["inventory_info"]["version_folder_id"].asString();
+ int count = listing["inventory_info"]["count_on_hand"].asInt();
LLUUID folder_id(folder_uuid_string);
LLUUID version_id(version_uuid_string);
if (folder_id.notNull())
{
LLMarketplaceData::instance().deleteListing(folder_id,false);
- LLMarketplaceData::instance().addListing(folder_id,listing_id,version_id,is_listed);
- LLMarketplaceData::instance().setListingURL(folder_id, edit_url);
+ LLMarketplaceData::instance().addListing(folder_id,listing_id,version_id,is_listed,false);
+ LLMarketplaceData::instance().setListingURL(folder_id, edit_url,false);
+ LLMarketplaceData::instance().setCountOnHand(folder_id,count,false);
+ update_marketplace_category(folder_id, false);
+ gInventory.notifyObservers();
}
it++;
}
@@ -297,11 +301,15 @@ public:
std::string edit_url = listing["edit_url"].asString();
std::string folder_uuid_string = listing["inventory_info"]["listing_folder_id"].asString();
std::string version_uuid_string = listing["inventory_info"]["version_folder_id"].asString();
+ int count = listing["inventory_info"]["count_on_hand"].asInt();
LLUUID folder_id(folder_uuid_string);
LLUUID version_id(version_uuid_string);
- LLMarketplaceData::instance().addListing(folder_id,listing_id,version_id,is_listed);
- LLMarketplaceData::instance().setListingURL(folder_id, edit_url);
+ LLMarketplaceData::instance().addListing(folder_id,listing_id,version_id,is_listed, false);
+ LLMarketplaceData::instance().setListingURL(folder_id, edit_url, false);
+ LLMarketplaceData::instance().setCountOnHand(folder_id,count,false);
+ update_marketplace_category(folder_id, false);
+ gInventory.notifyObservers();
it++;
}
}
@@ -361,15 +369,19 @@ public:
std::string edit_url = listing["edit_url"].asString();
std::string folder_uuid_string = listing["inventory_info"]["listing_folder_id"].asString();
std::string version_uuid_string = listing["inventory_info"]["version_folder_id"].asString();
+ int count = listing["inventory_info"]["count_on_hand"].asInt();
LLUUID folder_id(folder_uuid_string);
LLUUID version_id(version_uuid_string);
// Update that listing
- LLMarketplaceData::instance().setListingID(folder_id, listing_id);
- LLMarketplaceData::instance().setVersionFolderID(folder_id, version_id);
- LLMarketplaceData::instance().setActivationState(folder_id, is_listed);
- LLMarketplaceData::instance().setListingURL(folder_id, edit_url);
+ LLMarketplaceData::instance().setListingID(folder_id, listing_id, false);
+ LLMarketplaceData::instance().setVersionFolderID(folder_id, version_id, false);
+ LLMarketplaceData::instance().setActivationState(folder_id, is_listed, false);
+ LLMarketplaceData::instance().setListingURL(folder_id, edit_url, false);
+ LLMarketplaceData::instance().setCountOnHand(folder_id,count,false);
+ update_marketplace_category(folder_id, false);
+ gInventory.notifyObservers();
it++;
}
@@ -432,15 +444,19 @@ public:
std::string edit_url = listing["edit_url"].asString();
std::string folder_uuid_string = listing["inventory_info"]["listing_folder_id"].asString();
std::string version_uuid_string = listing["inventory_info"]["version_folder_id"].asString();
+ int count = listing["inventory_info"]["count_on_hand"].asInt();
LLUUID folder_id(folder_uuid_string);
LLUUID version_id(version_uuid_string);
// Update that listing
- LLMarketplaceData::instance().setListingID(folder_id, listing_id);
- LLMarketplaceData::instance().setVersionFolderID(folder_id, version_id);
- LLMarketplaceData::instance().setActivationState(folder_id, is_listed);
- LLMarketplaceData::instance().setListingURL(folder_id, edit_url);
+ LLMarketplaceData::instance().setListingID(folder_id, listing_id, false);
+ LLMarketplaceData::instance().setVersionFolderID(folder_id, version_id, false);
+ LLMarketplaceData::instance().setActivationState(folder_id, is_listed, false);
+ LLMarketplaceData::instance().setListingURL(folder_id, edit_url, false);
+ LLMarketplaceData::instance().setCountOnHand(folder_id,count,false);
+ update_marketplace_category(folder_id, false);
+ gInventory.notifyObservers();
// Show a notification alert if what we got is not what we expected
// (this actually doesn't result in an error status from the SLM API protocol)
@@ -516,7 +532,8 @@ public:
std::string edit_url = listing["edit_url"].asString();
std::string folder_uuid_string = listing["inventory_info"]["listing_folder_id"].asString();
std::string version_uuid_string = listing["inventory_info"]["version_folder_id"].asString();
-
+ int count = listing["inventory_info"]["count_on_hand"].asInt();
+
LLUUID folder_id(folder_uuid_string);
LLUUID version_id(version_uuid_string);
@@ -529,8 +546,11 @@ public:
}
// Add the new association
- LLMarketplaceData::instance().addListing(folder_id,listing_id,version_id,is_listed);
- LLMarketplaceData::instance().setListingURL(folder_id, edit_url);
+ LLMarketplaceData::instance().addListing(folder_id,listing_id,version_id,is_listed, false);
+ LLMarketplaceData::instance().setListingURL(folder_id, edit_url, false);
+ LLMarketplaceData::instance().setCountOnHand(folder_id,count,false);
+ update_marketplace_category(folder_id, false);
+ gInventory.notifyObservers();
// Alert with DAMA informing the user that a version folder must be designated
LLNotificationsUtil::add("AlertMerchantAssociateNeedsVersion");
@@ -1498,7 +1518,7 @@ bool LLMarketplaceData::associateListing(const LLUUID& folder_id, const LLUUID&
}
// Methods privately called or called by SLM responders to perform changes
-bool LLMarketplaceData::addListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed)
+bool LLMarketplaceData::addListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed, bool update)
{
if (isListed(folder_id))
{
@@ -1507,12 +1527,15 @@ bool LLMarketplaceData::addListing(const LLUUID& folder_id, S32 listing_id, cons
}
mMarketplaceItems[folder_id] = LLMarketplaceTuple(folder_id, listing_id, version_id, is_listed);
- update_marketplace_category(folder_id, false);
- gInventory.notifyObservers();
+ if (update)
+ {
+ update_marketplace_category(folder_id, false);
+ gInventory.notifyObservers();
+ }
return true;
}
-bool LLMarketplaceData::deleteListing(const LLUUID& folder_id, bool update_slm)
+bool LLMarketplaceData::deleteListing(const LLUUID& folder_id, bool update)
{
if (!isListed(folder_id))
{
@@ -1521,7 +1544,7 @@ bool LLMarketplaceData::deleteListing(const LLUUID& folder_id, bool update_slm)
}
mMarketplaceItems.erase(folder_id);
- if (update_slm)
+ if (update)
{
update_marketplace_category(folder_id, false);
gInventory.notifyObservers();
@@ -1529,7 +1552,7 @@ bool LLMarketplaceData::deleteListing(const LLUUID& folder_id, bool update_slm)
return true;
}
-bool LLMarketplaceData::deleteListing(S32 listing_id)
+bool LLMarketplaceData::deleteListing(S32 listing_id, bool update)
{
if (listing_id == 0)
{
@@ -1537,7 +1560,7 @@ bool LLMarketplaceData::deleteListing(S32 listing_id)
}
LLUUID folder_id = getListingFolder(listing_id);
- return deleteListing(folder_id);
+ return deleteListing(folder_id, update);
}
// Accessors
@@ -1686,7 +1709,7 @@ void LLMarketplaceData::setUpdating(const LLUUID& folder_id, bool isUpdating)
}
// Private Modifiers
-bool LLMarketplaceData::setListingID(const LLUUID& folder_id, S32 listing_id)
+bool LLMarketplaceData::setListingID(const LLUUID& folder_id, S32 listing_id, bool update)
{
marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id);
if (it == mMarketplaceItems.end())
@@ -1696,12 +1719,15 @@ bool LLMarketplaceData::setListingID(const LLUUID& folder_id, S32 listing_id)
(it->second).mListingId = listing_id;
- update_marketplace_category(folder_id, false);
- gInventory.notifyObservers();
+ if (update)
+ {
+ update_marketplace_category(folder_id, false);
+ gInventory.notifyObservers();
+ }
return true;
}
-bool LLMarketplaceData::setCountOnHand(const LLUUID& folder_id, S32 count)
+bool LLMarketplaceData::setCountOnHand(const LLUUID& folder_id, S32 count, bool update)
{
marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id);
if (it == mMarketplaceItems.end())
@@ -1714,7 +1740,7 @@ bool LLMarketplaceData::setCountOnHand(const LLUUID& folder_id, S32 count)
return true;
}
-bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id)
+bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id, bool update)
{
marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id);
if (it == mMarketplaceItems.end())
@@ -1729,14 +1755,17 @@ bool LLMarketplaceData::setVersionFolderID(const LLUUID& folder_id, const LLUUID
}
(it->second).mVersionFolderId = version_id;
-
- update_marketplace_category(old_version_id, false);
- update_marketplace_category(version_id, false);
- gInventory.notifyObservers();
+
+ if (update)
+ {
+ update_marketplace_category(old_version_id, false);
+ update_marketplace_category(version_id, false);
+ gInventory.notifyObservers();
+ }
return true;
}
-bool LLMarketplaceData::setActivationState(const LLUUID& folder_id, bool activate)
+bool LLMarketplaceData::setActivationState(const LLUUID& folder_id, bool activate, bool update)
{
marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id);
if (it == mMarketplaceItems.end())
@@ -1746,12 +1775,15 @@ bool LLMarketplaceData::setActivationState(const LLUUID& folder_id, bool activat
(it->second).mIsActive = activate;
- update_marketplace_category((it->second).mListingFolderId, false);
- gInventory.notifyObservers();
+ if (update)
+ {
+ update_marketplace_category((it->second).mListingFolderId, false);
+ gInventory.notifyObservers();
+ }
return true;
}
-bool LLMarketplaceData::setListingURL(const LLUUID& folder_id, const std::string& edit_url)
+bool LLMarketplaceData::setListingURL(const LLUUID& folder_id, const std::string& edit_url, bool update)
{
marketplace_items_list_t::iterator it = mMarketplaceItems.find(folder_id);
if (it == mMarketplaceItems.end())
diff --git a/indra/newview/llmarketplacefunctions.h b/indra/newview/llmarketplacefunctions.h
index 2b578c4c37..391ab8a733 100755
--- a/indra/newview/llmarketplacefunctions.h
+++ b/indra/newview/llmarketplacefunctions.h
@@ -199,7 +199,7 @@ public:
bool updateCountOnHand(const LLUUID& folder_id);
bool getListing(const LLUUID& folder_id);
bool getListing(S32 listing_id);
- bool deleteListing(S32 listing_id);
+ bool deleteListing(S32 listing_id, bool update = true);
// Probe the Marketplace data set to identify folders
bool isListed(const LLUUID& folder_id); // returns true if folder_id is a Listing folder
@@ -225,13 +225,13 @@ public:
private:
// Modify Marketplace data set : each method returns true if the function succeeds, false if error
// Used internally only by SLM Responders when data are received from the SLM Server
- bool addListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed);
- bool deleteListing(const LLUUID& folder_id, bool update_slm = true);
- bool setListingID(const LLUUID& folder_id, S32 listing_id);
- bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id);
- bool setActivationState(const LLUUID& folder_id, bool activate);
- bool setListingURL(const LLUUID& folder_id, const std::string& edit_url);
- bool setCountOnHand(const LLUUID& folder_id, S32 count);
+ bool addListing(const LLUUID& folder_id, S32 listing_id, const LLUUID& version_id, bool is_listed, bool update = true);
+ bool deleteListing(const LLUUID& folder_id, bool update = true);
+ bool setListingID(const LLUUID& folder_id, S32 listing_id, bool update = true);
+ bool setVersionFolderID(const LLUUID& folder_id, const LLUUID& version_id, bool update = true);
+ bool setActivationState(const LLUUID& folder_id, bool activate, bool update = true);
+ bool setListingURL(const LLUUID& folder_id, const std::string& edit_url, bool update = true);
+ 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 setSLMStatus(U32 status);