implement TwingleShop integration

This commit is contained in:
Marc Michalsky 2024-03-21 11:53:57 +01:00 committed by Jens Schuppe
parent ea46e6a747
commit 8cfa270dff
60 changed files with 5200 additions and 106 deletions

View file

@ -85,4 +85,13 @@
{ts domain="de.systopia.twingle"}<p>Create a contact note for each field specified in this selection.</p>
<p><i>Tip: You can enable or disable this fields in the TwingleMANAGER.</i></p>{/ts}
{/htxt}
{htxt id='id-enable_shop_integration'}
<p>{ts domain="de.systopia.twingle"}Enable the processing of orders via Twingle Shop for this profile. The ordered products will then appear as line items in the contribution.{/ts}</p>
{/htxt}
{htxt id='id-shop_map_products'}
<p>{ts domain="de.systopia.twingle"}If this option is enabled, all Twingle Shop products corresponding to the specified project IDs will be retrieved from Twingle and mapped as price sets and price fields. Each Twingle Shop is mapped as a price set with its products as price fields.</p>
<p>This allows you to manually create contributions with the same line items for phone orders, for example, as would be the case for orders placed through the Twingle Shop.</p>
{/htxt}
{/crmScope}

View file

@ -46,7 +46,7 @@
class="helpicon"
></a>
</td>
<td class="content">{$form.selector.html}</td>
<td id="selectors" class="content">{$form.selector.html}</td>
{/if}
</tr>
@ -353,6 +353,71 @@
</table>
{if $twingle_use_shop eq 1}
<legend>{ts domain="de.systopia.twingle"}Shop Integration{/ts}</legend>
<table class="form-layout-compressed">
<tr class="crm-section">
<td class="label">
{$form.enable_shop_integration.label}
<a
onclick='
CRM.help(
"{ts domain="de.systopia.twingle"}Enable Shop Integration{/ts}",
{literal}{
"id": "id-enable_shop_integration",
"file": "CRM\/Twingle\/Form\/Profile"
}{/literal}
);
return false;
'
href="#"
title="{ts domain="de.systopia.twingle"}Help{/ts}"
class="helpicon"
></a>
</td>
<td class="content">{$form.enable_shop_integration.html}</td>
</tr>
<tr class="crm-section twingle-shop-element">
<td class="label">{$form.shop_financial_type.label}</td>
<td class="content">{$form.shop_financial_type.html}</td>
</tr>
<tr class="crm-section twingle-shop-element">
<td class="label">{$form.shop_donation_financial_type.label}</td>
<td class="content">{$form.shop_donation_financial_type.html}</td>
</tr>
<tr class="crm-section twingle-shop-element">
<td class="label">{$form.shop_map_products.label}
<a
onclick='
CRM.help(
"{ts domain="de.systopia.twingle"}Map Products as Price Fields{/ts}",
{literal}{
"id": "id-shop_map_products",
"file": "CRM\/Twingle\/Form\/Profile"
}{/literal}
);
return false;
'
href="#"
title="{ts domain="de.systopia.twingle"}Help{/ts}"
class="helpicon"
></a></td>
<td class="content">{$form.shop_map_products.html}
<i id="twingle-shop-spinner" class="crm-i fa-spinner fa-spin"></i>
<div class="twingle-product-mapping">
<div id="tableContainer"></div>
</div>
</td>
</tr>
</table>
{/if}
</fieldset>
{elseif $op == 'delete'}
@ -389,11 +454,18 @@
}
}
// register events and run once
// register events
cj(document).ready(function (){
cj('#membership_type_id').change(twingle_membership_active_changed);
cj('#membership_type_id_recur').change(twingle_membership_active_changed);
// init Twingle Shop integration
if ({/literal}{if $twingle_use_shop eq 1}true{else}false{/if}{literal}) {
twingleShopInit();
}
});
// run once
twingle_membership_active_changed();
</script>
{/literal}

View file

