From 9ff7178ed5f28939fea3213323548361bb0426cd Mon Sep 17 00:00:00 2001 From: Chris Cromer Date: Sat, 19 Jan 2019 17:42:43 -0300 Subject: [PATCH] finish city and region text entry --- lib/db/asociado.vala | 22 ++----- lib/db/ciudad.vala | 57 ++++++++++++----- lib/db/region.vala | 43 +++++++++++-- lib/db/tour.vala | 8 +-- lib/queries.vala | 71 +++++++++++++++++++++ po/POTFILES | 4 ++ po/es.po | 144 +++++++++++++++++++++++-------------------- po/es_CL.po | 137 +++++++++++++++++++++------------------- po/sernatur.pot | 135 ++++++++++++++++++++++------------------ src/main_window.vala | 2 +- src/tour_editor.vala | 85 +++++++++++++++++++------ src/tour_places.vala | 4 +- 12 files changed, 460 insertions(+), 252 deletions(-) diff --git a/lib/db/asociado.vala b/lib/db/asociado.vala index 6c08453..f0acd7a 100644 --- a/lib/db/asociado.vala +++ b/lib/db/asociado.vala @@ -50,24 +50,10 @@ namespace LibSernatur { * Get all tuples and fields from database * @param conn The database connection to use * @return Returns a list of Asociado + * @throws PostgresError Thrown if there is a problem with escaping strings */ - public static List get_all_asociados (Connection conn) { - var res = conn.db.exec (" -SELECT A.fecha_llegada, A.hora_llegada, A.fecha_salida, A.hora_salida, -T.id_tour, T.nombre_tour, T.costo_indiv, T.costo_grupal, T.minima_personas, -C.id_ciudad, C.nombre_ciudad, -R.id_region, R.nombre_region, -L.id_lugar, L.nombre_lugar, L.valor_entrada, L.nivel, -C2.id_ciudad AS id_ciudad_lugar, C2.nombre_ciudad AS nombre_ciudad_lugar, -R2.id_region AS id_region_lugar, R2.nombre_region AS nombre_region_lugar -FROM asociado A -JOIN tour T ON (A.id_tour = T.id_tour) -JOIN ciudad C ON (T.id_ciudad = C.id_ciudad) -JOIN region R ON (C.id_region = R.id_region) -JOIN lugar L ON (A.id_lugar = L.id_lugar) -JOIN ciudad C2 ON (L.id_ciudad = C2.id_ciudad) -JOIN region R2 ON (C2.id_region = R2.id_region) - "); + public static List get_all_asociados (Connection conn) throws PostgresError { + var res = conn.db.exec (Query.get_query (conn, Query.Type.SELECT_ALL_ASSOCIATED, null)); if (res.get_status () != ExecStatus.TUPLES_OK) { #if DEBUG error (conn.db.get_error_message ()); @@ -132,7 +118,7 @@ JOIN region R2 ON (C2.id_region = R2.id_region) */ public static List get_all_asociados_by_tour (Connection conn, Tour tour) throws PostgresError, DBError { if (tour.id_tour == 0) { - throw new DBError.INVALID_VALUE (dgettext (null, "The id of the tour is invalid!")); + throw new DBError.INVALID_VALUE (_ ("The id of the tour is invalid!")); } var res = conn.db.exec (Query.get_query (conn, Query.Type.SELECT_ALL_ASSOCIATED_BY_TOUR, tour)); if (res.get_status () != ExecStatus.TUPLES_OK) { diff --git a/lib/db/ciudad.vala b/lib/db/ciudad.vala index dea6b5f..5179fe1 100644 --- a/lib/db/ciudad.vala +++ b/lib/db/ciudad.vala @@ -50,14 +50,10 @@ namespace LibSernatur { * Get all tuples and fields from database * @param conn The database connection to use * @return Returns a list of Ciudad + * @throws PostgresError If there is a problem with with escaping strings */ - public static List get_all_ciudades (Connection conn) { - var res = conn.db.exec (" -SELECT C.id_ciudad, C.nombre_ciudad, -R.id_region, R.nombre_region -FROM ciudad C -JOIN region R ON (C.id_region = R.id_region) - "); + public static List get_all_ciudades (Connection conn) throws PostgresError { + var res = conn.db.exec (Query.get_query (conn, Query.Type.SELECT_ALL_CITIES, null)); if (res.get_status () != ExecStatus.TUPLES_OK) { #if DEBUG error (conn.db.get_error_message ()); @@ -96,15 +92,10 @@ JOIN region R ON (C.id_region = R.id_region) * @param conn The database connection to use * @param region_id The id of the region to filter that results * @return Returns a list of Ciudad + * @throws PostgresError If there is a problem with with escaping strings */ - public static List get_all_ciudades_in_region(Connection conn, uint region_id) { - var res = conn.db.exec (" -SELECT C.id_ciudad, C.nombre_ciudad, -R.id_region, R.nombre_region -FROM ciudad C -JOIN region R ON (C.id_region = R.id_region) -WHERE (R.id_region = " + region_id.to_string () + ") - "); + public static List get_all_ciudades_in_region(Connection conn, uint region_id) throws PostgresError { + var res = conn.db.exec (Query.get_query (conn, Query.Type.SELECT_ALL_CITIES_BY_REGION, region_id)); if (res.get_status () != ExecStatus.TUPLES_OK) { #if DEBUG error (conn.db.get_error_message ()); @@ -137,6 +128,42 @@ WHERE (R.id_region = " + region_id.to_string () + ") } return list; } + + /** + * Insert a city in the database + * @param conn The database connection + * @param ciudad The city to insert + * @return Returns the id of the tuple inserted + * @throws PostgresError Thrown if there is a problem with escaping strings + * @throws DBError Thrown if an invalid value is passed + */ + public static uint insert_city (Connection conn, Ciudad ciudad) throws PostgresError, DBError { + if (ciudad.id_ciudad != 0) { + throw new DBError.INVALID_VALUE (_ ("The id of the city is invalid!")); + } + var res = conn.db.exec (Query.get_query (conn, Query.Type.INSERT_CITY, ciudad)); + // This uses TUPLES_OK because it returns a result which is the id of the inserted city + if (res.get_status () != ExecStatus.TUPLES_OK) { + #if DEBUG + error (conn.db.get_error_message ()); + #else + warning (conn.db.get_error_message ()); + #endif + } + + var wra = new ResultWrapper (res); + try { + return wra.get_int_n (0, "id_ciudad"); + } + catch (Error e) { + #if DEBUG + error (e.message); + #else + warning (e.message); + return 0; + #endif + } + } } } } diff --git a/lib/db/region.vala b/lib/db/region.vala index 86f4a12..b99553a 100644 --- a/lib/db/region.vala +++ b/lib/db/region.vala @@ -44,11 +44,10 @@ namespace LibSernatur { * Get all tuples and fields from database * @param conn The database connection to use * @return Returns a list of Region + * @throws PostgresError If there is a problem with with escaping strings */ - public static List get_all_regiones (Connection conn) { - var res = conn.db.exec (" -SELECT id_region, nombre_region FROM region - "); + public static List get_all_regiones (Connection conn) throws PostgresError { + var res = conn.db.exec (Query.get_query (conn, Query.Type.SELECT_ALL_REGIONS, null)); if (res.get_status () != ExecStatus.TUPLES_OK) { #if DEBUG error (conn.db.get_error_message ()); @@ -78,6 +77,42 @@ SELECT id_region, nombre_region FROM region } return list; } + + /** + * Insert a region in the database + * @param conn The database connection + * @param region The region to insert + * @return Returns the id of the tuple inserted + * @throws PostgresError Thrown if there is a problem with escaping strings + * @throws DBError Thrown if an invalid value is passed + */ + public static uint insert_region (Connection conn, Region region) throws PostgresError, DBError { + if (region.id_region != 0) { + throw new DBError.INVALID_VALUE (_ ("The id of the region is invalid!")); + } + var res = conn.db.exec (Query.get_query (conn, Query.Type.INSERT_REGION, region)); + // This uses TUPLES_OK because it returns a result which is the id of the inserted region + if (res.get_status () != ExecStatus.TUPLES_OK) { + #if DEBUG + error (conn.db.get_error_message ()); + #else + warning (conn.db.get_error_message ()); + #endif + } + + var wra = new ResultWrapper (res); + try { + return wra.get_int_n (0, "id_region"); + } + catch (Error e) { + #if DEBUG + error (e.message); + #else + warning (e.message); + return 0; + #endif + } + } } } } diff --git a/lib/db/tour.vala b/lib/db/tour.vala index 2966857..e41bff7 100644 --- a/lib/db/tour.vala +++ b/lib/db/tour.vala @@ -120,7 +120,7 @@ namespace LibSernatur { */ public static void update_tour (Connection conn, Tour tour) throws PostgresError, DBError { if (tour.id_tour == 0) { - throw new DBError.INVALID_VALUE (dgettext (null, "The id of the tour is invalid!")); + throw new DBError.INVALID_VALUE (_ ("The id of the tour is invalid!")); } var res = conn.db.exec (Query.get_query (conn, Query.Type.UPDATE_TOUR, tour)); if (res.get_status () != ExecStatus.COMMAND_OK) { @@ -142,10 +142,10 @@ namespace LibSernatur { */ public static uint insert_tour (Connection conn, Tour tour) throws PostgresError, DBError { if (tour.id_tour != 0) { - throw new DBError.INVALID_VALUE (dgettext (null, "The id of the tour is invalid!")); + throw new DBError.INVALID_VALUE (_ ("The id of the tour is invalid!")); } var res = conn.db.exec (Query.get_query (conn, Query.Type.INSERT_TOUR, tour)); - // This uses TUPLES_OK because it returns a result which is hte id of the inserted tour + // This uses TUPLES_OK because it returns a result which is the id of the inserted tour if (res.get_status () != ExecStatus.TUPLES_OK) { #if DEBUG error (conn.db.get_error_message ()); @@ -177,7 +177,7 @@ namespace LibSernatur { */ public static void delete_tour (Connection conn, Tour tour) throws PostgresError, DBError { if (tour.id_tour == 0) { - throw new DBError.INVALID_VALUE (dgettext (null, "The id of the tour is invalid!")); + throw new DBError.INVALID_VALUE (_ ("The id of the tour is invalid!")); } var res = conn.db.exec (Query.get_query (conn, Query.Type.DELETE_TOUR, tour)); if (res.get_status () != ExecStatus.COMMAND_OK) { diff --git a/lib/queries.vala b/lib/queries.vala index 0aaef9e..615bc8e 100644 --- a/lib/queries.vala +++ b/lib/queries.vala @@ -19,15 +19,64 @@ namespace LibSernatur { */ public class Query < T > : Object { public enum Type { + SELECT_ALL_CITIES, + SELECT_ALL_CITIES_BY_REGION, + INSERT_CITY, + SELECT_ALL_REGIONS, + INSERT_REGION, SELECT_ALL_TOURS, INSERT_TOUR, UPDATE_TOUR, DELETE_TOUR, + SELECT_ALL_ASSOCIATED, SELECT_ALL_ASSOCIATED_BY_TOUR } public static string get_query (Connection conn, Type type, T? t) throws PostgresError { switch (type) { + case SELECT_ALL_CITIES: + return " +SELECT C.id_ciudad, C.nombre_ciudad, +R.id_region, R.nombre_region +FROM ciudad C +JOIN region R ON (C.id_region = R.id_region)"; + + case SELECT_ALL_CITIES_BY_REGION: + uint region_id = (uint) t; + return " +SELECT C.id_ciudad, C.nombre_ciudad, +R.id_region, R.nombre_region +FROM ciudad C +JOIN region R ON (C.id_region = R.id_region) +WHERE (R.id_region = " + region_id.to_string () + ")"; + + case INSERT_CITY: + Ciudad ciudad = (Ciudad) t; + return " +INSERT INTO ciudad +(nombre_ciudad, id_region) +VALUES +( +'" + conn.escape (ciudad.nombre_ciudad) + "', +" + ciudad.region.id_region.to_string () + " +) +RETURNING id_ciudad"; + + case SELECT_ALL_REGIONS: + return " +SELECT id_region, nombre_region FROM region"; + + case INSERT_REGION: + Region region = (Region) t; + return " +INSERT INTO region +(nombre_region) +VALUES +( +'" + conn.escape (region.nombre_region) + "' +) +RETURNING id_region"; + case SELECT_ALL_TOURS: return " SELECT T.id_tour, T.nombre_tour, T.costo_indiv, T.costo_grupal, T.minima_personas, @@ -36,6 +85,7 @@ R.id_region, R.nombre_region FROM tour T JOIN ciudad C ON (T.id_ciudad = C.id_ciudad) JOIN region R ON (C.id_region = R.id_region)"; + case UPDATE_TOUR: Tour tour = (Tour) t; return " @@ -46,6 +96,7 @@ UPDATE tour SET minima_personas = " + tour.minima_personas.to_string () + ", id_ciudad = " + tour.ciudad.id_ciudad.to_string () + " WHERE id_tour = " + tour.id_tour.to_string (); + case INSERT_TOUR: Tour tour = (Tour) t; return " @@ -60,11 +111,30 @@ VALUES " + tour.ciudad.id_ciudad.to_string () + " ) RETURNING id_tour"; + case DELETE_TOUR: Tour tour = (Tour) t; return " DELETE FROM tour WHERE id_tour = " + tour.id_tour.to_string (); + + case SELECT_ALL_ASSOCIATED: + return " +SELECT A.fecha_llegada, A.hora_llegada, A.fecha_salida, A.hora_salida, +T.id_tour, T.nombre_tour, T.costo_indiv, T.costo_grupal, T.minima_personas, +C.id_ciudad, C.nombre_ciudad, +R.id_region, R.nombre_region, +L.id_lugar, L.nombre_lugar, L.valor_entrada, L.nivel, +C2.id_ciudad AS id_ciudad_lugar, C2.nombre_ciudad AS nombre_ciudad_lugar, +R2.id_region AS id_region_lugar, R2.nombre_region AS nombre_region_lugar +FROM asociado A +JOIN tour T ON (A.id_tour = T.id_tour) +JOIN ciudad C ON (T.id_ciudad = C.id_ciudad) +JOIN region R ON (C.id_region = R.id_region) +JOIN lugar L ON (A.id_lugar = L.id_lugar) +JOIN ciudad C2 ON (L.id_ciudad = C2.id_ciudad) +JOIN region R2 ON (C2.id_region = R2.id_region)"; + case SELECT_ALL_ASSOCIATED_BY_TOUR: Tour tour = (Tour) t; return " @@ -83,6 +153,7 @@ JOIN lugar L ON (A.id_lugar = L.id_lugar) JOIN ciudad C2 ON (L.id_ciudad = C2.id_ciudad) JOIN region R2 ON (C2.id_region = R2.id_region) WHERE t.id_tour = " + tour.id_tour.to_string (); + default: return ""; } diff --git a/po/POTFILES b/po/POTFILES index 8a0eb27..a3e4e73 100644 --- a/po/POTFILES +++ b/po/POTFILES @@ -1,6 +1,10 @@ lib/db.vala lib/dbwrapper.vala lib/misc.vala +lib/db/asociado.vala +lib/db/ciudad.vala +lib/db/region.vala +lib/db/tour.vala src/sernatur.vala src/main_window.vala src/tour_list.vala diff --git a/po/es.po b/po/es.po index bc81e24..71f814d 100644 --- a/po/es.po +++ b/po/es.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: sernatur\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-18 17:59-0300\n" -"PO-Revision-Date: 2019-01-18 18:02-0300\n" +"POT-Creation-Date: 2019-01-19 17:42-0300\n" +"PO-Revision-Date: 2019-01-19 17:41-0300\n" "Last-Translator: Chris Cromer \n" "Language-Team: none\n" "Language: es\n" @@ -20,7 +20,7 @@ msgstr "" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-Basepath: .\n" -#: lib/db.vala:74 +#: lib/db.vala:78 msgid "Postgresql server version:" msgstr "Versión del servidor Postgresql:" @@ -44,20 +44,32 @@ msgstr "El RUT %s es demasiado grande!" msgid "The verifier %C is invalid!" msgstr "El verificador %C es invalido!" -#: src/sernatur.vala:88 +#: lib/db/asociado.vala:121 lib/db/tour.vala:123 lib/db/tour.vala:145 +#: lib/db/tour.vala:180 +msgid "The id of the tour is invalid!" +msgstr "El id del tour es invalido!" + +#: lib/db/ciudad.vala:142 +msgid "The id of the city is invalid!" +msgstr "El id de la ciudad es invalida!" + +#: lib/db/region.vala:91 +msgid "The id of the region is invalid!" +msgstr "El id de la región es invalida!" + +#: src/sernatur.vala:87 #, c-format msgid "Error: %s\n" msgstr "Error: %s\n" -#: src/sernatur.vala:89 +#: src/sernatur.vala:88 #, c-format -msgid "" -"Run '%s --help' to see a full list of available command line options.\n" +msgid "Run '%s --help' to see a full list of available command line options.\n" msgstr "" "Correr '%s --help' para ver una lista completa de las opciones de la " "consola.\n" -#: src/sernatur.vala:94 +#: src/sernatur.vala:93 msgid "SERNATUR version: " msgstr "Versión de SERNATUR: " @@ -65,80 +77,80 @@ msgstr "Versión de SERNATUR: " msgid "Error: Could not connect to the database!" msgstr "Error: No se puede conectar al base de datos!" -#: src/main_window.vala:228 src/tour_list.vala:215 src/tour_list.vala:231 +#: src/main_window.vala:228 src/tour_list.vala:233 src/tour_list.vala:256 msgid "Error" msgstr "Error" -#: src/tour_list.vala:185 +#: src/tour_list.vala:191 msgid "Are you sure you wish to delete this tour?" msgstr "¿Usted está seguro que quiere borrar este tour?" -#: src/tour_list.vala:192 +#: src/tour_list.vala:198 msgid "Are you sure you wish to delete these tours?" msgstr "¿Usted está seguro que quiere borrar estos tour?" -#: src/tour_list.vala:211 +#: src/tour_list.vala:229 #, c-format msgid "" "Error: Could not delete tour \"%s\" because either this tour has been taken " "or is still associated with a place or vehicle!" msgstr "" -"Error: No se puede borrar el tour \"%s\" porque este tour ya fue realizado " -"o todavía esta asociado con lugares ó vehículos!" +"Error: No se puede borrar el tour \"%s\" porque este tour ya fue realizado o " +"todavía esta asociado con lugares ó vehículos!" -#: src/query_window.vala:290 data/ui/main.window.ui:136 +#: src/query_window.vala:290 data/ui/main.window.ui:135 msgid "(Q1) Regions with discounts" msgstr "(Q1) Regiones sin descuentos" -#: src/query_window.vala:303 data/ui/main.window.ui:144 +#: src/query_window.vala:303 data/ui/main.window.ui:143 msgid "(Q2) Tour values" msgstr "(Q2) Valores tour" -#: src/query_window.vala:316 data/ui/main.window.ui:152 +#: src/query_window.vala:316 data/ui/main.window.ui:151 msgid "(Q3) Coordinator total" msgstr "(Q3) Total de coordinadores" -#: src/query_window.vala:329 data/ui/main.window.ui:160 +#: src/query_window.vala:329 data/ui/main.window.ui:159 msgid "(Q4) Tourist total" msgstr "(Q4) Total de turistas" -#: src/query_window.vala:342 data/ui/main.window.ui:168 +#: src/query_window.vala:342 data/ui/main.window.ui:167 msgid "(Q5) Vehicle total" msgstr "(Q5) Total de vehículos" -#: data/ui/main.window.ui:44 +#: data/ui/main.window.ui:43 msgid "_Menu" msgstr "_Menú" -#: data/ui/main.window.ui:54 data/ui/tour.list.ui:23 +#: data/ui/main.window.ui:53 data/ui/tour.list.ui:23 msgid "Tours" msgstr "Tours" -#: data/ui/main.window.ui:62 +#: data/ui/main.window.ui:61 msgid "Staff" msgstr "Empleados" -#: data/ui/main.window.ui:70 +#: data/ui/main.window.ui:69 msgid "Tourists" msgstr "Turistas" -#: data/ui/main.window.ui:80 +#: data/ui/main.window.ui:79 msgid "Illnesses" msgstr "Enfermedades" -#: data/ui/main.window.ui:88 +#: data/ui/main.window.ui:87 msgid "Participate" msgstr "Participar" -#: data/ui/main.window.ui:100 +#: data/ui/main.window.ui:99 msgid "Vehicles" msgstr "Vehículos" -#: data/ui/main.window.ui:114 +#: data/ui/main.window.ui:113 msgid "Quit" msgstr "Salir" -#: data/ui/main.window.ui:126 +#: data/ui/main.window.ui:125 msgid "_Views" msgstr "_Vistas" @@ -146,61 +158,61 @@ msgstr "_Vistas" msgid "Christopher Cromer" msgstr "Christopher Cromer" -#: data/ui/tour.list.ui:69 data/ui/tour.editor.ui:54 data/ui/query.tree.ui:80 +#: data/ui/tour.list.ui:68 data/ui/tour.editor.ui:53 data/ui/query.tree.ui:80 #: data/ui/query.tree.ui:120 data/ui/query.tree.ui:160 msgid "Tour Name" msgstr "Nombre del Tour" -#: data/ui/tour.list.ui:83 data/ui/tour.editor.ui:87 +#: data/ui/tour.list.ui:82 data/ui/tour.editor.ui:86 msgid "Individual Cost" msgstr "Costo Individual" -#: data/ui/tour.list.ui:97 data/ui/tour.editor.ui:103 +#: data/ui/tour.list.ui:96 data/ui/tour.editor.ui:102 msgid "Group Cost" msgstr "Costo Grupal" -#: data/ui/tour.list.ui:111 data/ui/tour.editor.ui:119 +#: data/ui/tour.list.ui:110 data/ui/tour.editor.ui:118 msgid "Minimum People" msgstr "Mínima Personas" -#: data/ui/tour.list.ui:125 data/ui/tour.editor.ui:187 +#: data/ui/tour.list.ui:124 data/ui/tour.editor.ui:186 msgid "City" msgstr "Ciudad" -#: data/ui/tour.list.ui:139 data/ui/tour.editor.ui:135 +#: data/ui/tour.list.ui:138 data/ui/tour.editor.ui:134 msgid "Region" msgstr "Región" -#: data/ui/tour.list.ui:171 data/ui/tour.places.ui:185 +#: data/ui/tour.list.ui:170 data/ui/tour.places.ui:184 msgid "Edit" msgstr "Editar" -#: data/ui/tour.list.ui:176 +#: data/ui/tour.list.ui:175 msgid "Edit selected tour." msgstr "Editar el tour seleccionado." -#: data/ui/tour.list.ui:186 data/ui/tour.places.ui:243 +#: data/ui/tour.list.ui:185 data/ui/tour.places.ui:242 msgid "New" msgstr "Nuevo" -#: data/ui/tour.list.ui:190 +#: data/ui/tour.list.ui:189 msgid "Create a new tour." msgstr "Crear un tour nuevo." -#: data/ui/tour.list.ui:200 data/ui/tour.places.ui:214 +#: data/ui/tour.list.ui:199 data/ui/tour.places.ui:213 msgid "Delete" msgstr "Borrar" -#: data/ui/tour.list.ui:205 +#: data/ui/tour.list.ui:204 msgid "Delete selected tour." msgstr "Borrar el tour seleccionado." -#: data/ui/tour.list.ui:215 data/ui/tour.places.ui:229 -#: data/ui/query.window.ui:67 +#: data/ui/tour.list.ui:214 data/ui/tour.places.ui:228 +#: data/ui/query.window.ui:66 msgid "Close" msgstr "Cerrar" -#: data/ui/tour.list.ui:219 data/ui/tour.places.ui:233 +#: data/ui/tour.list.ui:218 data/ui/tour.places.ui:232 msgid "Close this window." msgstr "Cerrar esta ventana." @@ -208,95 +220,95 @@ msgstr "Cerrar esta ventana." msgid "Tour Editor" msgstr "Editor de Tour" -#: data/ui/tour.editor.ui:234 +#: data/ui/tour.editor.ui:233 msgid "Create a new region by typing here." msgstr "Crear una nueva región con escribir aquí." -#: data/ui/tour.editor.ui:262 +#: data/ui/tour.editor.ui:261 msgid "Create a new city by typing here." msgstr "Crear una nueva ciudad con escribir aquí." -#: data/ui/tour.editor.ui:287 +#: data/ui/tour.editor.ui:286 msgid "Cancel" msgstr "Cancelar" -#: data/ui/tour.editor.ui:291 +#: data/ui/tour.editor.ui:290 msgid "Cancel the modification of this tour." msgstr "Cancelar la modificación de este tour." -#: data/ui/tour.editor.ui:306 data/ui/tour.places.ui:23 +#: data/ui/tour.editor.ui:305 data/ui/tour.places.ui:23 msgid "Places" msgstr "Lugares" -#: data/ui/tour.editor.ui:310 +#: data/ui/tour.editor.ui:309 msgid "Add or edit places." msgstr "Agregar o editar places." -#: data/ui/tour.editor.ui:325 +#: data/ui/tour.editor.ui:324 msgid "Save" msgstr "Guardar" -#: data/ui/tour.editor.ui:329 +#: data/ui/tour.editor.ui:328 msgid "Save this tour." msgstr "Guardar este tour." -#: data/ui/tour.places.ui:69 +#: data/ui/tour.places.ui:68 msgid "Place Name" msgstr "Nombre de Lugar" -#: data/ui/tour.places.ui:83 +#: data/ui/tour.places.ui:82 msgid "Ticket Price" msgstr "Valor Entrada" -#: data/ui/tour.places.ui:97 +#: data/ui/tour.places.ui:96 msgid "Difficulty" msgstr "Dificultad" -#: data/ui/tour.places.ui:111 +#: data/ui/tour.places.ui:110 msgid "Arrival Date" msgstr "Fecha de Llegada" -#: data/ui/tour.places.ui:125 +#: data/ui/tour.places.ui:124 msgid "Arrival Time" msgstr "Hora de Llegada" -#: data/ui/tour.places.ui:139 +#: data/ui/tour.places.ui:138 msgid "Departure Date" msgstr "Fecha de Salida" -#: data/ui/tour.places.ui:153 +#: data/ui/tour.places.ui:152 msgid "Departure Time" msgstr "Hora de Salida" -#: data/ui/tour.places.ui:190 +#: data/ui/tour.places.ui:189 msgid "Edit associated place." msgstr "Edit lugar asociado." -#: data/ui/tour.places.ui:200 +#: data/ui/tour.places.ui:199 msgid "Add" msgstr "Agregar" -#: data/ui/tour.places.ui:204 +#: data/ui/tour.places.ui:203 msgid "Associate this tour with an existing place." msgstr "Asociar este tour con un lugar que ya existe." -#: data/ui/tour.places.ui:219 +#: data/ui/tour.places.ui:218 msgid "Delete associated place." msgstr "Borrar lugar asociado." -#: data/ui/tour.places.ui:247 +#: data/ui/tour.places.ui:246 msgid "Create a new place to associate." msgstr "Crear un lugar nuevo para asociar con el tour." -#: data/ui/query.window.ui:85 +#: data/ui/query.window.ui:84 msgid "Run" msgstr "Correr" -#: data/ui/query.window.ui:127 +#: data/ui/query.window.ui:126 msgid "Statement" msgstr "Enunciado" -#: data/ui/query.window.ui:157 +#: data/ui/query.window.ui:156 msgid "View and Query" msgstr "Vista y Consulta" diff --git a/po/es_CL.po b/po/es_CL.po index 5e8d198..f6c71ff 100644 --- a/po/es_CL.po +++ b/po/es_CL.po @@ -7,8 +7,8 @@ msgid "" msgstr "" "Project-Id-Version: sernatur\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-18 17:59-0300\n" -"PO-Revision-Date: 2019-01-18 18:02-0300\n" +"POT-Creation-Date: 2019-01-19 17:42-0300\n" +"PO-Revision-Date: 2019-01-19 17:41-0300\n" "Last-Translator: Chris Cromer \n" "Language-Team: none\n" "Language: es\n" @@ -20,7 +20,7 @@ msgstr "" "X-Poedit-SourceCharset: UTF-8\n" "X-Poedit-Basepath: .\n" -#: lib/db.vala:74 +#: lib/db.vala:78 msgid "Postgresql server version:" msgstr "Versión de la wea de Postgresql:" @@ -44,19 +44,32 @@ msgstr "La wea %s es demasiado grande!" msgid "The verifier %C is invalid!" msgstr "La wea %C es invalido!" -#: src/sernatur.vala:88 +#: lib/db/asociado.vala:121 lib/db/tour.vala:123 lib/db/tour.vala:145 +#: lib/db/tour.vala:180 +msgid "The id of the tour is invalid!" +msgstr "El id de la wea es invalida!" + +#: lib/db/ciudad.vala:142 +msgid "The id of the city is invalid!" +msgstr "El id de la wea es invalida!" + +#: lib/db/region.vala:91 +msgid "The id of the region is invalid!" +msgstr "El id de la wea es invalida!" + +#: src/sernatur.vala:87 #, c-format msgid "Error: %s\n" msgstr "Puta la wea: %s\n" -#: src/sernatur.vala:89 +#: src/sernatur.vala:88 #, c-format msgid "Run '%s --help' to see a full list of available command line options.\n" msgstr "" "Correr '%s --help' para ver una lista completa de las weas que se puede usar " "en la consola.\n" -#: src/sernatur.vala:94 +#: src/sernatur.vala:93 msgid "SERNATUR version: " msgstr "Versión de SERNATUR: " @@ -64,19 +77,19 @@ msgstr "Versión de SERNATUR: " msgid "Error: Could not connect to the database!" msgstr "Puta la wea: No se puede conectar al base de datos!" -#: src/main_window.vala:228 src/tour_list.vala:215 src/tour_list.vala:231 +#: src/main_window.vala:228 src/tour_list.vala:233 src/tour_list.vala:256 msgid "Error" msgstr "Puta la wea" -#: src/tour_list.vala:185 +#: src/tour_list.vala:191 msgid "Are you sure you wish to delete this tour?" msgstr "¿Weon, está seguro que quiere borrar esta wea?" -#: src/tour_list.vala:192 +#: src/tour_list.vala:198 msgid "Are you sure you wish to delete these tours?" msgstr "¿Weon, está seguro que quiere borrar estas weas?" -#: src/tour_list.vala:211 +#: src/tour_list.vala:229 #, c-format msgid "" "Error: Could not delete tour \"%s\" because either this tour has been taken " @@ -85,59 +98,59 @@ msgstr "" "Puta la wea: No se puede borrar la wea \"%s\" porque esta wea ya fue " "realizada o la wea todavía esta asociado con lugares ó vehículos!" -#: src/query_window.vala:290 data/ui/main.window.ui:136 +#: src/query_window.vala:290 data/ui/main.window.ui:135 msgid "(Q1) Regions with discounts" msgstr "(Q1) Regiones sin descuentos" -#: src/query_window.vala:303 data/ui/main.window.ui:144 +#: src/query_window.vala:303 data/ui/main.window.ui:143 msgid "(Q2) Tour values" msgstr "(Q2) Valores tour" -#: src/query_window.vala:316 data/ui/main.window.ui:152 +#: src/query_window.vala:316 data/ui/main.window.ui:151 msgid "(Q3) Coordinator total" msgstr "(Q3) Total de coordinadores" -#: src/query_window.vala:329 data/ui/main.window.ui:160 +#: src/query_window.vala:329 data/ui/main.window.ui:159 msgid "(Q4) Tourist total" msgstr "(Q4) Total de turistas" -#: src/query_window.vala:342 data/ui/main.window.ui:168 +#: src/query_window.vala:342 data/ui/main.window.ui:167 msgid "(Q5) Vehicle total" msgstr "(Q5) Total de vehículos" -#: data/ui/main.window.ui:44 +#: data/ui/main.window.ui:43 msgid "_Menu" msgstr "_Menú" -#: data/ui/main.window.ui:54 data/ui/tour.list.ui:23 +#: data/ui/main.window.ui:53 data/ui/tour.list.ui:23 msgid "Tours" msgstr "Tours" -#: data/ui/main.window.ui:62 +#: data/ui/main.window.ui:61 msgid "Staff" msgstr "Weones flojos" -#: data/ui/main.window.ui:70 +#: data/ui/main.window.ui:69 msgid "Tourists" msgstr "Weones visitores" -#: data/ui/main.window.ui:80 +#: data/ui/main.window.ui:79 msgid "Illnesses" msgstr "Enfermedades" -#: data/ui/main.window.ui:88 +#: data/ui/main.window.ui:87 msgid "Participate" msgstr "Participar" -#: data/ui/main.window.ui:100 +#: data/ui/main.window.ui:99 msgid "Vehicles" msgstr "Vehículos" -#: data/ui/main.window.ui:114 +#: data/ui/main.window.ui:113 msgid "Quit" msgstr "Salir de la wea" -#: data/ui/main.window.ui:126 +#: data/ui/main.window.ui:125 msgid "_Views" msgstr "_Vistas" @@ -145,61 +158,61 @@ msgstr "_Vistas" msgid "Christopher Cromer" msgstr "Christopher Cromer (El Weon Gringo)" -#: data/ui/tour.list.ui:69 data/ui/tour.editor.ui:54 data/ui/query.tree.ui:80 +#: data/ui/tour.list.ui:68 data/ui/tour.editor.ui:53 data/ui/query.tree.ui:80 #: data/ui/query.tree.ui:120 data/ui/query.tree.ui:160 msgid "Tour Name" msgstr "Nombre de la Wea" -#: data/ui/tour.list.ui:83 data/ui/tour.editor.ui:87 +#: data/ui/tour.list.ui:82 data/ui/tour.editor.ui:86 msgid "Individual Cost" msgstr "Costo Individual" -#: data/ui/tour.list.ui:97 data/ui/tour.editor.ui:103 +#: data/ui/tour.list.ui:96 data/ui/tour.editor.ui:102 msgid "Group Cost" msgstr "Costo Grupal" -#: data/ui/tour.list.ui:111 data/ui/tour.editor.ui:119 +#: data/ui/tour.list.ui:110 data/ui/tour.editor.ui:118 msgid "Minimum People" msgstr "Mínima de Weones" -#: data/ui/tour.list.ui:125 data/ui/tour.editor.ui:187 +#: data/ui/tour.list.ui:124 data/ui/tour.editor.ui:186 msgid "City" msgstr "Ciudad" -#: data/ui/tour.list.ui:139 data/ui/tour.editor.ui:135 +#: data/ui/tour.list.ui:138 data/ui/tour.editor.ui:134 msgid "Region" msgstr "Región" -#: data/ui/tour.list.ui:171 data/ui/tour.places.ui:185 +#: data/ui/tour.list.ui:170 data/ui/tour.places.ui:184 msgid "Edit" msgstr "Editar la wea" -#: data/ui/tour.list.ui:176 +#: data/ui/tour.list.ui:175 msgid "Edit selected tour." msgstr "Editar la wea seleccionado." -#: data/ui/tour.list.ui:186 data/ui/tour.places.ui:243 +#: data/ui/tour.list.ui:185 data/ui/tour.places.ui:242 msgid "New" msgstr "Nueva wea" -#: data/ui/tour.list.ui:190 +#: data/ui/tour.list.ui:189 msgid "Create a new tour." msgstr "Crear una wea nueva." -#: data/ui/tour.list.ui:200 data/ui/tour.places.ui:214 +#: data/ui/tour.list.ui:199 data/ui/tour.places.ui:213 msgid "Delete" msgstr "Borrar la wea" -#: data/ui/tour.list.ui:205 +#: data/ui/tour.list.ui:204 msgid "Delete selected tour." msgstr "Borrar la wea seleccionado." -#: data/ui/tour.list.ui:215 data/ui/tour.places.ui:229 -#: data/ui/query.window.ui:67 +#: data/ui/tour.list.ui:214 data/ui/tour.places.ui:228 +#: data/ui/query.window.ui:66 msgid "Close" msgstr "Cerrar la wea" -#: data/ui/tour.list.ui:219 data/ui/tour.places.ui:233 +#: data/ui/tour.list.ui:218 data/ui/tour.places.ui:232 msgid "Close this window." msgstr "Cerrar la wea." @@ -207,95 +220,95 @@ msgstr "Cerrar la wea." msgid "Tour Editor" msgstr "Editor de la Wea" -#: data/ui/tour.editor.ui:234 +#: data/ui/tour.editor.ui:233 msgid "Create a new region by typing here." msgstr "Crear una nueva wea con escribir aquí." -#: data/ui/tour.editor.ui:262 +#: data/ui/tour.editor.ui:261 msgid "Create a new city by typing here." msgstr "Crear una nueva wea con escribir aquí." -#: data/ui/tour.editor.ui:287 +#: data/ui/tour.editor.ui:286 msgid "Cancel" msgstr "Cancelar la wea" -#: data/ui/tour.editor.ui:291 +#: data/ui/tour.editor.ui:290 msgid "Cancel the modification of this tour." msgstr "Cancelar la modificación de esta wea." -#: data/ui/tour.editor.ui:306 data/ui/tour.places.ui:23 +#: data/ui/tour.editor.ui:305 data/ui/tour.places.ui:23 msgid "Places" msgstr "Lugares" -#: data/ui/tour.editor.ui:310 +#: data/ui/tour.editor.ui:309 msgid "Add or edit places." msgstr "Agregar o editar places." -#: data/ui/tour.editor.ui:325 +#: data/ui/tour.editor.ui:324 msgid "Save" msgstr "Guardar la wea" -#: data/ui/tour.editor.ui:329 +#: data/ui/tour.editor.ui:328 msgid "Save this tour." msgstr "Guardar esta wea." -#: data/ui/tour.places.ui:69 +#: data/ui/tour.places.ui:68 msgid "Place Name" msgstr "Nombre de la Wea" -#: data/ui/tour.places.ui:83 +#: data/ui/tour.places.ui:82 msgid "Ticket Price" msgstr "Valor de la Wea" -#: data/ui/tour.places.ui:97 +#: data/ui/tour.places.ui:96 msgid "Difficulty" msgstr "Dificultad" -#: data/ui/tour.places.ui:111 +#: data/ui/tour.places.ui:110 msgid "Arrival Date" msgstr "Fecha de Llegada" -#: data/ui/tour.places.ui:125 +#: data/ui/tour.places.ui:124 msgid "Arrival Time" msgstr "Hora de Llegada" -#: data/ui/tour.places.ui:139 +#: data/ui/tour.places.ui:138 msgid "Departure Date" msgstr "Fecha de Salida" -#: data/ui/tour.places.ui:153 +#: data/ui/tour.places.ui:152 msgid "Departure Time" msgstr "Hora de Salida" -#: data/ui/tour.places.ui:190 +#: data/ui/tour.places.ui:189 msgid "Edit associated place." msgstr "Edit lugar asociado." -#: data/ui/tour.places.ui:200 +#: data/ui/tour.places.ui:199 msgid "Add" msgstr "Agregar una wea" -#: data/ui/tour.places.ui:204 +#: data/ui/tour.places.ui:203 msgid "Associate this tour with an existing place." msgstr "Asociar esta wea con un lugar que ya existe." -#: data/ui/tour.places.ui:219 +#: data/ui/tour.places.ui:218 msgid "Delete associated place." msgstr "Borrar la wea asociado." -#: data/ui/tour.places.ui:247 +#: data/ui/tour.places.ui:246 msgid "Create a new place to associate." msgstr "Crear una wea nueva para asociar con el tour." -#: data/ui/query.window.ui:85 +#: data/ui/query.window.ui:84 msgid "Run" msgstr "Correr la wea" -#: data/ui/query.window.ui:127 +#: data/ui/query.window.ui:126 msgid "Statement" msgstr "Enunciado" -#: data/ui/query.window.ui:157 +#: data/ui/query.window.ui:156 msgid "View and Query" msgstr "Vista y Consulta" diff --git a/po/sernatur.pot b/po/sernatur.pot index 6da222f..b4d111a 100644 --- a/po/sernatur.pot +++ b/po/sernatur.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: sernatur\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-01-18 17:59-0300\n" +"POT-Creation-Date: 2019-01-19 17:42-0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,7 +17,7 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: lib/db.vala:74 +#: lib/db.vala:78 msgid "Postgresql server version:" msgstr "" @@ -41,17 +41,30 @@ msgstr "" msgid "The verifier %C is invalid!" msgstr "" -#: src/sernatur.vala:88 +#: lib/db/asociado.vala:121 lib/db/tour.vala:123 lib/db/tour.vala:145 +#: lib/db/tour.vala:180 +msgid "The id of the tour is invalid!" +msgstr "" + +#: lib/db/ciudad.vala:142 +msgid "The id of the city is invalid!" +msgstr "" + +#: lib/db/region.vala:91 +msgid "The id of the region is invalid!" +msgstr "" + +#: src/sernatur.vala:87 #, c-format msgid "Error: %s\n" msgstr "" -#: src/sernatur.vala:89 +#: src/sernatur.vala:88 #, c-format msgid "Run '%s --help' to see a full list of available command line options.\n" msgstr "" -#: src/sernatur.vala:94 +#: src/sernatur.vala:93 msgid "SERNATUR version: " msgstr "" @@ -59,78 +72,78 @@ msgstr "" msgid "Error: Could not connect to the database!" msgstr "" -#: src/main_window.vala:228 src/tour_list.vala:215 src/tour_list.vala:231 +#: src/main_window.vala:228 src/tour_list.vala:233 src/tour_list.vala:256 msgid "Error" msgstr "" -#: src/tour_list.vala:185 +#: src/tour_list.vala:191 msgid "Are you sure you wish to delete this tour?" msgstr "" -#: src/tour_list.vala:192 +#: src/tour_list.vala:198 msgid "Are you sure you wish to delete these tours?" msgstr "" -#: src/tour_list.vala:211 +#: src/tour_list.vala:229 #, c-format msgid "" "Error: Could not delete tour \"%s\" because either this tour has been taken " "or is still associated with a place or vehicle!" msgstr "" -#: src/query_window.vala:290 data/ui/main.window.ui:136 +#: src/query_window.vala:290 data/ui/main.window.ui:135 msgid "(Q1) Regions with discounts" msgstr "" -#: src/query_window.vala:303 data/ui/main.window.ui:144 +#: src/query_window.vala:303 data/ui/main.window.ui:143 msgid "(Q2) Tour values" msgstr "" -#: src/query_window.vala:316 data/ui/main.window.ui:152 +#: src/query_window.vala:316 data/ui/main.window.ui:151 msgid "(Q3) Coordinator total" msgstr "" -#: src/query_window.vala:329 data/ui/main.window.ui:160 +#: src/query_window.vala:329 data/ui/main.window.ui:159 msgid "(Q4) Tourist total" msgstr "" -#: src/query_window.vala:342 data/ui/main.window.ui:168 +#: src/query_window.vala:342 data/ui/main.window.ui:167 msgid "(Q5) Vehicle total" msgstr "" -#: data/ui/main.window.ui:44 +#: data/ui/main.window.ui:43 msgid "_Menu" msgstr "" -#: data/ui/main.window.ui:54 data/ui/tour.list.ui:23 +#: data/ui/main.window.ui:53 data/ui/tour.list.ui:23 msgid "Tours" msgstr "" -#: data/ui/main.window.ui:62 +#: data/ui/main.window.ui:61 msgid "Staff" msgstr "" -#: data/ui/main.window.ui:70 +#: data/ui/main.window.ui:69 msgid "Tourists" msgstr "" -#: data/ui/main.window.ui:80 +#: data/ui/main.window.ui:79 msgid "Illnesses" msgstr "" -#: data/ui/main.window.ui:88 +#: data/ui/main.window.ui:87 msgid "Participate" msgstr "" -#: data/ui/main.window.ui:100 +#: data/ui/main.window.ui:99 msgid "Vehicles" msgstr "" -#: data/ui/main.window.ui:114 +#: data/ui/main.window.ui:113 msgid "Quit" msgstr "" -#: data/ui/main.window.ui:126 +#: data/ui/main.window.ui:125 msgid "_Views" msgstr "" @@ -138,61 +151,61 @@ msgstr "" msgid "Christopher Cromer" msgstr "" -#: data/ui/tour.list.ui:69 data/ui/tour.editor.ui:54 data/ui/query.tree.ui:80 +#: data/ui/tour.list.ui:68 data/ui/tour.editor.ui:53 data/ui/query.tree.ui:80 #: data/ui/query.tree.ui:120 data/ui/query.tree.ui:160 msgid "Tour Name" msgstr "" -#: data/ui/tour.list.ui:83 data/ui/tour.editor.ui:87 +#: data/ui/tour.list.ui:82 data/ui/tour.editor.ui:86 msgid "Individual Cost" msgstr "" -#: data/ui/tour.list.ui:97 data/ui/tour.editor.ui:103 +#: data/ui/tour.list.ui:96 data/ui/tour.editor.ui:102 msgid "Group Cost" msgstr "" -#: data/ui/tour.list.ui:111 data/ui/tour.editor.ui:119 +#: data/ui/tour.list.ui:110 data/ui/tour.editor.ui:118 msgid "Minimum People" msgstr "" -#: data/ui/tour.list.ui:125 data/ui/tour.editor.ui:187 +#: data/ui/tour.list.ui:124 data/ui/tour.editor.ui:186 msgid "City" msgstr "" -#: data/ui/tour.list.ui:139 data/ui/tour.editor.ui:135 +#: data/ui/tour.list.ui:138 data/ui/tour.editor.ui:134 msgid "Region" msgstr "" -#: data/ui/tour.list.ui:171 data/ui/tour.places.ui:185 +#: data/ui/tour.list.ui:170 data/ui/tour.places.ui:184 msgid "Edit" msgstr "" -#: data/ui/tour.list.ui:176 +#: data/ui/tour.list.ui:175 msgid "Edit selected tour." msgstr "" -#: data/ui/tour.list.ui:186 data/ui/tour.places.ui:243 +#: data/ui/tour.list.ui:185 data/ui/tour.places.ui:242 msgid "New" msgstr "" -#: data/ui/tour.list.ui:190 +#: data/ui/tour.list.ui:189 msgid "Create a new tour." msgstr "" -#: data/ui/tour.list.ui:200 data/ui/tour.places.ui:214 +#: data/ui/tour.list.ui:199 data/ui/tour.places.ui:213 msgid "Delete" msgstr "" -#: data/ui/tour.list.ui:205 +#: data/ui/tour.list.ui:204 msgid "Delete selected tour." msgstr "" -#: data/ui/tour.list.ui:215 data/ui/tour.places.ui:229 -#: data/ui/query.window.ui:67 +#: data/ui/tour.list.ui:214 data/ui/tour.places.ui:228 +#: data/ui/query.window.ui:66 msgid "Close" msgstr "" -#: data/ui/tour.list.ui:219 data/ui/tour.places.ui:233 +#: data/ui/tour.list.ui:218 data/ui/tour.places.ui:232 msgid "Close this window." msgstr "" @@ -200,95 +213,95 @@ msgstr "" msgid "Tour Editor" msgstr "" -#: data/ui/tour.editor.ui:234 +#: data/ui/tour.editor.ui:233 msgid "Create a new region by typing here." msgstr "" -#: data/ui/tour.editor.ui:262 +#: data/ui/tour.editor.ui:261 msgid "Create a new city by typing here." msgstr "" -#: data/ui/tour.editor.ui:287 +#: data/ui/tour.editor.ui:286 msgid "Cancel" msgstr "" -#: data/ui/tour.editor.ui:291 +#: data/ui/tour.editor.ui:290 msgid "Cancel the modification of this tour." msgstr "" -#: data/ui/tour.editor.ui:306 data/ui/tour.places.ui:23 +#: data/ui/tour.editor.ui:305 data/ui/tour.places.ui:23 msgid "Places" msgstr "" -#: data/ui/tour.editor.ui:310 +#: data/ui/tour.editor.ui:309 msgid "Add or edit places." msgstr "" -#: data/ui/tour.editor.ui:325 +#: data/ui/tour.editor.ui:324 msgid "Save" msgstr "" -#: data/ui/tour.editor.ui:329 +#: data/ui/tour.editor.ui:328 msgid "Save this tour." msgstr "" -#: data/ui/tour.places.ui:69 +#: data/ui/tour.places.ui:68 msgid "Place Name" msgstr "" -#: data/ui/tour.places.ui:83 +#: data/ui/tour.places.ui:82 msgid "Ticket Price" msgstr "" -#: data/ui/tour.places.ui:97 +#: data/ui/tour.places.ui:96 msgid "Difficulty" msgstr "" -#: data/ui/tour.places.ui:111 +#: data/ui/tour.places.ui:110 msgid "Arrival Date" msgstr "" -#: data/ui/tour.places.ui:125 +#: data/ui/tour.places.ui:124 msgid "Arrival Time" msgstr "" -#: data/ui/tour.places.ui:139 +#: data/ui/tour.places.ui:138 msgid "Departure Date" msgstr "" -#: data/ui/tour.places.ui:153 +#: data/ui/tour.places.ui:152 msgid "Departure Time" msgstr "" -#: data/ui/tour.places.ui:190 +#: data/ui/tour.places.ui:189 msgid "Edit associated place." msgstr "" -#: data/ui/tour.places.ui:200 +#: data/ui/tour.places.ui:199 msgid "Add" msgstr "" -#: data/ui/tour.places.ui:204 +#: data/ui/tour.places.ui:203 msgid "Associate this tour with an existing place." msgstr "" -#: data/ui/tour.places.ui:219 +#: data/ui/tour.places.ui:218 msgid "Delete associated place." msgstr "" -#: data/ui/tour.places.ui:247 +#: data/ui/tour.places.ui:246 msgid "Create a new place to associate." msgstr "" -#: data/ui/query.window.ui:85 +#: data/ui/query.window.ui:84 msgid "Run" msgstr "" -#: data/ui/query.window.ui:127 +#: data/ui/query.window.ui:126 msgid "Statement" msgstr "" -#: data/ui/query.window.ui:157 +#: data/ui/query.window.ui:156 msgid "View and Query" msgstr "" diff --git a/src/main_window.vala b/src/main_window.vala index 272951e..47c270e 100644 --- a/src/main_window.vala +++ b/src/main_window.vala @@ -213,7 +213,7 @@ namespace Sernatur { Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, - dgettext(null, "Error: Could not connect to the database!")); + _ ("Error: Could not connect to the database!")); msg.response.connect ((response_id) => { switch (response_id) { case Gtk.ResponseType.CLOSE: diff --git a/src/tour_editor.vala b/src/tour_editor.vala index e1e4a29..dbfca47 100644 --- a/src/tour_editor.vala +++ b/src/tour_editor.vala @@ -140,6 +140,7 @@ namespace Sernatur { region.get_active_iter (out iter); Region temp_region; if (region_list_store.iter_is_valid (iter)) { + // The region is from the list, not typed region_list_store.get (iter, RegionColumn.REGION, out temp_region); tour.ciudad.region = temp_region; @@ -147,9 +148,6 @@ namespace Sernatur { reset_city (); } } - else { - // New region to be created - } } } @@ -195,9 +193,6 @@ namespace Sernatur { public void on_clicked_button (Gtk.Button button) { if (button == save) { if (tour.id_tour == 0) { - // This is if they typed a new city, TODO - /*print (city.get_active_text () + "\n");*/ - update_tour_instance (); try { Tour.insert_tour (conn, tour); @@ -243,25 +238,77 @@ namespace Sernatur { } } + /** + * Update the the tour object with new info from the editor + */ private void update_tour_instance () { tour.nombre_tour = tour_name.get_text (); tour.costo_indiv = (uint) int.parse (indiv_cost.get_text ()); tour.costo_grupal = (uint) int.parse (group_cost.get_text ()); tour.minima_personas = (uint) minimum_people.get_value_as_int (); - Gtk.TreeIter iter; - Ciudad ciudad; - city.get_active_iter (out iter); - if (city_list_store.iter_is_valid (iter)) { - city_list_store.get (iter, - CityColumn.CITY, out ciudad); - tour.ciudad = ciudad; + if (region.get_active () == -1) { + Region new_region = new Region (0, region.get_active_text ()); + try { + new_region.id_region = Region.insert_region (conn, new_region); + } + catch (Error e) { + #if DEBUG + error (e.message); + #else + warning (e.message); + #endif + } + finally { + update_tour_instance_city (new_region); + } } - Region new_region; - region.get_active_iter (out iter); - if (region_list_store.iter_is_valid (iter)) { - region_list_store.get (iter, - RegionColumn.REGION, out new_region); - tour.ciudad.region = new_region; + else { + Region new_region; + Gtk.TreeIter iter; + region.get_active_iter (out iter); + if (region_list_store.iter_is_valid (iter)) { + region_list_store.get (iter, + RegionColumn.REGION, out new_region); + } + else { + new_region = new Region (); + } + update_tour_instance_city (new_region); + } + } + + /** + * This method updates the city part of the tour instance + * @param new_region The region to insert into the city object + */ + private void update_tour_instance_city (Region new_region) { + Ciudad ciudad; + if (city.get_active () == -1) { + ciudad = new Ciudad (0, city.get_active_text ()); + ciudad.region = new_region; + try { + ciudad.id_ciudad = Ciudad.insert_city (conn, ciudad); + } + catch (Error e) { + #if DEBUG + error (e.message); + #else + warning (e.message); + #endif + } + finally { + tour.ciudad = ciudad; + } + } + else { + Gtk.TreeIter iter; + city.get_active_iter (out iter); + if (city_list_store.iter_is_valid (iter)) { + city_list_store.get (iter, + CityColumn.CITY, out ciudad); + ciudad.region = new_region; + tour.ciudad = ciudad; + } } } diff --git a/src/tour_places.vala b/src/tour_places.vala index fde6fdc..a355344 100644 --- a/src/tour_places.vala +++ b/src/tour_places.vala @@ -207,7 +207,7 @@ namespace Sernatur { Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.YES_NO, - dgettext(null, "Are you sure you wish to delete this tour?")); + _ ("Are you sure you wish to delete this tour?")); msg.response.connect ((response_id) => { switch (response_id) { case Gtk.ResponseType.YES: @@ -227,7 +227,7 @@ namespace Sernatur { Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.CLOSE, - dgettext(null, "Error: Could not delete tour because there are still associated arrival and departure dates and times!")); + _ ("Error: Could not delete tour because there are still associated arrival and departure dates and times!")); msg2.response.connect ((response_id) => { msg2.destroy (); });