From 09a2ba8a9e5865dc76e33bdaeb9295b7c90e1524 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sat, 14 Jan 2012 15:34:49 +0000 Subject: [PATCH] --- Logic/Financial/FinancialAccounts.cs | 13 +++- .../OrganizationFinancialAccounts.cs | 8 +-- Site5/App_Code/PageV5Base.cs | 6 +- .../Controls/v5/Base/LanguageSelector.ascx.cs | 2 +- Site5/Global.asax | 2 +- Site5/Master-v5.master.cs | 18 +++++- Site5/Pages/v5/Ledgers/SetRootBudgets.aspx | 18 ++++-- Site5/Pages/v5/Ledgers/SetRootBudgets.aspx.cs | 61 ++++++++++++++++++- Site5/Tests/TestBookkeepingIntegrity.aspx.cs | 4 +- 9 files changed, 109 insertions(+), 23 deletions(-) diff --git a/Logic/Financial/FinancialAccounts.cs b/Logic/Financial/FinancialAccounts.cs index 910f786a..530c03a1 100644 --- a/Logic/Financial/FinancialAccounts.cs +++ b/Logic/Financial/FinancialAccounts.cs @@ -80,14 +80,21 @@ namespace Activizr.Logic.Financial return FinancialAccountRows.FromArray(basicRows); } - - public double GetBudgetSum (int year) + [Obsolete("This function uses double-point variables for money. Use GetBudgetSumCents instead.")] + public double GetBudgetSum(int year) { return PirateDb.GetDatabase().GetFinancialAccountsBudget(this.Identities, year); } - public Int64 GetDeltaCents (DateTime start, DateTime end) + public Int64 GetBudgetSumCents(int year) + { + // TODO: Add support in database + return (Int64) (PirateDb.GetDatabase().GetFinancialAccountsBudget(this.Identities, year) * 100); + } + + + public Int64 GetDeltaCents(DateTime start, DateTime end) { return PirateDb.GetDatabase().GetFinancialAccountBalanceDeltaCents(this.Identities, start, end); } diff --git a/Logic/Financial/OrganizationFinancialAccounts.cs b/Logic/Financial/OrganizationFinancialAccounts.cs index a01a853e..7ad71d80 100644 --- a/Logic/Financial/OrganizationFinancialAccounts.cs +++ b/Logic/Financial/OrganizationFinancialAccounts.cs @@ -29,7 +29,7 @@ namespace Activizr.Logic.Financial organizationAccounts[OrganizationFinancialAccountType.AssetsOutboundInvoices] = 28; organizationAccounts[OrganizationFinancialAccountType.DebtsCapital] = 96; organizationAccounts[OrganizationFinancialAccountType.AssetsPaypal] = 2; - organizationAccounts[OrganizationFinancialAccountType.CostsYearResult] = 97; + organizationAccounts[OrganizationFinancialAccountType.CostsYearlyResult] = 97; } public OrganizationFinancialAccounts (int organizationId) @@ -121,12 +121,12 @@ namespace Activizr.Logic.Financial organizationAccounts[OrganizationFinancialAccountType.CostsLocalDonationTransfers]); } } - public FinancialAccount CostsYearResult + public FinancialAccount CostsYearlyResult { get { return - FinancialAccount.FromIdentity(organizationAccounts[OrganizationFinancialAccountType.CostsYearResult]); + FinancialAccount.FromIdentity(organizationAccounts[OrganizationFinancialAccountType.CostsYearlyResult]); } } @@ -164,6 +164,6 @@ namespace Activizr.Logic.Financial CostsLocalDonationTransfers, CostsAllocatedFunds, CostsConferences, - CostsYearResult // multi-account type + CostsYearlyResult // multi-account type } } diff --git a/Site5/App_Code/PageV5Base.cs b/Site5/App_Code/PageV5Base.cs index a419aaa5..96a29528 100644 --- a/Site5/App_Code/PageV5Base.cs +++ b/Site5/App_Code/PageV5Base.cs @@ -63,9 +63,9 @@ public class PageV5Base : System.Web.UI.Page { // Localization - // Set default culture (English, United States) + // Set default culture (English, United States, but that doesn't work so fake it to GB) - string preferredCulture = "en-US"; + string preferredCulture = "en-GB"; // ----------- SET CULTURE ------------ @@ -79,7 +79,7 @@ public class PageV5Base : System.Web.UI.Page else { // No, determine from browser - string browserPreference = "en-US"; + string browserPreference = "en-GB"; if (Request.UserLanguages != null && Request.UserLanguages.Length > 0) { browserPreference = Request.UserLanguages[0]; diff --git a/Site5/Controls/v5/Base/LanguageSelector.ascx.cs b/Site5/Controls/v5/Base/LanguageSelector.ascx.cs index eb550ab1..75726e7b 100644 --- a/Site5/Controls/v5/Base/LanguageSelector.ascx.cs +++ b/Site5/Controls/v5/Base/LanguageSelector.ascx.cs @@ -30,7 +30,7 @@ namespace Activizr.Controls.Base protected void LinkEnglish_Click(object sender, EventArgs e) { - System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-US"); + System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("en-GB"); FireLanguageChanged(); } diff --git a/Site5/Global.asax b/Site5/Global.asax index ff940bfe..636ed713 100644 --- a/Site5/Global.asax +++ b/Site5/Global.asax @@ -13,7 +13,7 @@ // Code that runs on application startup // Set supported cultures - HttpContext.Current.Application["Cultures"] = new string[] { "sv-SE", "en-US", "de-DE", "de-AT", "fi-FI" }; + HttpContext.Current.Application["Cultures"] = new string[] { "sv-SE", "en-GB", "de-DE", "de-AT", "fi-FI" }; HttpContext.Current.Application["UserRoleCache"] = new Dictionary(); } diff --git a/Site5/Master-v5.master.cs b/Site5/Master-v5.master.cs index 985da76e..a5906a38 100644 --- a/Site5/Master-v5.master.cs +++ b/Site5/Master-v5.master.cs @@ -95,9 +95,23 @@ namespace Activizr string cultureString = Thread.CurrentThread.CurrentCulture.ToString(); string cultureStringLower = cultureString.ToLowerInvariant(); + if (cultureStringLower == "en-us") + { + // doesn't work with tooltip styling for some completely inexplicable reason, use en-gb + + cultureString = "en-GB"; + cultureStringLower = "en-gb"; + Thread.CurrentThread.CurrentCulture = new CultureInfo(cultureString); + + HttpCookie cookieCulture = new HttpCookie("PreferredCulture"); + cookieCulture.Value = cultureString; + cookieCulture.Expires = DateTime.Now.AddDays(365); + Response.Cookies.Add(cookieCulture); + } + string flagName = "uk"; - if (cultureStringLower != "en-us" && cultureString.Length > 3) + if (cultureStringLower != "en-gb" && cultureString.Length > 3) { flagName = cultureStringLower.Substring(3); } @@ -107,7 +121,7 @@ namespace Activizr this.LinkLogout.Text = Resources.Pages.Global.CurrentUserInfo_Logout; this.LabelPreferences.Text = Resources.Pages.Global.CurrentUserInfo_Preferences; - if (cultureStringLower != "en-us" && cultureStringLower != "sv-se" && cultureString.Trim().Length > 0) + if (cultureStringLower != "en-gb" && cultureStringLower != "sv-se" && cultureString.Trim().Length > 0) { this.LinkTranslate.Visible = true; } diff --git a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx b/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx index e428fd45..eea92a41 100644 --- a/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx +++ b/Site5/Pages/v5/Ledgers/SetRootBudgets.aspx @@ -10,13 +10,23 @@ +
Budget, Owner [LOC]
-    
+  
+   +
+ +
@@ -24,7 +34,7 @@ -

+

@@ -32,7 +42,7 @@
-

+