From 82e39279f77212b6e30445fa39a2ea167653a118 Mon Sep 17 00:00:00 2001 From: Rick Falkvinge Date: Sun, 5 Apr 2015 20:59:31 +0200 Subject: [PATCH] Denying attestation works and has nice feedback. --- ...ications.Transmission.NotificationPayload.Designer.cs | 4 ++-- ....Communications.Transmission.NotificationPayload.resx | 4 ++-- Site5/Pages/v5/Financial/AttestCosts.aspx | 3 +++ Site5/Pages/v5/Financial/AttestCosts.aspx.cs | 9 ++++++++- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs index 4938065f..3ff2dfea 100644 --- a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs +++ b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.Designer.cs @@ -70,7 +70,7 @@ namespace Swarmops.Logic.Resources { } /// - /// Looks up a localized string similar to [OrganizationName] Cash Advance Attested: [CurrencyCode] [BudgetAmountFloat]. + /// Looks up a localized string similar to [[OrganizationName]] Cash Advance Attested: [CurrencyCode] [BudgetAmountFloat]. /// internal static string CashAdvance_Attested_Subject { get { @@ -90,7 +90,7 @@ namespace Swarmops.Logic.Resources { } /// - /// Looks up a localized string similar to [OrganizationName] Cash Advance DE-attested: [CurrencyCode] [BudgetAmountFloat]. + /// Looks up a localized string similar to [[OrganizationName]] Cash Advance DE-attested: [CurrencyCode] [BudgetAmountFloat]. /// internal static string CashAdvance_Deattested_Subject { get { diff --git a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx index 6c470419..ae810525 100644 --- a/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx +++ b/Logic/Resources/Logic.Communications.Transmission.NotificationPayload.resx @@ -121,7 +121,7 @@ Your requested cash advance with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been attested by the budget owner. It will now proceed to payout to you. - [OrganizationName] Cash Advance Attested: [CurrencyCode] [BudgetAmountFloat] + [[OrganizationName]] Cash Advance Attested: [CurrencyCode] [BudgetAmountFloat] Your requested cash advance with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat], concerning [RequestPurpose], has been DE-attested by the budget owner. This usually indicates some sort of problem with your request. @@ -129,7 +129,7 @@ Expect more communication from the budget owner to follow on the matter. - [OrganizationName] Cash Advance DE-attested: [CurrencyCode] [BudgetAmountFloat] + [[OrganizationName]] Cash Advance DE-attested: [CurrencyCode] [BudgetAmountFloat] Your expense claim with [OrganizationName] for [CurrencyCode] [BudgetAmountFloat] concerning [RequestPurpose] has been denied. The text below was given as reason for denying it: diff --git a/Site5/Pages/v5/Financial/AttestCosts.aspx b/Site5/Pages/v5/Financial/AttestCosts.aspx index 29a549f9..442b9f55 100644 --- a/Site5/Pages/v5/Financial/AttestCosts.aspx +++ b/Site5/Pages/v5/Financial/AttestCosts.aspx @@ -303,6 +303,7 @@ $('#IconApproval' + recordId).hide(); $('#IconDenial' + recordId).hide(); $('#IconDenied' + recordId).attr('src', '/Images/Abstract/ajaxloader-48x36px.gif'); + $('#IconDenied' + recordId).show(); <%= this.DialogDeny.ClientID %>_close(); SwarmopsJS.ajaxCall( @@ -312,6 +313,8 @@ if (result.Success) { $(this).attr("src", "/Images/Icons/iconshock-red-cross-circled-128x96px.png"); $(this).fadeIn(); // was visible already, but this will create an effect as it changes image + $('.row' + $(this).attr('baseid')).animate({ color: "#CCC" }, 500); + $('.row' + $(this).attr('baseid')).css('text-decoration', 'line-through'); } else { // Failure can happen for many reasons, all bad, so we're just reloading the // entire grid to cover our bases diff --git a/Site5/Pages/v5/Financial/AttestCosts.aspx.cs b/Site5/Pages/v5/Financial/AttestCosts.aspx.cs index a6d93859..ca8e1f7e 100644 --- a/Site5/Pages/v5/Financial/AttestCosts.aspx.cs +++ b/Site5/Pages/v5/Financial/AttestCosts.aspx.cs @@ -133,7 +133,7 @@ namespace Swarmops.Frontend.Pages.v5.Financial [WebMethod] - public static void DenyItem (string recordId, string reason) + public static AjaxCallResult DenyItem (string recordId, string reason) { AuthenticationData authData = GetAuthenticationDataAndCulture(); IPayable payable = PayableFromRecordId (recordId); @@ -145,7 +145,14 @@ namespace Swarmops.Frontend.Pages.v5.Financial throw new UnauthorizedAccessException(); } + if (String.IsNullOrEmpty (reason.Trim())) + { + reason = Resources.Global.Global_NoReasonGiven; + } + payable.DenyAttestation (authData.CurrentUser, reason); + + return new AjaxCallResult { Success = true }; }