From c3065cd3ef1aa370c44b9636a8ca9638121aad22 Mon Sep 17 00:00:00 2001 From: Amir Meshkin Date: Mon, 31 Jul 2023 14:17:25 +0000 Subject: [PATCH 1/5] FOIA-238: WS-238 Updated codebase with new button to make clearing and updating values easier. --- .../foia_annual_data_report.module | 24 +- .../js/foia-change-report-agency.js | 529 ++++++++++++++++-- 2 files changed, 483 insertions(+), 70 deletions(-) diff --git a/docroot/modules/custom/foia_annual_data_report/foia_annual_data_report.module b/docroot/modules/custom/foia_annual_data_report/foia_annual_data_report.module index 374d69d7e..d4c2404c6 100644 --- a/docroot/modules/custom/foia_annual_data_report/foia_annual_data_report.module +++ b/docroot/modules/custom/foia_annual_data_report/foia_annual_data_report.module @@ -45,8 +45,7 @@ function foia_annual_data_report_form_alter(&$form, FormStateInterface $form_sta if (!in_array($key, $starting_fields)) { $form[$key]['#access'] = FALSE; } - } - else { + } else { if (in_array($key, $hide_elements)) { $form[$key]['#access'] = FALSE; } @@ -56,8 +55,7 @@ function foia_annual_data_report_form_alter(&$form, FormStateInterface $form_sta $form['actions']['submit']['#value'] = 'Save and continue'; $form['actions']['preview']['#access'] = FALSE; $form['#attached']['library'][] = 'foia_annual_data_report/foia_form_display_new_reports'; - } - else { + } else { // Add the javascript functionality (only needed for existing nodes). $form['#attached']['library'][] = 'foia_annual_data_report/foia_change_report_agency'; } @@ -237,8 +235,7 @@ function foia_annual_data_report_form_annual_data_report_section_validate(array // Check if field is a selected paragraph field. if (in_array($key, $paragraph_parent_fields)) { _foia_annual_data_report_validate_paragraph_fields($form, $form_state, $key, $form_value, $paragraph_fields_for_validation); - } - else { + } else { // Determine first if this is a subform of the field to be validated. if (!empty($form_value['widget'][0]['subform'])) { @@ -266,15 +263,14 @@ function foia_annual_data_report_form_annual_data_report_section_validate(array } break; } - } - else { + } else { $value = isset($form_value[0]['value']) ?: 0; $element = $form[$key]; $element_title = isset($element['widget'][0]['#title']) ?: NULL; $error_msg = t( "Invalid input for :element_title:, please use number greater or equal to zero.", [':element_title:' => $element_title] - ); + ); _foia_annual_data_report_text_as_integer_validation($form_state, $key, $value, $error_msg); } } @@ -374,8 +370,7 @@ function foia_annual_data_report_form_annual_data_report_validate(array &$form, // Check for an existing report. if ($form_state->getFormObject() instanceof EntityForm) { $current_nid = $form_state->getformObject()->getEntity()->id(); - } - else { + } else { $current_nid = 0; } @@ -492,8 +487,7 @@ function foia_annual_data_report_unrequire_hidden_fields(array &$form) { function foia_annual_data_report_set_memory_limit() { try { $config_value = foia_annual_data_report_get_config('annual_report_memory_limit'); - } - catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException $e) { \Drupal::logger('foia_annual_data_report')->error('Invalid setting requested.'); } @@ -508,8 +502,7 @@ function foia_annual_data_report_set_memory_limit() { function foia_annual_data_report_set_max_execution_time() { try { $config_value = foia_annual_data_report_get_config('annual_report_max_execution_time'); - } - catch (\InvalidArgumentException $e) { + } catch (\InvalidArgumentException $e) { \Drupal::logger('foia_annual_data_report')->error('Invalid setting requested.'); } @@ -678,3 +671,4 @@ function foia_annual_data_report_entity_operation_alter(array &$operations, Enti } } } + diff --git a/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js b/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js index 88d2fbc99..8023d0deb 100644 --- a/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js +++ b/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js @@ -5,135 +5,539 @@ (function ($, drupalSettings) { Drupal.behaviors.foia_change_report_agency = { attach: function attach() { + var clearAllReportData = function (containId, overWriteFields = null) { + // Clear all sections data, + // clear individual section field will be in section clear function. + let dialogOptions + // need text and number fields but not buttons + let containerInputs = $('#' + containId + ' table tbody tr input:not([type=submit]):not([readonly])'); + // If there are inputs for this container meaning component is filled out + if (typeof containerInputs !== 'undefined' && containerInputs.length > 0) { + // Count number of rows, check for N/A + var inputValues = containerInputs.map(function () { + if (this.value) { + return this.value; + } + }).get(); + + // If data was already added manually then show error,å inputValues.includes("N/A") + if (inputValues.length >= 1) { + dialogOptions = { + title: "Manual Changes Detected", + width: 370, + height: 200, + buttons: { + button_resume: { + text: Drupal.t('Close'), + click: function () { + $(this).dialog('close'); + } + }, + button_confirm: { + text: Drupal.t('Replace Anyway'), + click: function () { + runInputs() + $(this).dialog('close'); + }, + } + }, + close: function () { + $(this).remove(); + } + }; + $('
').appendTo('body') + .html('
You have already entered data in this section. Please adjust the data manually.
') + .dialog(dialogOptions); + } else { + // Run the foreach script if there are not any manual edits + runInputs(); + } + + } else { + // Show error if "No Data to report for this section" was pressed + // without having populated any components + dialogOptions = { + title: "Add Placeholders First", + width: 370, + height: 200, + buttons: { + button_resume: { + text: Drupal.t('Close'), + click: function () { + $(this).dialog('close'); + } + }, + button_confirm: { + text: Drupal.t('Add Placeholders'), + click: function () { + $('#' + containId + " .component-placeholder-button").trigger("click"); + $(this).dialog('close'); + }, + } + }, + close: function () { + $(this).remove(); + } + }; + $('
').appendTo('body') + .html('
Please press "Add placeholders for component data below" and try again.
') + .dialog(dialogOptions); + } + + // Run only when needed since this code will run before user answers dialogue + function runInputs() { + $('#' + containId + ' table tbody tr input').each(function () { + if ($(this).is('[type=text]') && !$(this).attr('readonly')) { + $(this).val('N/A'); + if (overWriteFields !== null) { + for (var i = 0; i < overWriteFields.length; i++) { + var FieldIdPattern = overWriteFields[i].field; + var id = $(this).attr('id'); + if (id.match(FieldIdPattern)) { + $(this).val(overWriteFields[i].value); + break; + } + } + } + } + if ($(this).is('[type=number]') && (typeof $(this).attr('readonly') === "undefined")) { + $(this).val('0').trigger("change"); + } + }); + + $('#' + containId + ' table tbody tr textarea').each(function () { + if (typeof $(this).attr('readonly') === "undefined") { + $(this).val('N/A'); + } + }); + } + }; var sections = [ { field: 'field_admin_app_vib', - paragraph: 'admin_app_vib', + paragraph: 'admin_app_vib', // VI.B + section: { + name: 'vib', + containerWrapper: 'edit-field-admin-app-vib-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_admin_app_vic1', - paragraph: 'admin_app_vic1', + paragraph: 'admin_app_vic1', // VI.C.1 + section: { + name: 'vic1', + containerWrapper: 'edit-field-admin-app-vic1-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_admin_app_vic2', - paragraph: 'admin_app_vic2', + paragraph: 'admin_app_vic2', // VI.C.2 + section: { + name: 'vic2', + containerWrapper: 'edit-field-admin-app-vic2-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_admin_app_vic3', - paragraph: 'admin_app_vic3', + paragraph: 'admin_app_vic3', // VI.C.3 + section: { + name: 'vic3', + containerWrapper: 'edit-field-admin-app-vic3-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_admin_app_vic4', - paragraph: 'admin_app_vic4', + paragraph: 'admin_app_vic4', // VI.C.4 + section: { + name: 'vic4', + containerWrapper: 'edit-field-admin-app-vic4-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_admin_app_vic5', - paragraph: 'oldest_days', + paragraph: 'oldest_days', // VI.C.5 + section: { + name: 'vic5', + containerWrapper: 'edit-field-admin-app-vic5-wrapper', + fnt: function () { + var fields = [ + { + field: '-subform-field-date-', + value: 'N/A', + }, + { + field: 'subform-field-num-days-', + value: '0', + }, + ]; + clearAllReportData(this.containerWrapper, fields); + }, + }, }, { field: 'field_admin_app_via', - paragraph: 'admin_app_via', + paragraph: 'admin_app_via', // VI.A + section: { + name: 'via', + containerWrapper: 'edit-field-admin-app-via-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_fees_x', - paragraph: 'fees_x', + paragraph: 'fees_x', // X + section: { + name: 'x', + containerWrapper: 'edit-field-fees-x-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_foia_pers_costs_ix', - paragraph: 'foia_pers_costs_ix', + paragraph: 'foia_pers_costs_ix', // IX + section: { + name: 'ix', + containerWrapper: 'edit-field-foia-pers-costs-ix-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_foia_xiia', - paragraph: 'foia_xiia', + paragraph: 'foia_xiia', // XII.A + section: { + name: 'xiia', + containerWrapper: 'edit-field-foia-xiia-wrapper', + fnt: function () { + var fields = [ + { + field: '-subform-field-back-app-end-yr-', + value: '0', + }, + ]; + clearAllReportData(this.containerWrapper, fields); + }, + }, }, { field: 'field_foia_xiib', - paragraph: 'foia_xiib', + paragraph: 'foia_xiib', // XII.B + section: { + name: 'xiib', + containerWrapper: 'edit-field-foia-xiib-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_foia_xiic', - paragraph: 'oldest_days', + paragraph: 'oldest_days', // XII.C + section: { + name: 'xiic', + containerWrapper: 'edit-field-foia-xiic-wrapper', + fnt: function () { + var fields = [ + { + field: '-subform-field-num-days-', + value: '0', + }, + { + field: '-subform-field-date-', + value: 'N/A', + }, + ]; + clearAllReportData(this.containerWrapper, fields); + }, + }, }, { field: 'field_foia_xiid1', - paragraph: 'foia_xii_received_proc', + paragraph: 'foia_xii_received_proc', // XII.D.1 + section: { + name: 'xiid1', + containerWrapper: 'edit-field-foia-xiid1-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_foia_xiid2', - paragraph: 'foia_xii_backlogged', + paragraph: 'foia_xii_backlogged', // XII.D.2 + section: { + name: 'xiid2', + containerWrapper: 'edit-field-foia-xiid2-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_foia_xiie1', - paragraph: 'foia_xii_received_proc', + paragraph: 'foia_xii_received_proc', // XII.E.1 + section: { + name: 'xiie1', + containerWrapper: 'edit-field-foia-xiie1-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_foia_xiie2', - paragraph: 'foia_xii_backlogged', + paragraph: 'foia_xii_backlogged', // XII.E.2 + section: { + name: 'xiie2', + containerWrapper: 'edit-field-foia-xiie2-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_foia_requests_va', - paragraph: 'foia_req_va', + paragraph: 'foia_req_va', // V.A + section: + { + name: 'va', + containerWrapper: 'edit-field-foia-requests-va-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_foia_requests_vb2', - paragraph: 'foia_req_vb2', + paragraph: 'foia_req_vb2', // V.B.2 + section: { + name: 'vb2', + containerWrapper: 'edit-field-foia-requests-vb2-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_foia_requests_vb3', - paragraph: 'admin_app_vic1', + paragraph: 'admin_app_vic1', // V.B.3 + section: { + name: 'vb3', + containerWrapper: 'edit-field-foia-requests-vb3-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_foia_requests_vb1', - paragraph: 'foia_req_vb1', + paragraph: 'foia_req_vb1', // V.B.1 + section: { + name: 'vb1', + containerWrapper: 'edit-field-foia-requests-vb1-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_pending_requests_vii_d_', - paragraph: 'pending_requests_viid', + paragraph: 'pending_requests_viid', // VII.D + section: { + name: 'vii-d-', + containerWrapper: 'edit-field-pending-requests-vii-d-wrapper', + fnt: function () { + var fields = [ + { + field: '-subform-field-sim-pend-', + value: '0', + }, + { + field: '-subform-field-comp-med-', + value: 'N/A', + }, + { + field: '-subform-field-comp-avg-', + value: 'N/A', + }, + { + field: '-subform-field-sim-med-', + value: 'N/A', + }, + { + field: '-subform-field-sim-avg-', + value: 'N/A', + }, + { + field: '-subform-field-exp-med-', + value: 'N/A', + }, + { + field: '-subform-field-exp-avg-', + value: 'N/A', + }, + ]; + clearAllReportData(this.containerWrapper, fields); + }, + }, }, { field: 'field_admin_app_viie', - paragraph: 'oldest_days', + paragraph: 'oldest_days', // VII.E + section: { + name: 'viie', + containerWrapper: 'edit-field-admin-app-viie-wrapper', + fnt: function () { + var fields = [ + { + field: '-subform-field-date-', + value: 'N/A', + }, + { + field: '-subform-field-num-days-', + value: '0', + }, + ]; + clearAllReportData(this.containerWrapper, fields); + }, + }, }, { field: 'field_proc_req_viia', - paragraph: 'processed_requests_vii', + paragraph: 'processed_requests_vii', // VII.A + section: { + name: 'viia', + containerWrapper: 'edit-field-proc-req-viia-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_proc_req_viib', - paragraph: 'processed_requests_vii', + paragraph: 'processed_requests_vii', // VII.B + section: { + name: 'viib', + containerWrapper: 'edit-field-proc-req-viib-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_proc_req_viic1', - paragraph: 'proc_req_viic', + paragraph: 'proc_req_viic', // VII.C.1 + section: { + name: 'viic1', + containerWrapper: 'edit-field-proc-req-viic1-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_proc_req_viic2', - paragraph: 'proc_req_viic', + paragraph: 'proc_req_viic', // VII.C.2 + section: { + name: 'viic2', + containerWrapper: 'edit-field-proc-req-viic2-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_proc_req_viic3', - paragraph: 'proc_req_viic', + paragraph: 'proc_req_viic', // VII.C.3 + section: { + name: 'viic3', + containerWrapper: 'edit-field-proc-req-viic3-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_req_viiib', - paragraph: 'req_viiib', + paragraph: 'req_viiib', // VIII.B + section: { + name: 'viiib', + containerWrapper: 'edit-field-req-viiib-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_req_viiia', - paragraph: 'req_viiia', + paragraph: 'req_viiia', // VIII.A + section: { + name: 'viiia', + containerWrapper: 'edit-field-req-viiia-wrapper', + fnt: function () { + var fields = [ + { + field: '-subform-field-num-jud-w', + value: '0', + }, + ]; + clearAllReportData(this.containerWrapper, fields); + }, + }, }, { field: 'field_statute_iv', - paragraph: 'statute', + paragraph: 'statute', // IV + section: { + name: 'iv', + containerWrapper: 'edit-field-statute-iv-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_sub_xia', - paragraph: 'sub_xia', + paragraph: 'sub_xia', // XI.A + section: { + name: 'xia', + containerWrapper: 'edit-field-sub-xia-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, { field: 'field_sub_xib', - paragraph: 'sub_xib', + paragraph: 'sub_xib', // XI.B + section: { + name: 'xib', + containerWrapper: 'edit-field-sub-xib-wrapper', + fnt: function () { + clearAllReportData(this.containerWrapper); + }, + }, }, ]; for (var i = 0; i < sections.length; i++) { @@ -143,7 +547,7 @@ this.addClearDataButton(); }, - addClearDataButton: function() { + addClearDataButton: function () { function clearData() { var form = '#node-annual-foia-report-data-edit-form'; var exempt = '#edit-group-agency-info'; @@ -157,10 +561,10 @@ } alert('All data has been cleared from the form. Click "Save" to finalize.'); } - $('#edit-actions').once('foia-clear-data-button').each(function() { + $('#edit-actions').once('foia-clear-data-button').each(function () { var $button = $(''); $(this).append($button); - $button.click(function(evt) { + $button.click(function (evt) { evt.preventDefault(); if (confirm('Are you sure you want to clear all data from this report?')) { clearData(); @@ -169,29 +573,44 @@ }); }, - addPopulateComponentsButton: function(section) { + addPopulateComponentsButton: function (section) { // Anomaly - if a field ends in an underscore needs to be removed for the wrapper but maintained for other uses. var wrapperVar = section.field.replace(/_$/, ''); var fieldWrapperId = 'edit-' + wrapperVar.replace(/_/g, '-') + '-wrapper', - addMoreName = section.field + '_' + section.paragraph + '_add_more', - fieldWrapperSelector = '#' + fieldWrapperId, - addMoreSelector = 'input[name="' + addMoreName + '"]', - existingComponentSelector = fieldWrapperSelector + ' tbody tr:visible', - checkedComponentSelector = '#edit-field-agency-components input:checked', - getComponentDropdownName = function(index) { return section.field + '[' + index + '][subform]' }; - $(fieldWrapperSelector).once('foia-add-populate-button').each(function() { - $(this).prepend('
Use this button when starting a new report, to quickly add placeholders for all of the components that you have selected in the checkboxes above.
'); - var $button = $(''); - $(this).prepend($button); - $button.click(function(evt) { + addMoreName = section.field + '_' + section.paragraph + '_add_more', + fieldWrapperSelector = '#' + fieldWrapperId, + addMoreSelector = 'input[name="' + addMoreName + '"]', + existingComponentSelector = fieldWrapperSelector + ' tbody tr:visible', + checkedComponentSelector = '#edit-field-agency-components input:checked', + getComponentDropdownName = function (index) { return section.field + '[' + index + '][subform]' }; + + $(fieldWrapperSelector).once('foia-add-populate-button').each(function () { + // Build buttons contain. + var sectionBtns = $('
Use this button when starting a new report, to quickly add placeholders for all of the components that you have selected in the checkboxes above.
Use this button to quickly fill 0 or N/A for components do not apply.
'); + $(this).prepend(sectionBtns); + + let componentPlaceholderButtonDiv = $(this).find('.section-button-group .component-placeholder-button-div'); + let noDataToReportDiv = $(this).find('.section-button-group .no-data-to-report-div'); + // Build component placeholder button. + let $placeholderButton = $(''); + componentPlaceholderButtonDiv.prepend($placeholderButton); + // Build no data report button. + let $noDataButton = $(''); + noDataToReportDiv.prepend($noDataButton); + // debugger; + $noDataButton.click(function (evt) { + evt.preventDefault(); + section.section.fnt(); + }); + $placeholderButton.click(function (evt) { evt.preventDefault(); var $components = $(checkedComponentSelector), - numComponents = $components.length, - currentComponent = 0, - singleComponent = $(existingComponentSelector).length === 1, - componentDropdownName = getComponentDropdownName(currentComponent), - componentDropdownSelector = 'select[name^="' + componentDropdownName + '"]', - blankComponent = singleComponent && $(componentDropdownSelector).val() === '_none'; + numComponents = $components.length, + currentComponent = 0, + singleComponent = $(existingComponentSelector).length === 1, + componentDropdownName = getComponentDropdownName(currentComponent), + componentDropdownSelector = 'select[name^="' + componentDropdownName + '"]', + blankComponent = singleComponent && $(componentDropdownSelector).val() === '_none'; if (numComponents === 0) { alert('First select the components you want using the checkboxes above.'); } @@ -216,7 +635,7 @@ alert('Finished adding placeholders.'); } } - $(document).on('ajaxStop', function() { + $(document).on('ajaxStop', function () { if (currentComponent < numComponents) { populateNextComponent(currentComponent); } @@ -231,5 +650,5 @@ }); }); } - } + }; })(jQuery, drupalSettings); From 7bbf579001d99727a546ca2df2332105ec477767 Mon Sep 17 00:00:00 2001 From: Amir Meshkin Date: Tue, 8 Aug 2023 10:35:56 -0400 Subject: [PATCH 2/5] FOIA-238: WS-238- Updating file to pass php sniffer. --- .../foia_annual_data_report.module | 26 ++++++++++++------- .../Action/AnnualReportModerationAction.php | 8 +++--- .../modules/custom/foia_api/foia_api.module | 4 +-- .../FoiaApiFiscalYearController.php | 6 ++--- .../FoiaApiQuarterlyFiscalYearController.php | 6 ++--- .../resource/WebformSubmissionResource.php | 2 +- .../src/Controller/ExportController.php | 2 +- .../src/Commands/FoiaFileCommands.php | 2 +- .../migrate/process/NewlineToLineBreak.php | 2 +- .../Controller/FoiaPersonnelController.php | 2 +- .../src/Entity/FoiaPersonnel.php | 6 ++--- .../src/Entity/FoiaPersonnelInterface.php | 4 +-- .../src/FoiaPersonnelAccessControlHandler.php | 2 +- .../src/FoiaPersonnelStorage.php | 2 +- .../src/FoiaPersonnelStorageInterface.php | 2 +- .../foia_quarterly_data_report.module | 4 +-- .../QuarterlyReportModerationAction.php | 8 +++--- .../foia_request/foia_request.drush.inc | 4 +-- .../src/Commands/FoiaRequestCommands.php | 6 ++--- .../foia_request/src/Entity/FoiaRequest.php | 4 +-- .../src/FoiaRequestAccessControlHandler.php | 2 +- .../src/Form/FoiaRequestPurgeForm.php | 2 +- docroot/modules/custom/foia_ui/foia_ui.module | 4 +-- .../src/Commands/FoiaUploadXmlCommands.php | 8 +++--- ...UploadXmlMigrationPostImportSubscriber.php | 16 ++++++------ ...oadXmlPostImportCalculationsSubscriber.php | 6 ++--- .../FailedMigrationHandler/DefaultHandler.php | 2 +- .../src/FoiaUploadXmlBatchImport.php | 2 +- .../src/FoiaUploadXmlMigrateExecutable.php | 10 +++---- .../src/FoiaUploadXmlMigrationsProcessor.php | 6 ++--- .../src/FoiaUploadXmlReportParser.php | 2 +- .../src/Form/AgencyXmlUploadForm.php | 8 +++--- .../QueueWorker/FoiaXmlReportImportWorker.php | 6 ++--- .../Plugin/migrate/FoiaUploadXmlMigration.php | 2 +- .../src/Plugin/migrate/process/ArrayPad.php | 2 +- .../migrate/process/ComponentLookup.php | 2 +- .../Plugin/migrate/process/FilterValues.php | 2 +- .../src/ReportUploadValidator.php | 8 +++--- .../custom/foia_users/foia_users.module | 2 +- .../custom/foia_webform/foia_webform.module | 2 +- .../src/FoiaSubmissionPrettyFormatter.php | 2 +- .../src/FoiaSubmissionQueueingService.php | 2 +- .../FoiaEmailWebformHandler.php | 2 +- .../src/Kernel/AgencyLookupServiceTest.php | 8 +++--- .../tests/src/Kernel/FieldInstallTrait.php | 2 +- .../Kernel/FoiaSubmissionQueueHandlerTest.php | 8 +++--- .../Kernel/FoiaSubmissionQueueWorkerTest.php | 2 +- .../Kernel/FoiaSubmissionServiceApiTest.php | 8 +++--- .../custom/foia_workflow/foia_workflow.module | 2 +- .../node_to_docx/node_to_docx.theme.inc | 2 +- .../EventSubscriber/AutoloaderSubscriber.php | 2 +- .../node_to_docx/src/NodeToDocxHandler.php | 2 +- .../FieldEnhancer/WebformElementsEnhancer.php | 2 +- .../src/Functional/WebformNormalizerTest.php | 2 +- .../src/WebformTemplateController.php | 6 ++--- .../webform_template/webform_template.module | 2 +- 56 files changed, 128 insertions(+), 122 deletions(-) diff --git a/docroot/modules/custom/foia_annual_data_report/foia_annual_data_report.module b/docroot/modules/custom/foia_annual_data_report/foia_annual_data_report.module index d4c2404c6..cc10aa50c 100644 --- a/docroot/modules/custom/foia_annual_data_report/foia_annual_data_report.module +++ b/docroot/modules/custom/foia_annual_data_report/foia_annual_data_report.module @@ -8,9 +8,9 @@ use Drupal\Core\Entity\EntityForm; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Render\Element; use Drupal\Core\Render\Markup; use Drupal\Core\StringTranslation\TranslatableMarkup; -use Drupal\Core\Render\Element; /** * Implements hook_form_form_alter(). @@ -45,7 +45,8 @@ function foia_annual_data_report_form_alter(&$form, FormStateInterface $form_sta if (!in_array($key, $starting_fields)) { $form[$key]['#access'] = FALSE; } - } else { + } + else { if (in_array($key, $hide_elements)) { $form[$key]['#access'] = FALSE; } @@ -55,7 +56,8 @@ function foia_annual_data_report_form_alter(&$form, FormStateInterface $form_sta $form['actions']['submit']['#value'] = 'Save and continue'; $form['actions']['preview']['#access'] = FALSE; $form['#attached']['library'][] = 'foia_annual_data_report/foia_form_display_new_reports'; - } else { + } + else { // Add the javascript functionality (only needed for existing nodes). $form['#attached']['library'][] = 'foia_annual_data_report/foia_change_report_agency'; } @@ -235,7 +237,8 @@ function foia_annual_data_report_form_annual_data_report_section_validate(array // Check if field is a selected paragraph field. if (in_array($key, $paragraph_parent_fields)) { _foia_annual_data_report_validate_paragraph_fields($form, $form_state, $key, $form_value, $paragraph_fields_for_validation); - } else { + } + else { // Determine first if this is a subform of the field to be validated. if (!empty($form_value['widget'][0]['subform'])) { @@ -263,14 +266,15 @@ function foia_annual_data_report_form_annual_data_report_section_validate(array } break; } - } else { + } + else { $value = isset($form_value[0]['value']) ?: 0; $element = $form[$key]; $element_title = isset($element['widget'][0]['#title']) ?: NULL; $error_msg = t( "Invalid input for :element_title:, please use number greater or equal to zero.", [':element_title:' => $element_title] - ); + ); _foia_annual_data_report_text_as_integer_validation($form_state, $key, $value, $error_msg); } } @@ -370,7 +374,8 @@ function foia_annual_data_report_form_annual_data_report_validate(array &$form, // Check for an existing report. if ($form_state->getFormObject() instanceof EntityForm) { $current_nid = $form_state->getformObject()->getEntity()->id(); - } else { + } + else { $current_nid = 0; } @@ -487,7 +492,8 @@ function foia_annual_data_report_unrequire_hidden_fields(array &$form) { function foia_annual_data_report_set_memory_limit() { try { $config_value = foia_annual_data_report_get_config('annual_report_memory_limit'); - } catch (\InvalidArgumentException $e) { + } + catch (\InvalidArgumentException $e) { \Drupal::logger('foia_annual_data_report')->error('Invalid setting requested.'); } @@ -502,7 +508,8 @@ function foia_annual_data_report_set_memory_limit() { function foia_annual_data_report_set_max_execution_time() { try { $config_value = foia_annual_data_report_get_config('annual_report_max_execution_time'); - } catch (\InvalidArgumentException $e) { + } + catch (\InvalidArgumentException $e) { \Drupal::logger('foia_annual_data_report')->error('Invalid setting requested.'); } @@ -671,4 +678,3 @@ function foia_annual_data_report_entity_operation_alter(array &$operations, Enti } } } - diff --git a/docroot/modules/custom/foia_annual_data_report/src/Plugin/Action/AnnualReportModerationAction.php b/docroot/modules/custom/foia_annual_data_report/src/Plugin/Action/AnnualReportModerationAction.php index 6145ca7cc..9e236fcaf 100644 --- a/docroot/modules/custom/foia_annual_data_report/src/Plugin/Action/AnnualReportModerationAction.php +++ b/docroot/modules/custom/foia_annual_data_report/src/Plugin/Action/AnnualReportModerationAction.php @@ -7,14 +7,14 @@ * Contains \Drupal\foia_annual_data_report\Plugin\Action\AnnualReportModerationAction. */ +use Drupal\content_moderation\ModerationInformationInterface; +use Drupal\content_moderation\StateTransitionValidationInterface; use Drupal\Core\Action\ActionBase; +use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Messenger\MessengerInterface; -use Drupal\content_moderation\ModerationInformationInterface; -use Drupal\content_moderation\StateTransitionValidationInterface; use Drupal\node\NodeInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Provides a a Publish foia annual reports action. diff --git a/docroot/modules/custom/foia_api/foia_api.module b/docroot/modules/custom/foia_api/foia_api.module index 0cd8ee199..b8e0ad602 100644 --- a/docroot/modules/custom/foia_api/foia_api.module +++ b/docroot/modules/custom/foia_api/foia_api.module @@ -5,11 +5,11 @@ * Main module file for FOIA API. */ -use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Entity\EntityTypeInterface; use Drupal\Core\Access\AccessResultAllowed; use Drupal\Core\Database\Query\AlterableInterface; use Drupal\Core\Database\Query\ConditionInterface; +use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Session\AccountInterface; /** * Implements hook_jsonapi_ENTITY_TYPE_filter_access(). diff --git a/docroot/modules/custom/foia_api/src/Controller/FoiaApiFiscalYearController.php b/docroot/modules/custom/foia_api/src/Controller/FoiaApiFiscalYearController.php index 8b36ecc6b..32ee63a2f 100644 --- a/docroot/modules/custom/foia_api/src/Controller/FoiaApiFiscalYearController.php +++ b/docroot/modules/custom/foia_api/src/Controller/FoiaApiFiscalYearController.php @@ -2,11 +2,11 @@ namespace Drupal\foia_api\Controller; -use Drupal\Core\Database\Connection; -use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Cache\CacheableJsonResponse; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\Core\Controller\ControllerBase; +use Drupal\Core\Database\Connection; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Gets jsonapi data. diff --git a/docroot/modules/custom/foia_api/src/Controller/FoiaApiQuarterlyFiscalYearController.php b/docroot/modules/custom/foia_api/src/Controller/FoiaApiQuarterlyFiscalYearController.php index 21252caf6..f484ac4c2 100644 --- a/docroot/modules/custom/foia_api/src/Controller/FoiaApiQuarterlyFiscalYearController.php +++ b/docroot/modules/custom/foia_api/src/Controller/FoiaApiQuarterlyFiscalYearController.php @@ -2,11 +2,11 @@ namespace Drupal\foia_api\Controller; -use Drupal\Core\Database\Connection; -use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Cache\CacheableJsonResponse; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\Core\Controller\ControllerBase; +use Drupal\Core\Database\Connection; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Gets jsonapi data. diff --git a/docroot/modules/custom/foia_api/src/Plugin/rest/resource/WebformSubmissionResource.php b/docroot/modules/custom/foia_api/src/Plugin/rest/resource/WebformSubmissionResource.php index 925750438..325fddb6a 100644 --- a/docroot/modules/custom/foia_api/src/Plugin/rest/resource/WebformSubmissionResource.php +++ b/docroot/modules/custom/foia_api/src/Plugin/rest/resource/WebformSubmissionResource.php @@ -10,8 +10,8 @@ use Drupal\file_entity\Entity\FileEntity; use Drupal\foia_webform\AgencyLookupServiceInterface; use Drupal\node\NodeInterface; -use Drupal\rest\Plugin\ResourceBase; use Drupal\rest\ModifiedResourceResponse; +use Drupal\rest\Plugin\ResourceBase; use Drupal\webform\Entity\Webform; use Drupal\webform\Plugin\WebformElementManagerInterface; use Drupal\webform\WebformInterface; diff --git a/docroot/modules/custom/foia_export_xml/src/Controller/ExportController.php b/docroot/modules/custom/foia_export_xml/src/Controller/ExportController.php index b47452f1d..dadd673ad 100644 --- a/docroot/modules/custom/foia_export_xml/src/Controller/ExportController.php +++ b/docroot/modules/custom/foia_export_xml/src/Controller/ExportController.php @@ -3,11 +3,11 @@ namespace Drupal\foia_export_xml\Controller; use Drupal\Core\Access\AccessResult; +use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Controller\ControllerBase; use Drupal\foia_export_xml\ExportXml; use Drupal\node\Entity\Node; use Symfony\Component\HttpFoundation\Response; -use Drupal\Core\Cache\CacheBackendInterface; /** * Class ExportController for XML export. diff --git a/docroot/modules/custom/foia_file/src/Commands/FoiaFileCommands.php b/docroot/modules/custom/foia_file/src/Commands/FoiaFileCommands.php index 7a9021331..beb0530fb 100644 --- a/docroot/modules/custom/foia_file/src/Commands/FoiaFileCommands.php +++ b/docroot/modules/custom/foia_file/src/Commands/FoiaFileCommands.php @@ -2,8 +2,8 @@ namespace Drupal\foia_file\Commands; -use Drush\Commands\DrushCommands; use Drupal\file\Entity\File; +use Drush\Commands\DrushCommands; /** * A Drush commandfile. diff --git a/docroot/modules/custom/foia_migrate/src/Plugin/migrate/process/NewlineToLineBreak.php b/docroot/modules/custom/foia_migrate/src/Plugin/migrate/process/NewlineToLineBreak.php index 413c0ec21..5f0b0a787 100644 --- a/docroot/modules/custom/foia_migrate/src/Plugin/migrate/process/NewlineToLineBreak.php +++ b/docroot/modules/custom/foia_migrate/src/Plugin/migrate/process/NewlineToLineBreak.php @@ -2,9 +2,9 @@ namespace Drupal\foia_migrate\Plugin\migrate\process; -use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\MigrateException; use Drupal\migrate\MigrateExecutableInterface; +use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\Row; /** diff --git a/docroot/modules/custom/foia_personnel/src/Controller/FoiaPersonnelController.php b/docroot/modules/custom/foia_personnel/src/Controller/FoiaPersonnelController.php index e3b465658..7a2cb5116 100644 --- a/docroot/modules/custom/foia_personnel/src/Controller/FoiaPersonnelController.php +++ b/docroot/modules/custom/foia_personnel/src/Controller/FoiaPersonnelController.php @@ -2,10 +2,10 @@ namespace Drupal\foia_personnel\Controller; -use Drupal\Core\Link; use Drupal\Component\Utility\Xss; use Drupal\Core\Controller\ControllerBase; use Drupal\Core\DependencyInjection\ContainerInjectionInterface; +use Drupal\Core\Link; use Drupal\Core\Url; use Drupal\foia_personnel\Entity\FoiaPersonnelInterface; diff --git a/docroot/modules/custom/foia_personnel/src/Entity/FoiaPersonnel.php b/docroot/modules/custom/foia_personnel/src/Entity/FoiaPersonnel.php index f6219ceca..4c2488ec2 100644 --- a/docroot/modules/custom/foia_personnel/src/Entity/FoiaPersonnel.php +++ b/docroot/modules/custom/foia_personnel/src/Entity/FoiaPersonnel.php @@ -2,11 +2,11 @@ namespace Drupal\foia_personnel\Entity; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Field\BaseFieldDefinition; -use Drupal\Core\Entity\RevisionableContentEntityBase; use Drupal\Core\Entity\EntityChangedTrait; +use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Entity\RevisionableContentEntityBase; +use Drupal\Core\Field\BaseFieldDefinition; use Drupal\user\UserInterface; /** diff --git a/docroot/modules/custom/foia_personnel/src/Entity/FoiaPersonnelInterface.php b/docroot/modules/custom/foia_personnel/src/Entity/FoiaPersonnelInterface.php index 7566443a6..8ec603f31 100644 --- a/docroot/modules/custom/foia_personnel/src/Entity/FoiaPersonnelInterface.php +++ b/docroot/modules/custom/foia_personnel/src/Entity/FoiaPersonnelInterface.php @@ -2,9 +2,9 @@ namespace Drupal\foia_personnel\Entity; -use Drupal\Core\Entity\RevisionLogInterface; -use Drupal\Core\Entity\RevisionableInterface; use Drupal\Core\Entity\EntityChangedInterface; +use Drupal\Core\Entity\RevisionableInterface; +use Drupal\Core\Entity\RevisionLogInterface; use Drupal\user\EntityOwnerInterface; /** diff --git a/docroot/modules/custom/foia_personnel/src/FoiaPersonnelAccessControlHandler.php b/docroot/modules/custom/foia_personnel/src/FoiaPersonnelAccessControlHandler.php index c40bda032..e07d9f0f2 100644 --- a/docroot/modules/custom/foia_personnel/src/FoiaPersonnelAccessControlHandler.php +++ b/docroot/modules/custom/foia_personnel/src/FoiaPersonnelAccessControlHandler.php @@ -2,10 +2,10 @@ namespace Drupal\foia_personnel; +use Drupal\Core\Access\AccessResult; use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Access\AccessResult; /** * Access controller for the FOIA Personnel entity. diff --git a/docroot/modules/custom/foia_personnel/src/FoiaPersonnelStorage.php b/docroot/modules/custom/foia_personnel/src/FoiaPersonnelStorage.php index d63253929..03cd09cee 100644 --- a/docroot/modules/custom/foia_personnel/src/FoiaPersonnelStorage.php +++ b/docroot/modules/custom/foia_personnel/src/FoiaPersonnelStorage.php @@ -3,8 +3,8 @@ namespace Drupal\foia_personnel; use Drupal\Core\Entity\Sql\SqlContentEntityStorage; -use Drupal\Core\Session\AccountInterface; use Drupal\Core\Language\LanguageInterface; +use Drupal\Core\Session\AccountInterface; use Drupal\foia_personnel\Entity\FoiaPersonnelInterface; /** diff --git a/docroot/modules/custom/foia_personnel/src/FoiaPersonnelStorageInterface.php b/docroot/modules/custom/foia_personnel/src/FoiaPersonnelStorageInterface.php index dc1ffefe5..9c60e372b 100644 --- a/docroot/modules/custom/foia_personnel/src/FoiaPersonnelStorageInterface.php +++ b/docroot/modules/custom/foia_personnel/src/FoiaPersonnelStorageInterface.php @@ -3,8 +3,8 @@ namespace Drupal\foia_personnel; use Drupal\Core\Entity\ContentEntityStorageInterface; -use Drupal\Core\Session\AccountInterface; use Drupal\Core\Language\LanguageInterface; +use Drupal\Core\Session\AccountInterface; use Drupal\foia_personnel\Entity\FoiaPersonnelInterface; /** diff --git a/docroot/modules/custom/foia_quarterly_data_report/foia_quarterly_data_report.module b/docroot/modules/custom/foia_quarterly_data_report/foia_quarterly_data_report.module index 2ebb499e1..6805e8ac7 100644 --- a/docroot/modules/custom/foia_quarterly_data_report/foia_quarterly_data_report.module +++ b/docroot/modules/custom/foia_quarterly_data_report/foia_quarterly_data_report.module @@ -5,11 +5,11 @@ * Primary module hooks for foia_quarterly_data_report module. */ +use Drupal\Core\Entity\EntityForm; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Render\Element; use Drupal\Core\Render\Markup; use Drupal\Core\StringTranslation\TranslatableMarkup; -use Drupal\Core\Entity\EntityForm; -use Drupal\Core\Render\Element; /** * Implements hook_form_form_id_alter(). diff --git a/docroot/modules/custom/foia_quarterly_data_report/src/Plugin/Action/QuarterlyReportModerationAction.php b/docroot/modules/custom/foia_quarterly_data_report/src/Plugin/Action/QuarterlyReportModerationAction.php index 9b9fbeb76..c550ba4ca 100644 --- a/docroot/modules/custom/foia_quarterly_data_report/src/Plugin/Action/QuarterlyReportModerationAction.php +++ b/docroot/modules/custom/foia_quarterly_data_report/src/Plugin/Action/QuarterlyReportModerationAction.php @@ -7,14 +7,14 @@ * Contains \Drupal\foia_quarterly_data_report\Plugin\Action\QuarterlyReportModerationAction. */ +use Drupal\content_moderation\ModerationInformationInterface; +use Drupal\content_moderation\StateTransitionValidationInterface; use Drupal\Core\Action\ActionBase; +use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Messenger\MessengerInterface; -use Drupal\content_moderation\ModerationInformationInterface; -use Drupal\content_moderation\StateTransitionValidationInterface; use Drupal\node\NodeInterface; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * VBO Moderation state change. diff --git a/docroot/modules/custom/foia_request/foia_request.drush.inc b/docroot/modules/custom/foia_request/foia_request.drush.inc index 5e18d3c3c..0eeccd48e 100644 --- a/docroot/modules/custom/foia_request/foia_request.drush.inc +++ b/docroot/modules/custom/foia_request/foia_request.drush.inc @@ -5,10 +5,10 @@ * Drush command to update FOIA request submissions. */ -use Drupal\webform\Entity\WebformSubmission; use Drupal\file_entity\Entity\FileEntity; -use Drupal\foia_request\Entity\FoiaRequestInterface; use Drupal\foia_request\Entity\FoiaRequest; +use Drupal\foia_request\Entity\FoiaRequestInterface; +use Drupal\webform\Entity\WebformSubmission; /** * Implements hook_drush_command(). diff --git a/docroot/modules/custom/foia_request/src/Commands/FoiaRequestCommands.php b/docroot/modules/custom/foia_request/src/Commands/FoiaRequestCommands.php index 66e601b36..fba7a4a19 100644 --- a/docroot/modules/custom/foia_request/src/Commands/FoiaRequestCommands.php +++ b/docroot/modules/custom/foia_request/src/Commands/FoiaRequestCommands.php @@ -2,11 +2,11 @@ namespace Drupal\foia_request\Commands; -use Drush\Commands\DrushCommands; -use Drupal\webform\Entity\WebformSubmission; use Drupal\file_entity\Entity\FileEntity; -use Drupal\foia_request\Entity\FoiaRequestInterface; use Drupal\foia_request\Entity\FoiaRequest; +use Drupal\foia_request\Entity\FoiaRequestInterface; +use Drupal\webform\Entity\WebformSubmission; +use Drush\Commands\DrushCommands; /** * A Drush commandfile. diff --git a/docroot/modules/custom/foia_request/src/Entity/FoiaRequest.php b/docroot/modules/custom/foia_request/src/Entity/FoiaRequest.php index 83df45833..2d341f960 100644 --- a/docroot/modules/custom/foia_request/src/Entity/FoiaRequest.php +++ b/docroot/modules/custom/foia_request/src/Entity/FoiaRequest.php @@ -2,11 +2,11 @@ namespace Drupal\foia_request\Entity; -use Drupal\Core\Entity\EntityStorageInterface; -use Drupal\Core\Field\BaseFieldDefinition; use Drupal\Core\Entity\ContentEntityBase; use Drupal\Core\Entity\EntityChangedTrait; +use Drupal\Core\Entity\EntityStorageInterface; use Drupal\Core\Entity\EntityTypeInterface; +use Drupal\Core\Field\BaseFieldDefinition; use Drupal\user\UserInterface; /** diff --git a/docroot/modules/custom/foia_request/src/FoiaRequestAccessControlHandler.php b/docroot/modules/custom/foia_request/src/FoiaRequestAccessControlHandler.php index 847e148fc..338750882 100644 --- a/docroot/modules/custom/foia_request/src/FoiaRequestAccessControlHandler.php +++ b/docroot/modules/custom/foia_request/src/FoiaRequestAccessControlHandler.php @@ -2,10 +2,10 @@ namespace Drupal\foia_request; +use Drupal\Core\Access\AccessResult; use Drupal\Core\Entity\EntityAccessControlHandler; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; -use Drupal\Core\Access\AccessResult; /** * Access controller for the FOIA Request entity. diff --git a/docroot/modules/custom/foia_request/src/Form/FoiaRequestPurgeForm.php b/docroot/modules/custom/foia_request/src/Form/FoiaRequestPurgeForm.php index e16613275..bbb8d4eab 100644 --- a/docroot/modules/custom/foia_request/src/Form/FoiaRequestPurgeForm.php +++ b/docroot/modules/custom/foia_request/src/Form/FoiaRequestPurgeForm.php @@ -4,8 +4,8 @@ use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; -use Drupal\foia_request\Entity\FoiaRequestInterface; use Drupal\foia_request\Entity\FoiaRequest; +use Drupal\foia_request\Entity\FoiaRequestInterface; /** * Purge failed FOIA requests older than 2 weeks. diff --git a/docroot/modules/custom/foia_ui/foia_ui.module b/docroot/modules/custom/foia_ui/foia_ui.module index a79fc265d..d83787017 100644 --- a/docroot/modules/custom/foia_ui/foia_ui.module +++ b/docroot/modules/custom/foia_ui/foia_ui.module @@ -5,11 +5,11 @@ * FOIA UI module hook implementations. */ +use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Render\Element; use Drupal\Core\Url; use Drupal\node\Entity\Node; use Drupal\node\Entity\NodeType; -use Drupal\Core\Render\Element; -use Drupal\Core\Form\FormStateInterface; /** * Implements hook_toolbar_alter(). diff --git a/docroot/modules/custom/foia_upload_xml/src/Commands/FoiaUploadXmlCommands.php b/docroot/modules/custom/foia_upload_xml/src/Commands/FoiaUploadXmlCommands.php index 2d8036cab..5f5fd14a2 100644 --- a/docroot/modules/custom/foia_upload_xml/src/Commands/FoiaUploadXmlCommands.php +++ b/docroot/modules/custom/foia_upload_xml/src/Commands/FoiaUploadXmlCommands.php @@ -2,14 +2,14 @@ namespace Drupal\foia_upload_xml\Commands; -use Drupal\file\FileInterface; +use Consolidation\OutputFormatters\StructuredData\RowsOfFields; use Drupal\Core\Database\Connection; -use Drupal\migrate\Plugin\MigrateIdMapInterface; use Drupal\Core\Entity\EntityTypeManagerInterface; -use Drupal\foia_upload_xml\FoiaUploadXmlReportParser; use Drupal\Core\Logger\LoggerChannelFactoryInterface; +use Drupal\file\FileInterface; use Drupal\foia_upload_xml\FoiaUploadXmlMigrationsProcessor; -use Consolidation\OutputFormatters\StructuredData\RowsOfFields; +use Drupal\foia_upload_xml\FoiaUploadXmlReportParser; +use Drupal\migrate\Plugin\MigrateIdMapInterface; use Drush\Commands\DrushCommands; /** diff --git a/docroot/modules/custom/foia_upload_xml/src/EventSubscriber/FoiaUploadXmlMigrationPostImportSubscriber.php b/docroot/modules/custom/foia_upload_xml/src/EventSubscriber/FoiaUploadXmlMigrationPostImportSubscriber.php index 693cd665c..93e3c5d01 100644 --- a/docroot/modules/custom/foia_upload_xml/src/EventSubscriber/FoiaUploadXmlMigrationPostImportSubscriber.php +++ b/docroot/modules/custom/foia_upload_xml/src/EventSubscriber/FoiaUploadXmlMigrationPostImportSubscriber.php @@ -2,18 +2,18 @@ namespace Drupal\foia_upload_xml\EventSubscriber; -use Drupal\migrate\Row; +use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Utility\Error; -use Drupal\migrate\MigrateMessage; -use Drupal\migrate\MigrateException; use Drupal\migrate\Event\MigrateEvents; use Drupal\migrate\Event\MigrateImportEvent; -use Drupal\Core\Messenger\MessengerInterface; -use Drupal\migrate\Plugin\MigrationInterface; -use Drupal\migrate\Plugin\MigrateIdMapInterface; -use Drupal\migrate\Event\MigratePreRowSaveEvent; use Drupal\migrate\Event\MigratePostRowSaveEvent; -use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\migrate\Event\MigratePreRowSaveEvent; +use Drupal\migrate\MigrateException; +use Drupal\migrate\MigrateMessage; +use Drupal\migrate\Plugin\MigrateIdMapInterface; +use Drupal\migrate\Plugin\MigrationInterface; +use Drupal\migrate\Row; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** diff --git a/docroot/modules/custom/foia_upload_xml/src/EventSubscriber/FoiaUploadXmlPostImportCalculationsSubscriber.php b/docroot/modules/custom/foia_upload_xml/src/EventSubscriber/FoiaUploadXmlPostImportCalculationsSubscriber.php index f925519a9..c2409bc94 100644 --- a/docroot/modules/custom/foia_upload_xml/src/EventSubscriber/FoiaUploadXmlPostImportCalculationsSubscriber.php +++ b/docroot/modules/custom/foia_upload_xml/src/EventSubscriber/FoiaUploadXmlPostImportCalculationsSubscriber.php @@ -2,11 +2,11 @@ namespace Drupal\foia_upload_xml\EventSubscriber; -use Drupal\migrate\Row; -use Drupal\migrate\Event\MigrateEvents; +use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Messenger\MessengerInterface; +use Drupal\migrate\Event\MigrateEvents; use Drupal\migrate\Event\MigratePreRowSaveEvent; -use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\migrate\Row; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** diff --git a/docroot/modules/custom/foia_upload_xml/src/FailedMigrationHandler/DefaultHandler.php b/docroot/modules/custom/foia_upload_xml/src/FailedMigrationHandler/DefaultHandler.php index d67cb9e82..143b5e0e4 100644 --- a/docroot/modules/custom/foia_upload_xml/src/FailedMigrationHandler/DefaultHandler.php +++ b/docroot/modules/custom/foia_upload_xml/src/FailedMigrationHandler/DefaultHandler.php @@ -3,8 +3,8 @@ namespace Drupal\foia_upload_xml\FailedMigrationHandler; use Drupal\Core\Messenger\MessengerInterface; -use Drupal\migrate\Plugin\MigrationInterface; use Drupal\Core\StringTranslation\TranslationInterface; +use Drupal\migrate\Plugin\MigrationInterface; /** * A default FailedMigrationHandler. diff --git a/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlBatchImport.php b/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlBatchImport.php index aabcefae1..54339a408 100644 --- a/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlBatchImport.php +++ b/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlBatchImport.php @@ -2,10 +2,10 @@ namespace Drupal\foia_upload_xml; -use Drupal\file\FileInterface; use Drupal\Core\Messenger\MessengerInterface; use Drupal\Core\Session\AccountInterface; use Drupal\Core\StringTranslation\StringTranslationTrait; +use Drupal\file\FileInterface; use Drupal\migrate\MigrateMessage; /** diff --git a/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlMigrateExecutable.php b/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlMigrateExecutable.php index 7d43767fa..afaa5963d 100644 --- a/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlMigrateExecutable.php +++ b/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlMigrateExecutable.php @@ -2,13 +2,13 @@ namespace Drupal\foia_upload_xml; -use Drupal\migrate\Row; +use Drupal\foia_upload_xml\FailedMigrationHandler\DefaultHandler; +use Drupal\foia_upload_xml\FailedMigrationHandler\SectionMissing; use Drupal\migrate\MigrateException; -use Drupal\migrate_tools\MigrateExecutable; -use Drupal\migrate\Plugin\MigrateIdMapInterface; use Drupal\migrate\Plugin\migrate\process\Extract; -use Drupal\foia_upload_xml\FailedMigrationHandler\SectionMissing; -use Drupal\foia_upload_xml\FailedMigrationHandler\DefaultHandler; +use Drupal\migrate\Plugin\MigrateIdMapInterface; +use Drupal\migrate\Row; +use Drupal\migrate_tools\MigrateExecutable; /** * Wrapper around MigrateExecutable that provides for better failure messaging. diff --git a/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlMigrationsProcessor.php b/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlMigrationsProcessor.php index ec796092c..b4c650054 100644 --- a/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlMigrationsProcessor.php +++ b/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlMigrationsProcessor.php @@ -2,11 +2,11 @@ namespace Drupal\foia_upload_xml; -use Drupal\file\FileInterface; -use Drupal\migrate\MigrateMessage; +use Drupal\Component\Utility\NestedArray; use Drupal\Core\Cache\NullBackend; use Drupal\Core\Session\AccountInterface; -use Drupal\Component\Utility\NestedArray; +use Drupal\file\FileInterface; +use Drupal\migrate\MigrateMessage; use Drupal\migrate\MigrateMessageInterface; use Drupal\migrate\Plugin\MigrationPluginManager; diff --git a/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlReportParser.php b/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlReportParser.php index 4bf033a2b..4adb9cce5 100644 --- a/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlReportParser.php +++ b/docroot/modules/custom/foia_upload_xml/src/FoiaUploadXmlReportParser.php @@ -2,8 +2,8 @@ namespace Drupal\foia_upload_xml; -use Drupal\file\FileInterface; use Drupal\Core\Entity\EntityTypeManager; +use Drupal\file\FileInterface; use Drupal\migrate_plus\DataParserPluginManager; /** diff --git a/docroot/modules/custom/foia_upload_xml/src/Form/AgencyXmlUploadForm.php b/docroot/modules/custom/foia_upload_xml/src/Form/AgencyXmlUploadForm.php index 252de8ecf..570407491 100644 --- a/docroot/modules/custom/foia_upload_xml/src/Form/AgencyXmlUploadForm.php +++ b/docroot/modules/custom/foia_upload_xml/src/Form/AgencyXmlUploadForm.php @@ -2,14 +2,14 @@ namespace Drupal\foia_upload_xml\Form; -use Drupal\file\FileInterface; -use Drupal\Core\File\FileSystemInterface; -use Drupal\foia_upload_xml\ReportUploadValidator; use Drupal\Core\Entity\EntityTypeManagerInterface; +use Drupal\Core\File\FileSystemInterface; use Drupal\Core\Form\FormBase; use Drupal\Core\Form\FormStateInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Drupal\file\FileInterface; +use Drupal\foia_upload_xml\ReportUploadValidator; use Drupal\user\Entity\User; +use Symfony\Component\DependencyInjection\ContainerInterface; /** * Class AgencyXmlUploadForm. diff --git a/docroot/modules/custom/foia_upload_xml/src/Plugin/QueueWorker/FoiaXmlReportImportWorker.php b/docroot/modules/custom/foia_upload_xml/src/Plugin/QueueWorker/FoiaXmlReportImportWorker.php index 800390331..2bc798160 100644 --- a/docroot/modules/custom/foia_upload_xml/src/Plugin/QueueWorker/FoiaXmlReportImportWorker.php +++ b/docroot/modules/custom/foia_upload_xml/src/Plugin/QueueWorker/FoiaXmlReportImportWorker.php @@ -2,11 +2,11 @@ namespace Drupal\foia_upload_xml\Plugin\QueueWorker; -use Drupal\file\Entity\File; -use Drupal\user\Entity\User; +use Drupal\Core\File\Exception\FileNotExistsException; use Drupal\Core\Queue\QueueWorkerBase; use Drupal\Core\Queue\RequeueException; -use Drupal\Core\File\Exception\FileNotExistsException; +use Drupal\file\Entity\File; +use Drupal\user\Entity\User; /** * Import uploaded report xml files on cron. diff --git a/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/FoiaUploadXmlMigration.php b/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/FoiaUploadXmlMigration.php index 76faf24b4..fd8328724 100644 --- a/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/FoiaUploadXmlMigration.php +++ b/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/FoiaUploadXmlMigration.php @@ -2,10 +2,10 @@ namespace Drupal\foia_upload_xml\Plugin\migrate; +use Drupal\migrate\Exception\RequirementsException; use Drupal\migrate\Plugin\Migration; use Drupal\migrate\Plugin\MigrationInterface; use Drupal\migrate\Plugin\RequirementsInterface; -use Drupal\migrate\Exception\RequirementsException; /** * Custom migration plugin for report xml upload processing. diff --git a/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/process/ArrayPad.php b/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/process/ArrayPad.php index 13c4e73a1..dac35707e 100644 --- a/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/process/ArrayPad.php +++ b/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/process/ArrayPad.php @@ -2,8 +2,8 @@ namespace Drupal\foia_upload_xml\Plugin\migrate\process; -use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\MigrateExecutableInterface; +use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\Row; /** diff --git a/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/process/ComponentLookup.php b/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/process/ComponentLookup.php index 5aee0f993..7562b774e 100644 --- a/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/process/ComponentLookup.php +++ b/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/process/ComponentLookup.php @@ -4,8 +4,8 @@ use Drupal\Core\Entity\EntityTypeManagerInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; -use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\MigrateExecutableInterface; +use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\Row; use Symfony\Component\DependencyInjection\ContainerInterface; diff --git a/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/process/FilterValues.php b/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/process/FilterValues.php index bfb74ef8e..0f8404553 100644 --- a/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/process/FilterValues.php +++ b/docroot/modules/custom/foia_upload_xml/src/Plugin/migrate/process/FilterValues.php @@ -2,8 +2,8 @@ namespace Drupal\foia_upload_xml\Plugin\migrate\process; -use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\MigrateExecutableInterface; +use Drupal\migrate\ProcessPluginBase; use Drupal\migrate\Row; /** diff --git a/docroot/modules/custom/foia_upload_xml/src/ReportUploadValidator.php b/docroot/modules/custom/foia_upload_xml/src/ReportUploadValidator.php index 5a217a54b..68cf397a0 100644 --- a/docroot/modules/custom/foia_upload_xml/src/ReportUploadValidator.php +++ b/docroot/modules/custom/foia_upload_xml/src/ReportUploadValidator.php @@ -2,12 +2,12 @@ namespace Drupal\foia_upload_xml; -use Drupal\node\Entity\Node; -use Drupal\file\FileInterface; -use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\DependencyInjection\DependencySerializationTrait; use Drupal\Core\Entity\EntityTypeManager; +use Drupal\Core\Form\FormStateInterface; use Drupal\Core\TypedData\Exception\MissingDataException; -use Drupal\Core\DependencyInjection\DependencySerializationTrait; +use Drupal\file\FileInterface; +use Drupal\node\Entity\Node; /** * Validates that an uploaded report can overwrite existing report data. diff --git a/docroot/modules/custom/foia_users/foia_users.module b/docroot/modules/custom/foia_users/foia_users.module index 720953265..114088fcf 100644 --- a/docroot/modules/custom/foia_users/foia_users.module +++ b/docroot/modules/custom/foia_users/foia_users.module @@ -6,9 +6,9 @@ */ use Drupal\Core\Access\AccessResult; -use Drupal\user\Entity\User; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\user\Entity\User; /** * Validates Office NID matching for users. diff --git a/docroot/modules/custom/foia_webform/foia_webform.module b/docroot/modules/custom/foia_webform/foia_webform.module index e0b1da4c0..508ed5e40 100644 --- a/docroot/modules/custom/foia_webform/foia_webform.module +++ b/docroot/modules/custom/foia_webform/foia_webform.module @@ -5,8 +5,8 @@ * FOIA Webform module. */ -use Drupal\webform\WebformInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\webform\WebformInterface; /** * Programmatically add the foia_submission_queue handler to new webforms. diff --git a/docroot/modules/custom/foia_webform/src/FoiaSubmissionPrettyFormatter.php b/docroot/modules/custom/foia_webform/src/FoiaSubmissionPrettyFormatter.php index 7314ab252..c811c500c 100644 --- a/docroot/modules/custom/foia_webform/src/FoiaSubmissionPrettyFormatter.php +++ b/docroot/modules/custom/foia_webform/src/FoiaSubmissionPrettyFormatter.php @@ -2,9 +2,9 @@ namespace Drupal\foia_webform; -use Drupal\webform\WebformSubmissionInterface; use Dompdf\Dompdf; use Drupal\file\Entity\File; +use Drupal\webform\WebformSubmissionInterface; /** * Class FoiaSubmissionPrettyFormatter. diff --git a/docroot/modules/custom/foia_webform/src/FoiaSubmissionQueueingService.php b/docroot/modules/custom/foia_webform/src/FoiaSubmissionQueueingService.php index 560d75dea..7f7e9097c 100644 --- a/docroot/modules/custom/foia_webform/src/FoiaSubmissionQueueingService.php +++ b/docroot/modules/custom/foia_webform/src/FoiaSubmissionQueueingService.php @@ -2,8 +2,8 @@ namespace Drupal\foia_webform; -use Drupal\foia_request\Entity\FoiaRequestInterface; use Drupal\Core\Queue\QueueFactory; +use Drupal\foia_request\Entity\FoiaRequestInterface; use Psr\Log\LoggerInterface; /** diff --git a/docroot/modules/custom/foia_webform/src/Plugin/WebformHandler/FoiaEmailWebformHandler.php b/docroot/modules/custom/foia_webform/src/Plugin/WebformHandler/FoiaEmailWebformHandler.php index 028673f27..84ad5a2ca 100644 --- a/docroot/modules/custom/foia_webform/src/Plugin/WebformHandler/FoiaEmailWebformHandler.php +++ b/docroot/modules/custom/foia_webform/src/Plugin/WebformHandler/FoiaEmailWebformHandler.php @@ -3,10 +3,10 @@ namespace Drupal\foia_webform\Plugin\WebformHandler; use Drupal\Core\Render\Markup; +use Drupal\foia_webform\FoiaSubmissionPrettyFormatter; use Drupal\node\NodeInterface; use Drupal\webform\Plugin\WebformHandler\EmailWebformHandler; use Drupal\webform\WebformSubmissionInterface; -use Drupal\foia_webform\FoiaSubmissionPrettyFormatter; /** * Emails a webform submission. diff --git a/docroot/modules/custom/foia_webform/tests/src/Kernel/AgencyLookupServiceTest.php b/docroot/modules/custom/foia_webform/tests/src/Kernel/AgencyLookupServiceTest.php index dc93a048b..28824b4a3 100644 --- a/docroot/modules/custom/foia_webform/tests/src/Kernel/AgencyLookupServiceTest.php +++ b/docroot/modules/custom/foia_webform/tests/src/Kernel/AgencyLookupServiceTest.php @@ -2,12 +2,12 @@ namespace Drupal\Tests\foia_webform\Kernel; -use Drupal\KernelTests\KernelTestBase; +use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; use Drupal\foia_webform\AgencyLookupService; -use Drupal\node\Entity\NodeType; +use Drupal\KernelTests\KernelTestBase; use Drupal\node\Entity\Node; -use Drupal\field\Entity\FieldStorageConfig; -use Drupal\field\Entity\FieldConfig; +use Drupal\node\Entity\NodeType; use Drupal\taxonomy\Entity\Term; use Drupal\taxonomy\Entity\Vocabulary; diff --git a/docroot/modules/custom/foia_webform/tests/src/Kernel/FieldInstallTrait.php b/docroot/modules/custom/foia_webform/tests/src/Kernel/FieldInstallTrait.php index 8180c5839..6bf2a0177 100644 --- a/docroot/modules/custom/foia_webform/tests/src/Kernel/FieldInstallTrait.php +++ b/docroot/modules/custom/foia_webform/tests/src/Kernel/FieldInstallTrait.php @@ -2,8 +2,8 @@ namespace Drupal\Tests\foia_webform\Kernel; -use Drupal\field\Entity\FieldStorageConfig; use Drupal\field\Entity\FieldConfig; +use Drupal\field\Entity\FieldStorageConfig; /** * Trait FieldInstallTrait installs fields from config. diff --git a/docroot/modules/custom/foia_webform/tests/src/Kernel/FoiaSubmissionQueueHandlerTest.php b/docroot/modules/custom/foia_webform/tests/src/Kernel/FoiaSubmissionQueueHandlerTest.php index 73b45dd44..2b17ed2f0 100644 --- a/docroot/modules/custom/foia_webform/tests/src/Kernel/FoiaSubmissionQueueHandlerTest.php +++ b/docroot/modules/custom/foia_webform/tests/src/Kernel/FoiaSubmissionQueueHandlerTest.php @@ -2,16 +2,16 @@ namespace Drupal\Tests\foia_webform\Kernel; +use Drupal\file\Entity\File; use Drupal\foia_request\Entity\FoiaRequest; use Drupal\foia_request\Entity\FoiaRequestInterface; use Drupal\KernelTests\KernelTestBase; +use Drupal\node\Entity\Node; +use Drupal\node\Entity\NodeType; +use Drupal\taxonomy\Entity\Term; use Drupal\taxonomy\Entity\Vocabulary; use Drupal\webform\Entity\Webform; use Drupal\webform\Entity\WebformSubmission; -use Drupal\node\Entity\NodeType; -use Drupal\node\Entity\Node; -use Drupal\taxonomy\Entity\Term; -use Drupal\file\Entity\File; /** * Class FoiaSubmissionQueueHandlerTest testing for FoiaSubmissionQueueHandler. diff --git a/docroot/modules/custom/foia_webform/tests/src/Kernel/FoiaSubmissionQueueWorkerTest.php b/docroot/modules/custom/foia_webform/tests/src/Kernel/FoiaSubmissionQueueWorkerTest.php index 12fedd85e..fdff56aba 100644 --- a/docroot/modules/custom/foia_webform/tests/src/Kernel/FoiaSubmissionQueueWorkerTest.php +++ b/docroot/modules/custom/foia_webform/tests/src/Kernel/FoiaSubmissionQueueWorkerTest.php @@ -2,10 +2,10 @@ namespace Drupal\Tests\foia_webform\Kernel; +use Drupal\foia_request\Entity\FoiaRequest; use Drupal\foia_request\Entity\FoiaRequestInterface; use Drupal\foia_webform\FoiaSubmissionServiceApi; use Drupal\foia_webform\Plugin\QueueWorker\FoiaSubmissionQueueWorker; -use Drupal\foia_request\Entity\FoiaRequest; /** * Class FoiaSubmissionQueueWorkerTest. diff --git a/docroot/modules/custom/foia_webform/tests/src/Kernel/FoiaSubmissionServiceApiTest.php b/docroot/modules/custom/foia_webform/tests/src/Kernel/FoiaSubmissionServiceApiTest.php index b555c7fc9..29890da4f 100644 --- a/docroot/modules/custom/foia_webform/tests/src/Kernel/FoiaSubmissionServiceApiTest.php +++ b/docroot/modules/custom/foia_webform/tests/src/Kernel/FoiaSubmissionServiceApiTest.php @@ -6,14 +6,16 @@ use Drupal\file_entity\Entity\FileEntity; use Drupal\file_entity\Entity\FileType; use Drupal\foia_request\Entity\FoiaRequest; +use Drupal\foia_webform\AgencyLookupService; use Drupal\foia_webform\FoiaSubmissionServiceApi; use Drupal\foia_webform\FoiaSubmissionServiceInterface; use Drupal\KernelTests\KernelTestBase; +use Drupal\node\Entity\Node; +use Drupal\node\Entity\NodeType; +use Drupal\taxonomy\Entity\Term; use Drupal\taxonomy\Entity\Vocabulary; use Drupal\webform\Entity\Webform; use Drupal\webform\Entity\WebformSubmission; -use Drupal\node\Entity\NodeType; -use Drupal\node\Entity\Node; use Drupal\webform\WebformInterface; use GuzzleHttp\Client; use GuzzleHttp\Exception\RequestException; @@ -21,8 +23,6 @@ use GuzzleHttp\HandlerStack; use GuzzleHttp\Psr7\Request; use GuzzleHttp\Psr7\Response; -use Drupal\foia_webform\AgencyLookupService; -use Drupal\taxonomy\Entity\Term; /** * Class FoiaSubmissionServiceApiTest. diff --git a/docroot/modules/custom/foia_workflow/foia_workflow.module b/docroot/modules/custom/foia_workflow/foia_workflow.module index 36937e79b..72bbd4da8 100644 --- a/docroot/modules/custom/foia_workflow/foia_workflow.module +++ b/docroot/modules/custom/foia_workflow/foia_workflow.module @@ -6,8 +6,8 @@ */ use Drupal\core\Access\AccessResult; -use Drupal\node\NodeInterface; use Drupal\Core\Session\AccountInterface; +use Drupal\node\NodeInterface; use Drupal\user\Entity\User; /** diff --git a/docroot/modules/custom/node_to_docx/node_to_docx.theme.inc b/docroot/modules/custom/node_to_docx/node_to_docx.theme.inc index 8369db792..6b9eb9c5b 100644 --- a/docroot/modules/custom/node_to_docx/node_to_docx.theme.inc +++ b/docroot/modules/custom/node_to_docx/node_to_docx.theme.inc @@ -6,8 +6,8 @@ */ use Drupal\Core\Render\Element; -use Drupal\node\Entity\Node; use Drupal\field\Entity\FieldStorageConfig; +use Drupal\node\Entity\Node; /** * Set variables. diff --git a/docroot/modules/custom/node_to_docx/src/EventSubscriber/AutoloaderSubscriber.php b/docroot/modules/custom/node_to_docx/src/EventSubscriber/AutoloaderSubscriber.php index 7c8568e68..a69544f58 100644 --- a/docroot/modules/custom/node_to_docx/src/EventSubscriber/AutoloaderSubscriber.php +++ b/docroot/modules/custom/node_to_docx/src/EventSubscriber/AutoloaderSubscriber.php @@ -3,8 +3,8 @@ namespace Drupal\node_to_docx\EventSubscriber; use Drupal\Component\Render\FormattableMarkup; -use Phpdocx\AutoLoader; use Drupal\Core\Logger\RfcLogLevel; +use Phpdocx\AutoLoader; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; diff --git a/docroot/modules/custom/node_to_docx/src/NodeToDocxHandler.php b/docroot/modules/custom/node_to_docx/src/NodeToDocxHandler.php index 4b4257fae..1db3ebacf 100644 --- a/docroot/modules/custom/node_to_docx/src/NodeToDocxHandler.php +++ b/docroot/modules/custom/node_to_docx/src/NodeToDocxHandler.php @@ -3,8 +3,8 @@ namespace Drupal\node_to_docx; use Drupal\Core\Url; -use Phpdocx\Create\CreateDocx; use Drupal\node\NodeInterface; +use Phpdocx\Create\CreateDocx; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareTrait; use Symfony\Component\HttpFoundation\RedirectResponse; diff --git a/docroot/modules/custom/webform_serialization/src/Plugin/jsonapi/FieldEnhancer/WebformElementsEnhancer.php b/docroot/modules/custom/webform_serialization/src/Plugin/jsonapi/FieldEnhancer/WebformElementsEnhancer.php index 68965bf9d..bc43323e3 100644 --- a/docroot/modules/custom/webform_serialization/src/Plugin/jsonapi/FieldEnhancer/WebformElementsEnhancer.php +++ b/docroot/modules/custom/webform_serialization/src/Plugin/jsonapi/FieldEnhancer/WebformElementsEnhancer.php @@ -4,8 +4,8 @@ use Drupal\Core\Serialization\Yaml; use Drupal\jsonapi_extras\Plugin\ResourceFieldEnhancerBase; -use Shaper\Util\Context; use Drupal\webform\Entity\WebformOptions; +use Shaper\Util\Context; /** * Decode YAML content. diff --git a/docroot/modules/custom/webform_serialization/tests/src/Functional/WebformNormalizerTest.php b/docroot/modules/custom/webform_serialization/tests/src/Functional/WebformNormalizerTest.php index ebde50545..653907cde 100644 --- a/docroot/modules/custom/webform_serialization/tests/src/Functional/WebformNormalizerTest.php +++ b/docroot/modules/custom/webform_serialization/tests/src/Functional/WebformNormalizerTest.php @@ -2,10 +2,10 @@ namespace Drupal\Tests\webform_serialization\Functional; +use Drupal\Component\Serialization\Json; use Drupal\Core\Session\AccountInterface; use Drupal\Tests\BrowserTestBase; use Drupal\webform\Entity\Webform; -use Drupal\Component\Serialization\Json; use Drupal\webform\Entity\WebformOptions; /** diff --git a/docroot/modules/custom/webform_template/src/WebformTemplateController.php b/docroot/modules/custom/webform_template/src/WebformTemplateController.php index 5772796e0..49ec21fb8 100644 --- a/docroot/modules/custom/webform_template/src/WebformTemplateController.php +++ b/docroot/modules/custom/webform_template/src/WebformTemplateController.php @@ -2,11 +2,11 @@ namespace Drupal\webform_template; -use Drupal\webform\Entity\Webform; -use Drupal\webform\WebformInterface; -use Drupal\Core\Serialization\Yaml; use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\Core\Serialization\Yaml; +use Drupal\webform\Entity\Webform; +use Drupal\webform\WebformInterface; /** * The Webform Template Controller. diff --git a/docroot/modules/custom/webform_template/webform_template.module b/docroot/modules/custom/webform_template/webform_template.module index 3d3870274..0b1f3d2a8 100644 --- a/docroot/modules/custom/webform_template/webform_template.module +++ b/docroot/modules/custom/webform_template/webform_template.module @@ -6,8 +6,8 @@ */ use Drupal\Core\Entity\EntityInterface; -use Drupal\webform\WebformInterface; use Drupal\Core\Form\FormStateInterface; +use Drupal\webform\WebformInterface; /** * Implements hook_webform_insert(). From 22f2be7085451654835fbec018432f8a663cf6ef Mon Sep 17 00:00:00 2001 From: Amir Meshkin Date: Fri, 25 Aug 2023 19:10:36 +0000 Subject: [PATCH 3/5] WS-238: Updating js code to cover textarea too. --- .../js/foia-change-report-agency.js | 140 ++++++++++-------- 1 file changed, 80 insertions(+), 60 deletions(-) diff --git a/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js b/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js index 8023d0deb..21d38d03a 100644 --- a/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js +++ b/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js @@ -8,47 +8,33 @@ var clearAllReportData = function (containId, overWriteFields = null) { // Clear all sections data, // clear individual section field will be in section clear function. - let dialogOptions - // need text and number fields but not buttons - let containerInputs = $('#' + containId + ' table tbody tr input:not([type=submit]):not([readonly])'); + let dialogOptions; + // Loop through textareas and check for values + let textInputs = $('#' + containId + ' table tbody tr textarea:not([readonly]):not([type=hidden])'); + var textValues = textInputs.map(function () { + if (this.value) { + return this.value; + } + }).get(); + + if (typeof textInputs !== 'undefined' && textValues.length >= 1) { + runManualWarning(); + return; + } + + // Inputs, number fields and textareas that are not submit or readonly + let containerInputs = $('#' + containId + ' table tbody tr input:not([type=submit]):not([readonly]):not([type=hidden])'); // If there are inputs for this container meaning component is filled out if (typeof containerInputs !== 'undefined' && containerInputs.length > 0) { // Count number of rows, check for N/A var inputValues = containerInputs.map(function () { - - if (this.value) { + if (this.value && typeof this.value !== 'undefined') { return this.value; } }).get(); - - // If data was already added manually then show error,å inputValues.includes("N/A") + // If data was already added manually then show error:inputValues.includes("N/A") if (inputValues.length >= 1) { - dialogOptions = { - title: "Manual Changes Detected", - width: 370, - height: 200, - buttons: { - button_resume: { - text: Drupal.t('Close'), - click: function () { - $(this).dialog('close'); - } - }, - button_confirm: { - text: Drupal.t('Replace Anyway'), - click: function () { - runInputs() - $(this).dialog('close'); - }, - } - }, - close: function () { - $(this).remove(); - } - }; - $('
').appendTo('body') - .html('
You have already entered data in this section. Please adjust the data manually.
') - .dialog(dialogOptions); + runManualWarning(); } else { // Run the foreach script if there are not any manual edits runInputs(); @@ -57,32 +43,7 @@ } else { // Show error if "No Data to report for this section" was pressed // without having populated any components - dialogOptions = { - title: "Add Placeholders First", - width: 370, - height: 200, - buttons: { - button_resume: { - text: Drupal.t('Close'), - click: function () { - $(this).dialog('close'); - } - }, - button_confirm: { - text: Drupal.t('Add Placeholders'), - click: function () { - $('#' + containId + " .component-placeholder-button").trigger("click"); - $(this).dialog('close'); - }, - } - }, - close: function () { - $(this).remove(); - } - }; - $('
').appendTo('body') - .html('
Please press "Add placeholders for component data below" and try again.
') - .dialog(dialogOptions); + runPlaceholderWarning() } // Run only when needed since this code will run before user answers dialogue @@ -112,7 +73,67 @@ } }); } + + function runManualWarning() { + dialogOptions = { + title: "Manual Changes Detected", + width: 370, + height: 200, + buttons: { + button_resume: { + text: Drupal.t('Close'), + click: function () { + $(this).dialog('close'); + } + }, + button_confirm: { + text: Drupal.t('Replace Anyway'), + click: function () { + runInputs() + $(this).dialog('close'); + }, + } + }, + close: function () { + $(this).remove(); + } + }; + $('
').appendTo('body') + .html('
You have already entered data in this section. Please adjust the data manually.
') + .dialog(dialogOptions); + } + + // Show warning about fields already being filled out + function runPlaceholderWarning() { + dialogOptions = { + title: "Add Placeholders First", + width: 370, + height: 200, + buttons: { + button_resume: { + text: Drupal.t('Close'), + click: function () { + $(this).dialog('close'); + } + }, + button_confirm: { + text: Drupal.t('Add Placeholders'), + click: function () { + $('#' + containId + " .component-placeholder-button").trigger("click"); + $(this).dialog('close'); + }, + } + }, + close: function () { + $(this).remove(); + } + }; + $('
').appendTo('body') + .html('
Please press "Add placeholders for component data below" and try again.
') + .dialog(dialogOptions); + } }; + var sections = [ { field: 'field_admin_app_vib', @@ -597,7 +618,6 @@ // Build no data report button. let $noDataButton = $(''); noDataToReportDiv.prepend($noDataButton); - // debugger; $noDataButton.click(function (evt) { evt.preventDefault(); section.section.fnt(); From aabeffed0b48df6783dd26d2ea0de6349156db42 Mon Sep 17 00:00:00 2001 From: Amir Meshkin Date: Wed, 20 Sep 2023 11:03:11 -0400 Subject: [PATCH 4/5] FOIA-238: Still need to fix multiple components. --- .../js/foia-change-report-agency.js | 138 +++++++++++++++--- 1 file changed, 118 insertions(+), 20 deletions(-) diff --git a/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js b/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js index 21d38d03a..d859dd3a3 100644 --- a/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js +++ b/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js @@ -5,13 +5,35 @@ (function ($, drupalSettings) { Drupal.behaviors.foia_change_report_agency = { attach: function attach() { - var clearAllReportData = function (containId, overWriteFields = null) { + + function genericWarning(title, btn, msg) { + dialogOptions = { + title: title, + width: 370, + height: 200, + buttons: { + button_resume: { + text: Drupal.t(btn), + click: function () { + $(this).dialog('close'); + } + }, + }, + close: function () { + $(this).remove(); + } + }; + $('
').appendTo('body') + .html(`
${msg}.
`) + .dialog(dialogOptions); + } + const clearAllReportData = function (containId, overWriteFields = null) { // Clear all sections data, // clear individual section field will be in section clear function. let dialogOptions; // Loop through textareas and check for values let textInputs = $('#' + containId + ' table tbody tr textarea:not([readonly]):not([type=hidden])'); - var textValues = textInputs.map(function () { + const textValues = textInputs.map(function () { if (this.value) { return this.value; } @@ -21,13 +43,21 @@ runManualWarning(); return; } - + // Make sure that there is an agency selected + let selectAgency = $('#' + containId + ' table tbody tr select:not([readonly]):not([type=hidden])'); + let agencyVal = selectAgency.val(); + if (agencyVal === '_none') { + genericWarning('Select an Agency First', + 'Close', + 'Select an agency using the drop down for the section you are adding.'); + return; + } // Inputs, number fields and textareas that are not submit or readonly let containerInputs = $('#' + containId + ' table tbody tr input:not([type=submit]):not([readonly]):not([type=hidden])'); // If there are inputs for this container meaning component is filled out if (typeof containerInputs !== 'undefined' && containerInputs.length > 0) { // Count number of rows, check for N/A - var inputValues = containerInputs.map(function () { + const inputValues = containerInputs.map(function () { if (this.value && typeof this.value !== 'undefined') { return this.value; } @@ -39,22 +69,20 @@ // Run the foreach script if there are not any manual edits runInputs(); } - } else { // Show error if "No Data to report for this section" was pressed // without having populated any components runPlaceholderWarning() } - // Run only when needed since this code will run before user answers dialogue function runInputs() { $('#' + containId + ' table tbody tr input').each(function () { if ($(this).is('[type=text]') && !$(this).attr('readonly')) { $(this).val('N/A'); if (overWriteFields !== null) { - for (var i = 0; i < overWriteFields.length; i++) { - var FieldIdPattern = overWriteFields[i].field; - var id = $(this).attr('id'); + for (let i = 0; i < overWriteFields.length; i++) { + let FieldIdPattern = overWriteFields[i].field; + let id = $(this).attr('id'); if (id.match(FieldIdPattern)) { $(this).val(overWriteFields[i].value); break; @@ -66,14 +94,12 @@ $(this).val('0').trigger("change"); } }); - $('#' + containId + ' table tbody tr textarea').each(function () { if (typeof $(this).attr('readonly') === "undefined") { $(this).val('N/A'); } }); } - function runManualWarning() { dialogOptions = { title: "Manual Changes Detected", @@ -102,7 +128,6 @@ .html('
You have already entered data in this section. Please adjust the data manually.
') .dialog(dialogOptions); } - // Show warning about fields already being filled out function runPlaceholderWarning() { dialogOptions = { @@ -133,8 +158,7 @@ .dialog(dialogOptions); } }; - - var sections = [ + const sections = [ { field: 'field_admin_app_vib', paragraph: 'admin_app_vib', // VI.B @@ -580,7 +604,26 @@ for (var i = 0; i < elements.length; i++) { $(form + ' ' + elements[i]).not(exempt + ' ' + elements[i]).val(''); } - alert('All data has been cleared from the form. Click "Save" to finalize.'); + dialogOptions = { + title: 'Form Fields Cleared', + width: 370, + height: 200, + buttons: { + button_resume: { + text: Drupal.t('Close'), + click: function () { + $(this).dialog('close'); + } + }, + }, + close: function () { + $(this).remove(); + } + }; + $('
').appendTo('body') + .html(`
All data has been cleared from the form. Click "Save" to finalize.
`) + .dialog(dialogOptions); + } $('#edit-actions').once('foia-clear-data-button').each(function () { var $button = $(''); @@ -604,12 +647,10 @@ existingComponentSelector = fieldWrapperSelector + ' tbody tr:visible', checkedComponentSelector = '#edit-field-agency-components input:checked', getComponentDropdownName = function (index) { return section.field + '[' + index + '][subform]' }; - $(fieldWrapperSelector).once('foia-add-populate-button').each(function () { // Build buttons contain. var sectionBtns = $('
Use this button when starting a new report, to quickly add placeholders for all of the components that you have selected in the checkboxes above.
Use this button to quickly fill 0 or N/A for components do not apply.
'); $(this).prepend(sectionBtns); - let componentPlaceholderButtonDiv = $(this).find('.section-button-group .component-placeholder-button-div'); let noDataToReportDiv = $(this).find('.section-button-group .no-data-to-report-div'); // Build component placeholder button. @@ -631,11 +672,50 @@ componentDropdownName = getComponentDropdownName(currentComponent), componentDropdownSelector = 'select[name^="' + componentDropdownName + '"]', blankComponent = singleComponent && $(componentDropdownSelector).val() === '_none'; + + console.log("blankcomponent", blankComponent) + // TODO: multiple components not working if (numComponents === 0) { - alert('First select the components you want using the checkboxes above.'); + dialogOptions = { + title: 'Select an Agency First', + width: 370, + height: 200, + buttons: { + button_resume: { + text: Drupal.t('Close'), + click: function () { + $(this).dialog('close'); + } + }, + }, + close: function () { + $(this).remove(); + } + }; + $('
').appendTo('body') + .html(`
First select the components you want using the checkboxes above.
`) + .dialog(dialogOptions); } else if ($(existingComponentSelector).length > 0 && !blankComponent) { - alert('Placeholders cannot be added while there are existing entries. Please remove all entries and try again.'); + dialogOptions = { + title: 'Existing Entries', + width: 370, + height: 200, + buttons: { + button_resume: { + text: Drupal.t('Close'), + click: function () { + $(this).dialog('close'); + } + }, + }, + close: function () { + $(this).remove(); + } + }; + $('
').appendTo('body') + .html(`
Placeholders cannot be added while there are existing entries. Please remove all entries and try again.
`) + .dialog(dialogOptions); } else { function clickAddMoreButton() { @@ -652,7 +732,25 @@ clickAddMoreButton(); } else { - alert('Finished adding placeholders.'); + dialogOptions = { + title: 'Finished adding placeholders.', + width: 370, + height: 200, + buttons: { + button_resume: { + text: Drupal.t('close'), + click: function () { + $(this).dialog('close'); + } + }, + }, + close: function () { + $(this).remove(); + } + }; + $('
').appendTo('body') + .html(`
You can now manually enter data or click the "No Data to report for this section" button.
`) + .dialog(dialogOptions); } } $(document).on('ajaxStop', function () { From dbb5b144e0982124f360ab106b3be3441d0bf849 Mon Sep 17 00:00:00 2001 From: Amir Meshkin Date: Wed, 20 Sep 2023 12:59:22 -0400 Subject: [PATCH 5/5] FOIA-238: Added dialog boxes and agency check. --- .../js/foia-change-report-agency.js | 34 +++++++------------ 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js b/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js index d859dd3a3..bc39191e6 100644 --- a/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js +++ b/docroot/modules/custom/foia_annual_data_report/js/foia-change-report-agency.js @@ -5,7 +5,6 @@ (function ($, drupalSettings) { Drupal.behaviors.foia_change_report_agency = { attach: function attach() { - function genericWarning(title, btn, msg) { dialogOptions = { title: title, @@ -32,26 +31,19 @@ // clear individual section field will be in section clear function. let dialogOptions; // Loop through textareas and check for values - let textInputs = $('#' + containId + ' table tbody tr textarea:not([readonly]):not([type=hidden])'); - const textValues = textInputs.map(function () { + $('#' + containId + ' table tbody tr textarea:not([readonly]):not([type=hidden])').map(function () { if (this.value) { return this.value; } }).get(); - - if (typeof textInputs !== 'undefined' && textValues.length >= 1) { - runManualWarning(); - return; - } - // Make sure that there is an agency selected - let selectAgency = $('#' + containId + ' table tbody tr select:not([readonly]):not([type=hidden])'); - let agencyVal = selectAgency.val(); - if (agencyVal === '_none') { - genericWarning('Select an Agency First', - 'Close', - 'Select an agency using the drop down for the section you are adding.'); - return; - } + $('#' + containId + ' table tbody tr select[name*="field_agency_component"]:not([readonly]):not([type=hidden])').each(function(index, value) { + if (this.value === '_none') { + $(this).css('border', '1px solid #8B0100'); + return genericWarning('Select an Agency First', + 'Close', + 'Select an agency using the drop down for the section you are adding'); + } + }); // Inputs, number fields and textareas that are not submit or readonly let containerInputs = $('#' + containId + ' table tbody tr input:not([type=submit]):not([readonly]):not([type=hidden])'); // If there are inputs for this container meaning component is filled out @@ -64,15 +56,16 @@ }).get(); // If data was already added manually then show error:inputValues.includes("N/A") if (inputValues.length >= 1) { - runManualWarning(); + return runManualWarning(); } else { // Run the foreach script if there are not any manual edits + $(this).css('border', 'none'); runInputs(); } } else { // Show error if "No Data to report for this section" was pressed // without having populated any components - runPlaceholderWarning() + return runPlaceholderWarning(); } // Run only when needed since this code will run before user answers dialogue function runInputs() { @@ -672,9 +665,6 @@ componentDropdownName = getComponentDropdownName(currentComponent), componentDropdownSelector = 'select[name^="' + componentDropdownName + '"]', blankComponent = singleComponent && $(componentDropdownSelector).val() === '_none'; - - console.log("blankcomponent", blankComponent) - // TODO: multiple components not working if (numComponents === 0) { dialogOptions = { title: 'Select an Agency First',