")
}
/// Write footer for any email, including link generation
@@ -138,7 +135,7 @@ ClassMethod WriteEmailFooter(pMsg As %Net.MailMessage)
}
/// Write improved email format for subscription, including embeded pivot table
-ClassMethod WriteEmail(pSubscription As PivotSubscriptions.Subscription, pMsg As %Net.MailMessage, pTableStatus)
+ClassMethod WriteEmail(pSubscription As PivotSubscriptions.Subscription, pMsg As %Net.MailMessage, pTableStatus, pUnsubscribeList)
{
Do ##class(PivotSubscriptions.Utils).WriteEmailHeader(pMsg)
@@ -180,14 +177,14 @@ ClassMethod WriteEmail(pSubscription As PivotSubscriptions.Subscription, pMsg As
Do pMsg.TextData.WriteLine("Pivot table is too big to be embedded. Please see attachment.")
}
- Do ##class(PivotSubscriptions.Utils).WriteUnsubscribe(pMsg)
+ Do ##class(PivotSubscriptions.Utils).WriteUnsubscribe(pMsg,pUnsubscribeList)
Do ##class(PivotSubscriptions.Utils).WriteEmailFooter(pMsg)
}
-ClassMethod TableErrorMessage(pSubscription As PivotSubscriptions.Subscription, pEmail As %String, pName As %String, pReason As %String) As %Status
+ClassMethod TableErrorMessage(pSubscription As PivotSubscriptions.Subscription, pEmail As %String, pName As %String, pReason As %String, pMDX As %String) As %Status
{
Set tAdminEmail=##class(PivotSubscriptions.Utils).GetSettings("AdminEmail")
- Set tLog=##class(PivotSubscriptions.EventLog).CreateEvent("tableError",$username,pSubscription.Pivot,pSubscription.DayOfWeek,pSubscription.Hour,pSubscription.Minute,pSubscription.Format,tAdminEmail,pName,.pEvent)
+ Set tLog=##class(PivotSubscriptions.EventLog).CreateEvent("tableError",pSubscription.%Id(),$username,pSubscription.Pivot,pSubscription.DayOfWeek,pSubscription.Hour,pSubscription.Minute,pSubscription.Format,tAdminEmail,pName,.pEvent)
If $$$ISERR(tLog) Quit tLog
@@ -211,6 +208,8 @@ ClassMethod TableErrorMessage(pSubscription As PivotSubscriptions.Subscription,
Do tMsg.TextData.WriteLine("The pivot table is too large to be embedded. ")
}
Do tMsg.TextData.WriteLine(" Please check the Subscription Manager.")
+ Do tMsg.TextData.WriteLine("
MDX Executed:")
+ Do tMsg.TextData.WriteLine(pMDX)
Do ##class(PivotSubscriptions.Utils).WriteEmailFooter(tMsg)
// Set recipient of email
@@ -282,4 +281,15 @@ ClassMethod GenerateFileForSubscription(pType = "Excel", pMDX, pCustomFilter, pN
Quit tSC
}
+ClassMethod CheckUnsubscribe(pSubscriptionId, pEmail, pGUID) As %Boolean
+{
+ Set tConfirmed=0
+
+ Set tSQL="SELECT ID FROM PivotSubscriptions.EventLog WHERE Subscription=? AND Emails=? AND GUID=?"
+ Set tSQLRS=##class(%SQL.Statement).%ExecDirect(,tSQL,pSubscriptionId,pEmail,pGUID)
+ Set tConfirmed=tSQLRS.%Next()
+
+ Quit tConfirmed
+}
+
}
diff --git a/README.md b/README.md
index cb22439..e65c082 100644
--- a/README.md
+++ b/README.md
@@ -19,16 +19,18 @@ Once installation is complete, a new "Pivot Subscriptions" Link will be added to
5. Follow the Configuration steps
## Configuration steps
-### Configure Default Namespace
-To ensure that links to the SubscriptionManager page are correctly generated, the Default Application of the namespace you are working in is correctly configured.
-1. Go to Management Portal
-2. Go to System Administration > Security > Applications > Web Applications
-3. Click on /csp/??? where ??? is the namespace you are working in
-4. Check the checkbox next to Namespace Default Application and Save
-
### Configure Task Manager Email Settings
Subscriptions are delivered by Email. The Task Manager Email must be configured to allow alerts to be delivered by Email. At a minimum, the SMTP Server must be assigned in the Task Manager Email Settings (Management Portal -> System Administration -> Configuration -> Additional Settings -> Task Manager Email). For more information, please see the documentation.
+### Unsubscribe Web Application
+A new Web Application is created to allow users to manually unsubscribe to subscriptions by clicking on the unsubscribe link include in the subscription email. This new Web Application is "/api/pivotsubscriptionsunsubscribe". It allows unauthenticated access to a REST API that only allows users to unsubscribe if they have the specific URL. Depending on security settings, it may be necessary to give the application additional permissions. This can be accomplished in The Management Portal -> System Administration -> Security -> Applications -> Web Applications -> /api/pivotsubscriptionsunsubscribe -> Application Roles Tab.
+These additional permissions include:
+1) The Database Resource for the Database that contains the PivotSubscriptions Code
+2) The Database Resource for the Database that contains the PivotSubscriptions Data
+3) The Database Resource for the NameSpace's Default Globals Database where PivotSubscriptions is installed
+
+Depending on your security settings and mapping configuration, this may be between 0 and 3 resources that are needed.
+
### Optional: Custom Action
The Piovt List page gives access to a list of Pivot Tables available to the user. From there, a Pivot Subscription can be added. However, if you would like to add a Pivot Subscription directly from Analyzer or from a Dashboard, you will need to configure a new Custom Action. In order to add the Custom Action, an Action Class is first needed. For more information, please see the documentation for defining custom actions. In your Action KPI, define the new action as:
```
@@ -41,4 +43,4 @@ If (pAction="AddPivotSubscription") {
}
```
-The ActionCommand Method will generate a command that will allow for the creation of the Pivot Subscription
\ No newline at end of file
+The ActionCommand Method will generate a command that will allow for the creation of the Pivot Subscription
|