diff --git a/Database/Schemata/upgrade-0037.sql b/Database/Schemata/upgrade-0037.sql
index 50f9fcb6..c0c5b38c 100644
--- a/Database/Schemata/upgrade-0037.sql
+++ b/Database/Schemata/upgrade-0037.sql
@@ -1,7 +1,47 @@
+ALTER TABLE `FinancialTransactions`
+CHANGE COLUMN `Comment` `Comment` TEXT NOT NULL
+
+#
+
+DROP PROCEDURE `CreateFinancialTransactionStub`
+
+#
+
+CREATE PROCEDURE `CreateFinancialTransactionStub`(
+ IN organizationId INTEGER,
+ IN financialAccountId INTEGER,
+ IN amountCents BIGINT,
+ IN dateTime DATETIME,
+ IN comment TEXT,
+ IN importHash VARCHAR(32),
+ IN personId INTEGER
+)
+BEGIN
+
+ DECLARE financialTransactionId INTEGER;
+
+ SELECT 0 INTO financialTransactionId;
+
+ IF ((SELECT COUNT(*) FROM FinancialTransactions WHERE FinancialTransactions.ImportHash=importHash) = 0)
+ THEN
+ INSERT INTO FinancialTransactions (OrganizationId, DateTime, Comment, ImportHash)
+ VALUES (organizationId, dateTime, comment, importHash);
+
+ SELECT LAST_INSERT_ID() INTO financialTransactionId;
+
+ INSERT INTO FinancialTransactionRows (FinancialAccountId, FinancialTransactionId, Amount, AmountCents, CreatedDateTime, CreatedByPersonId)
+ VALUES (financialAccountId, financialTransactionId, amountCents/100.0, amountCents, DateTime, personId);
+
+ END IF;
+
+ SELECT financialTransactionId AS Identity;
+
+END
+
+#
+
ALTER TABLE `InboundInvoices`
-ADD COLUMN `PayToBitcoinAddress` VARCHAR(128) NOT NULL DEFAULT '' AFTER `SupplierId`,
-ADD COLUMN `PayToBitcoinCashAddress` VARCHAR(128) NOT NULL DEFAULT '' AFTER `PayToBitcoinAddress`
-ADD COLUMN `PayToEthereumAddress` VARCHAR(128) NOT NULL DEFAULT '' AFTER `PayToBitcoinCashAddress`
+ADD COLUMN `PayoutSpecId` INT NOT NULL DEFAULT 0 AFTER `SupplierId`,
#
diff --git a/Logic/Financial/ExternalBankData.cs b/Logic/Financial/ExternalBankData.cs
index b5e33409..9be25068 100644
--- a/Logic/Financial/ExternalBankData.cs
+++ b/Logic/Financial/ExternalBankData.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Globalization;
using System.IO;
+using System.Security.Cryptography;
using Swarmops.Common;
using Swarmops.Logic.Structure;
using Swarmops.Logic.Support;
diff --git a/Logic/Financial/ExternalBankDataProfile.cs b/Logic/Financial/ExternalBankDataProfile.cs
index dae3f697..8337956e 100644
--- a/Logic/Financial/ExternalBankDataProfile.cs
+++ b/Logic/Financial/ExternalBankDataProfile.cs
@@ -121,13 +121,13 @@ namespace Swarmops.Logic.Financial
result.Name = "DE Postbank";
result.Country = Country.FromCode("DE");
result.Culture = "de-DE";
- result.IgnoreInitialLines = 8;
- result.InitialReplacements = ";|\t| | ()|";
+ result.IgnoreInitialLines = 7;
+ result.InitialReplacements = ";|\t| €|";
result.FieldNames[ExternalBankDataFieldName.Date] = "Buchungstag";
result.FieldNames[ExternalBankDataFieldName.Description] = "Buchungsdetails";
- result.FieldNames[ExternalBankDataFieldName.TransactionNet] = "Betrag";
- result.FieldNames[ExternalBankDataFieldName.AccountBalance] = "Saldo";
+ result.FieldNames[ExternalBankDataFieldName.TransactionNet] = "Betrag (€)";
+ result.FieldNames[ExternalBankDataFieldName.AccountBalance] = "Saldo (€)";
result.LatestTransactionLocation = LatestTransactionLocation.Top;
result.FeeSignage = FeeSignage.Unknown; // no inline fees
diff --git a/Logic/Financial/ExternalBankDataRecord.cs b/Logic/Financial/ExternalBankDataRecord.cs
index a425cadf..81872dc5 100644
--- a/Logic/Financial/ExternalBankDataRecord.cs
+++ b/Logic/Financial/ExternalBankDataRecord.cs
@@ -40,10 +40,12 @@ namespace Swarmops.Logic.Financial
{
importKey = this.UniqueId;
}
- else if (!string.IsNullOrEmpty (this.NotUniqueId))
+ else if (!string.IsNullOrEmpty (this.NotUniqueId)) // no unique ID, but maybe something else
{
string commentKey = this.Description.ToLowerInvariant();
+ // " / 100.0" below serves no purpose but must stay now that the hash scheme is in effect
+
string hashKey = this.NotUniqueId + commentKey +
(this.TransactionNetCents/100.0).ToString (CultureInfo.InvariantCulture) +
(this.AccountBalanceCents/100.0).ToString (CultureInfo.InvariantCulture) +
@@ -51,6 +53,18 @@ namespace Swarmops.Logic.Financial
importKey = SHA1.Hash (hashKey).Replace (" ", "");
}
+ else // neither unique nor nonunique ID, like DE Postbank
+ {
+ string commentKey = this.Description.ToLowerInvariant();
+
+ string hashKey = commentKey +
+ this.TransactionNetCents.ToString(CultureInfo.InvariantCulture) +
+ this.AccountBalanceCents.ToString(CultureInfo.InvariantCulture) +
+ this.DateTime.ToString("yyyy-MM-dd-HH-mm-ss");
+
+ importKey = SHA1.Hash(hashKey).Replace(" ", "");
+
+ }
if (importKey.Length > 30)
{
diff --git a/Site/Controls/v5/Base/FileUpload.ascx b/Site/Controls/v5/Base/FileUpload.ascx
index e640ca4e..aea76503 100644
--- a/Site/Controls/v5/Base/FileUpload.ascx
+++ b/Site/Controls/v5/Base/FileUpload.ascx
@@ -1,5 +1,5 @@
-<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="FileUpload.ascx.cs" CodeFile="FileUpload.ascx.cs" Inherits="Swarmops.Controls.Base.FileUpload" %>
-<%@ Import Namespace="System.Net" %>
+<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="FileUpload.ascx.cs" Inherits="Swarmops.Controls.Base.FileUpload" %>
+
diff --git a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx
index 49a15ce9..d5de2e01 100644
--- a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx
+++ b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx
@@ -1,5 +1,4 @@
-<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Site.Pages.Ledgers.UploadBankFiles" Codebehind="UploadBankFiles.aspx.cs" %>
-<%@ Register src="~/Controls/v5/Base/FileUpload.ascx" tagname="FileUpload" tagprefix="Swarmops5" %>
+<%@ Page Title="" Language="C#" MasterPageFile="~/Master-v5.master" AutoEventWireup="true" Inherits="Swarmops.Site.Pages.Ledgers.UploadBankFiles" CodeFile="UploadBankFiles.aspx.cs" Codebehind="UploadBankFiles.aspx.cs" %>
diff --git a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs
index a8c8f03b..4a7a107d 100644
--- a/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs
+++ b/Site/Pages/v5/Ledgers/UploadBankFiles.aspx.cs
@@ -376,7 +376,7 @@ namespace Swarmops.Site.Pages.Ledgers
GuidCache.Set (guid + "-Result", ImportResultsCategory.Questionable);
}
}
- catch (Exception)
+ catch (Exception e)
{
reader.BaseStream.Position = 0; // rewind stream to retry parse with different file type
@@ -437,7 +437,7 @@ namespace Swarmops.Site.Pages.Ledgers
{
bool fileWasUploaded = false;
- foreach (string fileInputID in Request.Files)
+ foreach (string fileInputID in Request.Files)F
{
UploadedFile file = UploadedFile.FromHttpPostedFile(Request.Files[fileInputID]);
if (file.ContentLength > 0)
@@ -579,7 +579,7 @@ namespace Swarmops.Site.Pages.Ledgers
{
FinancialAccount assetAccount = args.Account;
FinancialAccount autoDepositAccount = args.Organization.FinancialAccounts.IncomeDonations;
- int autoDepositLimit = 1000; // TODO: this.CurrentOrganization.Parameters.AutoDonationLimit;
+ int autoDepositLimit = 0; // Disabled; TODO: this.CurrentOrganization.Parameters.AutoDonationLimit;
ImportResults result = new ImportResults();
int count = 0;
diff --git a/Site/Pages/v5/Support/StreamUpload.aspx.cs b/Site/Pages/v5/Support/StreamUpload.aspx.cs
index 9aa79a4f..11a6e501 100644
--- a/Site/Pages/v5/Support/StreamUpload.aspx.cs
+++ b/Site/Pages/v5/Support/StreamUpload.aspx.cs
@@ -191,7 +191,16 @@ namespace Swarmops.Pages.v5.Support
if (!File.Exists (StorageRoot + legacyMarker + serverFileName))
{
- throw new FileNotFoundException (StorageRoot + legacyMarker + serverFileName);
+ if (!Debugger.IsAttached) // if running live; ignore FNF errors when debugging
+ {
+ throw new FileNotFoundException(StorageRoot + legacyMarker + serverFileName);
+ }
+ else
+ {
+ Response.StatusCode = 404;
+ Response.End();
+ return;
+ }
}
Response.ContentType = contentType + "; filename=" + document.ClientFileName;
diff --git a/Site/Site.csproj b/Site/Site.csproj
index a6bad5dc..ecfca736 100644
--- a/Site/Site.csproj
+++ b/Site/Site.csproj
@@ -110,6 +110,13 @@
AjaxToggleSlider.ascx
+
+ FileUploader.ascx
+ ASPXCodeBehind
+
+
+ FileUploader.ascx
+
ImpersonationWarningBox.ascx
ASPXCodeBehind
@@ -683,6 +690,7 @@
+
diff --git a/Site/web.config b/Site/web.config
index 4ca529c6..b3265f3d 100644
--- a/Site/web.config
+++ b/Site/web.config
@@ -30,18 +30,19 @@
-
-
-
+
-
-
+
+
+
+
+
+
-