Fixing account selection

This commit is contained in:
Rick Falkvinge
2018-04-24 21:09:10 +02:00
parent 86eb3c7ea3
commit 9a5bf5d551
7 changed files with 73 additions and 42 deletions
@@ -51,12 +51,13 @@ namespace Swarmops.Logic.Financial
public enum FinancialAccountAutomationProfileHardIds
{
Unknown = 0,
BitcoinHotwallet = 1,
BitcoinCashArmory = 2,
BitcoinCoreArmory = 3,
BankPaypal = 4,
BankSwedenSeb = 5,
BankGermanyPostbank = 6,
BankCzechFio = 7
Custom = 1,
BitcoinHotwallet = 2,
BitcoinCashArmory = 3,
BitcoinCoreArmory = 4,
BankPaypal = 5,
BankSwedenSeb = 6,
BankGermanyPostbank = 7,
BankCzechFio = 8
}
}
+16 -1
View File
@@ -210,9 +210,24 @@ namespace Swarmops.Logic.Structure
{
get
{
FinancialAccounts result = new FinancialAccounts();
FinancialAccounts allAssets = Logic.Financial.FinancialAccounts.ForOrganization(this, FinancialAccountType.Asset);
foreach (FinancialAccount account in allAssets)
{
if (account.AutomationProfileId != 0)
{
result.Add(account);
}
}
return result;
// HACK: MUST FETCH THIS FROM ACTUAL ACCOUNTS
// HACK HACK HACK HACK HACK HACK
/*
if (PilotInstallationIds.IsPilot (PilotInstallationIds.PiratePartySE) && OrganizationId == 1)
{
FinancialAccounts result = new FinancialAccounts();
@@ -236,7 +251,7 @@ namespace Swarmops.Logic.Structure
return result;
}
throw new NotImplementedException();
throw new NotImplementedException();*/
}
}
+27
View File
@@ -1698,6 +1698,15 @@ namespace Resources.Pages {
}
}
/// <summary>
/// Looks up a localized string similar to Automation Profile.
/// </summary>
internal static string UploadBankFiles_AccountAutomationProfile {
get {
return ResourceManager.GetString("UploadBankFiles_AccountAutomationProfile", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Account Statement.
/// </summary>
@@ -1806,6 +1815,15 @@ namespace Resources.Pages {
}
}
/// <summary>
/// Looks up a localized string similar to There are no asset accounts set up for automation, so no accounts support data upload at this time. Returning to Dashboard..
/// </summary>
internal static string UploadBankFiles_Error_NoAutomationProfiles {
get {
return ResourceManager.GetString("UploadBankFiles_Error_NoAutomationProfiles", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Expected File.
/// </summary>
@@ -1842,6 +1860,15 @@ namespace Resources.Pages {
}
}
/// <summary>
/// Looks up a localized string similar to As this was the first upload to this automated account, the initial balance of {0} {1:N2} going into the year {2} has been detected and set..
/// </summary>
internal static string UploadBankFiles_FirstUploadBalanceSet {
get {
return ResourceManager.GetString("UploadBankFiles_FirstUploadBalanceSet", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error on importing file.
/// </summary>
@@ -976,4 +976,15 @@
<data name="InspectLedgers_TxInfo_PayoutInvoice" xml:space="preserve">
<value>This transaction pays Inbound Invoice #{0:N0} from {1}.</value>
</data>
<data name="UploadBankFiles_AccountAutomationProfile" xml:space="preserve">
<value>Automation Profile</value>
<comment>This is where the bank name, country, and currency appears.</comment>
</data>
<data name="UploadBankFiles_Error_NoAutomationProfiles" xml:space="preserve">
<value>There are no asset accounts set up for automation, so no accounts support data upload at this time. Returning to Dashboard.</value>
</data>
<data name="UploadBankFiles_FirstUploadBalanceSet" xml:space="preserve">
<value>As this was the first upload to this automated account, the initial balance of {0} {1:N2} going into the year {2} has been detected and set.</value>
<comment>{0} is currency, {1} is amount, {2} is the first accounting year</comment>
</data>
</root>
+2 -2
View File
@@ -178,12 +178,12 @@
<div class="entryFields">
<asp:DropDownList runat="server" ID="DropAccounts"/>
<span id="SpanInstructions"></span>&thinsp;<br/>
<div class="stacked-input-control"><span id="SpanInstructions"></span></div>
<Swarmops5:FileUpload runat="server" ID="UploadFile" Filter="NoFilter" DisplayCount="8" HideTrigger="true" ClientUploadCompleteCallback="uploadCompletedCallback" /></div>
<div class="entryLabels">
<asp:Label runat="server" ID="LabelBankAccount" /><br/>
<asp:Label runat="server" ID="LabelInstructions" /><br/>
<asp:Label runat="server" ID="LabelProfile" /><br/>
<asp:Label runat="server" ID="LabelUploadBankFile" />
</div>
</div>
+7 -30
View File
@@ -46,42 +46,13 @@ namespace Swarmops.Site.Pages.Ledgers
PageIcon = "iconshock-bank";
PageAccessRequired = new Access (CurrentOrganization, AccessAspect.Bookkeeping, AccessType.Write);
// HACK HACK: If not a supported hardcoded org, bail out like a chicken
// UGLY UGLY UGLY
bool supportedHardcode = false;
if (PilotInstallationIds.IsPilot (PilotInstallationIds.PiratePartySE) && CurrentOrganization.Identity == 1)
// PPSE
{
supportedHardcode = true;
}
if (PilotInstallationIds.IsPilot(PilotInstallationIds.SwarmopsLive) && CurrentOrganization.Identity == 7)
// EPA
{
supportedHardcode = true;
}
if (PilotInstallationIds.IsPilot(PilotInstallationIds.SwarmopsLive) && CurrentOrganization.Identity == 8)
// RFF
{
supportedHardcode = true;
}
if (!supportedHardcode)
{
DashboardMessage.Set ("There are no asset accounts set up for automation, so no accounts support data upload at this time. Returning to Dashboard.");
Response.Redirect ("/", true);
}
if (!IsPostBack)
{
// Localize
InfoBoxLiteral = Resources.Pages.Ledgers.UploadBankFiles_Info;
this.LabelBankAccount.Text = Resources.Pages.Ledgers.UploadBankFiles_BankAccount;
this.LabelInstructions.Text = Resources.Pages.Ledgers.UploadBankFiles_Instructions;
this.LabelProfile.Text = Resources.Pages.Ledgers.UploadBankFiles_AccountAutomationProfile;
this.LabelProcessing.Text = Resources.Pages.Ledgers.UploadBankFiles_Processing;
this.LabelProcessingComplete.Text = Resources.Pages.Ledgers.UploadBankFiles_ProcessingComplete;
this.LabelUploadBankFile.Text = Resources.Pages.Ledgers.UploadBankFiles_UploadBankFile;
@@ -91,6 +62,12 @@ namespace Swarmops.Site.Pages.Ledgers
// Populate the asset account dropdown, if needed for file type
PopulateAccountDropDown();
if (this.DropAccounts.Items.Count < 2)
{
DashboardMessage.Set(CommonV5.JavascriptEscape(Resources.Pages.Ledgers.UploadBankFiles_Error_NoAutomationProfiles));
Response.Redirect("/", true);
}
}
if (!IsPostBack)
+2 -2
View File
@@ -67,13 +67,13 @@ namespace Swarmops.Site.Pages.Ledgers {
protected global::System.Web.UI.WebControls.Label LabelBankAccount;
/// <summary>
/// LabelInstructions control.
/// LabelProfile control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Label LabelInstructions;
protected global::System.Web.UI.WebControls.Label LabelProfile;
/// <summary>
/// LabelUploadBankFile control.