Had to bring the same fields that i have for a payment to booking, except that some of those should be nullable, because it is unreasonable to ask front desk to gather all customer data when they have a booking via phone, for instance. Therefore, i can not take advantage of the validation for customer data that i use in the public-facing form, but, fortunately, most of the validations where in separated functions, thus only had to rewrite that one for this case. I already have to create a booking from a payment, when receiving a payment from the public instance, thus i made that function and reused it here. Then i “overwrite” the newly created pre-booking with the customer data from the form, and set is as confirmed, as we do not see any point of allowing pre-bookings from employees.
28 lines
480 B
PL/PgSQL
28 lines
480 B
PL/PgSQL
-- Verify camper:booking__payment_fields on pg
|
|
|
|
begin;
|
|
|
|
select address
|
|
, postal_code
|
|
, city
|
|
, country_code
|
|
, email
|
|
, phone
|
|
, lang_tag
|
|
, zone_preferences
|
|
, subtotal_nights
|
|
, number_adults
|
|
, subtotal_adults
|
|
, number_teenagers
|
|
, subtotal_teenagers
|
|
, number_children
|
|
, subtotal_children
|
|
, subtotal_dogs
|
|
, subtotal_tourist_tax
|
|
, total
|
|
, currency_code
|
|
from camper.booking
|
|
where false;
|
|
|
|
rollback;
|