Add campsite_type_pet_cost relation to hold price of dogs in campsites

It is a separate relation, instead of having a field in campsite_type,
because not all campsite types allow dogs.  I could have added a new
field to campsite_type, but then its values it would be meaningless for
campsites that do not allow dogs, and a nullable field is not a valid
solution because NULL means “unknown”, but we **do** know the price —
none.

A separate relation encodes the same information without ambiguities nor
null values, and, in fact, removed the dogs_allowed field from
campsite_type to prevent erroneous status, such as a campsite type that
allows dogs without having a cost — even if the cost is zero, it has to
be added to the new relation.
This commit is contained in:
jordi fita mas 2024-02-10 06:18:30 +01:00
parent e5023a2a41
commit 92dba96b29
74 changed files with 1140 additions and 447 deletions

View File

@ -127,11 +127,11 @@ select translate_services_carousel_slide(63, 'en', 'Safari Tents');
select translate_services_carousel_slide(63, 'es', 'Tiendas Safari');
alter table campsite_type alter column campsite_type_id restart with 72;
select add_campsite_type(52, 62, 'Parceŀles', '<h3>Acampa enmig de la natura</h3><p>Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.</p><p>Parcel·les amples amb serveis a prop don ets per fer allò que vols.</p>', '<h4>Proxo/terrassa (13 m²)</h4><ul><li>Moblat</li></ul><h4>Planta baixa (32 m²)</h4><ul><li>Sala menjador</li><li>Cuina equipada</li><li>Una habitació llit doble (150×200)</li><li>Bany complet</li></ul><h4>Planta altell (16 m²)</h4><ul><li>Tres llits individuals (90×200)</li></ul>', '<h4>El preu inclou</h4><ul><li>Llençols i nòrdic</li><li>Cistella de benvinguda: oli doliva, sal, sucre, cafè i te</li><li>WiFi</li><li>Plaça daparcament per un cotxe</li><li>Kit nadó (bressol, trona i banyera) <em>sota reserva</em></li></ul><p>* Tovalloles: preu extra</p>', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', '', '15 h a 21 h', '12 h', 6, '[1, 7]', true, true, true);
select add_campsite_type(52, 63, 'Safari Tents', '<h3>Glàmping a la teva disposició</h3><p>Un luxe de tendes per viure aventures.</p><p>Dues tendes amb terra de fusta, llits, cuina i tot de comoditats per gaudir de les teves vacances.</p>', '<h4>Proxo/terrassa (13 m²)</h4><ul><li>Moblat</li></ul><h4>Planta baixa (32 m²)</h4><ul><li>Sala menjador</li><li>Cuina equipada</li><li>Una habitació llit doble (150×200)</li><li>Bany complet</li></ul><h4>Planta altell (16 m²)</h4><ul><li>Tres llits individuals (90×200)</li></ul>', '<h4>El preu inclou</h4><ul><li>Llençols i nòrdic</li><li>Cistella de benvinguda: oli doliva, sal, sucre, cafè i te</li><li>WiFi</li><li>Plaça daparcament per un cotxe</li><li>Kit nadó (bressol, trona i banyera) <em>sota reserva</em></li></ul><p>* Tovalloles: preu extra</p>', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', '', '16 h a 21 h', '10 h', 6, '[2, 7]', false, false, false);
select add_campsite_type(52, 64, 'Bungalous', '<h3>Allotjaments de luxe</h3><p>Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.</p><p>Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.</p>', '<h4>Proxo/terrassa (13 m²)</h4><ul><li>Moblat</li></ul><h4>Planta baixa (32 m²)</h4><ul><li>Sala menjador</li><li>Cuina equipada</li><li>Una habitació llit doble (150×200)</li><li>Bany complet</li></ul><h4>Planta altell (16 m²)</h4><ul><li>Tres llits individuals (90×200)</li></ul>', '<h4>El preu inclou</h4><ul><li>Llençols i nòrdic</li><li>Cistella de benvinguda: oli doliva, sal, sucre, cafè i te</li><li>WiFi</li><li>Plaça daparcament per un cotxe</li><li>Kit nadó (bressol, trona i banyera) <em>sota reserva</em></li></ul><p>* Tovalloles: preu extra</p>', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', '', '15 h a 21 h', '12 h', 5, '[2, 7]', false, false, false);
select add_campsite_type(52, 65, 'Bungalous prèmium', '<h3>Allotjaments de luxe</h3><p>Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.</p><p>Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.</p>', '<h4>Proxo/terrassa (13 m²)</h4><ul><li>Moblat</li></ul><h4>Planta baixa (32 m²)</h4><ul><li>Sala menjador</li><li>Cuina equipada</li><li>Una habitació llit doble (150×200)</li><li>Bany complet</li></ul><h4>Planta altell (16 m²)</h4><ul><li>Tres llits individuals (90×200)</li></ul>', '<h4>El preu inclou</h4><ul><li>Llençols i nòrdic</li><li>Cistella de benvinguda: oli doliva, sal, sucre, cafè i te</li><li>WiFi</li><li>Plaça daparcament per un cotxe</li><li>Kit nadó (bressol, trona i banyera) <em>sota reserva</em></li></ul><p>* Tovalloles: preu extra</p>', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', '', '15 h a 21 h', '12 h', 5, '[2, 7]', false, false, false);
select add_campsite_type(52, 66, 'Cabanes de fusta', '<h3>Allotjaments de luxe</h3><p>Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.</p><p>Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.</p>', '<h4>Proxo/terrassa (13 m²)</h4><ul><li>Moblat</li></ul><h4>Planta baixa (32 m²)</h4><ul><li>Sala menjador</li><li>Cuina equipada</li><li>Una habitació llit doble (150×200)</li><li>Bany complet</li></ul><h4>Planta altell (16 m²)</h4><ul><li>Tres llits individuals (90×200)</li></ul>', '<h4>El preu inclou</h4><ul><li>Llençols i nòrdic</li><li>Cistella de benvinguda: oli doliva, sal, sucre, cafè i te</li><li>WiFi</li><li>Plaça daparcament per un cotxe</li><li>Kit nadó (bressol, trona i banyera) <em>sota reserva</em></li></ul><p>* Tovalloles: preu extra</p>', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', '', '15 h a 21 h', '12 h', 5, '[2, 7]', false, false, false);
select add_campsite_type(52, 62, 'Parceŀles', '<h3>Acampa enmig de la natura</h3><p>Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.</p><p>Parcel·les amples amb serveis a prop don ets per fer allò que vols.</p>', '<h4>Proxo/terrassa (13 m²)</h4><ul><li>Moblat</li></ul><h4>Planta baixa (32 m²)</h4><ul><li>Sala menjador</li><li>Cuina equipada</li><li>Una habitació llit doble (150×200)</li><li>Bany complet</li></ul><h4>Planta altell (16 m²)</h4><ul><li>Tres llits individuals (90×200)</li></ul>', '<h4>El preu inclou</h4><ul><li>Llençols i nòrdic</li><li>Cistella de benvinguda: oli doliva, sal, sucre, cafè i te</li><li>WiFi</li><li>Plaça daparcament per un cotxe</li><li>Kit nadó (bressol, trona i banyera) <em>sota reserva</em></li></ul><p>* Tovalloles: preu extra</p>', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', '', '15 h a 21 h', '12 h', 6, '[1, 7]', true, true);
select add_campsite_type(52, 63, 'Safari Tents', '<h3>Glàmping a la teva disposició</h3><p>Un luxe de tendes per viure aventures.</p><p>Dues tendes amb terra de fusta, llits, cuina i tot de comoditats per gaudir de les teves vacances.</p>', '<h4>Proxo/terrassa (13 m²)</h4><ul><li>Moblat</li></ul><h4>Planta baixa (32 m²)</h4><ul><li>Sala menjador</li><li>Cuina equipada</li><li>Una habitació llit doble (150×200)</li><li>Bany complet</li></ul><h4>Planta altell (16 m²)</h4><ul><li>Tres llits individuals (90×200)</li></ul>', '<h4>El preu inclou</h4><ul><li>Llençols i nòrdic</li><li>Cistella de benvinguda: oli doliva, sal, sucre, cafè i te</li><li>WiFi</li><li>Plaça daparcament per un cotxe</li><li>Kit nadó (bressol, trona i banyera) <em>sota reserva</em></li></ul><p>* Tovalloles: preu extra</p>', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', '', '16 h a 21 h', '10 h', 6, '[2, 7]', false, false);
select add_campsite_type(52, 64, 'Bungalous', '<h3>Allotjaments de luxe</h3><p>Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.</p><p>Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.</p>', '<h4>Proxo/terrassa (13 m²)</h4><ul><li>Moblat</li></ul><h4>Planta baixa (32 m²)</h4><ul><li>Sala menjador</li><li>Cuina equipada</li><li>Una habitació llit doble (150×200)</li><li>Bany complet</li></ul><h4>Planta altell (16 m²)</h4><ul><li>Tres llits individuals (90×200)</li></ul>', '<h4>El preu inclou</h4><ul><li>Llençols i nòrdic</li><li>Cistella de benvinguda: oli doliva, sal, sucre, cafè i te</li><li>WiFi</li><li>Plaça daparcament per un cotxe</li><li>Kit nadó (bressol, trona i banyera) <em>sota reserva</em></li></ul><p>* Tovalloles: preu extra</p>', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', '', '15 h a 21 h', '12 h', 5, '[2, 7]', false, false);
select add_campsite_type(52, 65, 'Bungalous prèmium', '<h3>Allotjaments de luxe</h3><p>Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.</p><p>Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.</p>', '<h4>Proxo/terrassa (13 m²)</h4><ul><li>Moblat</li></ul><h4>Planta baixa (32 m²)</h4><ul><li>Sala menjador</li><li>Cuina equipada</li><li>Una habitació llit doble (150×200)</li><li>Bany complet</li></ul><h4>Planta altell (16 m²)</h4><ul><li>Tres llits individuals (90×200)</li></ul>', '<h4>El preu inclou</h4><ul><li>Llençols i nòrdic</li><li>Cistella de benvinguda: oli doliva, sal, sucre, cafè i te</li><li>WiFi</li><li>Plaça daparcament per un cotxe</li><li>Kit nadó (bressol, trona i banyera) <em>sota reserva</em></li></ul><p>* Tovalloles: preu extra</p>', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', '', '15 h a 21 h', '12 h', 5, '[2, 7]', false, false);
select add_campsite_type(52, 66, 'Cabanes de fusta', '<h3>Allotjaments de luxe</h3><p>Ubicats al costat muntanya del càmping i amb vista a la natura que ens envolta.</p><p>Dues cabanes de fusta massissa de dues plantes i amb porxo cobert per gaudir entre arbres.</p>', '<h4>Proxo/terrassa (13 m²)</h4><ul><li>Moblat</li></ul><h4>Planta baixa (32 m²)</h4><ul><li>Sala menjador</li><li>Cuina equipada</li><li>Una habitació llit doble (150×200)</li><li>Bany complet</li></ul><h4>Planta altell (16 m²)</h4><ul><li>Tres llits individuals (90×200)</li></ul>', '<h4>El preu inclou</h4><ul><li>Llençols i nòrdic</li><li>Cistella de benvinguda: oli doliva, sal, sucre, cafè i te</li><li>WiFi</li><li>Plaça daparcament per un cotxe</li><li>Kit nadó (bressol, trona i banyera) <em>sota reserva</em></li></ul><p>* Tovalloles: preu extra</p>', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', '', '15 h a 21 h', '12 h', 5, '[2, 7]', false, false);
insert into campsite_type_i18n (campsite_type_id, lang_tag, name, spiel, info, facilities, description, additional_info, check_in, check_out)
values (72, 'en', 'Plots', '<h3>Camp in the middle of nature</h3><p>Located on the campgrounds mountain-side and overlooking the nature that surrounds us.</p><p>Large plots with serivces close to where you are to do what you want.</p>', '<h4>Porch/terrace (13 m²)</h4><ul><li>Furnished</li></ul><h4>First floor (32 m²)</h4><ul><li>Dining room</li><li>Equipped kitchen</li><li>One room with a double bed (150×200)</li><li>Full bathroom</li></ul><h4>Loft floor (16 m²)</h4><ul><li>Three individual beds (90×200)</li></ul>', '<h4>Price includes</h4><ul><li>Sheets and duvet</li><li>Welcome basket: olive oil, salt, sugar, coffee, and tea</li><li>WiFi</li><li>Parking space for one car</li><li>Baby Kit (bassinet, high chair, and bathtub) <em>reservation required</em></li></ul><p>* Towels: extra cost</p>', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', '', '3 p.m. to 9 p.m.', '12 a.m.')
@ -146,6 +146,8 @@ values (72, 'en', 'Plots', '<h3>Camp in the middle of nature</h3><p>Located on t
, (76, 'es', 'Cabañas de madera', '<h3>Alojamientos de lujo</h3><p>Ubicadas al lado montaña del camping y con vista a la naturaleza que nos rodea.</p><p>Dos cabañas de madera maciza de dos plantas y con porche cubierto para disfutrar entre árboles.</p>', '<h4>Proche/terraza (13 m²)</h4><ul><li>Moblado</li></ul><h4>Planta baja (32 m²)</h4><ul><li>Sala comedor</li><li>Cocina equipada</li><li>Una habitación cama doble (150×200)</li><li>Baño completo</li></ul><h4>Planta altillo (16 m²)</h4><ul><li>Tres camas individuales (90×200)</li></ul>', '<h4>El precio incluye</h4><ul><li>Sábanas y nórdico</li><li>Cesto de bienvenida: aceite de oliva, sal, azúcar, café y té</li><li>WiFi</li><li>Plaza de aparcamiento para un coche</li><li>Kit bebé (cuna, trona y bañera) <em>bajo reserva</em></li></ul><p>* Toallas: precio extra</p>', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.</p><p>Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', '', '15 h a 21 h', '12 h')
;
select set_campsite_type_pet_cost (slug, '3.50') from campsite_type where campsite_type_id = 72;
alter table campsite_type_feature alter column campsite_type_feature_id restart with 82;
insert into campsite_type_feature (campsite_type_id, icon_name, name)
values (72, 'person', 'Máx. 5 pers.')

View File

@ -13,16 +13,16 @@ set search_path to camper, public;
drop function if exists add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean, boolean);
create or replace function add_campsite_type(company integer, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, bookable_nights int4range, dogs_allowed boolean, overflow_allowed boolean, ask_zone_preferences boolean) returns uuid as
create or replace function add_campsite_type(company integer, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, bookable_nights int4range, overflow_allowed boolean, ask_zone_preferences boolean) returns uuid as
$$
insert into campsite_type (company_id, media_id, name, spiel, info, facilities, description, additional_info, check_in, check_out, max_campers, bookable_nights, dogs_allowed, overflow_allowed, ask_zone_preferences)
values (company, media_id, name, xmlparse(content spiel), xmlparse(content info), xmlparse(content facilities), xmlparse(content description), xmlparse(content additional_info), check_in, check_out, max_campers, bookable_nights, dogs_allowed, overflow_allowed, ask_zone_preferences)
insert into campsite_type (company_id, media_id, name, spiel, info, facilities, description, additional_info, check_in, check_out, max_campers, bookable_nights, overflow_allowed, ask_zone_preferences)
values (company, media_id, name, xmlparse(content spiel), xmlparse(content info), xmlparse(content facilities), xmlparse(content description), xmlparse(content additional_info), check_in, check_out, max_campers, bookable_nights, overflow_allowed, ask_zone_preferences)
returning slug;
$$
language sql
;
revoke execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean, boolean) from public;
grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean, boolean) to admin;
revoke execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean) from public;
grant execute on function add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean) to admin;
commit;

View File

@ -0,0 +1,19 @@
-- Deploy camper:campsite_type__-dogs_allowed to pg
-- requires: campsite_type
-- requires: campsite_type_pet_cost
-- requires: set_campsite_type_pet_cost
begin;
set search_path to camper, public;
select set_campsite_type_pet_cost(slug, '3.50')
from campsite_type
where dogs_allowed
;
alter table campsite_type
drop column if exists dogs_allowed
;
commit;

View File

@ -0,0 +1,52 @@
-- Deploy camper:campsite_type_pet_cost to pg
-- requires: roles
-- requires: schema_camper
-- requires: campsite_type
-- requires: user_profile
begin;
set search_path to camper, public;
create table campsite_type_pet_cost (
campsite_type_id integer primary key references campsite_type,
cost_per_night integer not null constraint cost_not_negative check(cost_per_night >= 0)
);
grant select on table campsite_type_pet_cost to guest;
grant select on table campsite_type_pet_cost to employee;
grant select, insert, update, delete on table campsite_type_pet_cost to admin;
alter table campsite_type_pet_cost enable row level security;
create policy guest_ok
on campsite_type_pet_cost
for select
using (true)
;
create policy insert_to_company
on campsite_type_pet_cost
for insert
with check (
exists (select 1 from campsite_type join user_profile using (company_id) where campsite_type.campsite_type_id = campsite_type_pet_cost.campsite_type_id)
)
;
create policy update_company
on campsite_type_pet_cost
for update
using (
exists (select 1 from campsite_type join user_profile using (company_id) where campsite_type.campsite_type_id = campsite_type_pet_cost.campsite_type_id)
)
;
create policy delete_from_company
on campsite_type_pet_cost
for delete
using (
exists (select 1 from campsite_type join user_profile using (company_id) where campsite_type.campsite_type_id = campsite_type_pet_cost.campsite_type_id)
)
;
commit;

View File

@ -13,7 +13,7 @@ set search_path to camper, public;
drop function if exists edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, boolean, boolean, boolean, boolean);
create or replace function edit_campsite_type(slug uuid, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, bookable_nights int4range, dogs_allowed boolean, overflow_allowed boolean, ask_zone_preferences boolean, active boolean) returns uuid as
create or replace function edit_campsite_type(slug uuid, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, bookable_nights int4range, overflow_allowed boolean, ask_zone_preferences boolean, active boolean) returns uuid as
$$
update campsite_type
set name = edit_campsite_type.name
@ -27,7 +27,6 @@ $$
, media_id = coalesce(edit_campsite_type.media_id, campsite_type.media_id)
, max_campers = edit_campsite_type.max_campers
, bookable_nights = edit_campsite_type.bookable_nights
, dogs_allowed = edit_campsite_type.dogs_allowed
, overflow_allowed = edit_campsite_type.overflow_allowed
, ask_zone_preferences = edit_campsite_type.ask_zone_preferences
, active = edit_campsite_type.active
@ -37,7 +36,7 @@ $$
language sql
;
revoke execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean, boolean, boolean) from public;
grant execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean, boolean, boolean) to admin;
revoke execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean, boolean) from public;
grant execute on function edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean, boolean) to admin;
commit;

View File

@ -0,0 +1,30 @@
-- Deploy camper:set_campsite_type_pet_cost to pg
-- requires: roles
-- requires: schema_camper
-- requires: campsite_type
-- requires: campsite_type_pet_cost
-- requires: parse_price
begin;
set search_path to camper, public;
create or replace function set_campsite_type_pet_cost(slug uuid, cost text) returns void as
$$
insert into campsite_type_pet_cost (campsite_type_id, cost_per_night)
select campsite_type_id, parse_price(cost, decimal_digits)
from campsite_type
join company using (company_id)
join currency using (currency_code)
where campsite_type.slug = set_campsite_type_pet_cost.slug
on conflict (campsite_type_id) do update
set cost_per_night = excluded.cost_per_night
;
$$
language sql
;
revoke execute on function set_campsite_type_pet_cost(uuid, text) from public;
grant execute on function set_campsite_type_pet_cost(uuid, text) to admin;
commit;

View File

@ -0,0 +1,26 @@
-- Deploy camper:unset_campsite_type_pet_cost to pg
-- requires: roles
-- requires: schema_camper
-- requires: campsite_type
-- requires: campsite_type_pet_cost
begin;
set search_path to camper, public;
create or replace function unset_campsite_type_pet_cost(slug uuid) returns void as
$$
delete from campsite_type_pet_cost
where campsite_type_id in (
select campsite_type_id
from campsite_type
where campsite_type.slug = unset_campsite_type_pet_cost.slug
);
$$
language sql
;
revoke execute on function unset_campsite_type_pet_cost(uuid) from public;
grant execute on function unset_campsite_type_pet_cost(uuid) to admin;
commit;

View File

@ -54,6 +54,13 @@ func newBookingCart(ctx context.Context, conn *database.Conn, f *bookingForm, ca
if err != nil {
return cart, nil
}
numDogs := 0
if f.Guests.NumberDogs != nil {
numDogs, err = strconv.Atoi(f.Guests.NumberDogs.Val)
if err != nil {
return cart, nil
}
}
optionMap := make(map[int]*campsiteTypeOption)
var typeOptions []*campsiteTypeOption
@ -75,17 +82,19 @@ func newBookingCart(ctx context.Context, conn *database.Conn, f *bookingForm, ca
row := conn.QueryRow(ctx, `
with per_person as (
select count(*) as num_nights
, sum(cost_per_night * ceiling(($4::numeric + $5::numeric + $6::numeric) / max_campers::numeric)::integer)::integer as nights
, sum(cost.cost_per_night * ceiling(($4::numeric + $5::numeric + $6::numeric) / max_campers::numeric)::integer)::integer as nights
, sum(cost_per_adult * $4)::integer as adults
, sum(cost_per_teenager * $5)::integer as teenagers
, sum(cost_per_child * $6)::integer as children
, sum(case when $7 > 0 then coalesce(pet.cost_per_night, 0) else 0 end)::integer as dogs
, sum(tourist_tax * $4)::integer as tourist_tax
, max(decimal_digits) as decimal_digits
from generate_series($1, $2, interval '1 day') as date(day)
left join season_calendar on season_range @> date.day::date
left join season using (season_id)
left join campsite_type using (company_id)
left join campsite_type_cost using (campsite_type_id, season_id)
left join campsite_type_pet_cost as pet using (campsite_type_id)
left join campsite_type_cost as cost using (campsite_type_id, season_id)
left join company using (company_id)
left join currency using (currency_code)
where campsite_type.slug = $3
@ -95,7 +104,7 @@ func newBookingCart(ctx context.Context, conn *database.Conn, f *bookingForm, ca
from generate_series($1, $2, interval '1 day') as date(day)
join season_calendar on season_range @> date.day::date
join campsite_type_option_cost using (season_id)
join unnest($7::integer[], $8::integer[]) as option_units(campsite_type_option_id, units) using (campsite_type_option_id)
join unnest($8::integer[], $9::integer[]) as option_units(campsite_type_option_id, units) using (campsite_type_option_id)
group by campsite_type_option_id
union all select -1, 0
)
@ -104,6 +113,7 @@ func newBookingCart(ctx context.Context, conn *database.Conn, f *bookingForm, ca
, coalesce(to_price(adults, decimal_digits), '')
, coalesce(to_price(teenagers, decimal_digits), '')
, coalesce(to_price(children, decimal_digits), '')
, coalesce(to_price(dogs, decimal_digits), '')
, coalesce(to_price(tourist_tax, decimal_digits), '')
, coalesce(to_price(nights + adults + teenagers + children + tourist_tax + sum(option_cost)::integer, decimal_digits), '')
, array_agg((campsite_type_option_id, to_price(option_cost, decimal_digits)))
@ -113,19 +123,21 @@ func newBookingCart(ctx context.Context, conn *database.Conn, f *bookingForm, ca
, adults
, teenagers
, children
, dogs
, tourist_tax
, decimal_digits
`, pgx.QueryResultFormats{pgx.BinaryFormatCode}, arrivalDate, departureDate.AddDate(0, 0, -1), campsiteType, numAdults, numTeenagers, numChildren, optionIDs, optionUnits)
`, pgx.QueryResultFormats{pgx.BinaryFormatCode}, arrivalDate, departureDate.AddDate(0, 0, -1), campsiteType, numAdults, numTeenagers, numChildren, numDogs, optionIDs, optionUnits)
var numNights int
var nights string
var adults string
var teenagers string
var children string
var dogs string
var touristTax string
var total string
var optionPrices database.RecordArray
if err = row.Scan(&numNights, &nights, &adults, &teenagers, &children, &touristTax, &total, &optionPrices); err != nil {
if err = row.Scan(&numNights, &nights, &adults, &teenagers, &children, &dogs, &touristTax, &total, &optionPrices); err != nil {
if database.ErrorIsNotFound(err) {
return cart, nil
}
@ -145,6 +157,7 @@ func newBookingCart(ctx context.Context, conn *database.Conn, f *bookingForm, ca
maybeAddLine(numAdults, adults, locale.PgettextNoop("Adult", "cart"))
maybeAddLine(numTeenagers, teenagers, locale.PgettextNoop("Teenager", "cart"))
maybeAddLine(numChildren, children, locale.PgettextNoop("Child", "cart"))
maybeAddLine(numDogs, dogs, locale.PgettextNoop("Dog", "cart"))
for _, el := range optionPrices.Elements {
optionID := el.Fields[0].Get()

View File

@ -368,8 +368,9 @@ func newBookingGuestFields(ctx context.Context, conn *database.Conn, campsiteTyp
row := conn.QueryRow(ctx, `
select max_campers
, overflow_allowed
, dogs_allowed
, pet.cost_per_night is not null as dogs_allowed
from campsite_type
left join campsite_type_pet_cost as pet using (campsite_type_id)
where slug = $1
`, campsiteType)
var dogsAllowed bool

View File

@ -167,13 +167,16 @@ func addType(w http.ResponseWriter, r *http.Request, user *auth.User, company *a
}
processTypeForm(w, r, user, company, conn, f, func(ctx context.Context, tx *database.Tx) error {
var err error
f.Slug, err = tx.AddCampsiteType(ctx, company.ID, f.Media.Int(), f.Name[f.DefaultLang].Val, f.Spiel[f.DefaultLang].Val, f.Info[f.DefaultLang].Val, f.Facilities[f.DefaultLang].Val, f.Description[f.DefaultLang].Val, f.AdditionalInfo[f.DefaultLang].Val, f.CheckIn[f.DefaultLang].Val, f.CheckOut[f.DefaultLang].Val, f.MaxCampers.Int(), f.MinNights.Int(), f.MaxNights.Int(), f.DogsAllowed.Checked, f.OverflowAllowed.Checked, f.AskZonePreferences.Checked)
f.Slug, err = tx.AddCampsiteType(ctx, company.ID, f.Media.Int(), f.Name[f.DefaultLang].Val, f.Spiel[f.DefaultLang].Val, f.Info[f.DefaultLang].Val, f.Facilities[f.DefaultLang].Val, f.Description[f.DefaultLang].Val, f.AdditionalInfo[f.DefaultLang].Val, f.CheckIn[f.DefaultLang].Val, f.CheckOut[f.DefaultLang].Val, f.MaxCampers.Int(), f.MinNights.Int(), f.MaxNights.Int(), f.OverflowAllowed.Checked, f.AskZonePreferences.Checked)
if err != nil {
return err
}
if err := translateTypes(ctx, tx, company, f); err != nil {
return err
}
if err := setTypeDogsPrice(ctx, tx, f); err != nil {
return err
}
return setTypePrices(ctx, tx, f.Slug, f.Prices)
})
}
@ -191,6 +194,14 @@ func translateTypes(ctx context.Context, tx *database.Tx, company *auth.Company,
return nil
}
func setTypeDogsPrice(ctx context.Context, tx *database.Tx, f *typeForm) error {
if f.DogsAllowed.Checked {
return tx.SetCampsitePetTypeCost(ctx, f.Slug, f.DogsPrice.Val)
} else {
return tx.UnsetCampsitePetTypeCost(ctx, f.Slug)
}
}
func setTypePrices(ctx context.Context, tx *database.Tx, slug string, prices map[int]*typePriceForm) error {
for seasonID, p := range prices {
if err := tx.SetCampsiteTypeCost(ctx, slug, seasonID, p.PricePerNight.Val, p.PricePerAdult.Val, p.PricePerTeenager.Val, p.PricePerChild.Val); err != nil {
@ -202,12 +213,15 @@ func setTypePrices(ctx context.Context, tx *database.Tx, slug string, prices map
func editType(w http.ResponseWriter, r *http.Request, user *auth.User, company *auth.Company, conn *database.Conn, f *typeForm) {
processTypeForm(w, r, user, company, conn, f, func(ctx context.Context, tx *database.Tx) error {
if _, err := tx.EditCampsiteType(ctx, f.Slug, f.Media.Int(), f.Name[f.DefaultLang].Val, f.Spiel[f.DefaultLang].Val, f.Info[f.DefaultLang].Val, f.Facilities[f.DefaultLang].Val, f.Description[f.DefaultLang].Val, f.AdditionalInfo[f.DefaultLang].Val, f.CheckIn[f.DefaultLang].Val, f.CheckOut[f.DefaultLang].Val, f.MaxCampers.Int(), f.MinNights.Int(), f.MaxNights.Int(), f.DogsAllowed.Checked, f.OverflowAllowed.Checked, f.AskZonePreferences.Checked, f.Active.Checked); err != nil {
if _, err := tx.EditCampsiteType(ctx, f.Slug, f.Media.Int(), f.Name[f.DefaultLang].Val, f.Spiel[f.DefaultLang].Val, f.Info[f.DefaultLang].Val, f.Facilities[f.DefaultLang].Val, f.Description[f.DefaultLang].Val, f.AdditionalInfo[f.DefaultLang].Val, f.CheckIn[f.DefaultLang].Val, f.CheckOut[f.DefaultLang].Val, f.MaxCampers.Int(), f.MinNights.Int(), f.MaxNights.Int(), f.OverflowAllowed.Checked, f.AskZonePreferences.Checked, f.Active.Checked); err != nil {
return err
}
if err := translateTypes(ctx, tx, company, f); err != nil {
return err
}
if err := setTypeDogsPrice(ctx, tx, f); err != nil {
return err
}
return setTypePrices(ctx, tx, f.Slug, f.Prices)
})
}
@ -279,6 +293,7 @@ type typeForm struct {
MinNights *form.Input
MaxNights *form.Input
DogsAllowed *form.Checkbox
DogsPrice *form.Input
OverflowAllowed *form.Checkbox
AskZonePreferences *form.Checkbox
Spiel form.I18nInput
@ -328,6 +343,9 @@ func newTypeForm(ctx context.Context, company *auth.Company, conn *database.Conn
DogsAllowed: &form.Checkbox{
Name: "dogs_allowed",
},
DogsPrice: &form.Input{
Name: "dogs_price",
},
OverflowAllowed: &form.Checkbox{
Name: "overflow_allowed",
},
@ -403,7 +421,8 @@ func (f *typeForm) FillFromDatabase(ctx context.Context, conn *database.Conn, sl
, max_campers::text
, lower(bookable_nights)::text
, (upper(bookable_nights) - 1)::text
, dogs_allowed
, pet.cost_per_night is not null as dogs_allowed
, to_price(coalesce(pet.cost_per_night, 0)) as pet_cost
, overflow_allowed
, ask_zone_preferences
, active
@ -416,7 +435,8 @@ func (f *typeForm) FillFromDatabase(ctx context.Context, conn *database.Conn, sl
, array_agg((lang_tag, i18n.check_in))
, array_agg((lang_tag, i18n.check_out))
from campsite_type
left join campsite_type_i18n as i18n using (campsite_type_id)
left join campsite_type_pet_cost as pet using (campsite_type_id)
left join campsite_type_i18n as i18n using (campsite_type_id)
where slug = $1
group by campsite_type.name
, campsite_type.spiel::text
@ -429,7 +449,7 @@ func (f *typeForm) FillFromDatabase(ctx context.Context, conn *database.Conn, sl
, media_id::text
, max_campers::text
, bookable_nights
, dogs_allowed
, pet.cost_per_night
, overflow_allowed
, ask_zone_preferences
, active
@ -448,6 +468,7 @@ func (f *typeForm) FillFromDatabase(ctx context.Context, conn *database.Conn, sl
&f.MinNights.Val,
&f.MaxNights.Val,
&f.DogsAllowed.Checked,
&f.DogsPrice.Val,
&f.OverflowAllowed.Checked,
&f.AskZonePreferences.Checked,
&f.Active.Checked,
@ -531,6 +552,7 @@ func (f *typeForm) Parse(r *http.Request) error {
f.MinNights.FillValue(r)
f.MaxNights.FillValue(r)
f.DogsAllowed.FillValue(r)
f.DogsPrice.FillValue(r)
f.OverflowAllowed.FillValue(r)
f.AskZonePreferences.FillValue(r)
f.Spiel.FillValue(r)
@ -577,6 +599,13 @@ func (f *typeForm) Valid(ctx context.Context, conn *database.Conn, l *locale.Loc
v.CheckMinInteger(f.MaxNights, f.MinNights.Int(), l.GettextNoop("Maximum number of nights must be equal or greater than the minimum."))
}
}
if f.DogsAllowed.Checked {
if v.CheckRequired(f.DogsPrice, l.GettextNoop("Dogs price can not be empty when dogs are allowed.")) {
if v.CheckValidDecimal(f.DogsPrice, l.GettextNoop("Dogs price must be a decimal number.")) {
v.CheckMinDecimal(f.DogsPrice, 0.0, l.GettextNoop("Dogs price must be zero or greater."))
}
}
}
for _, p := range f.Prices {
if v.CheckRequired(p.PricePerNight, l.GettextNoop("Price per night can not be empty.")) {
if v.CheckValidDecimal(p.PricePerNight, l.GettextNoop("Price per night must be a decimal number.")) {

View File

@ -139,9 +139,10 @@ func newPublicPage(ctx context.Context, company *auth.Company, conn *database.Co
, coalesce(i18n.additional_info, campsite_type.additional_info)::text as l10n_description
, coalesce(i18n.check_in, campsite_type.check_in)::text as l10n_check_in
, coalesce(i18n.check_out, campsite_type.check_out)::text as l10n_check_out
, dogs_allowed
, '3.50' as dogs_prices
, pet.cost_per_night is not null as dogs_allowed
, to_price(coalesce(pet.cost_per_night, 0)) as dogs_prices
from campsite_type
left join campsite_type_pet_cost as pet using (campsite_type_id)
left join campsite_type_i18n as i18n on campsite_type.campsite_type_id = i18n.campsite_type_id and i18n.lang_tag = $1
where slug = $2
and active

View File

@ -130,12 +130,12 @@ func (c *Conn) RemoveCampsiteFeature(ctx context.Context, id int) error {
return err
}
func (tx *Tx) AddCampsiteType(ctx context.Context, companyID int, mediaID int, name string, spiel string, info string, facilities string, description string, additionalInfo string, checkIn string, checkOut string, maxCampers int, minNights int, maxNights int, dogsAllowed bool, overflowAllowed bool, askZonePreferences bool) (string, error) {
return tx.GetText(ctx, "select add_campsite_type($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, int4range($12, $13), $14, $15, $16)", companyID, mediaID, name, spiel, info, facilities, description, additionalInfo, checkIn, checkOut, maxCampers, minNights, maxNights+1, dogsAllowed, overflowAllowed, askZonePreferences)
func (tx *Tx) AddCampsiteType(ctx context.Context, companyID int, mediaID int, name string, spiel string, info string, facilities string, description string, additionalInfo string, checkIn string, checkOut string, maxCampers int, minNights int, maxNights int, overflowAllowed bool, askZonePreferences bool) (string, error) {
return tx.GetText(ctx, "select add_campsite_type($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, int4range($12, $13), $14, $15)", companyID, mediaID, name, spiel, info, facilities, description, additionalInfo, checkIn, checkOut, maxCampers, minNights, maxNights+1, overflowAllowed, askZonePreferences)
}
func (tx *Tx) EditCampsiteType(ctx context.Context, slug string, mediaID int, name string, spiel string, info string, facilities string, description string, additionalInfo string, checkIn string, checkOut string, maxCampers int, minNights int, maxNights int, dogsAllowed bool, overflowAllowed bool, askZonePreferences bool, active bool) (string, error) {
return tx.GetText(ctx, "select edit_campsite_type($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, int4range($12, $13), $14, $15, $16, $17)", slug, mediaID, name, spiel, info, facilities, description, additionalInfo, checkIn, checkOut, maxCampers, minNights, maxNights+1, dogsAllowed, overflowAllowed, askZonePreferences, active)
func (tx *Tx) EditCampsiteType(ctx context.Context, slug string, mediaID int, name string, spiel string, info string, facilities string, description string, additionalInfo string, checkIn string, checkOut string, maxCampers int, minNights int, maxNights int, overflowAllowed bool, askZonePreferences bool, active bool) (string, error) {
return tx.GetText(ctx, "select edit_campsite_type($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, int4range($12, $13), $14, $15, $16)", slug, mediaID, name, spiel, info, facilities, description, additionalInfo, checkIn, checkOut, maxCampers, minNights, maxNights+1, overflowAllowed, askZonePreferences, active)
}
func (c *Conn) OrderCampsiteTypes(ctx context.Context, slugs []string) error {
@ -152,6 +152,16 @@ func (tx *Tx) SetCampsiteTypeCost(ctx context.Context, slug string, seasonID int
return err
}
func (tx *Tx) SetCampsitePetTypeCost(ctx context.Context, slug string, cost string) error {
_, err := tx.Exec(ctx, "select set_campsite_type_pet_cost($1, $2)", slug, cost)
return err
}
func (tx *Tx) UnsetCampsitePetTypeCost(ctx context.Context, slug string) error {
_, err := tx.Exec(ctx, "select unset_campsite_type_pet_cost($1)", slug)
return err
}
func (tx *Tx) AddCampsiteTypeOption(ctx context.Context, typeSlug string, name string, min int, max int) (int, error) {
return tx.GetInt(ctx, "select add_campsite_type_option($1, $2, $3, $4)", typeSlug, name, min, max)
}

186
po/ca.po
View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: camper\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2024-02-10 03:29+0100\n"
"POT-Creation-Date: 2024-02-10 06:05+0100\n"
"PO-Revision-Date: 2024-02-06 10:04+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Catalan <ca@dodds.net>\n"
@ -167,7 +167,7 @@ msgid "Calendar"
msgstr "Calendari"
#: web/templates/public/campsite/type.gohtml:68
#: web/templates/admin/campsite/type/form.gohtml:143
#: web/templates/admin/campsite/type/form.gohtml:153
#: web/templates/admin/campsite/type/option/form.gohtml:70
msgctxt "title"
msgid "Prices"
@ -700,7 +700,7 @@ msgstr "Contingut"
#: web/templates/admin/campsite/form.gohtml:92
#: web/templates/admin/campsite/type/feature/form.gohtml:74
#: web/templates/admin/campsite/type/carousel/form.gohtml:59
#: web/templates/admin/campsite/type/form.gohtml:277
#: web/templates/admin/campsite/type/form.gohtml:287
#: web/templates/admin/campsite/type/option/form.gohtml:90
#: web/templates/admin/season/form.gohtml:73
#: web/templates/admin/services/form.gohtml:81
@ -722,7 +722,7 @@ msgstr "Actualitza"
#: web/templates/admin/campsite/form.gohtml:94
#: web/templates/admin/campsite/type/feature/form.gohtml:76
#: web/templates/admin/campsite/type/carousel/form.gohtml:61
#: web/templates/admin/campsite/type/form.gohtml:279
#: web/templates/admin/campsite/type/form.gohtml:289
#: web/templates/admin/campsite/type/option/form.gohtml:92
#: web/templates/admin/season/form.gohtml:75
#: web/templates/admin/services/form.gohtml:83
@ -1160,80 +1160,85 @@ msgctxt "input"
msgid "Ask for zone preferences when booking"
msgstr "Demana la preferència de zona durant la reserva"
#: web/templates/admin/campsite/type/form.gohtml:137
#: web/templates/admin/campsite/type/form.gohtml:139
msgctxt "input"
msgid "Dogs allowed"
msgstr "Es permeten gossos"
#: web/templates/admin/campsite/type/form.gohtml:147
#: web/templates/admin/campsite/type/form.gohtml:144
msgctxt "input"
msgid "Dogs price"
msgstr "Preu dels gossos"
#: web/templates/admin/campsite/type/form.gohtml:157
msgctxt "header"
msgid "Season"
msgstr "Temporada"
#: web/templates/admin/campsite/type/form.gohtml:148
#: web/templates/admin/campsite/type/form.gohtml:158
msgctxt "header"
msgid "Price per night"
msgstr "Preu per nit"
#: web/templates/admin/campsite/type/form.gohtml:149
#: web/templates/admin/campsite/type/form.gohtml:159
msgctxt "header"
msgid "Price per adult (> 16)"
msgstr "Preu per adult (> 16)"
#: web/templates/admin/campsite/type/form.gohtml:150
#: web/templates/admin/campsite/type/form.gohtml:160
msgctxt "header"
msgid "Price per teenager (1116)"
msgstr "Preu per adolescent (1116)"
#: web/templates/admin/campsite/type/form.gohtml:151
#: web/templates/admin/campsite/type/form.gohtml:161
msgctxt "header"
msgid "Price per child (210)"
msgstr "Preu per nen (210)"
#: web/templates/admin/campsite/type/form.gohtml:161
#: web/templates/admin/campsite/type/form.gohtml:171
#: web/templates/admin/campsite/type/option/form.gohtml:76
msgctxt "input"
msgid "Price per night"
msgstr "Preu per nit"
#: web/templates/admin/campsite/type/form.gohtml:172
#: web/templates/admin/campsite/type/form.gohtml:182
msgctxt "input"
msgid "Price per adult (> 16)"
msgstr "Per per adult (> 16)"
#: web/templates/admin/campsite/type/form.gohtml:183
#: web/templates/admin/campsite/type/form.gohtml:193
msgctxt "input"
msgid "Price per teenager (1116)"
msgstr "Preu per adolescent (1116)"
#: web/templates/admin/campsite/type/form.gohtml:194
#: web/templates/admin/campsite/type/form.gohtml:204
msgctxt "input"
msgid "Price per child (210)"
msgstr "Preu per nene (210)"
#: web/templates/admin/campsite/type/form.gohtml:210
#: web/templates/admin/campsite/type/form.gohtml:220
msgctxt "input"
msgid "Spiel"
msgstr "Introducció"
#: web/templates/admin/campsite/type/form.gohtml:223
#: web/templates/admin/campsite/type/form.gohtml:233
msgctxt "input"
msgid "Info"
msgstr "Informació"
#: web/templates/admin/campsite/type/form.gohtml:236
#: web/templates/admin/campsite/type/form.gohtml:246
msgctxt "input"
msgid "Facilities"
msgstr "Equipaments"
#: web/templates/admin/campsite/type/form.gohtml:249
#: web/templates/admin/campsite/type/form.gohtml:259
#: web/templates/admin/services/form.gohtml:66
#: web/templates/admin/surroundings/form.gohtml:54
msgctxt "input"
msgid "Description"
msgstr "Descripció"
#: web/templates/admin/campsite/type/form.gohtml:262
#: web/templates/admin/campsite/type/form.gohtml:272
msgctxt "input"
msgid "Additional Information"
msgstr "Informació addicional"
@ -1930,7 +1935,7 @@ msgid "No booking found."
msgstr "No sha trobat cap reserva."
#: pkg/legal/admin.go:258 pkg/app/user.go:249 pkg/campsite/types/option.go:357
#: pkg/campsite/types/feature.go:272 pkg/campsite/types/admin.go:555
#: pkg/campsite/types/feature.go:272 pkg/campsite/types/admin.go:577
#: pkg/campsite/feature.go:269 pkg/season/admin.go:412
#: pkg/services/admin.go:316 pkg/surroundings/admin.go:340
#: pkg/amenity/feature.go:269 pkg/amenity/admin.go:283
@ -1938,7 +1943,7 @@ msgid "Name can not be empty."
msgstr "No podeu deixar el nom en blanc."
#: pkg/legal/admin.go:259 pkg/campsite/types/option.go:358
#: pkg/campsite/types/feature.go:273 pkg/campsite/types/admin.go:556
#: pkg/campsite/types/feature.go:273 pkg/campsite/types/admin.go:578
#: pkg/campsite/feature.go:270 pkg/amenity/feature.go:270
msgid "Name must have at least one letter."
msgstr "El nom ha de tenir com a mínim una lletra."
@ -1968,12 +1973,12 @@ msgid "Slide image must be an image media type."
msgstr "La imatge de la diapositiva ha de ser un mèdia de tipus imatge."
#: pkg/app/login.go:56 pkg/app/user.go:246 pkg/company/admin.go:217
#: pkg/booking/public.go:571
#: pkg/booking/public.go:572
msgid "Email can not be empty."
msgstr "No podeu deixar el correu-e en blanc."
#: pkg/app/login.go:57 pkg/app/user.go:247 pkg/company/admin.go:218
#: pkg/booking/public.go:572
#: pkg/booking/public.go:573
msgid "This email is not valid. It should be like name@domain.com."
msgstr "Aquest correu-e no és vàlid. Hauria de ser similar a nom@domini.com."
@ -2030,15 +2035,15 @@ msgstr "El valor del màxim ha de ser un número enter."
msgid "Maximum must be equal or greater than minimum."
msgstr "El valor del màxim ha de ser igual o superir al del mínim."
#: pkg/campsite/types/option.go:374 pkg/campsite/types/admin.go:581
#: pkg/campsite/types/option.go:374 pkg/campsite/types/admin.go:610
msgid "Price per night can not be empty."
msgstr "No podeu deixar el preu per nit en blanc."
#: pkg/campsite/types/option.go:375 pkg/campsite/types/admin.go:582
#: pkg/campsite/types/option.go:375 pkg/campsite/types/admin.go:611
msgid "Price per night must be a decimal number."
msgstr "El preu per nit ha de ser un número decimal."
#: pkg/campsite/types/option.go:376 pkg/campsite/types/admin.go:583
#: pkg/campsite/types/option.go:376 pkg/campsite/types/admin.go:612
msgid "Price per night must be zero or greater."
msgstr "El preu per nit ha de ser com a mínim zero."
@ -2047,115 +2052,127 @@ msgstr "El preu per nit ha de ser com a mínim zero."
msgid "Selected icon is not valid."
msgstr "La icona escollida no és vàlida."
#: pkg/campsite/types/admin.go:313
#: pkg/campsite/types/admin.go:328
msgctxt "input"
msgid "Cover image"
msgstr "Imatge de portada"
#: pkg/campsite/types/admin.go:314
#: pkg/campsite/types/admin.go:329
msgctxt "action"
msgid "Set campsite type cover"
msgstr "Estableix la portada del tipus dallotjament"
#: pkg/campsite/types/admin.go:558
#: pkg/campsite/types/admin.go:580
msgid "Check-in can not be empty."
msgstr "No podeu deixar lentrada en blanc."
#: pkg/campsite/types/admin.go:559
#: pkg/campsite/types/admin.go:581
msgid "Check-out can not be empty."
msgstr "No podeu deixar la sortida en blanc."
#: pkg/campsite/types/admin.go:560
#: pkg/campsite/types/admin.go:582
msgid "Cover image can not be empty."
msgstr "No podeu deixar la imatge de portada en blanc."
#: pkg/campsite/types/admin.go:561
#: pkg/campsite/types/admin.go:583
msgid "Cover image must be an image media type."
msgstr "La imatge de portada ha de ser un mèdia de tipus imatge."
#: pkg/campsite/types/admin.go:565
#: pkg/campsite/types/admin.go:587
msgid "Maximum number of campers can not be empty."
msgstr "No podeu deixar el número màxim de persones en blanc."
#: pkg/campsite/types/admin.go:566
#: pkg/campsite/types/admin.go:588
msgid "Maximum number of campers must be an integer number."
msgstr "El número màxim de persones ha de ser enter."
#: pkg/campsite/types/admin.go:567
#: pkg/campsite/types/admin.go:589
msgid "Maximum number of campers must be one or greater."
msgstr "El número màxim de persones no pot ser zero."
#: pkg/campsite/types/admin.go:570
#: pkg/campsite/types/admin.go:592
msgid "Minimum number of nights can not be empty."
msgstr "No podeu deixar el número mínim de nits en blanc."
#: pkg/campsite/types/admin.go:571
#: pkg/campsite/types/admin.go:593
msgid "Minimum number of nights must be an integer."
msgstr "El número mínim de nits ha de ser enter."
#: pkg/campsite/types/admin.go:572
#: pkg/campsite/types/admin.go:594
msgid "Minimum number of nights must be one or greater."
msgstr "El número mínim de nits no pot ser zero."
#: pkg/campsite/types/admin.go:575
#: pkg/campsite/types/admin.go:597
msgid "Maximum number of nights can not be empty."
msgstr "No podeu deixar el número màxim de nits en blanc."
#: pkg/campsite/types/admin.go:576
#: pkg/campsite/types/admin.go:598
msgid "Maximum number of nights must be an integer."
msgstr "El número màxim de nits ha de ser enter."
#: pkg/campsite/types/admin.go:577
#: pkg/campsite/types/admin.go:599
msgid "Maximum number of nights must be equal or greater than the minimum."
msgstr "El valor del número màxim de nits ha de ser igual o superir al del mínim."
#: pkg/campsite/types/admin.go:586
#: pkg/campsite/types/admin.go:603
msgid "Dogs price can not be empty when dogs are allowed."
msgstr "El preu dels gossos no pot ser buit quan són permesos."
#: pkg/campsite/types/admin.go:604
msgid "Dogs price must be a decimal number."
msgstr "El preu dels gossos ha de ser un número decimal."
#: pkg/campsite/types/admin.go:605
msgid "Dogs price must be zero or greater."
msgstr "El preu dels gossos ha de ser com a mínim zero."
#: pkg/campsite/types/admin.go:615
msgid "Price per adult can not be empty."
msgstr "No podeu deixar el preu per adult en blanc."
#: pkg/campsite/types/admin.go:587
#: pkg/campsite/types/admin.go:616
msgid "Price per adult must be a decimal number."
msgstr "El preu per adult ha de ser un número decimal."
#: pkg/campsite/types/admin.go:588
#: pkg/campsite/types/admin.go:617
msgid "Price per adult must be zero or greater."
msgstr "El preu per adult ha de ser com a mínim zero."
#: pkg/campsite/types/admin.go:591
#: pkg/campsite/types/admin.go:620
msgid "Price per teenager can not be empty."
msgstr "No podeu deixar el preu per adolescent en blanc."
#: pkg/campsite/types/admin.go:592
#: pkg/campsite/types/admin.go:621
msgid "Price per teenager must be a decimal number."
msgstr "El preu per adolescent ha de ser un número decimal."
#: pkg/campsite/types/admin.go:593
#: pkg/campsite/types/admin.go:622
msgid "Price per teenager must be zero or greater."
msgstr "El preu per adolescent ha de ser com a mínim zero."
#: pkg/campsite/types/admin.go:596
#: pkg/campsite/types/admin.go:625
msgid "Price per child can not be empty."
msgstr "No podeu deixar el preu per nen en blanc."
#: pkg/campsite/types/admin.go:597
#: pkg/campsite/types/admin.go:626
msgid "Price per child must be a decimal number."
msgstr "El preu per nen ha de ser un número decimal."
#: pkg/campsite/types/admin.go:598
#: pkg/campsite/types/admin.go:627
msgid "Price per child must be zero or greater."
msgstr "El preu per nen ha de ser com a mínim zero."
#: pkg/campsite/types/public.go:244
#: pkg/campsite/types/public.go:245
msgctxt "header"
msgid "Adults"
msgstr "Adults"
#: pkg/campsite/types/public.go:250
#: pkg/campsite/types/public.go:251
msgctxt "header"
msgid "Teenagers (aged 11 to 16)"
msgstr "Adolescents (entre 11 i 16 anys)"
#: pkg/campsite/types/public.go:256
#: pkg/campsite/types/public.go:257
msgctxt "header"
msgid "Children (aged 2 to 10)"
msgstr "Mainada (entre 2 i 10 anys)"
@ -2317,7 +2334,7 @@ msgstr "No podeu deixar ladreça de lenllaç en blanc."
msgid "This web address is not valid. It should be like https://domain.com/."
msgstr "Aquesta adreça web no és vàlida. Hauria de ser similar a https://domini.com/."
#: pkg/company/admin.go:200 pkg/booking/public.go:558
#: pkg/company/admin.go:200 pkg/booking/public.go:559
msgid "Selected country is not valid."
msgstr "El país escollit no és vàlid."
@ -2337,11 +2354,11 @@ msgstr "No podeu deixar el NIF en blanc."
msgid "This VAT number is not valid."
msgstr "Aquest NIF no és vàlid."
#: pkg/company/admin.go:212 pkg/booking/public.go:574
#: pkg/company/admin.go:212 pkg/booking/public.go:575
msgid "Phone can not be empty."
msgstr "No podeu deixar el telèfon en blanc."
#: pkg/company/admin.go:213 pkg/booking/public.go:575
#: pkg/company/admin.go:213 pkg/booking/public.go:576
msgid "This phone number is not valid."
msgstr "Aquest número de telèfon no és vàlid."
@ -2361,7 +2378,7 @@ msgstr "No podeu deixar la província en blanc."
msgid "Postal code can not be empty."
msgstr "No podeu deixar el codi postal en blanc."
#: pkg/company/admin.go:227 pkg/booking/public.go:567
#: pkg/company/admin.go:227 pkg/booking/public.go:568
msgid "This postal code is not valid."
msgstr "Aquest codi postal no és vàlid."
@ -2401,27 +2418,32 @@ msgstr "No podeu deixar el fitxer del mèdia en blanc."
msgid "Filename can not be empty."
msgstr "No podeu deixar el nom del fitxer en blanc."
#: pkg/booking/cart.go:142
#: pkg/booking/cart.go:156
msgctxt "cart"
msgid "Night"
msgstr "Nit"
#: pkg/booking/cart.go:143
#: pkg/booking/cart.go:157
msgctxt "cart"
msgid "Adult"
msgstr "Adult"
#: pkg/booking/cart.go:144
#: pkg/booking/cart.go:158
msgctxt "cart"
msgid "Teenager"
msgstr "Adolescent"
#: pkg/booking/cart.go:145
#: pkg/booking/cart.go:159
msgctxt "cart"
msgid "Child"
msgstr "Nen"
#: pkg/booking/cart.go:164
#: pkg/booking/cart.go:160
msgctxt "cart"
msgid "Dog"
msgstr "Gos"
#: pkg/booking/cart.go:179
msgctxt "cart"
msgid "Tourist tax"
msgstr "Impost turístic"
@ -2519,88 +2541,88 @@ msgstr "La data de sortida ha de ser igual o posterior a %s."
msgid "Departure date must be %s or before."
msgstr "La data de sortida ha de ser anterior o igual a %s."
#: pkg/booking/public.go:394
#: pkg/booking/public.go:395
#, c-format
msgid "There can be at most %d guests in this accommodation."
msgstr "Hi poden haver com a màxim %d convidats a aquest allotjament."
#: pkg/booking/public.go:413
#: pkg/booking/public.go:414
msgid "Number of adults can not be empty"
msgstr "No podeu deixar el número dadults en blanc."
#: pkg/booking/public.go:414
#: pkg/booking/public.go:415
msgid "Number of adults must be an integer."
msgstr "El número dadults ha de ser enter."
#: pkg/booking/public.go:415
#: pkg/booking/public.go:416
msgid "There must be at least one adult."
msgstr "Hi ha dhaver com a mínim un adult."
#: pkg/booking/public.go:418
#: pkg/booking/public.go:419
msgid "Number of teenagers can not be empty"
msgstr "No podeu deixar el número dadolescents en blanc."
#: pkg/booking/public.go:419
#: pkg/booking/public.go:420
msgid "Number of teenagers must be an integer."
msgstr "El número dadolescents ha de ser enter."
#: pkg/booking/public.go:420
#: pkg/booking/public.go:421
msgid "Number of teenagers can not be negative."
msgstr "El número dadolescents no pot ser negatiu."
#: pkg/booking/public.go:423
#: pkg/booking/public.go:424
msgid "Number of children can not be empty"
msgstr "No podeu deixar el número de nens en blanc."
#: pkg/booking/public.go:424
#: pkg/booking/public.go:425
msgid "Number of children must be an integer."
msgstr "El número de nens ha de ser enter."
#: pkg/booking/public.go:425
#: pkg/booking/public.go:426
msgid "Number of children can not be negative."
msgstr "El número de nens no pot ser negatiu."
#: pkg/booking/public.go:428
#: pkg/booking/public.go:429
msgid "Number of dogs can not be empty"
msgstr "No podeu deixar el número de gossos en blanc."
#: pkg/booking/public.go:429
#: pkg/booking/public.go:430
msgid "Number of dogs must be an integer."
msgstr "El número de gossos ha de ser enter."
#: pkg/booking/public.go:430
#: pkg/booking/public.go:431
msgid "Number of dogs can not be negative."
msgstr "El número de gossos no pot ser negatiu."
#: pkg/booking/public.go:501
#: pkg/booking/public.go:502
#, c-format
msgid "%s can not be empty"
msgstr "No podeu deixar %s en blanc."
#: pkg/booking/public.go:502
#: pkg/booking/public.go:503
#, c-format
msgid "%s must be an integer."
msgstr "%s ha de ser un número enter."
#: pkg/booking/public.go:503
#: pkg/booking/public.go:504
#, c-format
msgid "%s must be %d or greater."
msgstr "El valor de %s ha de ser com a mínim %d."
#: pkg/booking/public.go:504
#: pkg/booking/public.go:505
#, c-format
msgid "%s must be at most %d."
msgstr "El valor de %s ha de ser com a màxim %d."
#: pkg/booking/public.go:562
#: pkg/booking/public.go:563
msgid "Full name can not be empty."
msgstr "No podeu deixar el nom i els cognoms en blanc."
#: pkg/booking/public.go:563
#: pkg/booking/public.go:564
msgid "Full name must have at least one letter."
msgstr "El nom i els cognoms han de tenir com a mínim una lletra."
#: pkg/booking/public.go:580
#: pkg/booking/public.go:581
msgid "It is mandatory to agree to the reservation conditions."
msgstr "És obligatori acceptar les condicions de reserves."

187
po/es.po
View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: camper\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2024-02-10 03:31+0100\n"
"POT-Creation-Date: 2024-02-10 06:05+0100\n"
"PO-Revision-Date: 2024-02-06 10:04+0100\n"
"Last-Translator: jordi fita mas <jordi@tandem.blog>\n"
"Language-Team: Spanish <es@tp.org.es>\n"
@ -167,7 +167,7 @@ msgid "Calendar"
msgstr "Calendario"
#: web/templates/public/campsite/type.gohtml:68
#: web/templates/admin/campsite/type/form.gohtml:143
#: web/templates/admin/campsite/type/form.gohtml:153
#: web/templates/admin/campsite/type/option/form.gohtml:70
msgctxt "title"
msgid "Prices"
@ -700,7 +700,7 @@ msgstr "Contenido"
#: web/templates/admin/campsite/form.gohtml:92
#: web/templates/admin/campsite/type/feature/form.gohtml:74
#: web/templates/admin/campsite/type/carousel/form.gohtml:59
#: web/templates/admin/campsite/type/form.gohtml:277
#: web/templates/admin/campsite/type/form.gohtml:287
#: web/templates/admin/campsite/type/option/form.gohtml:90
#: web/templates/admin/season/form.gohtml:73
#: web/templates/admin/services/form.gohtml:81
@ -722,7 +722,7 @@ msgstr "Actualizar"
#: web/templates/admin/campsite/form.gohtml:94
#: web/templates/admin/campsite/type/feature/form.gohtml:76
#: web/templates/admin/campsite/type/carousel/form.gohtml:61
#: web/templates/admin/campsite/type/form.gohtml:279
#: web/templates/admin/campsite/type/form.gohtml:289
#: web/templates/admin/campsite/type/option/form.gohtml:92
#: web/templates/admin/season/form.gohtml:75
#: web/templates/admin/services/form.gohtml:83
@ -1160,80 +1160,85 @@ msgctxt "input"
msgid "Ask for zone preferences when booking"
msgstr "Pedir la preferencia de zona durante la reserva"
#: web/templates/admin/campsite/type/form.gohtml:137
#: web/templates/admin/campsite/type/form.gohtml:139
msgctxt "input"
msgid "Dogs allowed"
msgstr "Se permiten perros"
#: web/templates/admin/campsite/type/form.gohtml:147
#: web/templates/admin/campsite/type/form.gohtml:144
msgctxt "input"
msgid "Dogs price"
msgstr "Precio de los perros"
#: web/templates/admin/campsite/type/form.gohtml:157
msgctxt "header"
msgid "Season"
msgstr "Temporada"
#: web/templates/admin/campsite/type/form.gohtml:148
#: web/templates/admin/campsite/type/form.gohtml:158
msgctxt "header"
msgid "Price per night"
msgstr "Precio por noche"
#: web/templates/admin/campsite/type/form.gohtml:149
#: web/templates/admin/campsite/type/form.gohtml:159
msgctxt "header"
msgid "Price per adult (> 16)"
msgstr "Precio por adulto (> 16)"
#: web/templates/admin/campsite/type/form.gohtml:150
#: web/templates/admin/campsite/type/form.gohtml:160
msgctxt "header"
msgid "Price per teenager (1116)"
msgstr "Precio por adolescente (1116)"
#: web/templates/admin/campsite/type/form.gohtml:151
#: web/templates/admin/campsite/type/form.gohtml:161
msgctxt "header"
msgid "Price per child (210)"
msgstr "Precio por niño (210)"
#: web/templates/admin/campsite/type/form.gohtml:161
#: web/templates/admin/campsite/type/form.gohtml:171
#: web/templates/admin/campsite/type/option/form.gohtml:76
msgctxt "input"
msgid "Price per night"
msgstr "Precio por noche"
#: web/templates/admin/campsite/type/form.gohtml:172
#: web/templates/admin/campsite/type/form.gohtml:182
msgctxt "input"
msgid "Price per adult (> 16)"
msgstr "Precio por adulto (> 16)"
#: web/templates/admin/campsite/type/form.gohtml:183
#: web/templates/admin/campsite/type/form.gohtml:193
msgctxt "input"
msgid "Price per teenager (1116)"
msgstr "Precio por adolescente (1116)"
#: web/templates/admin/campsite/type/form.gohtml:194
#: web/templates/admin/campsite/type/form.gohtml:204
msgctxt "input"
msgid "Price per child (210)"
msgstr "Precio por niño (210)"
#: web/templates/admin/campsite/type/form.gohtml:210
#: web/templates/admin/campsite/type/form.gohtml:220
msgctxt "input"
msgid "Spiel"
msgstr "Introducción"
#: web/templates/admin/campsite/type/form.gohtml:223
#: web/templates/admin/campsite/type/form.gohtml:233
msgctxt "input"
msgid "Info"
msgstr "Información"
#: web/templates/admin/campsite/type/form.gohtml:236
#: web/templates/admin/campsite/type/form.gohtml:246
msgctxt "input"
msgid "Facilities"
msgstr "Equipamento"
#: web/templates/admin/campsite/type/form.gohtml:249
#: web/templates/admin/campsite/type/form.gohtml:259
#: web/templates/admin/services/form.gohtml:66
#: web/templates/admin/surroundings/form.gohtml:54
msgctxt "input"
msgid "Description"
msgstr "Descripción"
#: web/templates/admin/campsite/type/form.gohtml:262
#: web/templates/admin/campsite/type/form.gohtml:272
msgctxt "input"
msgid "Additional Information"
msgstr "Información adicional"
@ -1930,7 +1935,7 @@ msgid "No booking found."
msgstr "No se ha encontrado ninguna reserva."
#: pkg/legal/admin.go:258 pkg/app/user.go:249 pkg/campsite/types/option.go:357
#: pkg/campsite/types/feature.go:272 pkg/campsite/types/admin.go:555
#: pkg/campsite/types/feature.go:272 pkg/campsite/types/admin.go:577
#: pkg/campsite/feature.go:269 pkg/season/admin.go:412
#: pkg/services/admin.go:316 pkg/surroundings/admin.go:340
#: pkg/amenity/feature.go:269 pkg/amenity/admin.go:283
@ -1938,7 +1943,7 @@ msgid "Name can not be empty."
msgstr "No podéis dejar el nombre en blanco."
#: pkg/legal/admin.go:259 pkg/campsite/types/option.go:358
#: pkg/campsite/types/feature.go:273 pkg/campsite/types/admin.go:556
#: pkg/campsite/types/feature.go:273 pkg/campsite/types/admin.go:578
#: pkg/campsite/feature.go:270 pkg/amenity/feature.go:270
msgid "Name must have at least one letter."
msgstr "El nombre tiene que tener como mínimo una letra."
@ -1968,12 +1973,12 @@ msgid "Slide image must be an image media type."
msgstr "La imagen de la diapositiva tiene que ser un medio de tipo imagen."
#: pkg/app/login.go:56 pkg/app/user.go:246 pkg/company/admin.go:217
#: pkg/booking/public.go:571
#: pkg/booking/public.go:572
msgid "Email can not be empty."
msgstr "No podéis dejar el correo-e en blanco."
#: pkg/app/login.go:57 pkg/app/user.go:247 pkg/company/admin.go:218
#: pkg/booking/public.go:572
#: pkg/booking/public.go:573
msgid "This email is not valid. It should be like name@domain.com."
msgstr "Este correo-e no es válido. Tiene que ser parecido a nombre@dominio.com."
@ -2030,15 +2035,15 @@ msgstr "El valor del máximo tiene que ser un número entero."
msgid "Maximum must be equal or greater than minimum."
msgstr "El valor del máximo tiene que ser igual o mayor al del mínimo."
#: pkg/campsite/types/option.go:374 pkg/campsite/types/admin.go:581
#: pkg/campsite/types/option.go:374 pkg/campsite/types/admin.go:610
msgid "Price per night can not be empty."
msgstr "No podéis dejar el precio por noche en blanco."
#: pkg/campsite/types/option.go:375 pkg/campsite/types/admin.go:582
#: pkg/campsite/types/option.go:375 pkg/campsite/types/admin.go:611
msgid "Price per night must be a decimal number."
msgstr "El precio por noche tiene que ser un número decimal."
#: pkg/campsite/types/option.go:376 pkg/campsite/types/admin.go:583
#: pkg/campsite/types/option.go:376 pkg/campsite/types/admin.go:612
msgid "Price per night must be zero or greater."
msgstr "El precio por noche tiene que ser como mínimo cero."
@ -2047,115 +2052,127 @@ msgstr "El precio por noche tiene que ser como mínimo cero."
msgid "Selected icon is not valid."
msgstr "El icono escogido no es válido."
#: pkg/campsite/types/admin.go:313
#: pkg/campsite/types/admin.go:328
msgctxt "input"
msgid "Cover image"
msgstr "Imagen de portada"
#: pkg/campsite/types/admin.go:314
#: pkg/campsite/types/admin.go:329
msgctxt "action"
msgid "Set campsite type cover"
msgstr "Establecer la portada del tipo de alojamiento"
#: pkg/campsite/types/admin.go:558
#: pkg/campsite/types/admin.go:580
msgid "Check-in can not be empty."
msgstr "No podéis dejar la entrada en blanco."
#: pkg/campsite/types/admin.go:559
#: pkg/campsite/types/admin.go:581
msgid "Check-out can not be empty."
msgstr "No podéis dejar la salida en blanco."
#: pkg/campsite/types/admin.go:560
#: pkg/campsite/types/admin.go:582
msgid "Cover image can not be empty."
msgstr "No podéis dejar la imagen de portada en blanco."
#: pkg/campsite/types/admin.go:561
#: pkg/campsite/types/admin.go:583
msgid "Cover image must be an image media type."
msgstr "La imagen de portada tiene que ser un medio de tipo imagen."
#: pkg/campsite/types/admin.go:565
#: pkg/campsite/types/admin.go:587
msgid "Maximum number of campers can not be empty."
msgstr "No podéis dejar el número máximo de personas en blanco."
#: pkg/campsite/types/admin.go:566
#: pkg/campsite/types/admin.go:588
msgid "Maximum number of campers must be an integer number."
msgstr "El número máximo de personas tiene que ser entero."
#: pkg/campsite/types/admin.go:567
#: pkg/campsite/types/admin.go:589
msgid "Maximum number of campers must be one or greater."
msgstr "El número máximo de personas no puede ser cero."
#: pkg/campsite/types/admin.go:570
#: pkg/campsite/types/admin.go:592
msgid "Minimum number of nights can not be empty."
msgstr "No podéis dejar el número mínimo de noches en blanco."
#: pkg/campsite/types/admin.go:571
#: pkg/campsite/types/admin.go:593
msgid "Minimum number of nights must be an integer."
msgstr "El número mínimo de noches tiene que ser entero."
#: pkg/campsite/types/admin.go:572
#: pkg/campsite/types/admin.go:594
msgid "Minimum number of nights must be one or greater."
msgstr "El número mínimo de noches no puede ser cero."
#: pkg/campsite/types/admin.go:575
#: pkg/campsite/types/admin.go:597
msgid "Maximum number of nights can not be empty."
msgstr "No podéis dejar el número máximo de noches en blanco."
#: pkg/campsite/types/admin.go:576
#: pkg/campsite/types/admin.go:598
msgid "Maximum number of nights must be an integer."
msgstr "El número máximo de noches tiene que ser entero."
#: pkg/campsite/types/admin.go:577
#: pkg/campsite/types/admin.go:599
msgid "Maximum number of nights must be equal or greater than the minimum."
msgstr "El valor del número máximo de noches tiene que ser igual o mayor al del mínimo."
#: pkg/campsite/types/admin.go:586
#: pkg/campsite/types/admin.go:603
msgid "Dogs price can not be empty when dogs are allowed."
msgstr "El precio de los perros no puede ser vacío cuando son permitidos."
#: pkg/campsite/types/admin.go:604
msgid "Dogs price must be a decimal number."
msgstr "El precio de los perros tiene que ser un número decimal."
#: pkg/campsite/types/admin.go:605
msgid "Dogs price must be zero or greater."
msgstr "El precio de los perros tiene que ser como mínimo cero."
#: pkg/campsite/types/admin.go:615
msgid "Price per adult can not be empty."
msgstr "No podéis dejar el precio por adulto en blanco."
#: pkg/campsite/types/admin.go:587
#: pkg/campsite/types/admin.go:616
msgid "Price per adult must be a decimal number."
msgstr "El precio por adulto tiene que ser un número decimal."
#: pkg/campsite/types/admin.go:588
#: pkg/campsite/types/admin.go:617
msgid "Price per adult must be zero or greater."
msgstr "El precio por adulto tiene que ser como mínimo cero."
#: pkg/campsite/types/admin.go:591
#: pkg/campsite/types/admin.go:620
msgid "Price per teenager can not be empty."
msgstr "No podéis dejar el precio por adolescente en blanco."
#: pkg/campsite/types/admin.go:592
#: pkg/campsite/types/admin.go:621
msgid "Price per teenager must be a decimal number."
msgstr "El precio por adolescente tiene que ser un número decimal."
#: pkg/campsite/types/admin.go:593
#: pkg/campsite/types/admin.go:622
msgid "Price per teenager must be zero or greater."
msgstr "El precio por adolescente tiene que ser como mínimo cero."
#: pkg/campsite/types/admin.go:596
#: pkg/campsite/types/admin.go:625
msgid "Price per child can not be empty."
msgstr "No podéis dejar el precio por niño en blanco."
#: pkg/campsite/types/admin.go:597
#: pkg/campsite/types/admin.go:626
msgid "Price per child must be a decimal number."
msgstr "El precio por niño tiene que ser un número decimal."
#: pkg/campsite/types/admin.go:598
#: pkg/campsite/types/admin.go:627
msgid "Price per child must be zero or greater."
msgstr "El precio por niño tiene que ser como mínimo cero."
#: pkg/campsite/types/public.go:244
#: pkg/campsite/types/public.go:245
msgctxt "header"
msgid "Adults"
msgstr "Adultos"
#: pkg/campsite/types/public.go:250
#: pkg/campsite/types/public.go:251
msgctxt "header"
msgid "Teenagers (aged 11 to 16)"
msgstr "Adolescentes (de 11 a 16 años)"
#: pkg/campsite/types/public.go:256
#: pkg/campsite/types/public.go:257
msgctxt "header"
msgid "Children (aged 2 to 10)"
msgstr "Niños (de 2 a 10 años)"
@ -2317,7 +2334,7 @@ msgstr "No podéis dejar la dirección del enlace en blanco."
msgid "This web address is not valid. It should be like https://domain.com/."
msgstr "Esta dirección web no es válida. Tiene que ser parecido a https://dominio.com/."
#: pkg/company/admin.go:200 pkg/booking/public.go:558
#: pkg/company/admin.go:200 pkg/booking/public.go:559
msgid "Selected country is not valid."
msgstr "El país escogido no es válido."
@ -2337,11 +2354,11 @@ msgstr "No podéis dejar el NIF en blanco."
msgid "This VAT number is not valid."
msgstr "Este NIF no es válido."
#: pkg/company/admin.go:212 pkg/booking/public.go:574
#: pkg/company/admin.go:212 pkg/booking/public.go:575
msgid "Phone can not be empty."
msgstr "No podéis dejar el teléfono en blanco."
#: pkg/company/admin.go:213 pkg/booking/public.go:575
#: pkg/company/admin.go:213 pkg/booking/public.go:576
msgid "This phone number is not valid."
msgstr "Este teléfono no es válido."
@ -2361,7 +2378,7 @@ msgstr "No podéis dejar la provincia en blanco."
msgid "Postal code can not be empty."
msgstr "No podéis dejar el código postal en blanco."
#: pkg/company/admin.go:227 pkg/booking/public.go:567
#: pkg/company/admin.go:227 pkg/booking/public.go:568
msgid "This postal code is not valid."
msgstr "Este código postal no es válido."
@ -2401,27 +2418,32 @@ msgstr "No podéis dejar el archivo del medio en blanco."
msgid "Filename can not be empty."
msgstr "No podéis dejar el nombre del archivo en blanco."
#: pkg/booking/cart.go:142
#: pkg/booking/cart.go:156
msgctxt "cart"
msgid "Night"
msgstr "Noche"
#: pkg/booking/cart.go:143
#: pkg/booking/cart.go:157
msgctxt "cart"
msgid "Adult"
msgstr "Adulto"
#: pkg/booking/cart.go:144
#: pkg/booking/cart.go:158
msgctxt "cart"
msgid "Teenager"
msgstr "Adolescente"
#: pkg/booking/cart.go:145
#: pkg/booking/cart.go:159
msgctxt "cart"
msgid "Child"
msgstr "Niño"
#: pkg/booking/cart.go:164
#: pkg/booking/cart.go:160
msgctxt "cart"
msgid "Dog"
msgstr "Perro"
#: pkg/booking/cart.go:179
msgctxt "cart"
msgid "Tourist tax"
msgstr "Impuesto turístico"
@ -2496,6 +2518,7 @@ msgid "Arrival date can not be empty"
msgstr "No podéis dejar la fecha de llegada en blanco."
#: pkg/booking/public.go:348
#, c-format
msgid "Arrival date must be %s or after."
msgstr "La fecha de llegada tiene que ser igual o posterior a %s."
@ -2518,88 +2541,88 @@ msgstr "La fecha de partida tiene que igual o posterior a %s."
msgid "Departure date must be %s or before."
msgstr "La fecha de partida tiene que ser anterior o igual a %s."
#: pkg/booking/public.go:394
#: pkg/booking/public.go:395
#, c-format
msgid "There can be at most %d guests in this accommodation."
msgstr "Solo puede haber como máximo %d invitados en este alojamiento."
#: pkg/booking/public.go:413
#: pkg/booking/public.go:414
msgid "Number of adults can not be empty"
msgstr "No podéis dejar el número de adultos blanco."
#: pkg/booking/public.go:414
#: pkg/booking/public.go:415
msgid "Number of adults must be an integer."
msgstr "El número de adultos tiene que ser entero."
#: pkg/booking/public.go:415
#: pkg/booking/public.go:416
msgid "There must be at least one adult."
msgstr "Tiene que haber como mínimo un adulto."
#: pkg/booking/public.go:418
#: pkg/booking/public.go:419
msgid "Number of teenagers can not be empty"
msgstr "No podéis dejar el número de adolescentes en blanco."
#: pkg/booking/public.go:419
#: pkg/booking/public.go:420
msgid "Number of teenagers must be an integer."
msgstr "El número de adolescentes tiene que ser entero."
#: pkg/booking/public.go:420
#: pkg/booking/public.go:421
msgid "Number of teenagers can not be negative."
msgstr "El número de adolescentes no puede ser negativo."
#: pkg/booking/public.go:423
#: pkg/booking/public.go:424
msgid "Number of children can not be empty"
msgstr "No podéis dejar el número de niños en blanco."
#: pkg/booking/public.go:424
#: pkg/booking/public.go:425
msgid "Number of children must be an integer."
msgstr "El número de niños tiene que ser entero."
#: pkg/booking/public.go:425
#: pkg/booking/public.go:426
msgid "Number of children can not be negative."
msgstr "El número de niños no puede ser negativo."
#: pkg/booking/public.go:428
#: pkg/booking/public.go:429
msgid "Number of dogs can not be empty"
msgstr "No podéis dejar el número de perros en blanco."
#: pkg/booking/public.go:429
#: pkg/booking/public.go:430
msgid "Number of dogs must be an integer."
msgstr "El número de perros tiene que ser entero."
#: pkg/booking/public.go:430
#: pkg/booking/public.go:431
msgid "Number of dogs can not be negative."
msgstr "El número de perros no puede ser negativo."
#: pkg/booking/public.go:501
#: pkg/booking/public.go:502
#, c-format
msgid "%s can not be empty"
msgstr "No podéis dejar %s en blanco."
#: pkg/booking/public.go:502
#: pkg/booking/public.go:503
#, c-format
msgid "%s must be an integer."
msgstr "%s tiene que ser un número entero."
#: pkg/booking/public.go:503
#: pkg/booking/public.go:504
#, c-format
msgid "%s must be %d or greater."
msgstr "%s tiene que ser como mínimo %d."
#: pkg/booking/public.go:504
#: pkg/booking/public.go:505
#, c-format
msgid "%s must be at most %d."
msgstr "%s tiene que ser como máximo %d"
#: pkg/booking/public.go:562
#: pkg/booking/public.go:563
msgid "Full name can not be empty."
msgstr "No podéis dejar el nombre y los apellidos en blanco."
#: pkg/booking/public.go:563
#: pkg/booking/public.go:564
msgid "Full name must have at least one letter."
msgstr "El nombre y los apellidos tienen que tener como mínimo una letra."
#: pkg/booking/public.go:580
#: pkg/booking/public.go:581
msgid "It is mandatory to agree to the reservation conditions."
msgstr "Es obligatorio aceptar las condiciones de reserva."

188
po/fr.po
View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: camper\n"
"Report-Msgid-Bugs-To: jordi@tandem.blog\n"
"POT-Creation-Date: 2024-02-10 03:31+0100\n"
"POT-Creation-Date: 2024-02-10 06:05+0100\n"
"PO-Revision-Date: 2024-02-06 10:05+0100\n"
"Last-Translator: Oriol Carbonell <info@oriolcarbonell.cat>\n"
"Language-Team: French <traduc@traduc.org>\n"
@ -167,7 +167,7 @@ msgid "Calendar"
msgstr "Calendrier"
#: web/templates/public/campsite/type.gohtml:68
#: web/templates/admin/campsite/type/form.gohtml:143
#: web/templates/admin/campsite/type/form.gohtml:153
#: web/templates/admin/campsite/type/option/form.gohtml:70
msgctxt "title"
msgid "Prices"
@ -574,7 +574,7 @@ msgstr "Chiens"
#: web/templates/public/booking/fields.gohtml:100
msgid "Note: This accommodation does <strong>not</strong> allow dogs."
msgstr "Remarque: Dans cet hébergement les chiens <strong>ne</strong> sont pas autorisés."
msgstr "Remarque: Dans cet hébergement les chiens <strong>ne</strong> sont pas acceptés."
#: web/templates/public/booking/fields.gohtml:110
msgctxt "input"
@ -700,7 +700,7 @@ msgstr "Contenu"
#: web/templates/admin/campsite/form.gohtml:92
#: web/templates/admin/campsite/type/feature/form.gohtml:74
#: web/templates/admin/campsite/type/carousel/form.gohtml:59
#: web/templates/admin/campsite/type/form.gohtml:277
#: web/templates/admin/campsite/type/form.gohtml:287
#: web/templates/admin/campsite/type/option/form.gohtml:90
#: web/templates/admin/season/form.gohtml:73
#: web/templates/admin/services/form.gohtml:81
@ -722,7 +722,7 @@ msgstr "Mettre à jour"
#: web/templates/admin/campsite/form.gohtml:94
#: web/templates/admin/campsite/type/feature/form.gohtml:76
#: web/templates/admin/campsite/type/carousel/form.gohtml:61
#: web/templates/admin/campsite/type/form.gohtml:279
#: web/templates/admin/campsite/type/form.gohtml:289
#: web/templates/admin/campsite/type/option/form.gohtml:92
#: web/templates/admin/season/form.gohtml:75
#: web/templates/admin/services/form.gohtml:83
@ -1160,80 +1160,85 @@ msgctxt "input"
msgid "Ask for zone preferences when booking"
msgstr "Demandez la préférence de zone lors de la réservation"
#: web/templates/admin/campsite/type/form.gohtml:137
#: web/templates/admin/campsite/type/form.gohtml:139
msgctxt "input"
msgid "Dogs allowed"
msgstr "Chiens acceptés"
#: web/templates/admin/campsite/type/form.gohtml:147
#: web/templates/admin/campsite/type/form.gohtml:144
msgctxt "input"
msgid "Dogs price"
msgstr "Prix des chiens"
#: web/templates/admin/campsite/type/form.gohtml:157
msgctxt "header"
msgid "Season"
msgstr "Saison"
#: web/templates/admin/campsite/type/form.gohtml:148
#: web/templates/admin/campsite/type/form.gohtml:158
msgctxt "header"
msgid "Price per night"
msgstr "Prix par nuit"
#: web/templates/admin/campsite/type/form.gohtml:149
#: web/templates/admin/campsite/type/form.gohtml:159
msgctxt "header"
msgid "Price per adult (> 16)"
msgstr "Prix per adulte (> 16)"
#: web/templates/admin/campsite/type/form.gohtml:150
#: web/templates/admin/campsite/type/form.gohtml:160
msgctxt "header"
msgid "Price per teenager (1116)"
msgstr "Prix per adolescent (1116)"
#: web/templates/admin/campsite/type/form.gohtml:151
#: web/templates/admin/campsite/type/form.gohtml:161
msgctxt "header"
msgid "Price per child (210)"
msgstr "Prix per enfant (210)"
#: web/templates/admin/campsite/type/form.gohtml:161
#: web/templates/admin/campsite/type/form.gohtml:171
#: web/templates/admin/campsite/type/option/form.gohtml:76
msgctxt "input"
msgid "Price per night"
msgstr "Prix par nuit"
#: web/templates/admin/campsite/type/form.gohtml:172
#: web/templates/admin/campsite/type/form.gohtml:182
msgctxt "input"
msgid "Price per adult (> 16)"
msgstr "Prix per adulte (> 16)"
#: web/templates/admin/campsite/type/form.gohtml:183
#: web/templates/admin/campsite/type/form.gohtml:193
msgctxt "input"
msgid "Price per teenager (1116)"
msgstr "Prix per adolescent (1116)"
#: web/templates/admin/campsite/type/form.gohtml:194
#: web/templates/admin/campsite/type/form.gohtml:204
msgctxt "input"
msgid "Price per child (210)"
msgstr "Prix per enfant (210)"
#: web/templates/admin/campsite/type/form.gohtml:210
#: web/templates/admin/campsite/type/form.gohtml:220
msgctxt "input"
msgid "Spiel"
msgstr "Boniment"
#: web/templates/admin/campsite/type/form.gohtml:223
#: web/templates/admin/campsite/type/form.gohtml:233
msgctxt "input"
msgid "Info"
msgstr "Info"
#: web/templates/admin/campsite/type/form.gohtml:236
#: web/templates/admin/campsite/type/form.gohtml:246
msgctxt "input"
msgid "Facilities"
msgstr "Installations"
#: web/templates/admin/campsite/type/form.gohtml:249
#: web/templates/admin/campsite/type/form.gohtml:259
#: web/templates/admin/services/form.gohtml:66
#: web/templates/admin/surroundings/form.gohtml:54
msgctxt "input"
msgid "Description"
msgstr "Description"
#: web/templates/admin/campsite/type/form.gohtml:262
#: web/templates/admin/campsite/type/form.gohtml:272
msgctxt "input"
msgid "Additional Information"
msgstr "Informations Complémentaires"
@ -1930,7 +1935,7 @@ msgid "No booking found."
msgstr "Aucune réservation trouvée."
#: pkg/legal/admin.go:258 pkg/app/user.go:249 pkg/campsite/types/option.go:357
#: pkg/campsite/types/feature.go:272 pkg/campsite/types/admin.go:555
#: pkg/campsite/types/feature.go:272 pkg/campsite/types/admin.go:577
#: pkg/campsite/feature.go:269 pkg/season/admin.go:412
#: pkg/services/admin.go:316 pkg/surroundings/admin.go:340
#: pkg/amenity/feature.go:269 pkg/amenity/admin.go:283
@ -1938,7 +1943,7 @@ msgid "Name can not be empty."
msgstr "Le nom ne peut pas être laissé vide."
#: pkg/legal/admin.go:259 pkg/campsite/types/option.go:358
#: pkg/campsite/types/feature.go:273 pkg/campsite/types/admin.go:556
#: pkg/campsite/types/feature.go:273 pkg/campsite/types/admin.go:578
#: pkg/campsite/feature.go:270 pkg/amenity/feature.go:270
msgid "Name must have at least one letter."
msgstr "Le nom doit comporter au moins une lettre."
@ -1968,12 +1973,12 @@ msgid "Slide image must be an image media type."
msgstr "Limage de la diapositive doit être de type média dimage."
#: pkg/app/login.go:56 pkg/app/user.go:246 pkg/company/admin.go:217
#: pkg/booking/public.go:571
#: pkg/booking/public.go:572
msgid "Email can not be empty."
msgstr "Le-mail ne peut pas être vide."
#: pkg/app/login.go:57 pkg/app/user.go:247 pkg/company/admin.go:218
#: pkg/booking/public.go:572
#: pkg/booking/public.go:573
msgid "This email is not valid. It should be like name@domain.com."
msgstr "Cette adresse e-mail nest pas valide. Il devrait en être name@domain.com."
@ -2030,15 +2035,15 @@ msgstr "Le maximum doit être un nombre entier."
msgid "Maximum must be equal or greater than minimum."
msgstr "Le maximum doit être égal ou supérieur au minimum."
#: pkg/campsite/types/option.go:374 pkg/campsite/types/admin.go:581
#: pkg/campsite/types/option.go:374 pkg/campsite/types/admin.go:610
msgid "Price per night can not be empty."
msgstr "Le prix par nuit ne peut pas être vide."
#: pkg/campsite/types/option.go:375 pkg/campsite/types/admin.go:582
#: pkg/campsite/types/option.go:375 pkg/campsite/types/admin.go:611
msgid "Price per night must be a decimal number."
msgstr "Le prix par nuit doit être un nombre décimal."
#: pkg/campsite/types/option.go:376 pkg/campsite/types/admin.go:583
#: pkg/campsite/types/option.go:376 pkg/campsite/types/admin.go:612
msgid "Price per night must be zero or greater."
msgstr "Le prix par nuit doit être égal ou supérieur."
@ -2047,115 +2052,127 @@ msgstr "Le prix par nuit doit être égal ou supérieur."
msgid "Selected icon is not valid."
msgstr "Licône sélectionnée nest pas valide."
#: pkg/campsite/types/admin.go:313
#: pkg/campsite/types/admin.go:328
msgctxt "input"
msgid "Cover image"
msgstr "Image de couverture"
#: pkg/campsite/types/admin.go:314
#: pkg/campsite/types/admin.go:329
msgctxt "action"
msgid "Set campsite type cover"
msgstr "Définir une couverture type camping"
#: pkg/campsite/types/admin.go:558
#: pkg/campsite/types/admin.go:580
msgid "Check-in can not be empty."
msgstr "Larrivée ne peut pas être vide."
#: pkg/campsite/types/admin.go:559
#: pkg/campsite/types/admin.go:581
msgid "Check-out can not be empty."
msgstr "Le départ ne peut pas être vide."
#: pkg/campsite/types/admin.go:560
#: pkg/campsite/types/admin.go:582
msgid "Cover image can not be empty."
msgstr "Limage de couverture ne peut pas être vide."
#: pkg/campsite/types/admin.go:561
#: pkg/campsite/types/admin.go:583
msgid "Cover image must be an image media type."
msgstr "Limage de couverture doit être de type média dimage."
#: pkg/campsite/types/admin.go:565
#: pkg/campsite/types/admin.go:587
msgid "Maximum number of campers can not be empty."
msgstr "Le nombre maximum de campeurs ne peut pas être vide."
#: pkg/campsite/types/admin.go:566
#: pkg/campsite/types/admin.go:588
msgid "Maximum number of campers must be an integer number."
msgstr "Le nombre maximum de campeurs doit être un nombre entier."
#: pkg/campsite/types/admin.go:567
#: pkg/campsite/types/admin.go:589
msgid "Maximum number of campers must be one or greater."
msgstr "Le nombre maximum de campeurs doit être égal ou supérieur à un campeur."
#: pkg/campsite/types/admin.go:570
#: pkg/campsite/types/admin.go:592
msgid "Minimum number of nights can not be empty."
msgstr "Le nombre minimum de nuits ne peut pas être vide."
#: pkg/campsite/types/admin.go:571
#: pkg/campsite/types/admin.go:593
msgid "Minimum number of nights must be an integer."
msgstr "Le nombre minimum de nuits doit être un entier."
#: pkg/campsite/types/admin.go:572
#: pkg/campsite/types/admin.go:594
msgid "Minimum number of nights must be one or greater."
msgstr "Le nombre minimum de nuits doit être supérieur ou égal à une nuit."
#: pkg/campsite/types/admin.go:575
#: pkg/campsite/types/admin.go:597
msgid "Maximum number of nights can not be empty."
msgstr "Le nombre maximale de nuits ne peut pas être vide."
#: pkg/campsite/types/admin.go:576
#: pkg/campsite/types/admin.go:598
msgid "Maximum number of nights must be an integer."
msgstr "Le nombre maximale de nuits doit être un entier."
#: pkg/campsite/types/admin.go:577
#: pkg/campsite/types/admin.go:599
msgid "Maximum number of nights must be equal or greater than the minimum."
msgstr "Le nombre maximale de nuits doit être égal ou supérieur au minimum."
#: pkg/campsite/types/admin.go:586
#: pkg/campsite/types/admin.go:603
msgid "Dogs price can not be empty when dogs are allowed."
msgstr "Le prix des chiens net peut pas être vide lorsquils sont acceptés."
#: pkg/campsite/types/admin.go:604
msgid "Dogs price must be a decimal number."
msgstr "Le prix des chiens doit être un nombre décimal."
#: pkg/campsite/types/admin.go:605
msgid "Dogs price must be zero or greater."
msgstr "Le prix de chiens doit être égal ou supérieur à zéro."
#: pkg/campsite/types/admin.go:615
msgid "Price per adult can not be empty."
msgstr "Le prix par adulte ne peut pas être vide."
#: pkg/campsite/types/admin.go:587
#: pkg/campsite/types/admin.go:616
msgid "Price per adult must be a decimal number."
msgstr "Le prix par adulte doit être un nombre décimal."
#: pkg/campsite/types/admin.go:588
#: pkg/campsite/types/admin.go:617
msgid "Price per adult must be zero or greater."
msgstr "Le prix par adulte doit être égal ou supérieur."
#: pkg/campsite/types/admin.go:591
#: pkg/campsite/types/admin.go:620
msgid "Price per teenager can not be empty."
msgstr "Le prix par adolescent ne peut pas être vide."
#: pkg/campsite/types/admin.go:592
#: pkg/campsite/types/admin.go:621
msgid "Price per teenager must be a decimal number."
msgstr "Le prix par adolescent doit être un nombre décimal."
#: pkg/campsite/types/admin.go:593
#: pkg/campsite/types/admin.go:622
msgid "Price per teenager must be zero or greater."
msgstr "Le prix par adolescent doit être égal ou supérieur."
#: pkg/campsite/types/admin.go:596
#: pkg/campsite/types/admin.go:625
msgid "Price per child can not be empty."
msgstr "Le prix par enfant ne peut pas être vide."
#: pkg/campsite/types/admin.go:597
#: pkg/campsite/types/admin.go:626
msgid "Price per child must be a decimal number."
msgstr "Le prix par enfant doit être un nombre décimal."
#: pkg/campsite/types/admin.go:598
#: pkg/campsite/types/admin.go:627
msgid "Price per child must be zero or greater."
msgstr "Le prix par enfant doit être égal ou supérieur."
#: pkg/campsite/types/public.go:244
#: pkg/campsite/types/public.go:245
msgctxt "header"
msgid "Adults"
msgstr "Adultes"
#: pkg/campsite/types/public.go:250
#: pkg/campsite/types/public.go:251
msgctxt "header"
msgid "Teenagers (aged 11 to 16)"
msgstr "Adolescents (de 11 à 16 anys)"
#: pkg/campsite/types/public.go:256
#: pkg/campsite/types/public.go:257
msgctxt "header"
msgid "Children (aged 2 to 10)"
msgstr "Enfants (de 2 à 10 anys)"
@ -2317,7 +2334,7 @@ msgstr "Laddresse du lien ne peut pas être vide."
msgid "This web address is not valid. It should be like https://domain.com/."
msgstr "Cette adresse web nest pas valide. Il devrait en être https://domain.com/."
#: pkg/company/admin.go:200 pkg/booking/public.go:558
#: pkg/company/admin.go:200 pkg/booking/public.go:559
msgid "Selected country is not valid."
msgstr "Le pays sélectionné nest pas valide."
@ -2337,11 +2354,11 @@ msgstr "Le numéro de TVA ne peut pas être vide."
msgid "This VAT number is not valid."
msgstr "Ce numéro de TVA nest pas valide."
#: pkg/company/admin.go:212 pkg/booking/public.go:574
#: pkg/company/admin.go:212 pkg/booking/public.go:575
msgid "Phone can not be empty."
msgstr "Le téléphone ne peut pas être vide."
#: pkg/company/admin.go:213 pkg/booking/public.go:575
#: pkg/company/admin.go:213 pkg/booking/public.go:576
msgid "This phone number is not valid."
msgstr "Ce numéro de téléphone nest pas valide."
@ -2361,7 +2378,7 @@ msgstr "La province ne peut pas être vide."
msgid "Postal code can not be empty."
msgstr "Le code postal ne peut pas être vide."
#: pkg/company/admin.go:227 pkg/booking/public.go:567
#: pkg/company/admin.go:227 pkg/booking/public.go:568
msgid "This postal code is not valid."
msgstr "Ce code postal nest pas valide."
@ -2401,27 +2418,32 @@ msgstr "Le fichier téléchargé ne peut pas être vide."
msgid "Filename can not be empty."
msgstr "Le nom de fichier ne peut pas être vide."
#: pkg/booking/cart.go:142
#: pkg/booking/cart.go:156
msgctxt "cart"
msgid "Night"
msgstr "Nuit"
#: pkg/booking/cart.go:143
#: pkg/booking/cart.go:157
msgctxt "cart"
msgid "Adult"
msgstr "Adulte"
#: pkg/booking/cart.go:144
#: pkg/booking/cart.go:158
msgctxt "cart"
msgid "Teenager"
msgstr "Adolescent"
#: pkg/booking/cart.go:145
#: pkg/booking/cart.go:159
msgctxt "cart"
msgid "Child"
msgstr "Enfant"
#: pkg/booking/cart.go:164
#: pkg/booking/cart.go:160
msgctxt "cart"
msgid "Dog"
msgstr "Chien"
#: pkg/booking/cart.go:179
msgctxt "cart"
msgid "Tourist tax"
msgstr "Taxe touristique"
@ -2519,88 +2541,88 @@ msgstr "La date de départ doit être égale ou postérieure à %s."
msgid "Departure date must be %s or before."
msgstr "La date de départ doit être antérieure ou égale à %s."
#: pkg/booking/public.go:394
#: pkg/booking/public.go:395
#, c-format
msgid "There can be at most %d guests in this accommodation."
msgstr "Il peut y avoir au plus %d invités dans cet hébergement."
#: pkg/booking/public.go:413
#: pkg/booking/public.go:414
msgid "Number of adults can not be empty"
msgstr "Le nombre dadultes ne peut pas être vide."
#: pkg/booking/public.go:414
#: pkg/booking/public.go:415
msgid "Number of adults must be an integer."
msgstr "Le nombre dadultes doit être un entier."
#: pkg/booking/public.go:415
#: pkg/booking/public.go:416
msgid "There must be at least one adult."
msgstr "Il doit y avoir au moins un adulte."
#: pkg/booking/public.go:418
#: pkg/booking/public.go:419
msgid "Number of teenagers can not be empty"
msgstr "Le nombre dadolescents ne peut pas être vide."
#: pkg/booking/public.go:419
#: pkg/booking/public.go:420
msgid "Number of teenagers must be an integer."
msgstr "Le nombre dadolescents doit être un entier."
#: pkg/booking/public.go:420
#: pkg/booking/public.go:421
msgid "Number of teenagers can not be negative."
msgstr "Le nombre dadolescents ne peut pas être négatif."
#: pkg/booking/public.go:423
#: pkg/booking/public.go:424
msgid "Number of children can not be empty"
msgstr "Le nombre denfants ne peut pas être vide."
#: pkg/booking/public.go:424
#: pkg/booking/public.go:425
msgid "Number of children must be an integer."
msgstr "Le nombre denfants doit être un entier."
#: pkg/booking/public.go:425
#: pkg/booking/public.go:426
msgid "Number of children can not be negative."
msgstr "Le nombre denfants ne peut pas être négatif."
#: pkg/booking/public.go:428
#: pkg/booking/public.go:429
msgid "Number of dogs can not be empty"
msgstr "Le nombre de chiens ne peut pas être vide."
#: pkg/booking/public.go:429
#: pkg/booking/public.go:430
msgid "Number of dogs must be an integer."
msgstr "Le nombre de chiens nuits être un entier."
#: pkg/booking/public.go:430
#: pkg/booking/public.go:431
msgid "Number of dogs can not be negative."
msgstr "Le nombre de chiens ne peut pas être négatif."
#: pkg/booking/public.go:501
#: pkg/booking/public.go:502
#, c-format
msgid "%s can not be empty"
msgstr "%s ne peut pas être vide"
#: pkg/booking/public.go:502
#: pkg/booking/public.go:503
#, c-format
msgid "%s must be an integer."
msgstr "%s doit être un entier."
#: pkg/booking/public.go:503
#: pkg/booking/public.go:504
#, c-format
msgid "%s must be %d or greater."
msgstr "%s doit être %d ou plus."
#: pkg/booking/public.go:504
#: pkg/booking/public.go:505
#, c-format
msgid "%s must be at most %d."
msgstr "%s doit être tout au plus %d."
#: pkg/booking/public.go:562
#: pkg/booking/public.go:563
msgid "Full name can not be empty."
msgstr "Le nom complet ne peut pas être vide."
#: pkg/booking/public.go:563
#: pkg/booking/public.go:564
msgid "Full name must have at least one letter."
msgstr "Le nom complet doit comporter au moins une lettre."
#: pkg/booking/public.go:580
#: pkg/booking/public.go:581
msgid "It is mandatory to agree to the reservation conditions."
msgstr "Il est obligatoire daccepter les conditions de réservation."

View File

@ -11,7 +11,7 @@ begin;
set search_path to camper, public;
drop function if exists add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean, boolean);
drop function if exists add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean);
create or replace function add_campsite_type(company integer, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, dogs_allowed boolean, overflow_allowed boolean, ask_zone_preferences boolean) returns uuid as
$$

View File

@ -0,0 +1,23 @@
-- Revert camper:campsite_type__-dogs_allowed from pg
begin;
set search_path to camper, public;
alter table campsite_type
add column if not exists dogs_allowed boolean not null default false
;
update campsite_type
set dogs_allowed = true
where campsite_type_id in (
select campsite_type_id
from campsite_type_pet_cost
);
alter table campsite_type
alter column dogs_allowed drop default
;
commit;

View File

@ -0,0 +1,7 @@
-- Revert camper:campsite_type_pet_cost from pg
begin;
drop table if exists camper.campsite_type_pet_cost;
commit;

View File

@ -11,7 +11,7 @@ begin;
set search_path to camper, public;
drop function if exists edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean, boolean, boolean);
drop function if exists edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean, boolean);
create or replace function edit_campsite_type(slug uuid, media_id integer, name text, spiel text, info text, facilities text, description text, additional_info text, check_in text, check_out text, max_campers integer, dogs_allowed boolean, overflow_allowed boolean, ask_zone_preferences boolean, active boolean) returns uuid as
$$

View File

@ -0,0 +1,7 @@
-- Revert camper:set_campsite_type_pet_cost from pg
begin;
drop function if exists camper.set_campsite_type_pet_cost(uuid, text);
commit;

View File

@ -0,0 +1,7 @@
-- Revert camper:unset_campsite_type_pet_cost from pg
begin;
drop function if exists camper.unset_campsite_type_pet_cost(uuid);
commit;

View File

@ -225,8 +225,12 @@ edit_campsite_type [edit_campsite_type@v2 campsite_type__overflow_allowed campsi
@v3 2024-01-31T20:40:16Z jordi fita mas <jordi@tandem.blog> # Tag v3
campsite_type__bookable_nights [campsite_type campsite_type_cost] 2024-01-31T19:45:46Z jordi fita mas <jordi@tandem.blog> # Add bookable_nights to campsite_type
add_campsite_type [add_campsite_type@v3 campsite_type__bookable_nights] 2024-01-31T20:46:47Z jordi fita mas <jordi@tandem.blog> # Add bookable_nights param to add_campsite_type
edit_campsite_type [edit_campsite_type@v3 campsite_type__bookable_nights] 2024-01-31T20:51:40Z jordi fita mas <jordi@tandem.blog> # Add bookable_nights param to edit_campsite_type
campsite_type_cost__per_age [campsite_type_cost] 2024-02-03T20:48:54Z jordi fita mas <jordi@tandem.blog> # Add cost_per_adult, cost_per_teenager, and cost_per_child fields to campsite_type_cost
set_campsite_type_cost [set_campsite_type_cost@v3 campsite_type__bookable_nights campsite_type_cost__per_age] 2024-01-31T21:02:06Z jordi fita mas <jordi@tandem.blog> # Remove min_nights parameter from set_campsite_type_cost, and add per_adult, per_teenager, and per_child parameters
campsite_type_cost__-min_nights [campsite_type__bookable_nights set_campsite_type_cost] 2024-01-31T21:46:33Z jordi fita mas <jordi@tandem.blog> # Remove min_nights field from campsite_type_cost relation
campsite_type_pet_cost [roles schema_camper campsite_type user_profile] 2024-02-10T03:24:04Z jordi fita mas <jordi@tandem.blog> # Add relation of pet cost of campsite type
set_campsite_type_pet_cost [roles schema_camper campsite_type campsite_type_pet_cost parse_price] 2024-02-10T03:49:54Z jordi fita mas <jordi@tandem.blog> # Add function to set pet cost of campsite type
unset_campsite_type_pet_cost [roles schema_camper campsite_type campsite_type_pet_cost] 2024-02-10T04:00:11Z jordi fita mas <jordi@tandem.blog> # Add function to remove pet cost from campsite type
add_campsite_type [add_campsite_type@v3 campsite_type__bookable_nights] 2024-01-31T20:46:47Z jordi fita mas <jordi@tandem.blog> # Add bookable_nights param to, and remove dogs_allowed param from add_campsite_type
edit_campsite_type [edit_campsite_type@v3 campsite_type__bookable_nights] 2024-01-31T20:51:40Z jordi fita mas <jordi@tandem.blog> # Add bookable_nights param to, and remove dogs_allowed param from edit_campsite_type
campsite_type__-dogs_allowed [campsite_type campsite_type_pet_cost set_campsite_type_pet_cost] 2024-02-10T04:15:00Z jordi fita mas <jordi@tandem.blog> # Remove dogs_allowed field from campsite_type

View File

@ -43,10 +43,10 @@ values (3, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (4, 2, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, dogs_allowed, max_campers, bookable_nights)
values (11, 1, 3, 'A', false, 5, '[1, 7]')
, (12, 1, 3, 'B', false, 5, '[2, 6]')
, (21, 2, 4, 'C', false, 5, '[3, 5]')
insert into campsite_type (campsite_type_id, company_id, media_id, name, max_campers, bookable_nights)
values (11, 1, 3, 'A', 5, '[1, 7]')
, (12, 1, 3, 'B', 5, '[2, 6]')
, (21, 2, 4, 'C', 5, '[3, 5]')
;
select lives_ok(

View File

@ -51,9 +51,9 @@ values (3, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (7, 1, 'image.svg', sha256('<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, max_campers, bookable_nights, dogs_allowed, active)
values (10, 1, 3, 'Type A', '<p>A</p>', 5, '[1, 7]', false, true)
, (11, 2, 4, 'Type A', '<p>A</p>', 5, '[2, 5]', false, true)
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, max_campers, bookable_nights, active)
values (10, 1, 3, 'Type A', '<p>A</p>', 5, '[1, 7]', true)
, (11, 2, 4, 'Type A', '<p>A</p>', 5, '[2, 5]', true)
;
insert into campsite (campsite_id, company_id, label, campsite_type_id)

View File

@ -43,9 +43,9 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (3, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, active, dogs_allowed, max_campers, bookable_nights)
values (4, 1, 3, 'Type A', '<p>A</p>', true, false, 4, '[1, 7]')
, (5, 1, 3, 'Type B', '<p>B</p>', true, false, 5, '[2, 5]')
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, active, max_campers, bookable_nights)
values (4, 1, 3, 'Type A', '<p>A</p>', true, 4, '[1, 7]')
, (5, 1, 3, 'Type B', '<p>B</p>', true, 5, '[2, 5]')
;
insert into campsite (campsite_id, company_id, label, campsite_type_id)

View File

@ -9,15 +9,15 @@ set search_path to camper, public;
select plan(13);
select has_function('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean']);
select function_lang_is('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'sql');
select function_returns('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'uuid');
select isnt_definer('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean']);
select volatility_is('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'volatile');
select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'guest', array[]::text[]);
select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'employee', array[]::text[]);
select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'admin', array['EXECUTE']);
select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'authenticator', array[]::text[]);
select has_function('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean']);
select function_lang_is('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean'], 'sql');
select function_returns('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean'], 'uuid');
select isnt_definer('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean']);
select volatility_is('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean'], 'volatile');
select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean'], 'guest', array[]::text[]);
select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean'], 'employee', array[]::text[]);
select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean'], 'admin', array['EXECUTE']);
select function_privs_are('camper', 'add_campsite_type', array ['integer', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean'], 'authenticator', array[]::text[]);
set client_min_messages to warning;
@ -44,19 +44,19 @@ values (3, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
;
select lives_ok(
$$ select add_campsite_type(1, 3, 'Type A', '', '<p>Features</p>', '', '<!-- block --><h2>This is what, exactly?</h2><!-- /block --><p>Dunno</p>', '', 'After 4 p.m.', '12 a.m.', 5, '[1, 7]', true, false, true) $$,
$$ select add_campsite_type(1, 3, 'Type A', '', '<p>Features</p>', '', '<!-- block --><h2>This is what, exactly?</h2><!-- /block --><p>Dunno</p>', '', 'After 4 p.m.', '12 a.m.', 5, '[1, 7]', false, true) $$,
'Should be able to add a campsite type to the first company'
);
select lives_ok(
$$ select add_campsite_type(2, 4, 'Type B', '<p>One</p><p>Two</p>', '', '<p>Pricing</p>', '', '<p>More</p>', 'After 9 p.m.', '9 a.m.', 2, '(1, 7)', false, true, false) $$,
$$ select add_campsite_type(2, 4, 'Type B', '<p>One</p><p>Two</p>', '', '<p>Pricing</p>', '', '<p>More</p>', 'After 9 p.m.', '9 a.m.', 2, '(1, 7)', true, false) $$,
'Should be able to add a campsite type to the second company'
);
select bag_eq(
$$ select company_id, media_id, name, spiel::text, info::text, facilities::text, description::text, additional_info::text, check_in, check_out, active, max_campers, bookable_nights, dogs_allowed, overflow_allowed, ask_zone_preferences from campsite_type $$,
$$ values (1, 3, 'Type A', '', '<p>Features</p>', '', '<!-- block --><h2>This is what, exactly?</h2><!-- /block --><p>Dunno</p>', '', 'After 4 p.m.', '12 a.m.', true, 5, int4range(1, 8), true, false, true)
, (2, 4, 'Type B', '<p>One</p><p>Two</p>', '', '<p>Pricing</p>', '', '<p>More</p>', 'After 9 p.m.', '9 a.m.', true, 2, int4range(2, 7), false, true, false)
$$ select company_id, media_id, name, spiel::text, info::text, facilities::text, description::text, additional_info::text, check_in, check_out, active, max_campers, bookable_nights, overflow_allowed, ask_zone_preferences from campsite_type $$,
$$ values (1, 3, 'Type A', '', '<p>Features</p>', '', '<!-- block --><h2>This is what, exactly?</h2><!-- /block --><p>Dunno</p>', '', 'After 4 p.m.', '12 a.m.', true, 5, int4range(1, 8), false, true)
, (2, 4, 'Type B', '<p>One</p><p>Two</p>', '', '<p>Pricing</p>', '', '<p>More</p>', 'After 9 p.m.', '9 a.m.', true, 2, int4range(2, 7), true, false)
$$,
'Should have added all two campsite type'
);

View File

@ -50,9 +50,9 @@ values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (6, 1, 'image.svg', sha256('<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, dogs_allowed, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', false, true)
, (11, 1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<p>B</p>', 4, '[2, 6]', true, false)
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', true)
, (11, 1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<p>B</p>', 4, '[2, 6]', false)
;
insert into campsite_type_carousel (campsite_type_id, media_id, caption)

View File

@ -42,9 +42,9 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, active, dogs_allowed, max_campers, bookable_nights)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', true, false, 4, '[1, 7]')
, (4, 1, '9ae5cf87-cd69-4541-b5a5-75f937cc9e58', 2, 'Type B', '<p>B</p>', true, false, 5, '[2, 6]')
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, active, max_campers, bookable_nights)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', true, 4, '[1, 7]')
, (4, 1, '9ae5cf87-cd69-4541-b5a5-75f937cc9e58', 2, 'Type B', '<p>B</p>', true, 5, '[2, 6]')
;
select lives_ok(

View File

@ -42,9 +42,9 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, active, dogs_allowed, max_campers, bookable_nights)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', true, false, 4, '[1, 7]')
, (4, 1, '9ae5cf87-cd69-4541-b5a5-75f937cc9e58', 2, 'Type B', '<p>B</p>', true, false, 5, '[1, 6]')
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, active, max_campers, bookable_nights)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', true, 4, '[1, 7]')
, (4, 1, '9ae5cf87-cd69-4541-b5a5-75f937cc9e58', 2, 'Type B', '<p>B</p>', true, 5, '[1, 6]')
;
select lives_ok(

View File

@ -125,9 +125,9 @@ values (6, 2, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (8, 4, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, name, media_id, dogs_allowed, max_campers, bookable_nights)
values (10, 2, 'Wooden lodge', 6, false, 7, '[1, 7]')
, (12, 4, 'Bungalow', 8, false, 6, '[2, 6]')
insert into campsite_type (campsite_type_id, company_id, name, media_id, max_campers, bookable_nights)
values (10, 2, 'Wooden lodge', 6, 7, '[1, 7]')
, (12, 4, 'Bungalow', 8, 6, '[2, 6]')
;
insert into booking (company_id, campsite_type_id, holder_name, arrival_date, departure_date, number_dogs, acsi_card)

View File

@ -102,9 +102,9 @@ values (6, 2, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (8, 4, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, dogs_allowed, max_campers, bookable_nights)
values (22, 2, 6, 'Wooden lodge', true, 5, '[1, 7]')
, (44, 4, 8, 'Bungalow', false, 4, '[2, 6]')
insert into campsite_type (campsite_type_id, company_id, media_id, name, max_campers, bookable_nights)
values (22, 2, 6, 'Wooden lodge', 5, '[1, 7]')
, (44, 4, 8, 'Bungalow', 4, '[2, 6]')
;
insert into campsite (company_id, campsite_type_id, label)

View File

@ -93,9 +93,9 @@ values ( 6, 2, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","
, (11, 4, 'text5.txt', sha256('content5'))
;
insert into campsite_type (campsite_type_id, company_id, name, media_id, dogs_allowed, max_campers, bookable_nights)
values (21, 2, 'Wooden lodge', 6, false, 7, '[1, 7]')
, (22, 4, 'Bungalow', 9, false, 6, '[2, 6]')
insert into campsite_type (campsite_type_id, company_id, name, media_id, max_campers, bookable_nights)
values (21, 2, 'Wooden lodge', 6, 7, '[1, 7]')
, (22, 4, 'Bungalow', 9, 6, '[2, 6]')
;
insert into campsite (campsite_id, company_id, label, campsite_type_id)

View File

@ -89,9 +89,9 @@ values (6, 2, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (8, 4, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, name, media_id, dogs_allowed, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, false, 7, '[1, 7]')
, (18, 4, 'Bungalow', 8, false, 6, '[2, 6]')
insert into campsite_type (campsite_type_id, company_id, name, media_id, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, 7, '[1, 7]')
, (18, 4, 'Bungalow', 8, 6, '[2, 6]')
;
insert into campsite (campsite_id, company_id, label, campsite_type_id)

View File

@ -5,7 +5,7 @@ reset client_min_messages;
begin;
select plan(112);
select plan(108);
set search_path to camper, public;
@ -83,11 +83,6 @@ select col_type_is('campsite_type', 'max_campers', 'integer');
select col_not_null('campsite_type', 'max_campers');
select col_hasnt_default('campsite_type', 'max_campers');
select has_column('campsite_type', 'dogs_allowed');
select col_type_is('campsite_type', 'dogs_allowed', 'boolean');
select col_not_null('campsite_type', 'dogs_allowed');
select col_hasnt_default('campsite_type', 'dogs_allowed');
select has_column('campsite_type', 'overflow_allowed');
select col_type_is('campsite_type', 'overflow_allowed', 'boolean');
select col_not_null('campsite_type', 'overflow_allowed');
@ -169,9 +164,9 @@ values (6, 2, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (8, 4, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (company_id, name, media_id, dogs_allowed, max_campers, bookable_nights)
values (2, 'Wooden lodge', 6, false, 7, '[1, 7]')
, (4, 'Bungalow', 8, false, 6, '[2, 6]')
insert into campsite_type (company_id, name, media_id, max_campers, bookable_nights)
values (2, 'Wooden lodge', 6, 7, '[1, 7]')
, (4, 'Bungalow', 8, 6, '[2, 6]')
;
prepare campsite_type_data as
@ -192,7 +187,7 @@ reset role;
select set_cookie('44facbb30d8a419dfd4bfbc44a4b5539d4970148dfc84bed0e/demo@tandem.blog', 'co2');
select lives_ok(
$$ insert into campsite_type(company_id, name, media_id, dogs_allowed, max_campers, bookable_nights) values (2, 'Another type', 6, true, 7, '[1, 7]') $$,
$$ insert into campsite_type(company_id, name, media_id, max_campers, bookable_nights) values (2, 'Another type', 6, 7, '[1, 7]') $$,
'Admin from company 2 should be able to insert a new campsite type to that company.'
);
@ -233,7 +228,7 @@ select bag_eq(
);
select throws_ok(
$$ insert into campsite_type (company_id, name, media_id, dogs_allowed, max_campers, bookable_nights) values (4, 'Another type', 6, true, 6, '[1, 7]') $$,
$$ insert into campsite_type (company_id, name, media_id, max_campers, bookable_nights) values (4, 'Another type', 6, 6, '[1, 7]') $$,
'42501', 'new row violates row-level security policy for table "campsite_type"',
'Admin from company 2 should NOT be able to insert new campsite types to company 4.'
);
@ -271,25 +266,25 @@ select bag_eq(
);
select throws_ok(
$$ insert into campsite_type (company_id, name, media_id, dogs_allowed, max_campers, bookable_nights) values (2, ' ', 6, false, 5, '[1, 7]') $$,
$$ insert into campsite_type (company_id, name, media_id, max_campers, bookable_nights) values (2, ' ', 6, 5, '[1, 7]') $$,
'23514', 'new row for relation "campsite_type" violates check constraint "name_not_empty"',
'Should not be able to insert campsite types with a blank name.'
);
select throws_ok(
$$ insert into campsite_type (company_id, name, media_id, dogs_allowed, max_campers, bookable_nights) values (2, 'Name', 6, false, 0, '[1, 7]') $$,
$$ insert into campsite_type (company_id, name, media_id, max_campers, bookable_nights) values (2, 'Name', 6, 0, '[1, 7]') $$,
'23514', 'new row for relation "campsite_type" violates check constraint "at_least_one_camper"',
'Should not be able to insert campsite types with no campers allowed.'
);
select throws_ok(
$$ insert into campsite_type (company_id, name, media_id, dogs_allowed, max_campers, bookable_nights) values (2, 'Name', 6, false, 1, '[0, 7]') $$,
$$ insert into campsite_type (company_id, name, media_id, max_campers, bookable_nights) values (2, 'Name', 6, 1, '[0, 7]') $$,
'23514', 'new row for relation "campsite_type" violates check constraint "at_least_one_night"',
'Should not be able to insert campsite types that allows to book zero nights.'
);
select throws_ok(
$$ insert into campsite_type (company_id, name, media_id, dogs_allowed, max_campers, bookable_nights) values (2, 'Name', 6, false, 1, '[1, 1)') $$,
$$ insert into campsite_type (company_id, name, media_id, max_campers, bookable_nights) values (2, 'Name', 6, 1, '[1, 1)') $$,
'23514', 'new row for relation "campsite_type" violates check constraint "at_least_one_night"',
'Should not be able to insert campsite types with no bookable nights.'
);

View File

@ -92,9 +92,9 @@ values ( 6, 2, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","
, (11, 4, 'text5.txt', sha256('content5'))
;
insert into campsite_type (campsite_type_id, company_id, name, media_id, dogs_allowed, max_campers, bookable_nights)
values (21, 2, 'Wooden lodge', 6, false, 7, '[1, 7]')
, (22, 4, 'Bungalow', 9, false, 6, '[2, 6]')
insert into campsite_type (campsite_type_id, company_id, name, media_id, max_campers, bookable_nights)
values (21, 2, 'Wooden lodge', 6, 7, '[1, 7]')
, (22, 4, 'Bungalow', 9, 6, '[2, 6]')
;
insert into campsite_type_carousel (campsite_type_id, media_id, caption)

View File

@ -93,9 +93,9 @@ values (6, 2, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (8, 4, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, name, media_id, dogs_allowed, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, false, 7, '[1, 7]')
, (18, 4, 'Bungalow', 8, false, 6, '[2, 6]')
insert into campsite_type (campsite_type_id, company_id, name, media_id, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, 7, '[1, 7]')
, (18, 4, 'Bungalow', 8, 6, '[2, 6]')
;
insert into season (season_id, company_id, name)

View File

@ -88,9 +88,9 @@ values (6, 2, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (8, 4, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, name, media_id, dogs_allowed, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, false, 7, '[1, 7]')
, (18, 4, 'Bungalow', 8, false, 6, '[2, 6]')
insert into campsite_type (campsite_type_id, company_id, name, media_id, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, 7, '[1, 7]')
, (18, 4, 'Bungalow', 8, 6, '[2, 6]')
;
insert into campsite_type_feature (campsite_type_id, icon_name, name)

View File

@ -86,9 +86,9 @@ values (6, 2, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (8, 4, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, name, media_id, dogs_allowed, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, false, 7, '[1, 7]')
, (18, 4, 'Bungalow', 8, false, 6, '[2, 6]')
insert into campsite_type (campsite_type_id, company_id, name, media_id, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, 7, '[1, 7]')
, (18, 4, 'Bungalow', 8, 6, '[2, 6]')
;
insert into campsite_type_option (campsite_type_id, name, range)

View File

@ -79,9 +79,9 @@ values (6, 2, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (8, 4, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, name, media_id, dogs_allowed, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, false, 7, '[1, 7]')
, (18, 4, 'Bungalow', 8, false, 6, '[2, 6]')
insert into campsite_type (campsite_type_id, company_id, name, media_id, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, 7, '[1, 7]')
, (18, 4, 'Bungalow', 8, 6, '[2, 6]')
;
insert into season (season_id, company_id, name)

View File

@ -0,0 +1,195 @@
-- Test campsite_type_pet_cost
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;
begin;
select plan(31);
set search_path to camper, public;
select has_table('campsite_type_pet_cost');
select has_pk('campsite_type_pet_cost');
select table_privs_are('campsite_type_pet_cost', 'guest', array['SELECT']);
select table_privs_are('campsite_type_pet_cost', 'employee', array['SELECT']);
select table_privs_are('campsite_type_pet_cost', 'admin', array['SELECT', 'INSERT', 'UPDATE', 'DELETE']);
select table_privs_are('campsite_type_pet_cost', 'authenticator', array[]::text[]);
select has_column('campsite_type_pet_cost', 'campsite_type_id');
select col_is_pk('campsite_type_pet_cost', 'campsite_type_id');
select col_is_fk('campsite_type_pet_cost', 'campsite_type_id');
select fk_ok('campsite_type_pet_cost', 'campsite_type_id', 'campsite_type', 'campsite_type_id');
select col_type_is('campsite_type_pet_cost', 'campsite_type_id', 'integer');
select col_not_null('campsite_type_pet_cost', 'campsite_type_id');
select col_hasnt_default('campsite_type_pet_cost', 'campsite_type_id');
select has_column('campsite_type_pet_cost', 'cost_per_night');
select col_type_is('campsite_type_pet_cost', 'cost_per_night', 'integer');
select col_not_null('campsite_type_pet_cost', 'cost_per_night');
select col_hasnt_default('campsite_type_pet_cost', 'cost_per_night');
set client_min_messages to warning;
truncate campsite_type_pet_cost cascade;
truncate campsite_type cascade;
truncate media cascade;
truncate media_content cascade;
truncate company_host cascade;
truncate company_user cascade;
truncate company cascade;
truncate auth."user" cascade;
reset client_min_messages;
insert into auth."user" (user_id, email, name, password, cookie, cookie_expires_at)
values (1, 'demo@tandem.blog', 'Demo', 'test', '44facbb30d8a419dfd4bfbc44a4b5539d4970148dfc84bed0e', current_timestamp + interval '1 month')
, (5, 'admin@tandem.blog', 'Demo', 'test', '12af4c88b528c2ad4222e3740496ecbc58e76e26f087657524', current_timestamp + interval '1 month')
;
insert into company (company_id, business_name, vatin, trade_name, phone, email, web, address, city, province, postal_code, rtc_number, tourist_tax, country_code, currency_code, default_lang_tag)
values (2, 'Company 2', 'XX123', '', '555-555-555', 'a@a', '', '', '', '', '', '', 60, 'ES', 'EUR', 'ca')
, (4, 'Company 4', 'XX234', '', '666-666-666', 'b@b', '', '', '', '', '', '', 60, 'FR', 'USD', 'ca')
;
insert into company_user (company_id, user_id, role)
values (2, 1, 'admin')
, (4, 5, 'admin')
;
insert into company_host (company_id, host)
values (2, 'co2')
, (4, 'co4')
;
insert into media_content (media_type, bytes)
values ('image/x-xpixmap', 'static char *s[]={"1 1 1 1","a c #ffffff","a"};')
;
insert into media (media_id, company_id, original_filename, content_hash)
values (6, 2, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
, (8, 4, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, name, media_id, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, 7, '[1, 7]')
, (17, 2, 'Another lodge', 6, 7, '[1, 7]')
, (18, 4, 'Bungalow', 8, 6, '[2, 6]')
, (19, 4, 'Bungalow Premium', 8, 6, '[2, 6]')
;
insert into campsite_type_pet_cost (campsite_type_id, cost_per_night)
values (16, 2)
, (18, 4)
;
prepare campsite_cost_data as
select campsite_type_id, cost_per_night
from campsite_type_pet_cost
;
set role guest;
select bag_eq(
'campsite_cost_data',
$$ values (16, 2)
, (18, 4)
$$,
'Everyone should be able to list all campsite type pet costs across all companies'
);
reset role;
select set_cookie('44facbb30d8a419dfd4bfbc44a4b5539d4970148dfc84bed0e/demo@tandem.blog', 'co2');
select lives_ok(
$$ insert into campsite_type_pet_cost(campsite_type_id, cost_per_night) values (17, 3) $$,
'Admin from company 2 should be able to insert a new pet cost to that company.'
);
select bag_eq(
'campsite_cost_data',
$$ values (16, 2)
, (17, 3)
, (18, 4)
$$,
'The new row should have been added'
);
select lives_ok(
$$ update campsite_type_pet_cost set cost_per_night = 6 where campsite_type_id = 17 $$,
'Admin from company 2 should be able to update pet cost of that company.'
);
select bag_eq(
'campsite_cost_data',
$$ values (16, 2)
, (17, 6)
, (18, 4)
$$,
'The row should have been updated.'
);
select lives_ok(
$$ delete from campsite_type_pet_cost where campsite_type_id = 17 $$,
'Admin from company 2 should be able to delete campsite type season from that company.'
);
select bag_eq(
'campsite_cost_data',
$$ values (16, 2)
, (18, 4)
$$,
'The row should have been deleted.'
);
select throws_ok(
$$ insert into campsite_type_pet_cost (campsite_type_id, cost_per_night) values (19, 5) $$,
'42501', 'new row violates row-level security policy for table "campsite_type_pet_cost"',
'Admin from company 2 should NOT be able to insert new pet costs to company 4.'
);
select lives_ok(
$$ update campsite_type_pet_cost set cost_per_night = 1 where campsite_type_id = 18 $$,
'Admin from company 2 should not be able to update pet costs of company 4, but no error if campsite_type_id is not changed.'
);
select bag_eq(
'campsite_cost_data',
$$ values (16, 2)
, (18, 4)
$$,
'No row should have been changed.'
);
select throws_ok(
$$ update campsite_type_pet_cost set campsite_type_id = 19 where campsite_type_id = 16 $$,
'42501', 'new row violates row-level security policy for table "campsite_type_pet_cost"',
'Admin from company 2 should NOT be able to move pet costs to one of company 4'
);
select lives_ok(
$$ delete from campsite_type_pet_cost where campsite_type_id = 18 $$,
'Admin from company 2 should NOT be able to delete pet costs from company 4, but not error is thrown'
);
select bag_eq(
'campsite_cost_data',
$$ values (16, 2)
, (18, 4)
$$,
'No row should have been changed'
);
select throws_ok(
$$ insert into campsite_type_pet_cost (campsite_type_id, cost_per_night) values (17, -1) $$,
'23514', 'new row for relation "campsite_type_pet_cost" violates check constraint "cost_not_negative"',
'Should not be able to insert negative pet costs.'
);
reset role;
select *
from finish();
rollback;

View File

@ -40,10 +40,10 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (3, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, dogs_allowed, max_campers, bookable_nights)
values (11, 1, 3, 'Type A', false, 5, '[1, 7]')
, (12, 1, 3, 'Type B', false, 5, '[2, 6]')
, (13, 1, 3, 'Type C', false, 5, '[3, 5]')
insert into campsite_type (campsite_type_id, company_id, media_id, name, max_campers, bookable_nights)
values (11, 1, 3, 'Type A', 5, '[1, 7]')
, (12, 1, 3, 'Type B', 5, '[2, 6]')
, (13, 1, 3, 'Type C', 5, '[3, 5]')
;
insert into campsite (campsite_id, company_id, campsite_type_id, label, info1, info2, active)

View File

@ -42,8 +42,8 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, active, dogs_allowed, max_campers, bookable_nights)
values (3, 1, 2, 'Type A', '<p>A</p>', true, false, 4, '[1, 7]')
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, active, max_campers, bookable_nights)
values (3, 1, 2, 'Type A', '<p>A</p>', true, 4, '[1, 7]')
;
insert into campsite (campsite_id, company_id, label, campsite_type_id)

View File

@ -9,15 +9,15 @@ set search_path to camper, public;
select plan(12);
select has_function('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean', 'boolean']);
select function_lang_is('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean', 'boolean'], 'sql');
select function_returns('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean', 'boolean'], 'uuid');
select isnt_definer('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean', 'boolean']);
select volatility_is('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean', 'boolean'], 'volatile');
select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean', 'boolean'], 'guest', array[]::text[]);
select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean', 'boolean'], 'employee', array[]::text[]);
select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean', 'boolean'], 'admin', array['EXECUTE']);
select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean', 'boolean'], 'authenticator', array[]::text[]);
select has_function('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean']);
select function_lang_is('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'sql');
select function_returns('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'uuid');
select isnt_definer('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean']);
select volatility_is('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'volatile');
select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'guest', array[]::text[]);
select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'employee', array[]::text[]);
select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'admin', array['EXECUTE']);
select function_privs_are('camper', 'edit_campsite_type', array ['uuid', 'integer', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'text', 'integer', 'int4range', 'boolean', 'boolean', 'boolean'], 'authenticator', array[]::text[]);
set client_min_messages to warning;
truncate campsite_type cascade;
@ -43,25 +43,25 @@ values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (4, 1, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffff00","a"};'))
;
insert into campsite_type (company_id, slug, media_id, name, spiel, info, facilities, description, additional_info, check_in, check_out, max_campers, bookable_nights, dogs_allowed, overflow_allowed, ask_zone_preferences, active)
values (1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<h1>1</h1>', '<p>info 1</p>', '<p>facilities A</p>', '<p>A</p>', '<p>Additional A</p>', '', '', 5, '[1, 7]', false, true, false, true)
, (1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<h2>2</h2>', '<p>info 2</p>', '<p>facilities B</p>', '<p>B</p>', '<p>Additional B</p>', '', '', 4, '[2, 6]', true, false, true, false)
insert into campsite_type (company_id, slug, media_id, name, spiel, info, facilities, description, additional_info, check_in, check_out, max_campers, bookable_nights, overflow_allowed, ask_zone_preferences, active)
values (1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<h1>1</h1>', '<p>info 1</p>', '<p>facilities A</p>', '<p>A</p>', '<p>Additional A</p>', '', '', 5, '[1, 7]', true, false, true)
, (1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<h2>2</h2>', '<p>info 2</p>', '<p>facilities B</p>', '<p>B</p>', '<p>Additional B</p>', '', '', 4, '[2, 6]', false, true, false)
;
select lives_ok(
$$ select edit_campsite_type('87452b88-b48f-48d3-bb6c-0296de64164e', 4, 'Type 1', '<h3>A</h3>', '<p>Features A</p>', '<p>Pricing 1</p>', '<p>1</p>', '<p>Additional 1</p>', 'Check-in 1', 'Check-out 1', 2, '(1, 7)', true, false, true, false) $$,
$$ select edit_campsite_type('87452b88-b48f-48d3-bb6c-0296de64164e', 4, 'Type 1', '<h3>A</h3>', '<p>Features A</p>', '<p>Pricing 1</p>', '<p>1</p>', '<p>Additional 1</p>', 'Check-in 1', 'Check-out 1', 2, '(1, 7)', false, true, false) $$,
'Should be able to edit the first type'
);
select lives_ok(
$$ select edit_campsite_type('9b6370f7-f941-46f2-bc6e-de455675bd0a', null, 'Type 2', '<h1>B</h1>', '<p>Features B</p>', '<p>Pricing 2</p>', '<p>2</p>', '<p>Additional 2</p>', 'Check-in 2', 'Check-out 2', 9, '(2, 6)', false, true, false, true) $$,
$$ select edit_campsite_type('9b6370f7-f941-46f2-bc6e-de455675bd0a', null, 'Type 2', '<h1>B</h1>', '<p>Features B</p>', '<p>Pricing 2</p>', '<p>2</p>', '<p>Additional 2</p>', 'Check-in 2', 'Check-out 2', 9, '(2, 6)', true, false, true) $$,
'Should be able to edit the second type'
);
select bag_eq(
$$ select slug::text, media_id, name, spiel::text, info::text, facilities::text, description::text, additional_info::text, check_in, check_out, max_campers, bookable_nights, dogs_allowed, overflow_allowed, ask_zone_preferences, active from campsite_type $$,
$$ values ('87452b88-b48f-48d3-bb6c-0296de64164e', 4, 'Type 1', '<h3>A</h3>', '<p>Features A</p>', '<p>Pricing 1</p>', '<p>1</p>', '<p>Additional 1</p>', 'Check-in 1', 'Check-out 1', 2, int4range(2, 7), true, false, true, false)
, ('9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type 2', '<h1>B</h1>', '<p>Features B</p>', '<p>Pricing 2</p>', '<p>2</p>', '<p>Additional 2</p>', 'Check-in 2', 'Check-out 2', 9, int4range(3, 6), false, true, false, true)
$$ select slug::text, media_id, name, spiel::text, info::text, facilities::text, description::text, additional_info::text, check_in, check_out, max_campers, bookable_nights, overflow_allowed, ask_zone_preferences, active from campsite_type $$,
$$ values ('87452b88-b48f-48d3-bb6c-0296de64164e', 4, 'Type 1', '<h3>A</h3>', '<p>Features A</p>', '<p>Pricing 1</p>', '<p>1</p>', '<p>Additional 1</p>', 'Check-in 1', 'Check-out 1', 2, int4range(2, 7), false, true, false)
, ('9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type 2', '<h1>B</h1>', '<p>Features B</p>', '<p>Pricing 2</p>', '<p>2</p>', '<p>Additional 2</p>', 'Check-in 2', 'Check-out 2', 9, int4range(3, 6), true, false, true)
$$,
'Should have updated all campsite types.'
);

View File

@ -42,8 +42,8 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, active, dogs_allowed, max_campers, bookable_nights)
values (3, 1, 2, 'Type A', '<p>A</p>', true, false, 4, '[1, 7]')
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, active, max_campers, bookable_nights)
values (3, 1, 2, 'Type A', '<p>A</p>', true, 4, '[1, 7]')
;
insert into campsite_type_feature (campsite_type_feature_id, campsite_type_id, icon_name, name)

View File

@ -42,8 +42,8 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, active, dogs_allowed, max_campers, bookable_nights)
values (3, 1, 2, 'Type A', '<p>A</p>', true, false, 4, '[1, 7]')
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, active, max_campers, bookable_nights)
values (3, 1, 2, 'Type A', '<p>A</p>', true, 4, '[1, 7]')
;
insert into campsite_type_option (campsite_type_option_id, campsite_type_id, name, range)

View File

@ -56,9 +56,9 @@ values ( 3, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","
, (12, 1, 'image.svg', sha256('<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, max_campers, bookable_nights, dogs_allowed, active)
values (13, 1, 3, 'Type A', '<p>A</p>', 5, '[1, 7]', false, true)
, (14, 2, 8, 'Type B', '<p>B</p>', 4, '[2, 6]', true, false)
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, max_campers, bookable_nights, active)
values (13, 1, 3, 'Type A', '<p>A</p>', 5, '[1, 7]', true)
, (14, 2, 8, 'Type B', '<p>B</p>', 4, '[2, 6]', false)
;
insert into campsite (campsite_id, company_id, label, campsite_type_id)

View File

@ -42,8 +42,8 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (6, 2, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, name, media_id, dogs_allowed, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, false, 7, '[1, 7]')
insert into campsite_type (campsite_type_id, company_id, name, media_id, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, 7, '[1, 7]')
;
insert into campsite (campsite_id, company_id, label, campsite_type_id)

View File

@ -50,9 +50,9 @@ values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (6, 1, 'image.svg', sha256('<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, dogs_allowed, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', false, true)
, (11, 1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<p>B</p>', 4, '[2, 6]', true, false)
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', true)
, (11, 1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<p>B</p>', 4, '[2, 6]', false)
;
insert into campsite_type_carousel (campsite_type_id, media_id, caption)

View File

@ -56,8 +56,8 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (6, 2, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, name, media_id, dogs_allowed, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, false, 7, '[1, 7]')
insert into campsite_type (campsite_type_id, company_id, name, media_id, max_campers, bookable_nights)
values (16, 2, 'Wooden lodge', 6, 7, '[1, 7]')
;
insert into campsite_type_feature (campsite_type_feature_id, campsite_type_id, icon_name, name)

View File

@ -42,8 +42,8 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, active, dogs_allowed, max_campers, bookable_nights)
values (3, 1, 2, 'Type A', '<p>A</p>', true, false, 4, '[1, 7]')
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, active, max_campers, bookable_nights)
values (3, 1, 2, 'Type A', '<p>A</p>', true, 4, '[1, 7]')
;
insert into campsite_type_option (campsite_type_option_id, campsite_type_id, name, range)

View File

@ -40,12 +40,12 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (company_id, slug, media_id, name, spiel, info, facilities, description, max_campers, bookable_nights, dogs_allowed, active)
values (1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'A', '', '', '', '', 5, '[1, 7]', false, true)
, (1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 2, 'B', '', '', '', '', 5, '[2, 6]', false, true)
, (1, 'b33cfbc9-fbcc-4aac-8335-e5f94ea7e6b2', 2, 'C', '', '', '', '', 5, '[3, 5]', false, true)
, (1, '8c4465ec-a690-43d7-854b-7fcd35fccb1c', 2, 'D', '', '', '', '', 5, '[4, 8]', false, true)
, (1, 'd28c30fb-57ac-4243-a8c3-ad1a26637f5a', 2, 'E', '', '', '', '', 5, '[5, 9]', false, true)
insert into campsite_type (company_id, slug, media_id, name, spiel, info, facilities, description, max_campers, bookable_nights, active)
values (1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'A', '', '', '', '', 5, '[1, 7]', true)
, (1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 2, 'B', '', '', '', '', 5, '[2, 6]', true)
, (1, 'b33cfbc9-fbcc-4aac-8335-e5f94ea7e6b2', 2, 'C', '', '', '', '', 5, '[3, 5]', true)
, (1, '8c4465ec-a690-43d7-854b-7fcd35fccb1c', 2, 'D', '', '', '', '', 5, '[4, 8]', true)
, (1, 'd28c30fb-57ac-4243-a8c3-ad1a26637f5a', 2, 'E', '', '', '', '', 5, '[5, 9]', true)
;
select lives_ok(

View File

@ -51,9 +51,9 @@ values (3, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (7, 2, 'image.svg', sha256('<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, max_campers, bookable_nights, dogs_allowed, active)
values (10, 1, 3, 'Type A', '<p>A</p>', 5, '[1, 7]', false, true)
, (11, 2, 7, 'Type B', '<p>B</p>', 4, '[2, 6]', true, false)
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, max_campers, bookable_nights, active)
values (10, 1, 3, 'Type A', '<p>A</p>', 5, '[1, 7]', true)
, (11, 2, 7, 'Type B', '<p>B</p>', 4, '[2, 6]', false)
;
insert into campsite (campsite_id, label, company_id, campsite_type_id)

View File

@ -47,8 +47,8 @@ values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (3, 1, 'cover3.xpm', sha256('static char *s[]={"1 1 1 1","a c #ff00ff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, dogs_allowed, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', false, true)
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', true)
;
insert into campsite (campsite_id, company_id, label, campsite_type_id)

View File

@ -48,9 +48,9 @@ values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (6, 1, 'image.svg', sha256('<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, dogs_allowed, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', false, true)
, (11, 1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<p>B</p>', 4, '[2, 6]', true, false)
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', true)
, (11, 1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<p>B</p>', 4, '[2, 6]', false)
;
insert into campsite_type_carousel (campsite_type_id, media_id, caption)

View File

@ -46,9 +46,9 @@ values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (3, 1, 'cover3.xpm', sha256('static char *s[]={"1 1 1 1","a c #ff00ff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, dogs_allowed, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', false, true)
, (11, 1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<p>B</p>', 4, '[2, 6]', true, false)
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', true)
, (11, 1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<p>B</p>', 4, '[2, 6]', false)
;
insert into campsite_type_feature (campsite_type_feature_id, campsite_type_id, icon_name, name)

View File

@ -47,9 +47,9 @@ values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (3, 1, 'cover3.xpm', sha256('static char *s[]={"1 1 1 1","a c #ff00ff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, dogs_allowed, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', false, true)
, (11, 1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<p>B</p>', 4, '[2, 6]', true, false)
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', true)
, (11, 1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<p>B</p>', 4, '[2, 6]', false)
;
insert into campsite_type_option (campsite_type_option_id, campsite_type_id, name, range)

View File

@ -41,8 +41,8 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, dogs_allowed, active)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '', 5, '[1, 7]', false, true)
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, active)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '', 5, '[1, 7]', true)
;
insert into season (season_id, company_id, name)

View File

@ -43,8 +43,8 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, dogs_allowed, active)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '', 5, '[1, 7]', false, true)
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, active)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '', 5, '[1, 7]', true)
;
insert into season (season_id, company_id, name)

View File

@ -0,0 +1,78 @@
-- Test set_campsite_type_pet_cost
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;
begin;
select plan(12);
set search_path to camper, public;
select has_function('camper', 'set_campsite_type_pet_cost', array['uuid', 'text']);
select function_lang_is('camper', 'set_campsite_type_pet_cost', array['uuid', 'text'], 'sql');
select function_returns('camper', 'set_campsite_type_pet_cost', array['uuid', 'text'], 'void');
select isnt_definer('camper', 'set_campsite_type_pet_cost', array['uuid', 'text']);
select volatility_is('camper', 'set_campsite_type_pet_cost', array['uuid', 'text'], 'volatile');
select function_privs_are('camper', 'set_campsite_type_pet_cost', array ['uuid', 'text'], 'guest', array[]::text[]);
select function_privs_are('camper', 'set_campsite_type_pet_cost', array ['uuid', 'text'], 'employee', array[]::text[]);
select function_privs_are('camper', 'set_campsite_type_pet_cost', array ['uuid', 'text'], 'admin', array['EXECUTE']);
select function_privs_are('camper', 'set_campsite_type_pet_cost', array ['uuid', 'text'], 'authenticator', array[]::text[]);
set client_min_messages to warning;
truncate campsite_type_pet_cost cascade;
truncate campsite_type cascade;
truncate media cascade;
truncate media_content cascade;
truncate company cascade;
reset client_min_messages;
insert into company (company_id, business_name, vatin, trade_name, phone, email, web, address, city, province, postal_code, rtc_number, tourist_tax, country_code, currency_code, default_lang_tag)
values (1, 'Company 2', 'XX123', '', '555-555-555', 'a@a', '', '', '', '', '', '', 60, 'ES', 'EUR', 'ca')
;
insert into media_content (media_type, bytes)
values ('image/x-xpixmap', 'static char *s[]={"1 1 1 1","a c #ffffff","a"};')
;
insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, active)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '', 5, '[1, 7]', true)
, (4, 1, '4ccf62bd-98f3-4239-8f25-a7534363cd98', 2, 'Type B', '', 5, '[1, 7]', true)
, (5, 1, 'b16a8473-c40d-4ab9-b209-6fed03e1d14d', 2, 'Type C', '', 5, '[1, 7]', true)
;
insert into campsite_type_pet_cost (campsite_type_id, cost_per_night)
values (3, 333)
, (4, 444)
;
select lives_ok(
$$ select set_campsite_type_pet_cost('87452b88-b48f-48d3-bb6c-0296de64164e', '3.50') $$,
'Should be able to edit the pet cost for first campsite type'
);
select lives_ok(
$$ select set_campsite_type_pet_cost('b16a8473-c40d-4ab9-b209-6fed03e1d14d', '12.34') $$,
'Should be able to add pet cost for third campsite type'
);
select bag_eq(
$$ select campsite_type_id, cost_per_night from campsite_type_pet_cost $$,
$$ values (3, 350)
, (4, 444)
, (5, 1234)
$$,
'Should have updated all campsite type pet costs.'
);
select *
from finish();
rollback;

View File

@ -42,8 +42,8 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (3, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, dogs_allowed, max_campers, bookable_nights)
values (11, 1, 3, 'Type A', false, 5, '[1, 7]')
insert into campsite_type (campsite_type_id, company_id, media_id, name, max_campers, bookable_nights)
values (11, 1, 3, 'Type A', 5, '[1, 7]')
;
insert into campsite (campsite_id, company_id, campsite_type_id, label, info1, info2, active)

View File

@ -51,9 +51,9 @@ values (3, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (7, 2, 'image.svg', sha256('<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, max_campers, bookable_nights, dogs_allowed, active)
values (10, 1, 3, 'Type A', '<p>A</p>', 5, '[1, 7]', false, true)
, (11, 2, 7, 'Type B', '<p>B</p>', 7, '[2, 6]', true, false)
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, max_campers, bookable_nights, active)
values (10, 1, 3, 'Type A', '<p>A</p>', 5, '[1, 7]', true)
, (11, 2, 7, 'Type B', '<p>B</p>', 7, '[2, 6]', false)
;
insert into campsite (campsite_id, label, company_id, campsite_type_id)

View File

@ -42,8 +42,8 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, active, dogs_allowed, max_campers, bookable_nights)
values (3, 1, 2, 'Type A', '<p>A</p>', true, false, 4, '[1, 7]')
insert into campsite_type (campsite_type_id, company_id, media_id, name, description, active, max_campers, bookable_nights)
values (3, 1, 2, 'Type A', '<p>A</p>', true, 4, '[1, 7]')
;
insert into campsite (campsite_id, company_id, label, campsite_type_id)

View File

@ -43,9 +43,9 @@ values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (4, 1, 'cover4.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffff00","a"};'))
;
insert into campsite_type (company_id, slug, media_id, name, spiel, info, facilities, description, additional_info, check_in, check_out, active, dogs_allowed, max_campers, bookable_nights)
values (1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<h2>One</h2>', '<p>Features A</p>', '<p>Pricing A</p>', '<p>A</p>', '<p>Additional A</p>', '', '', true, false, 4, '[1, 7]')
, (1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<h2>Two</h2>', '<p>Features B</p>', '<p>Pricing B</p>', '<p>B</p>', '<p>Additional B</p>', '', '', false, true, 5, '[2, 6]')
insert into campsite_type (company_id, slug, media_id, name, spiel, info, facilities, description, additional_info, check_in, check_out, active, max_campers, bookable_nights)
values (1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<h2>One</h2>', '<p>Features A</p>', '<p>Pricing A</p>', '<p>A</p>', '<p>Additional A</p>', '', '', true, 4, '[1, 7]')
, (1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<h2>Two</h2>', '<p>Features B</p>', '<p>Pricing B</p>', '<p>B</p>', '<p>Additional B</p>', '', '', false, 5, '[2, 6]')
;
insert into campsite_type_i18n (campsite_type_id, lang_tag, name, spiel, info, facilities, description, additional_info, check_in, check_out)

View File

@ -48,9 +48,9 @@ values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a
, (6, 1, 'image.svg', sha256('<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1"/>'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, dogs_allowed, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', false, true)
, (11, 1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<p>B</p>', 4, '[2, 6]', true, false)
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, active)
values (10, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', 5, '[1, 7]', true)
, (11, 1, '9b6370f7-f941-46f2-bc6e-de455675bd0a', 3, 'Type B', '<p>B</p>', 4, '[2, 6]', false)
;
insert into campsite_type_carousel (campsite_type_id, media_id, caption)

View File

@ -41,8 +41,8 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, active, dogs_allowed, max_campers, bookable_nights)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', true, false, 4, '[1, 7]')
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, active, max_campers, bookable_nights)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', true, 4, '[1, 7]')
;
insert into campsite_type_feature (campsite_type_feature_id, campsite_type_id, icon_name, name)

View File

@ -41,8 +41,8 @@ insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, active, dogs_allowed, max_campers, bookable_nights)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', true, false, 4, '[1, 7]')
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, active, max_campers, bookable_nights)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '<p>A</p>', true, 4, '[1, 7]')
;
insert into campsite_type_option (campsite_type_option_id, campsite_type_id, name, range)

View File

@ -0,0 +1,77 @@
-- Test unset_campsite_type_pet_cost
set client_min_messages to warning;
create extension if not exists pgtap;
reset client_min_messages;
begin;
select plan(12);
set search_path to camper, public;
select has_function('camper', 'unset_campsite_type_pet_cost', array['uuid']);
select function_lang_is('camper', 'unset_campsite_type_pet_cost', array['uuid'], 'sql');
select function_returns('camper', 'unset_campsite_type_pet_cost', array['uuid'], 'void');
select isnt_definer('camper', 'unset_campsite_type_pet_cost', array['uuid']);
select volatility_is('camper', 'unset_campsite_type_pet_cost', array['uuid'], 'volatile');
select function_privs_are('camper', 'unset_campsite_type_pet_cost', array ['uuid'], 'guest', array[]::text[]);
select function_privs_are('camper', 'unset_campsite_type_pet_cost', array ['uuid'], 'employee', array[]::text[]);
select function_privs_are('camper', 'unset_campsite_type_pet_cost', array ['uuid'], 'admin', array['EXECUTE']);
select function_privs_are('camper', 'unset_campsite_type_pet_cost', array ['uuid'], 'authenticator', array[]::text[]);
set client_min_messages to warning;
truncate campsite_type_pet_cost cascade;
truncate campsite_type cascade;
truncate media cascade;
truncate media_content cascade;
truncate company cascade;
reset client_min_messages;
insert into company (company_id, business_name, vatin, trade_name, phone, email, web, address, city, province, postal_code, rtc_number, tourist_tax, country_code, currency_code, default_lang_tag)
values (1, 'Company 2', 'XX123', '', '555-555-555', 'a@a', '', '', '', '', '', '', 60, 'ES', 'EUR', 'ca')
;
insert into media_content (media_type, bytes)
values ('image/x-xpixmap', 'static char *s[]={"1 1 1 1","a c #ffffff","a"};')
;
insert into media (media_id, company_id, original_filename, content_hash)
values (2, 1, 'cover2.xpm', sha256('static char *s[]={"1 1 1 1","a c #ffffff","a"};'))
;
insert into campsite_type (campsite_type_id, company_id, slug, media_id, name, description, max_campers, bookable_nights, active)
values (3, 1, '87452b88-b48f-48d3-bb6c-0296de64164e', 2, 'Type A', '', 5, '[1, 7]', true)
, (4, 1, '4ccf62bd-98f3-4239-8f25-a7534363cd98', 2, 'Type B', '', 5, '[1, 7]', true)
, (5, 1, 'b16a8473-c40d-4ab9-b209-6fed03e1d14d', 2, 'Type C', '', 5, '[1, 7]', true)
;
insert into campsite_type_pet_cost (campsite_type_id, cost_per_night)
values (3, 333)
, (4, 444)
, (5, 555)
;
select lives_ok(
$$ select unset_campsite_type_pet_cost('87452b88-b48f-48d3-bb6c-0296de64164e') $$,
'Should be able to unset the pet cost from first campsite type'
);
select lives_ok(
$$ select unset_campsite_type_pet_cost('b16a8473-c40d-4ab9-b209-6fed03e1d14d') $$,
'Should be able to unset pet cost for third campsite type'
);
select bag_eq(
$$ select campsite_type_id, cost_per_night from campsite_type_pet_cost $$,
$$ values (4, 444)
$$,
'Should have removed campsite type pet costs.'
);
select *
from finish();
rollback;

View File

@ -2,6 +2,6 @@
begin;
select has_function_privilege('camper.add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean, boolean)', 'execute');
select has_function_privilege('camper.add_campsite_type(integer, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean)', 'execute');
rollback;

View File

@ -0,0 +1,11 @@
-- Verify camper:campsite_type__-dogs_allowed on pg
begin;
select 1 / (1 - count(*))
from pg_attribute
where attrelid = 'camper.campsite_type'::regclass
and attname = 'dogs_allowed'
;
rollback;

View File

@ -0,0 +1,16 @@
-- Verify camper:campsite_type_pet_cost on pg
begin;
select campsite_type_id
, cost_per_night
from camper.campsite_type_pet_cost
where false;
select 1 / count(*) from pg_class where oid = 'camper.campsite_type_pet_cost'::regclass and relrowsecurity;
select 1 / count(*) from pg_policy where polname = 'guest_ok' and polrelid = 'camper.campsite_type_pet_cost'::regclass;
select 1 / count(*) from pg_policy where polname = 'insert_to_company' and polrelid = 'camper.campsite_type_pet_cost'::regclass;
select 1 / count(*) from pg_policy where polname = 'update_company' and polrelid = 'camper.campsite_type_pet_cost'::regclass;
select 1 / count(*) from pg_policy where polname = 'delete_from_company' and polrelid = 'camper.campsite_type_pet_cost'::regclass;
rollback;

View File

@ -2,6 +2,6 @@
begin;
select has_function_privilege('camper.edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean, boolean, boolean)', 'execute');
select has_function_privilege('camper.edit_campsite_type(uuid, integer, text, text, text, text, text, text, text, text, integer, int4range, boolean, boolean, boolean)', 'execute');
rollback;

View File

@ -0,0 +1,7 @@
-- Verify camper:set_campsite_type_pet_cost on pg
begin;
select has_function_privilege('camper.set_campsite_type_pet_cost(uuid, text)', 'execute');
rollback;

View File

@ -0,0 +1,7 @@
-- Verify camper:unset_campsite_type_pet_cost on pg
begin;
select has_function_privilege('camper.unset_campsite_type_pet_cost(uuid)', 'execute');
rollback;

View File

@ -130,14 +130,24 @@
</label>
{{ template "error-message" . }}
{{- end }}
{{ with .DogsAllowed -}}
<label>
<input type="checkbox" name="{{ .Name }}" {{ if .Checked}}checked{{ end }}
{{ template "error-attrs" . }}>
{{( pgettext "Dogs allowed" "input" )}}<br>
</label>
{{ template "error-message" . }}
{{- end }}
<fieldset x-data="{allowed: {{ if .DogsAllowed.Checked}}true{{ else }}false{{ end }}}">
{{ with .DogsAllowed -}}
<label>
<input type="checkbox" name="{{ .Name }}" {{ if .Checked}}checked{{ end }}
x-model="allowed"
{{ template "error-attrs" . }}>
{{( pgettext "Dogs allowed" "input" )}}<br>
</label>
{{ template "error-message" . }}
{{- end }}
{{ with .DogsPrice -}}
<label x-cloak x-show="allowed">{{( pgettext "Dogs price" "input")}}<br>
<input type="number" name="{{ .Name }}" value="{{ .Val }}" min="0"
step="0.01" {{ template "error-attrs" . }}><br>
{{ template "error-message" . }}
</label>
{{- end }}
</fieldset>
{{ with .Prices }}
<fieldset>
<legend>{{( pgettext "Prices" "title" )}}</legend>