Enabled Participant Financials

This commit is contained in:
Rick Falkvinge
2015-04-02 15:28:03 +02:00
parent a0f320a515
commit bd3bc13388
3 changed files with 45 additions and 1 deletions
+10
View File
@@ -1128,6 +1128,16 @@ namespace Swarmops.Logic.Swarm
return true;
}
if (access.Aspect == AccessAspect.Financials && access.Type == AccessType.Read)
{
if (access.Organization.ParticipantFinancialsEnabled)
{
// This organization has decided to open its financial reports to all participants. Reselect the access request to "participant" level.
access = new Access (access.Organization, AccessAspect.Participant);
}
}
if (access.Aspect == AccessAspect.Participant)
{
// Check that a membership (or whatever this org calls it) exists, for this org or a parentline org
+22 -1
View File
@@ -33,10 +33,19 @@
dataType: "json",
success: function(msg) {
if (msg.d.Success) {
alertify.log(msg.d.DisplayMessage);
if (msg.d.DisplayMessage.length > 2) { // the 2 is rather arbitrary. Read as "if defined".
alertify.log(msg.d.DisplayMessage);
}
if (msg.d.RequireForex && !($('#CheckEnableForex').prop("checked"))) {
$("#CheckEnableForex").prop("checked", true).change();
}
if (jsonData.switchName == "Paypal") {
if (jsonData.switchValue) {
$('.paypalAccountField').fadeIn();
} else {
$('.paypalAccountField').fadeOut();
}
}
} else {
alertify.error(msg.d.DisplayMessage);
if (msg.d.RequireForex && !($('#CheckEnableForex').prop("checked"))) {
@@ -79,7 +88,13 @@
$("#CheckEnablePaypal").prop("checked", orgSettings.AccountPaypal).change();
$("#CheckEnableForex").prop("checked", orgSettings.AccountsForex).change();
$("#CheckEnableVat").prop("checked", orgSettings.AccountsVat).change();
$("#CheckParticipantFinancials").prop("checked", orgSettings.ParticipantFinancials).change();
$("#<%=this.TextPaypalAccountAddress.ClientID%>_TextInput").val(orgSettings.PaypalAccountAddress);
suppressSwitchResponse = false;
if (orgSettings.AccountPaypal) {
$('.paypalAccountField').show();
}
}
var suppressSwitchResponse = false;
@@ -91,6 +106,8 @@
#IconCloseEdit { cursor: pointer; }
.paypalAccountField { display: none; }
.CheckboxContainer {
float: right;
padding-top: 6px;
@@ -109,16 +126,20 @@
<label for="CheckEnableBitcoinHot"><asp:Literal ID="LiteralLabelBitcoinHotShort" runat="server" Text="Bitcoin Hot"/></label><div class="CheckboxContainer"><input type="checkbox" rel="BitcoinHot" class="EditCheck" id="CheckEnableBitcoinHot"/></div><br/>
<asp:TextBox runat="server" ID="TextDaysCashReserves" CssClass="alignRight" Text="60-90" />&#8203;<br/>
<label for="CheckEnablePaypal"><asp:Literal ID="Literal1" runat="server" Text="Paypal"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Paypal" class="EditCheck" id="CheckEnablePaypal"/></div><br/>
<Swarmops5:AjaxTextBox ID="TextPaypalAccountAddress" runat="server" Placeholder="paypal@example.org" CssClass="paypalAccountField" AjaxCallbackUrl="/Pages/v5/Admin/OrgSettings.aspx/StoreCallback" Cookie="PaypalAccountAddress" />
<label for="CheckEnableForex"><asp:Literal ID="Literal2" runat="server" Text="Forex Profit/Loss"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Forex" class="EditCheck" id="CheckEnableForex"/></div><br/>
<label for="CheckEnableVat"><asp:Literal ID="Literal3" runat="server" Text="VAT In/Out"/></label><div class="CheckboxContainer"><input type="checkbox" rel="Vat" class="EditCheck" id="CheckEnableVat"/></div><br/>
<label for="CheckOpenFinancials"><asp:Literal ID="Literal4" runat="server" Text="Participant Financials"/></label><div class="CheckboxContainer"><input type="checkbox" rel="ParticipantFinancials" class="EditCheck" id="CheckOpenFinancials"/></div><br/>
</div>
<div class="entryLabels">
Enable bitcoin coldwallet tracking?<br/>
Enable bitcoin hotwallet autopay?<br/>
Days of coin reserves to keep hot<br/>
Enable Paypal tracking and IPN?<br/>
<span class="paypalAccountField">Paypal account mail address<br/></span>
Enable foreign currency accounts?<br/>
Enable Value Added Tax (VAT)?<br/>
Enable Participant Financials?<br/>
</div>
<div id="divUseAccountPlan" style="display: none; width: 100%; text-align: center; margin-top: 20px; margin-bottom: 20px; border-top: 1px solid <%= CommonV5.GetColor (ColorType.Base, ColorVariant.Light) %>; border-bottom: 1px solid <%= CommonV5.GetColor (ColorType.Base, ColorVariant.Light) %>; background-color: <%= CommonV5.GetColor (ColorType.Base, ColorVariant.XLight) %>">
Use the <a href="/Pages/v5/Ledgers/AccountPlan.aspx">Account Plan</a> page to set detailed parameters for these accounts, once enabled.
+13
View File
@@ -132,6 +132,8 @@ namespace Swarmops.Frontend.Pages.v5.Admin
org.FinancialAccounts.IncomeCurrencyFluctuations.Active);
result.AccountsVat = (org.FinancialAccounts.AssetsVatInbound != null &&
org.FinancialAccounts.AssetsVatInbound.Active);
result.ParticipantFinancials = org.ParticipantFinancialsEnabled;
result.PaypalAccountAddress = org.PaypalAccountMailAddress;
// TODO: Add all the other fields
@@ -304,6 +306,9 @@ namespace Swarmops.Frontend.Pages.v5.Admin
workAccounts.Add (assetsPaypal);
}
break;
case "ParticipantFinancials":
authData.CurrentOrganization.ParticipantFinancialsEnabled = switchValue;
break;
default:
throw new NotImplementedException();
}
@@ -406,6 +411,12 @@ namespace Swarmops.Frontend.Pages.v5.Admin
authenticationData.CurrentOrganization.OpenLedgersDomain = result.NewData;
break;
case "PaypalAccountAddress":
result.NewData = newValue.Trim();
result.ResultCode = AjaxTextBox.CodeSuccess;
authenticationData.CurrentOrganization.PaypalAccountMailAddress = result.NewData;
break;
default:
throw new NotImplementedException("Unknown cookie in StoreCallback");
}
@@ -430,6 +441,8 @@ namespace Swarmops.Frontend.Pages.v5.Admin
public bool AccountPaypal;
public bool AccountsForex;
public bool AccountsVat;
public bool ParticipantFinancials;
public string PaypalAccountAddress;
}
}
}