If your create a request for 11:00 to 12:00 and another one for 12:00 to 13:00 they should not interfere, but they do.

I've discover this using public bookings but I think is a bookings api bug

Comments

Anonymous’s picture

It is, yes. Somewhere in the docu there is a remark about this. It's known and *should* be easy to fix (<= vs <) but I'm not sure about side-effects ... will look into it.

rodrigobb’s picture

I've fixed it changing in bookingsapi.module:203

    $interval_sql .= "({bookings_schedules}.start BETWEEN '{$i[0]}' AND {$i[1]} OR {bookings_schedules}.end BETWEEN '{$i[0]}' AND {$i[1]}) OR
           ('{$i[0]}' BETWEEN {bookings_schedules}.start AND {bookings_schedules}.end OR {$i[1]} BETWEEN {bookings_schedules}.start AND {bookings_schedules}.end) OR ";

By

    $interval_sql .= "({bookings_schedules}.start BETWEEN '{$i[0]}' AND {$i[1]} - INTERVAL 1 SECOND OR {bookings_schedules}.end BETWEEN '{$i[0]}' + INTERVAL 1 SECOND AND {$i[1]}) OR
           ('{$i[0]}' BETWEEN {bookings_schedules}.start AND {bookings_schedules}.end - INTERVAL 1 SECOND OR {$i[1]} BETWEEN {bookings_schedules}.start + INTERVAL 1 SECOND AND {bookings_schedules}.end) OR ";

This should have no side-effects, but I don't know if there are other lines of code to change.

Anonymous’s picture

Status: Active » Fixed

Thanks. It's committed (changing only conflict_check shouldn't have any problems).

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.