From 284279966be66323418d5aaaaf96d16d90a12c8a Mon Sep 17 00:00:00 2001
From: Dmitry Zaporozhan <dzaporozhan@productengine.com>
Date: Wed, 20 Jan 2010 13:16:23 +0200
Subject: Fixed normal bug EXT-4476 - Classfield appears in classfield
 accordeon after error message about money scarcity has been closed.

--HG--
branch : product-engine
---
 indra/newview/llpanelclassified.cpp                  | 15 ++++++++++++++-
 indra/newview/llpanelclassified.h                    |  1 +
 indra/newview/skins/default/xui/en/notifications.xml | 10 ++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)

(limited to 'indra')

diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp
index e29320ffc2..01b3f3bb7f 100644
--- a/indra/newview/llpanelclassified.cpp
+++ b/indra/newview/llpanelclassified.cpp
@@ -72,6 +72,7 @@
 #include "llviewerwindow.h"	// for window width, height
 #include "llappviewer.h"	// abortQuit()
 #include "lltrans.h"
+#include "llstatusbar.h"
 
 const S32 MINIMUM_PRICE_FOR_LISTING = 50;	// L$
 const S32 MATURE_UNDEFINED = -1;
@@ -1364,6 +1365,7 @@ static const S32 CB_ITEM_PG	   = 1;
 LLPanelClassifiedEdit::LLPanelClassifiedEdit()
  : LLPanelClassifiedInfo()
  , mIsNew(false)
+ , mCanClose(false)
 {
 }
 
@@ -1559,7 +1561,7 @@ void LLPanelClassifiedEdit::resetControls()
 
 bool LLPanelClassifiedEdit::canClose()
 {
-	return isValidName();
+	return mCanClose;
 }
 
 void LLPanelClassifiedEdit::sendUpdate()
@@ -1676,12 +1678,23 @@ void LLPanelClassifiedEdit::onChange()
 
 void LLPanelClassifiedEdit::onSaveClick()
 {
+	mCanClose = false;
+
 	if(!isValidName())
 	{
 		notifyInvalidName();
 		return;
 	}
+	if(isNew())
+	{
+		if(gStatusBar->getBalance() < getPriceForListing())
+		{
+			LLNotificationsUtil::add("ClassifiedInsuffisientFunds");
+			return;
+		}
+	}
 
+	mCanClose = true;
 	sendUpdate();
 	resetDirty();
 }
diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h
index 10fdf60bbe..e46806f576 100644
--- a/indra/newview/llpanelclassified.h
+++ b/indra/newview/llpanelclassified.h
@@ -340,6 +340,7 @@ protected:
 
 private:
 	bool mIsNew;
+	bool mCanClose;
 };
 
 #endif // LL_LLPANELCLASSIFIED_H
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 1ec004b194..e5933816ef 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -770,6 +770,16 @@ Save changes to classified [NAME]?
      notext="Don&apos;t Save"
      yestext="Save"/>
   </notification>
+  
+  <notification
+   icon="alertmodal.tga"
+   name="ClassifiedInsuffisientFunds"
+   type="alertmodal">
+Insuffisient funds to create classified.
+    <usetemplate
+     name="okbutton"
+     yestext="OK"/>
+  </notification>
 
   <notification
    icon="alertmodal.tga"
-- 
cgit v1.2.3