Hi.

When using a bootstrap subtheme, there is an SQL error in "Add content" that has an "Availability Calendar" field with "Show the calendar as a number of months" widget.

The error is:

PDOException: SQLSTATE[22007]: Invalid datetime format: 1366 Incorrect integer value: 'new1' for column 'cid' at row 1

from this source file:
em availability_calendar_update_availability() (linha 638 de /home/aguasdoalgarve/public_html/sites/all/modules/availability_calendars/availability_calendar.inc).

I've done some testing and found out that when using bootstrap theme, the function availability_calendar_update_availability is called, but when using seven theme, it isn't called.

When is called, $cid parameter is string 'new1' and not a calendar ID, because the content has been created.

I've inserted this line in the beginning of the function:
if ($cid == 'new1') return;

So, I've got around this SQL Error, but surely is not a solution. And I don't understand why this happens with bootstrap theme.

Thanks.

Comments

jrochate created an issue. See original summary.

fietserwin’s picture

Category: Bug report » Support request
Issue tags: -bootstrap theme, -create content, -sql error

Neither do I understand that it can be called with a non integer:
- The only place where availability_calendar_update_availability() gets called is in availability_calendar_update_multiple_availability().
- The only place where availability_calendar_update_multiple_availability() gets called is in availability_calendar_field_attach_submit_inc() (plus a migration handler, but we can safely ignore that).
- In that function the $cid_unique gets converted to an integer:
$cid = availability_calendar_update_multiple_availability((int) $cid_unique, $changes);

But still a non integer gets passed into the update function.
- Do you have a theme hook function or something like that, that directly calls availability_calendar_update_multiple_availability() or availability_calendar_update_availability()?
- Can you get a full stack trace, preferably including parameter values, showing the calling path where it goes wrong?

jrochate’s picture

Status: Active » Closed (works as designed)

Yep. That was it!!

I'm using theme_preprocess_availability_calendar_months() to create a "blank" margin as the minimum days before it's available to book.

And I wasn't testing it for a new record! :(

Sorry for trouble. Your tip was right on the spot.

Thanks for this great module.