[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Switch receipt to use original amount & currency if provided.

2016-10-25 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged.

Change subject: Switch receipt to use original amount & currency if provided.
..


Switch receipt to use original amount & currency if provided.

I'm not loving this as it turns out the custom group label & custom field 
labels (not machine names)
are assigned to the template. This makes it a little brittle as we could change 
those. However,
it does resolve the immediate problem.

I am inclined to use it for now but raise a ticket to do a second round of this 
to make it more
robust (perhaps with a token, or review what is assigned to the template).

BUG: T137496

Change-Id: I22858e972d240fa58b3f3d30208bbc183a5f2406
---
M sites/all/modules/wmf_civicrm/templates/offline_receipt.html
M sites/all/modules/wmf_civicrm/templates/offline_receipt.txt
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
3 files changed, 64 insertions(+), 5 deletions(-)

Approvals:
  Ejegg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sites/all/modules/wmf_civicrm/templates/offline_receipt.html 
b/sites/all/modules/wmf_civicrm/templates/offline_receipt.html
index 75f62c1..b2b2eae 100644
--- a/sites/all/modules/wmf_civicrm/templates/offline_receipt.html
+++ b/sites/all/modules/wmf_civicrm/templates/offline_receipt.html
@@ -1,7 +1,22 @@
 
+
+{assign var="amount" value=$formValues.total_amount}
+{foreach from=$customGroup item=value key=customName}
+  {if $customName === "Contribution Extra"}
+{foreach from=$value item=v key=n}
+  {if $n == "Original Currency Received"}
+{assign var="currency" value=$v}
+  {/if}
+  {if $n == "Original Amount Received (unconverted)"}
+{assign var="amount" value=$v}
+  {/if}
+{/foreach}
+  {/if}
+{/foreach}
+
 Dear {contact.first_name},
 
-Thank you for your donation of 
{$formValues.total_amount-$totalTaxAmount|crmMoney:$currency} to the Wikimedia 
Foundation. The Wikimedia Foundation is the non-profit organization that 
supports Wikipedia and other free knowledge projects. Our mission is to build 
the most accessible and comprehensive source of free knowledge in the world.
+Thank you for your donation of {$amount|crmMoney:$currency} to the 
Wikimedia Foundation. The Wikimedia Foundation is the non-profit organization 
that supports Wikipedia and other free knowledge projects. Our mission is to 
build the most accessible and comprehensive source of free knowledge in the 
world.
 
 We believe that knowledge is a fundamental human right. As humanity rushes 
into our digital future, we need open, accessible, public spaces to access 
knowledge online. Wikimedia is such a space. Wikipedia delivers free knowledge 
to people, by people, in hundreds of languages around our planet.
 
@@ -18,7 +33,7 @@
 Many employers will match employee contributions: please check with your 
company to see if they have a https://wikimediafoundation.org/wiki/Matching_Gifts/form\;>corporate 
matching gift program.
 
 For your records: Your donation, number CNT-{$contactID}, on 
{$receive_date|truncate:10:\'\'|crmDate}
-was {$formValues.total_amount-$totalTaxAmount|crmMoney:$currency}.
+was {$amount|crmMoney:$currency}.
 
 
 This letter may serve as a record of your donation. No goods or services 
were provided, in whole or in part, for this contribution. The Wikimedia 
Foundation, Inc. is a non-profit charitable corporation with 501(c)(3) tax 
exempt status in the United States. Our address is 149 New Montgomery, 6th 
Floor, San Francisco, CA, 94105. U.S. tax-exempt number: 20-0049703
diff --git a/sites/all/modules/wmf_civicrm/templates/offline_receipt.txt 
b/sites/all/modules/wmf_civicrm/templates/offline_receipt.txt
index a22078b..50fb7d9 100644
--- a/sites/all/modules/wmf_civicrm/templates/offline_receipt.txt
+++ b/sites/all/modules/wmf_civicrm/templates/offline_receipt.txt
@@ -1,6 +1,18 @@
 Dear {contact.first_name},
-
-Thank you for your donation of 
{$formValues.total_amount-$totalTaxAmount|crmMoney:$currency} to the Wikimedia 
Foundation. The Wikimedia Foundation is the non-profit organization that 
supports Wikipedia and other free knowledge projects. Our mission is to build 
the most accessible and comprehensive source of free knowledge in the world.
+{assign var="amount" value=$formValues.total_amount}
+{foreach from=$customGroup item=value key=customName}
+  {if $customName === "Contribution Extra"}
+{foreach from=$value item=v key=n}
+  {if $n == "Original Currency Received"}
+{assign var="currency" value=$v}
+  {/if}
+  {if $n == "Original Amount Received (unconverted)"}
+{assign var="amount" value=$v}
+  {/if}
+{/foreach}
+  {/if}
+{/foreach}
+Thank you for your donation of {$amount|crmMoney:$currency} to the Wikimedia 
Foundation. The Wikimedia Foundation is the non-profit organization that 
supports Wikipedia and other free knowledge projects. Our mission is to build 
the most 

[MediaWiki-commits] [Gerrit] wikimedia...crm[master]: Switch receipt to use original amount & currency if provided.

2016-10-24 Thread Eileen (Code Review)
Eileen has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/317745

Change subject: Switch receipt to use original amount & currency if provided.
..

Switch receipt to use original amount & currency if provided.

I'm not loving this as it turns out the custom group label & custom field 
labels (not machine names)
are assigned to the template. This makes it a little brittle as we could change 
those. However,
it does resolve the immediate problem.

I am inclined to use it for now but raise a ticket to do a second round of this 
to make it more
robust (perhaps with a token, or review what is assigned to the template).

BUG: T137496

Change-Id: I22858e972d240fa58b3f3d30208bbc183a5f2406
---
M sites/all/modules/wmf_civicrm/templates/offline_receipt.html
M sites/all/modules/wmf_civicrm/templates/offline_receipt.txt
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
3 files changed, 64 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/45/317745/1

diff --git a/sites/all/modules/wmf_civicrm/templates/offline_receipt.html 
b/sites/all/modules/wmf_civicrm/templates/offline_receipt.html
index 75f62c1..b2b2eae 100644
--- a/sites/all/modules/wmf_civicrm/templates/offline_receipt.html
+++ b/sites/all/modules/wmf_civicrm/templates/offline_receipt.html
@@ -1,7 +1,22 @@
 
+
+{assign var="amount" value=$formValues.total_amount}
+{foreach from=$customGroup item=value key=customName}
+  {if $customName === "Contribution Extra"}
+{foreach from=$value item=v key=n}
+  {if $n == "Original Currency Received"}
+{assign var="currency" value=$v}
+  {/if}
+  {if $n == "Original Amount Received (unconverted)"}
+{assign var="amount" value=$v}
+  {/if}
+{/foreach}
+  {/if}
+{/foreach}
+
 Dear {contact.first_name},
 
-Thank you for your donation of 
{$formValues.total_amount-$totalTaxAmount|crmMoney:$currency} to the Wikimedia 
Foundation. The Wikimedia Foundation is the non-profit organization that 
supports Wikipedia and other free knowledge projects. Our mission is to build 
the most accessible and comprehensive source of free knowledge in the world.
+Thank you for your donation of {$amount|crmMoney:$currency} to the 
Wikimedia Foundation. The Wikimedia Foundation is the non-profit organization 
that supports Wikipedia and other free knowledge projects. Our mission is to 
build the most accessible and comprehensive source of free knowledge in the 
world.
 
 We believe that knowledge is a fundamental human right. As humanity rushes 
into our digital future, we need open, accessible, public spaces to access 
knowledge online. Wikimedia is such a space. Wikipedia delivers free knowledge 
to people, by people, in hundreds of languages around our planet.
 
@@ -18,7 +33,7 @@
 Many employers will match employee contributions: please check with your 
company to see if they have a https://wikimediafoundation.org/wiki/Matching_Gifts/form\;>corporate 
matching gift program.
 
 For your records: Your donation, number CNT-{$contactID}, on 
{$receive_date|truncate:10:\'\'|crmDate}
-was {$formValues.total_amount-$totalTaxAmount|crmMoney:$currency}.
+was {$amount|crmMoney:$currency}.
 
 
 This letter may serve as a record of your donation. No goods or services 
were provided, in whole or in part, for this contribution. The Wikimedia 
Foundation, Inc. is a non-profit charitable corporation with 501(c)(3) tax 
exempt status in the United States. Our address is 149 New Montgomery, 6th 
Floor, San Francisco, CA, 94105. U.S. tax-exempt number: 20-0049703
diff --git a/sites/all/modules/wmf_civicrm/templates/offline_receipt.txt 
b/sites/all/modules/wmf_civicrm/templates/offline_receipt.txt
index a22078b..50fb7d9 100644
--- a/sites/all/modules/wmf_civicrm/templates/offline_receipt.txt
+++ b/sites/all/modules/wmf_civicrm/templates/offline_receipt.txt
@@ -1,6 +1,18 @@
 Dear {contact.first_name},
-
-Thank you for your donation of 
{$formValues.total_amount-$totalTaxAmount|crmMoney:$currency} to the Wikimedia 
Foundation. The Wikimedia Foundation is the non-profit organization that 
supports Wikipedia and other free knowledge projects. Our mission is to build 
the most accessible and comprehensive source of free knowledge in the world.
+{assign var="amount" value=$formValues.total_amount}
+{foreach from=$customGroup item=value key=customName}
+  {if $customName === "Contribution Extra"}
+{foreach from=$value item=v key=n}
+  {if $n == "Original Currency Received"}
+{assign var="currency" value=$v}
+  {/if}
+  {if $n == "Original Amount Received (unconverted)"}
+{assign var="amount" value=$v}
+  {/if}
+{/foreach}
+  {/if}
+{/foreach}
+Thank you for your donation of {$amount|crmMoney:$currency} to the Wikimedia 
Foundation. The Wikimedia Foundation is the non-profit organization that 
supports Wikipedia and other free