[Import] E-notice fix
authorEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 26 Apr 2022 20:50:34 +0000 (08:50 +1200)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 26 Apr 2022 20:50:34 +0000 (08:50 +1200)
This fixes 1 of 2 notices on the Contact import field mapping screen.
- instead of assigning a variable for show-hide it uses jquery

CRM/Contact/Import/Form/MapField.php
templates/CRM/Contact/Import/Form/MapTable.tpl

index 7b6cfca1fcb76e3673a52a7684dc46735ccf9ae1..5947fdf33917eb649ed0aa9cada2278311c144c3 100644 (file)
@@ -390,7 +390,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField {
    * @param array $fields
    *   Posted values of the form.
    *
-   * @return array
+   * @return array|true
    *   list of errors to be posted back to the form
    */
   public static function formRule($fields) {
@@ -411,16 +411,7 @@ class CRM_Contact_Import_Form_MapField extends CRM_Import_Form_MapField {
     if (!empty($fields['saveMapping'])) {
       $template->assign('isCheked', TRUE);
     }
-
-    if (!empty($errors)) {
-      $_flag = 1;
-      $assignError = new CRM_Core_Page();
-      $assignError->assign('mappingDetailsError', $_flag);
-      return $errors;
-    }
-    else {
-      return TRUE;
-    }
+    return empty($errors) ? TRUE : $errors;
   }
 
   /**
index 1b651d7ac57435c7d39c57a93a9e32b90a41be00..aaa9ed885150d188c9008b91a3dc38db810bbcf5 100644 (file)
           </tr>
         </table>
       </div>
-      <script type="text/javascript">
-        {if $mappingDetailsError }
-          cj('#saveDetails').show();
-        {else}
-          cj('#saveDetails').hide();
-        {/if}
-
         {literal}
+        <script type="text/javascript">
+          if (cj('#saveMapping').prop('checked')) {
+            cj('#saveDetails').show();
+          } else {
+            cj('#saveDetails').hide();
+          }
+
           function showSaveDetails(chkbox) {
             if (chkbox.checked) {
               document.getElementById("saveDetails").style.display = "block";