From: Pradeep Nayak Date: Thu, 28 May 2015 20:21:26 +0000 (+0530) Subject: --CRM-16187, Added warning for Code Docs X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=85470f858a98059fde1143741d303d46a22cc1d0;p=civicrm-core.git --CRM-16187, Added warning for Code Docs --- diff --git a/templates/CRM/Admin/Page/APIExplorer.js b/templates/CRM/Admin/Page/APIExplorer.js index eb79dd6e67..5d7298eb33 100644 --- a/templates/CRM/Admin/Page/APIExplorer.js +++ b/templates/CRM/Admin/Page/APIExplorer.js @@ -682,6 +682,20 @@ $('#doc-result').html(entityDoc); prettyPrint('#doc-result pre'); } + checkBookKeepingEntity(entity, action); + } + + /** + * Check if entity is Financial Trxn and Entity Financial Trxn + * and Action is Create, delete, update etc then display warning + */ + function checkBookKeepingEntity(entity, action) { + if ($.inArray(entity, ['EntityFinancialTrxn', 'FinancialTrxn']) > -1 + && $.inArray(action, ['delete', 'setvalue', 'replace', 'create']) > -1 + ) { + var msg = ts('Given the importance of auditability, extension developers are strongly discouraged from writing code to add, update or delete entries in the civicrm_financial_item, civicrm_entity_financial_trxn, and civicrm_financial_trxn tables. Before publishing an extension on civicrm.org that does any of this, please ask for a special bookkeeping code review for the extension.'); + CRM.alert(msg, 'warning'); + } } $(document).ready(function() { @@ -720,12 +734,7 @@ $('#api-params').html(''); $('#api-params-table thead').show(); getFields(this); - if ($.inArray(entity, ['EntityFinancialTrxn', 'FinancialTrxn']) > -1 - && $.inArray(action, ['delete', 'setvalue', 'replace', 'create']) > -1 - ) { - var msg = ts('Given the importance of auditability, extension developers are strongly discouraged from writing code to add, update or delete entries in the civicrm_financial_item, civicrm_entity_financial_trxn, and civicrm_financial_trxn tables. Before publishing an extension on civicrm.org that does any of this, please ask for a special bookkeeping code review for the extension.'); - CRM.alert(msg, 'warning'); - } + checkBookKeepingEntity(entity, action); } else { $('#api-params, #api-generated pre').empty(); $('#api-param-buttons, #api-params-table thead').hide();