Broken Views Field for Date field on Opening Inst

Created on 24 March 2023, over 1 year ago
Updated 11 August 2023, over 1 year ago

The issue πŸ› Wrong field alias in query conditions for bookable_calendar smart date fields Closed: won't fix was raised on Calendar View β†’ that it is not finding the right column of date__value and is just trying to load that on date.

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'bookable_calendar_opening_inst.date' in 'where clause'

Looking at it and it appears it's possibly a bug related to this previous issue β†’ .

It adds:

$type = 'field';
$entity_type = \Drupal::entityTypeManager()->getDefinition('bookable_calendar_opening_inst');
$data[$table_name][$field_name_base][$type]['title'] = t('Date');
$data[$table_name][$field_name_base][$type]['id'] = 'field';
$data[$table_name][$field_name_base][$type]['help'] = t('Appears in: @bundles.', [
      '@bundles' => $entity_type->getLabel(),
    ]);
$data[$table_name][$field_name_base][$type]['field_name'] = $field_name_base;
$data[$table_name][$field_name_base][$type]['property'] = $column;

It appears because $field_name_base is date it's trying to load the column of just date instead of just date__value.

I just removed all of that except for this line:

$data[$table_name][$field_name_base . '__value']['field']['id'] = 'field'; as the loop above, this should have handled all the date fields we needed. It does appear that setting the field to a field instead of date allows for the smart date field widget to load as it should.

The issue with this change is it will break all Date fields set in any users Views, it's a simple fix, not sure if that's something the module can handle or if it's a breaking change that requires moving to version 2.3.x.

πŸ› Bug report
Status

Fixed

Version

2.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States josh.fabean

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024