summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2014-05-28 10:16:17 -0700
committerMerov Linden <merov@lindenlab.com>2014-05-28 10:16:17 -0700
commit4e0050ae9db61ef5b13c346ff659ae64c3756249 (patch)
tree29a330a85b9522bc76e2e3cd21cafbf7f93c2d23 /indra/newview
parentd06d4a36e702604368c70244114c58c5df730fb9 (diff)
DD-91 : WIP : Continue refactor of item checking in marketplace and simplify error messages
Diffstat (limited to 'indra/newview')
-rwxr-xr-xindra/newview/llinventoryfunctions.cpp73
-rwxr-xr-xindra/newview/llinventoryfunctions.h2
-rwxr-xr-xindra/newview/skins/default/xui/en/strings.xml16
3 files changed, 47 insertions, 44 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 25592be99e..12a89c0ad8 100755
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -914,16 +914,33 @@ S32 compute_stock_count(LLUUID cat_uuid)
return curr_count;
}
-bool can_move_to_marketplace(LLInventoryItem* inv_item, std::string& tooltip_msg)
+bool can_move_to_marketplace(LLInventoryItem* inv_item, std::string& tooltip_msg, bool resolve_links)
{
// Collapse links directly to items/folders
LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) inv_item;
LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem();
- if (linked_item != NULL)
+ LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory();
+
+ // Linked items and folders cannot be put for sale if caller can't resolve them
+ if (!resolve_links && (linked_category || linked_item))
+ {
+ tooltip_msg = LLTrans::getString("TooltipOutboxLinked");
+ return false;
+ }
+
+ // A category is always considered as passing...
+ if (linked_category != NULL)
+ {
+ return true;
+ }
+
+ // Take the linked item if necessary
+ if (linked_item != NULL)
{
inv_item = linked_item;
}
+ // Check permissions
bool allow_transfer = inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID());
if (!allow_transfer)
{
@@ -931,6 +948,7 @@ bool can_move_to_marketplace(LLInventoryItem* inv_item, std::string& tooltip_msg
return false;
}
+ // Check for worn/not worn status
bool worn = get_is_item_worn(inv_item->getUUID());
if (worn)
{
@@ -938,6 +956,7 @@ bool can_move_to_marketplace(LLInventoryItem* inv_item, std::string& tooltip_msg
return false;
}
+ // Check for type
bool calling_card = (LLAssetType::AT_CALLINGCARD == inv_item->getType());
if (calling_card)
{
@@ -1037,7 +1056,7 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve
return accept;
}
-// Returns true if inve_cat can be dropped in dest_folder, a folder nested in marketplace listings (or merchant inventory) under the root_folder root
+// Returns true if inv_cat can be dropped in dest_folder, a folder nested in marketplace listings (or merchant inventory) under the root_folder root
// If returns is false, tooltip_msg contains an error message to display to the user (localized and all).
// bundle_size is the amount of sibling items that are getting moved to the marketplace at the same time.
bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryCategory* inv_cat, std::string& tooltip_msg, S32 bundle_size)
@@ -1144,7 +1163,7 @@ bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol
{
llinfos << "Merov : Marketplace error : There is no marketplace listings folder -> move aborted!" << llendl;
LLSD subs;
- subs["[ERROR_CODE]"] = LLTrans::getString("Marketplace Error Not Merchant");
+ subs["[ERROR_CODE]"] = LLTrans::getString("Marketplace Error Prefix") + LLTrans::getString("Marketplace Error Not Merchant");
LLNotificationsUtil::add("MerchantPasteFailed", subs);
return false;
}
@@ -1166,7 +1185,8 @@ bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol
// Check that the agent has transfer permission on the item: this is required as a resident cannot
// put on sale items she cannot transfer. Proceed with move if we have permission.
- if (viewer_inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID(), gAgent.getGroupID()))
+ std::string error_msg;
+ if (can_move_to_marketplace(inv_item, error_msg))
{
// When moving an isolated item, we might need to create the folder structure to support it
if (depth == 0)
@@ -1196,7 +1216,7 @@ bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol
{
llinfos << "Merov : Marketplace error : Cannot move item in that folder -> move aborted!" << llendl;
LLSD subs;
- subs["[ERROR_CODE]"] = LLTrans::getString("Marketplace Error Not Accepted");
+ subs["[ERROR_CODE]"] = LLTrans::getString("Marketplace Error Prefix") + LLTrans::getString("Marketplace Error Not Accepted");
LLNotificationsUtil::add("MerchantPasteFailed", subs);
return false;
}
@@ -1229,9 +1249,9 @@ bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_fol
}
else
{
- llinfos << "Merov : Marketplace error : User doesn't have the correct permission to put this item on sale -> move aborted!" << llendl;
+ llinfos << "Merov : Marketplace error : " << error_msg << llendl;
LLSD subs;
- subs["[ERROR_CODE]"] = LLTrans::getString("Marketplace Error Unsellable Item");
+ subs["[ERROR_CODE]"] = LLTrans::getString("Marketplace Error Prefix") + error_msg;
LLNotificationsUtil::add("MerchantPasteFailed", subs);
return false;
}
@@ -1350,6 +1370,12 @@ void validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_
{
cb(message);
}
+ message.clear();
+ bool is_ok = can_move_folder_to_marketplace(cat, cat, cat, message);
+ if (cb && !is_ok)
+ {
+ cb(message);
+ }
}
if ((folder_type == LLFolderType::FT_MARKETPLACE_STOCK) && (depth <= 2))
{
@@ -1388,33 +1414,14 @@ void validate_marketplacelistings(LLInventoryCategory* cat, validation_callback_
{
LLInventoryItem* item = *iter;
LLViewerInventoryItem * viewer_inv_item = (LLViewerInventoryItem *) item;
- LLViewerInventoryCategory * linked_category = viewer_inv_item->getLinkedCategory();
- LLViewerInventoryItem * linked_item = viewer_inv_item->getLinkedItem();
+
// Skip items that shouldn't be there to start with, raise an error message for those
- if (linked_category || linked_item)
+ std::string error_msg;
+ if (!can_move_to_marketplace(item, error_msg, false))
{
- std::string message = " Error : linked item are not allowed in listings : " + viewer_inv_item->getName();
- llinfos << "Merov : Validation error : " << message << llendl;
- if (cb)
- {
- cb(message);
- }
- continue;
- }
- if (!viewer_inv_item->getPermissions().allowOperationBy(PERM_TRANSFER, gAgent.getID(), gAgent.getGroupID()))
- {
- std::string message = " Error : item with incorrect permissions in listing : " + viewer_inv_item->getName();
- llinfos << "Merov : Validation error : " << message << llendl;
- if (cb)
- {
- cb(message);
- }
- continue;
- }
- if (viewer_inv_item->getType() == LLAssetType::AT_CALLINGCARD)
- {
- std::string message = " Error : calling cards are not allowed in listings : " + viewer_inv_item->getName();
- llinfos << "Merov : Validation error : " << message << llendl;
+
+ std::string message = LLTrans::getString("Marketplace Error Prefix") + error_msg + " : " + viewer_inv_item->getName();
+ llinfos << "Merov : Validation : " << message << llendl;
if (cb)
{
cb(message);
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index e87a263427..bbe3edf0df 100755
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -78,7 +78,7 @@ typedef boost::function<void(std::string& validation_message)> validation_callba
bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryItem* inv_item, std::string& tooltip_msg, S32 bundle_size = 1);
bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLInventoryCategory* dest_folder, LLInventoryCategory* inv_cat, std::string& tooltip_msg, S32 bundle_size = 1);
-bool can_move_to_marketplace(LLInventoryItem* inv_item, std::string& tooltip_msg);
+bool can_move_to_marketplace(LLInventoryItem* inv_item, std::string& tooltip_msg, bool resolve_links = true);
bool move_item_to_marketplacelistings(LLInventoryItem* inv_item, LLUUID dest_folder, bool copy = false);
bool move_folder_to_marketplacelistings(LLInventoryCategory* inv_cat, const LLUUID& dest_folder, bool copy = false);
bool has_correct_permissions_for_sale(LLInventoryCategory* cat);
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index aed628d4f7..4e49c5ba58 100755
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -214,6 +214,7 @@ Please try logging in again in a minute.</string>
<string name="TooltipOutboxNoTransfer">One or more of these objects cannot be sold or transferred</string>
<string name="TooltipOutboxNotInInventory">You can only put items from your inventory on the marketplace</string>
<string name="TooltipOutboxWorn">You can not put items you are wearing on the marketplace</string>
+ <string name="TooltipOutboxLinked">You can not put linked items or folders on the marketplace</string>
<string name="TooltipOutboxCallingCard">You can not put calling cards on the marketplace</string>
<string name="TooltipOutboxFolderLevels">Depth of nested folders exceeds [AMOUNT]</string>
<string name="TooltipOutboxTooManyFolders">Subfolder count in top-level folder exceeds [AMOUNT]</string>
@@ -2261,16 +2262,11 @@ The [[MARKETPLACE_CREATE_STORE_URL] Marketplace store] is returning errors.
Drag folders to this area to list them for sale on the [[MARKETPLACE_DASHBOARD_URL] Marketplace].
</string>
- <string name="Marketplace Error None">No errors</string>
- <string name="Marketplace Error Not Merchant">Error: Before sending items to the Marketplace you will need to set yourself up as a merchant (free of charge).</string>
- <string name="Marketplace Error Empty Folder">Error: This folder has no contents.</string>
- <string name="Marketplace Error Not Accepted">Error: Cannot move item in that folder.</string>
- <string name="Marketplace Error Unassociated Products">Error: This item failed to upload because your merchant account has too many items unassociated with products. To fix this error, log in to the marketplace website and reduce your unassociated item count.</string>
-
- <string name="Marketplace Error Object Limit">Error: This item contains too many objects. Fix this error by placing objects together in boxes to reduce the total count to less than 200.</string>
- <string name="Marketplace Error Folder Depth">Error: This item contains too many levels of nested folders. Reorganize it to a maximum of 3 levels of nested folders.</string>
- <string name="Marketplace Error Unsellable Item">Error: This item can not be sold on the marketplace.</string>
- <string name="Marketplace Error Internal Import">Error: There was a problem with this item. Try again later.</string>
+ <string name="Marketplace Error None">No error</string>
+ <string name="Marketplace Error Prefix">Error: </string>
+ <string name="Marketplace Error Not Merchant">Before sending items to the Marketplace you will need to set yourself up as a merchant (free of charge).</string>
+ <string name="Marketplace Error Not Accepted">Cannot move item in that folder.</string>
+ <string name="Marketplace Error Unsellable Item">This item can not be sold on the marketplace.</string>
<string name="MarketplaceNoID">no Mkt ID</string>
<string name="MarketplaceLive">listed</string>