@ -27,3 +27,7 @@
{htxt id='id-twingle_prefix'}
{ts domain="de.systopia.twingle"}You can use this setting to add a prefix to the Twingle transaction ID, in order to avoid collisions with other transaction ids.{/ts}
{/htxt}
{htxt id='id-twingle_use_shop'}
{ts domain="de.systopia.twingle"}If you enable Twingle Shop integration, you can configure Twingle API profiles to include products ordered through Twingle Shop as line items in the created contribution.{/ts}
{/htxt}

View file

@ -37,7 +37,6 @@
</td>
</tr>
<tr class="crm-twingle-form-block-prefix">
<td class="label">{$form.twingle_prefix.label}
{help id="id-twingle_prefix" title=$form.twingle_prefix.label}
@ -86,6 +85,31 @@
</table>
<h3>Twingle Shop Integration</h3>
<table class="form-layout-compressed">
<tr class="crm-twingle-form-block-use-shop">
<td class="label">{$form.twingle_use_shop.label}&nbsp;&nbsp;<a onclick='CRM.help("{$form.twingle_use_shop.label}", {literal}{"id":"id-{/literal}{$form.twingle_use_shop.name}{literal}","file":"CRM\/Twingle\/Form\/Settings"}{/literal}); return false;' href="#" title="{ts domain="de.systopia.twingle"}Help{/ts}" class="helpicon"></a></td>
<td>
{$form.twingle_use_shop.html}
<br />
<span class="description">
{$formElements.twingle_use_shop.description}
</span>
</td>
</tr>
<tr class="crm-twingle-form-block-access-key twingle-shop-element">
<td class="label">{$form.twingle_access_key.label}&nbsp;&nbsp;<a onclick='CRM.help("{$form.twingle_access_key.label}", {literal}{"id":"id-{/literal}{$form.twingle_access_key.name}{literal}","file":"CRM\/Twingle\/Form\/Settings"}{/literal}); return false;' href="#" title="{ts domain="de.systopia.twingle"}Help{/ts}" class="helpicon"></a></td>
<td>
{$form.twingle_access_key.html}
<br />
<span class="description">
{$formElements.twingle_access_key.description}
</span>
</td>
</tr>
</table>
<div class="crm-submit-buttons">
{include file="CRM/common/formButtons.tpl" location="bottom"}
</div>

View file

@ -26,6 +26,9 @@
<tr>
<th>{ts domain="de.systopia.twingle"}Profile name{/ts}</th>
<th>{ts domain="de.systopia.twingle"}Selectors{/ts}</th>
{if $twingle_use_shop eq 1}
<th>{ts domain="de.systopia.twingle"}Shop Integration{/ts}</th>
{/if}
<th>{ts domain="de.systopia.twingle"}Used{/ts}</th>
<th>{ts domain="de.systopia.twingle"}Last Used{/ts}</th>
<th>{ts domain="de.systopia.twingle"}Operations{/ts}</th>
@ -46,6 +49,9 @@
</ul>
{/if}
</td>
{if $twingle_use_shop eq 1}
<td>{if $profile.enable_shop_integration}<span style="color:green">{ts domain="de.systopia.twingle"}enabled{/ts}</span>{else}<span>{ts domain="de.systopia.twingle"}disabled{/ts}</span>{/if}</td>
{/if}
<td>{ts domain="de.systopia.twingle"}{$profile_stats.$profile_name.access_counter_txt}{/ts}</td>
<td>{ts domain="de.systopia.twingle"}{$profile_stats.$profile_name.last_access_txt}{/ts}</td>
<td>
@ -56,7 +62,6 @@
{else}
<a href="{crmURL p="civicrm/admin/settings/twingle/profile" q="op=delete&id=$profile_id"}" title="{ts domain="de.systopia.twingle" 1=$profile.name}Delete profile %1{/ts}" class="action-item crm-hover-button">{ts domain="de.systopia.twingle"}Delete{/ts}</a>
{/if}
</td>
</tr>
{/foreach}