Eileen has uploaded a new change for review.

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

Change subject: Block access to merge screen without a limit.
......................................................................

Block access to merge screen without a limit.

Bug: T139964
Change-Id: I4ff2fdfd655459e65a48282b69b9ab3194238cfa
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
1 file changed, 33 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/78/298378/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index b7829f7..8935983 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -2751,3 +2751,36 @@
        $all_currencies = array_keys( CurrencyRates::getCurrencyRates() );
        return in_array( $currency, $all_currencies );
 }
+
+
+/**
+ * Implements hook_civicrm_validateForm().
+ *
+ * @param string $formName
+ * @param array $fields
+ * @param array $files
+ * @param CRM_Core_Form $form
+ * @param array $errors
+ */
+function wmf_civicrm_civicrm_validateForm($formName, &$fields, &$files, 
&$form, &$errors) {
+  if ($formName === 'CRM_Contact_Form_DedupeFind') {
+    if (!$fields['limit']) {
+      $errors['limit'] = ts('Save the database. Use a limit');
+    }
+  }
+}
+
+/**
+ * Block users from accessing the dedupe page without a limit.
+ *
+ * @param CRM_Core_Page $page
+ */
+function wmf_civicrm_civicrm_pageRun(&$page) {
+  if (get_class($page) == 'CRM_Contact_Page_DedupeFind') {
+    $action = $page->get('action');
+    if (!CRM_Utils_Request::retrieve('limit', 'Integer') && ($action != 
CRM_Core_Action::PREVIEW)) {
+      CRM_Core_Error::statusBounce(ts('The dedupe page can only be accessed 
with a limit. How did you get there without one? Tell fr-tech'), 
'civicrm/contact/deduperules?reset=1');
+    }
+  }
+
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/298378
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4ff2fdfd655459e65a48282b69b9ab3194238cfa
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to