| @@ -524,8 +524,12 @@ | ||
| 524 | 524 | $updated_data['form_content']['is_default'] = 1; |
| 525 | 525 | } |
| 526 | 526 | $updated_data['message'] = __('Form Saved successfully', 'bit-form'); |
| 527 | 527 | |
| 528 | + // Form and dependent rows are persisted; multilingual providers register | |
| 529 | + // the form's translatable strings here. | |
| 530 | + do_action('bitform_form_saved', $save_status); | |
| 531 | + | |
| 528 | 532 | return $updated_data; |
| 529 | 533 | } |
| 530 | 534 | } |
| 531 | 535 | |
| @@ -797,8 +801,11 @@ | ||
| 797 | 801 | } |
| 798 | 802 | $form_content = array_merge($form_content, ['workFlowExist' => $workFlowExist]); |
| 799 | 803 | //wrokFlows [end] |
| 800 | 804 | //reports [start] */ |
| 805 | + // read unconditionally after the reports block; a save without currentReport | |
| 806 | + // must not trip an undefined-variable warning | |
| 807 | + $reportIsDefault = null; | |
| 801 | 808 | if (!empty($reports)) { |
| 802 | 809 | $reportsModel = new ReportsModel(); |
| 803 | 810 | $fieldNames = []; |
| 804 | 811 | foreach ($fields as $key => $field) { |
| @@ -933,8 +940,12 @@ | ||
| 933 | 940 | } |
| 934 | 941 | if (2 === $newData['reports']) { |
| 935 | 942 | $errorIN .= empty($errorIN) ? 'reports' : ', reports'; |
| 936 | 943 | } |
| 944 | + // See createNewForm(). Fired before the partial-failure return: the rows | |
| 945 | + // that did save are already persisted, so their strings still need registering. | |
| 946 | + do_action('bitform_form_saved', $formId); | |
| 947 | + | |
| 937 | 948 | if (!empty($errorIN)) { |
| 938 | 949 | /* translators: %s: comma-separated list of areas where error occurred */ |
| 939 | 950 | $updated_data['message'] = sprintf(__('Error Occured in saving %s', 'bit-form'), $errorIN); |
| 940 | 951 | return new WP_Error('Form update Error.', $updated_data); |
| @@ -942,8 +953,9 @@ | ||
| 942 | 953 | if (null !== $reportIsDefault) { |
| 943 | 954 | $updated_data['form_content']['is_default'] = $reportIsDefault; |
| 944 | 955 | } |
| 945 | 956 | $updated_data['message'] = __('Form updated successfully.', 'bit-form'); |
| 957 | + | |
| 946 | 958 | return $updated_data; |
| 947 | 959 | } |
| 948 | 960 | } |
| 949 | 961 | |
| @@ -1151,9 +1163,9 @@ | ||
| 1151 | 1163 | 'title' => $emailTemplatevalue->title, |
| 1152 | 1164 | 'sub' => $emailTemplatevalue->sub, |
| 1153 | 1165 | 'body' => $emailTemplatevalue->body, |
| 1154 | 1166 | 'status' => isset($emailTemplatevalue->status) ? (int) $emailTemplatevalue->status : 1, |
| 1155 | - 'config' => !empty($emailTemplatevalue->config) ? json_decode($emailTemplatevalue->config) : (object) [], | |
| 1167 | + 'config' => EmailTemplateHandler::normalizeConfig($emailTemplatevalue->config ?? null), | |
| 1156 | 1168 | ]; |
| 1157 | 1169 | } |
| 1158 | 1170 | } |
| 1159 | 1171 | // get all pdf template |
| @@ -1448,9 +1460,9 @@ | ||
| 1448 | 1460 | 'title' => $emailTemplatevalue->title, |
| 1449 | 1461 | 'sub' => $emailTemplatevalue->sub, |
| 1450 | 1462 | 'body' => $emailTemplatevalue->body, |
| 1451 | 1463 | 'status' => isset($emailTemplatevalue->status) ? (int) $emailTemplatevalue->status : 1, |
| 1452 | - 'config' => !empty($emailTemplatevalue->config) ? json_decode($emailTemplatevalue->config) : (object) [], | |
| 1464 | + 'config' => EmailTemplateHandler::normalizeConfig($emailTemplatevalue->config ?? null), | |
| 1453 | 1465 | ]; |
| 1454 | 1466 | } |
| 1455 | 1467 | } |
| 1456 | 1468 | $integrationHandler = new IntegrationHandler($formID); |