Browse Source

a lot of work

Chris Cromer 6 months ago
parent
commit
3aaf811190
Signed by: Chris Cromer <chris@cromer.cl> GPG Key ID: 39CC813FF3C8708A
50 changed files with 1953 additions and 372 deletions
  1. 0
    1
      data/ui/main.window.ui
  2. 0
    1
      data/ui/query.window.ui
  3. 20
    2
      data/ui/tour.editor.ui
  4. 1
    0
      data/ui/tour.gresource.xml
  5. 3
    2
      data/ui/tour.list.ui
  6. 262
    0
      data/ui/tour.places.ui
  7. 26
    3
      lib/db.vala
  8. 6
    6
      lib/db/arrienda.vala
  9. 71
    6
      lib/db/asociado.vala
  10. 6
    6
      lib/db/categoria.vala
  11. 11
    11
      lib/db/ciudad.vala
  12. 6
    6
      lib/db/contacto_emergencia.vala
  13. 6
    6
      lib/db/descuento.vala
  14. 6
    6
      lib/db/empresa.vala
  15. 6
    6
      lib/db/enfermedad.vala
  16. 6
    6
      lib/db/especialidad.vala
  17. 6
    6
      lib/db/guia.vala
  18. 6
    6
      lib/db/lugar.vala
  19. 6
    6
      lib/db/participa.vala
  20. 6
    6
      lib/db/posee.vala
  21. 6
    6
      lib/db/realiza.vala
  22. 6
    6
      lib/db/region.vala
  23. 6
    6
      lib/db/regiones_sin_descuento.vala
  24. 6
    6
      lib/db/requerir_auto.vala
  25. 6
    6
      lib/db/tiene_enfermedad.vala
  26. 6
    6
      lib/db/total_arriendos.vala
  27. 6
    6
      lib/db/total_coordinadores.vala
  28. 6
    6
      lib/db/total_turistas.vala
  29. 6
    6
      lib/db/total_vehiculos.vala
  30. 48
    13
      lib/db/tour.vala
  31. 6
    6
      lib/db/turista.vala
  32. 6
    6
      lib/db/valores_tours.vala
  33. 6
    6
      lib/db/vehiculo.vala
  34. 30
    30
      lib/db/views.vala
  35. 2
    2
      lib/dbwrapper.vala
  36. 6
    6
      lib/misc.vala
  37. 39
    5
      lib/queries.vala
  38. 1
    1
      po/LINGUAS
  39. 2
    0
      po/POTFILES
  40. 102
    40
      po/es.po
  41. 374
    0
      po/es_CL.po
  42. 98
    36
      po/sernatur.pot
  43. 3
    4
      src/main_window.vala
  44. 1
    0
      src/meson.build
  45. 11
    11
      src/query_window.vala
  46. 5
    6
      src/sernatur.vala
  47. 60
    19
      src/tour_editor.vala
  48. 85
    35
      src/tour_list.vala
  49. 551
    0
      src/tour_places.vala
  50. 3
    0
      test/meson.build

+ 0
- 1
data/ui/main.window.ui View File

@@ -20,7 +20,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20 20
     <property name="can_focus">False</property>
21 21
     <property name="title">SERNATUR</property>
22 22
     <property name="window_position">center</property>
23
-    <property name="icon_name">sernatur</property>
24 23
     <signal name="configure-event" handler="on_configure_event" swapped="no"/>
25 24
     <signal name="destroy" handler="on_destroy" swapped="no"/>
26 25
     <signal name="window-state-event" handler="on_window_state_event" swapped="no"/>

+ 0
- 1
data/ui/query.window.ui View File

@@ -24,7 +24,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
24 24
     <property name="default_width">800</property>
25 25
     <property name="default_height">600</property>
26 26
     <property name="destroy_with_parent">True</property>
27
-    <property name="icon_name">sernatur</property>
28 27
     <property name="type_hint">dialog</property>
29 28
     <property name="skip_taskbar_hint">True</property>
30 29
     <property name="skip_pager_hint">True</property>

+ 20
- 2
data/ui/tour.editor.ui View File

@@ -30,7 +30,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
30 30
     <property name="modal">True</property>
31 31
     <property name="window_position">center-on-parent</property>
32 32
     <property name="destroy_with_parent">True</property>
33
-    <property name="icon_name">sernatur</property>
34 33
     <property name="type_hint">dialog</property>
35 34
     <property name="skip_taskbar_hint">True</property>
36 35
     <property name="skip_pager_hint">True</property>
@@ -301,6 +300,25 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
301 300
                 <property name="position">0</property>
302 301
               </packing>
303 302
             </child>
303
+            <child>
304
+              <object class="GtkButton" id="places">
305
+                <property name="label" translatable="yes">Places</property>
306
+                <property name="visible">True</property>
307
+                <property name="can_focus">True</property>
308
+                <property name="receives_default">True</property>
309
+                <property name="tooltip_text" translatable="yes">Add or edit places.</property>
310
+                <property name="margin_left">5</property>
311
+                <property name="margin_right">5</property>
312
+                <property name="margin_top">5</property>
313
+                <property name="margin_bottom">5</property>
314
+                <signal name="clicked" handler="on_clicked_button" swapped="no"/>
315
+              </object>
316
+              <packing>
317
+                <property name="expand">False</property>
318
+                <property name="fill">True</property>
319
+                <property name="position">1</property>
320
+              </packing>
321
+            </child>
304 322
             <child>
305 323
               <object class="GtkButton" id="save">
306 324
                 <property name="label" translatable="yes">Save</property>
@@ -317,7 +335,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
317 335
               <packing>
318 336
                 <property name="expand">False</property>
319 337
                 <property name="fill">True</property>
320
-                <property name="position">1</property>
338
+                <property name="position">2</property>
321 339
               </packing>
322 340
             </child>
323 341
           </object>

+ 1
- 0
data/ui/tour.gresource.xml View File

@@ -16,5 +16,6 @@
16 16
 	<gresource prefix="/cl/cromer/ubb/sernatur">
17 17
 		<file preprocess="xml-stripblanks">tour.list.ui</file>
18 18
 		<file preprocess="xml-stripblanks">tour.editor.ui</file>
19
+		<file preprocess="xml-stripblanks">tour.places.ui</file>
19 20
 	</gresource>
20 21
 </gresources>

+ 3
- 2
data/ui/tour.list.ui View File

@@ -25,7 +25,6 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25 25
     <property name="window_position">center-on-parent</property>
26 26
     <property name="default_height">480</property>
27 27
     <property name="destroy_with_parent">True</property>
28
-    <property name="icon_name">sernatur</property>
29 28
     <property name="type_hint">dialog</property>
30 29
     <property name="skip_taskbar_hint">True</property>
31 30
     <property name="skip_pager_hint">True</property>
@@ -59,6 +58,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
59 58
                 <property name="enable_tree_lines">True</property>
60 59
                 <child internal-child="selection">
61 60
                   <object class="GtkTreeSelection" id="selection">
61
+                    <property name="mode">multiple</property>
62 62
                     <signal name="changed" handler="on_changed_selection" swapped="no"/>
63 63
                   </object>
64 64
                 </child>
@@ -198,10 +198,10 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
198 198
               <object class="GtkButton" id="delete_tour">
199 199
                 <property name="label" translatable="yes">Delete</property>
200 200
                 <property name="visible">True</property>
201
+                <property name="sensitive">False</property>
201 202
                 <property name="can_focus">True</property>
202 203
                 <property name="receives_default">True</property>
203 204
                 <property name="tooltip_text" translatable="yes">Delete selected tour.</property>
204
-                <property name="halign">baseline</property>
205 205
                 <signal name="clicked" handler="on_clicked_button" swapped="no"/>
206 206
               </object>
207 207
               <packing>
@@ -215,6 +215,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
215 215
                 <property name="visible">True</property>
216 216
                 <property name="can_focus">True</property>
217 217
                 <property name="receives_default">True</property>
218
+                <property name="tooltip_text" translatable="yes">Close this window.</property>
218 219
                 <signal name="clicked" handler="on_clicked_button" swapped="no"/>
219 220
               </object>
220 221
               <packing>

+ 262
- 0
data/ui/tour.places.ui View File

@@ -0,0 +1,262 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!-- Generated with glade 3.22.1 
3
+
4
+Copyright 2018-2019 Chris Cromer
5
+
6
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
7
+
8
+1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
9
+
10
+2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
11
+
12
+3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
13
+
14
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
+
16
+-->
17
+<interface domain="sernatur">
18
+  <requires lib="gtk+" version="3.20"/>
19
+  <object class="GtkListStore" id="liststore1"/>
20
+  <template class="SernaturTourPlaces" parent="GtkApplicationWindow">
21
+    <property name="can_focus">False</property>
22
+    <property name="type">popup</property>
23
+    <property name="title" translatable="yes">Places</property>
24
+    <property name="modal">True</property>
25
+    <property name="window_position">center-on-parent</property>
26
+    <property name="default_height">480</property>
27
+    <property name="destroy_with_parent">True</property>
28
+    <property name="type_hint">dialog</property>
29
+    <property name="skip_taskbar_hint">True</property>
30
+    <property name="skip_pager_hint">True</property>
31
+    <property name="show_menubar">False</property>
32
+    <child type="titlebar">
33
+      <placeholder/>
34
+    </child>
35
+    <child>
36
+      <object class="GtkGrid">
37
+        <property name="visible">True</property>
38
+        <property name="can_focus">True</property>
39
+        <child>
40
+          <object class="GtkScrolledWindow">
41
+            <property name="visible">True</property>
42
+            <property name="can_focus">True</property>
43
+            <property name="hexpand">True</property>
44
+            <property name="vexpand">True</property>
45
+            <property name="hscrollbar_policy">never</property>
46
+            <property name="shadow_type">in</property>
47
+            <child>
48
+              <object class="GtkTreeView" id="place_tree">
49
+                <property name="visible">True</property>
50
+                <property name="can_focus">True</property>
51
+                <property name="hexpand">True</property>
52
+                <property name="vexpand">True</property>
53
+                <property name="hscroll_policy">natural</property>
54
+                <property name="vscroll_policy">natural</property>
55
+                <property name="model">liststore1</property>
56
+                <property name="fixed_height_mode">True</property>
57
+                <property name="enable_grid_lines">both</property>
58
+                <property name="enable_tree_lines">True</property>
59
+                <child internal-child="selection">
60
+                  <object class="GtkTreeSelection" id="selection">
61
+                    <property name="mode">multiple</property>
62
+                    <signal name="changed" handler="on_changed_selection" swapped="no"/>
63
+                  </object>
64
+                </child>
65
+                <child>
66
+                  <object class="GtkTreeViewColumn" id="place_name">
67
+                    <property name="sizing">fixed</property>
68
+                    <property name="title" translatable="yes">Place Name</property>
69
+                    <property name="clickable">True</property>
70
+                    <signal name="clicked" handler="on_clicked_column" swapped="no"/>
71
+                    <child>
72
+                      <object class="GtkCellRendererText"/>
73
+                      <attributes>
74
+                        <attribute name="markup">0</attribute>
75
+                      </attributes>
76
+                    </child>
77
+                  </object>
78
+                </child>
79
+                <child>
80
+                  <object class="GtkTreeViewColumn" id="ticket_price">
81
+                    <property name="sizing">fixed</property>
82
+                    <property name="title" translatable="yes">Ticket Price</property>
83
+                    <property name="clickable">True</property>
84
+                    <signal name="clicked" handler="on_clicked_column" swapped="no"/>
85
+                    <child>
86
+                      <object class="GtkCellRendererText"/>
87
+                      <attributes>
88
+                        <attribute name="markup">1</attribute>
89
+                      </attributes>
90
+                    </child>
91
+                  </object>
92
+                </child>
93
+                <child>
94
+                  <object class="GtkTreeViewColumn" id="difficulty">
95
+                    <property name="sizing">fixed</property>
96
+                    <property name="title" translatable="yes">Difficulty</property>
97
+                    <property name="clickable">True</property>
98
+                    <signal name="clicked" handler="on_clicked_column" swapped="no"/>
99
+                    <child>
100
+                      <object class="GtkCellRendererText"/>
101
+                      <attributes>
102
+                        <attribute name="markup">2</attribute>
103
+                      </attributes>
104
+                    </child>
105
+                  </object>
106
+                </child>
107
+                <child>
108
+                  <object class="GtkTreeViewColumn" id="arrival_date">
109
+                    <property name="sizing">fixed</property>
110
+                    <property name="title" translatable="yes">Arrival Date</property>
111
+                    <property name="clickable">True</property>
112
+                    <signal name="clicked" handler="on_clicked_column" swapped="no"/>
113
+                    <child>
114
+                      <object class="GtkCellRendererText"/>
115
+                      <attributes>
116
+                        <attribute name="markup">3</attribute>
117
+                      </attributes>
118
+                    </child>
119
+                  </object>
120
+                </child>
121
+                <child>
122
+                  <object class="GtkTreeViewColumn" id="arrival_time">
123
+                    <property name="sizing">fixed</property>
124
+                    <property name="title" translatable="yes">Arrival Time</property>
125
+                    <property name="clickable">True</property>
126
+                    <signal name="clicked" handler="on_clicked_column" swapped="no"/>
127
+                    <child>
128
+                      <object class="GtkCellRendererText"/>
129
+                      <attributes>
130
+                        <attribute name="markup">4</attribute>
131
+                      </attributes>
132
+                    </child>
133
+                  </object>
134
+                </child>
135
+                <child>
136
+                  <object class="GtkTreeViewColumn" id="departure_date">
137
+                    <property name="sizing">fixed</property>
138
+                    <property name="title" translatable="yes">Departure Date</property>
139
+                    <property name="clickable">True</property>
140
+                    <signal name="clicked" handler="on_clicked_column" swapped="no"/>
141
+                    <child>
142
+                      <object class="GtkCellRendererText"/>
143
+                      <attributes>
144
+                        <attribute name="markup">5</attribute>
145
+                      </attributes>
146
+                    </child>
147
+                  </object>
148
+                </child>
149
+                <child>
150
+                  <object class="GtkTreeViewColumn" id="departure_time">
151
+                    <property name="sizing">fixed</property>
152
+                    <property name="title" translatable="yes">Departure Time</property>
153
+                    <property name="clickable">True</property>
154
+                    <signal name="clicked" handler="on_clicked_column" swapped="no"/>
155
+                    <child>
156
+                      <object class="GtkCellRendererText"/>
157
+                      <attributes>
158
+                        <attribute name="markup">6</attribute>
159
+                      </attributes>
160
+                    </child>
161
+                  </object>
162
+                </child>
163
+              </object>
164
+            </child>
165
+          </object>
166
+          <packing>
167
+            <property name="left_attach">0</property>
168
+            <property name="top_attach">0</property>
169
+          </packing>
170
+        </child>
171
+        <child>
172
+          <object class="GtkGrid">
173
+            <property name="visible">True</property>
174
+            <property name="can_focus">True</property>
175
+            <property name="margin_left">5</property>
176
+            <property name="margin_right">5</property>
177
+            <property name="margin_top">5</property>
178
+            <property name="margin_bottom">5</property>
179
+            <property name="hexpand">True</property>
180
+            <property name="column_spacing">25</property>
181
+            <property name="column_homogeneous">True</property>
182
+            <child>
183
+              <object class="GtkButton" id="edit_place">
184
+                <property name="label" translatable="yes">Edit</property>
185
+                <property name="visible">True</property>
186
+                <property name="sensitive">False</property>
187
+                <property name="can_focus">True</property>
188
+                <property name="receives_default">True</property>
189
+                <property name="tooltip_text" translatable="yes">Edit associated place.</property>
190
+                <signal name="clicked" handler="on_clicked_button" swapped="no"/>
191
+              </object>
192
+              <packing>
193
+                <property name="left_attach">2</property>
194
+                <property name="top_attach">0</property>
195
+              </packing>
196
+            </child>
197
+            <child>
198
+              <object class="GtkButton" id="add_place">
199
+                <property name="label" translatable="yes">Add</property>
200
+                <property name="visible">True</property>
201
+                <property name="can_focus">True</property>
202
+                <property name="receives_default">True</property>
203
+                <property name="tooltip_text" translatable="yes">Associate this tour with an existing place.</property>
204
+                <signal name="clicked" handler="on_clicked_button" swapped="no"/>
205
+              </object>
206
+              <packing>
207
+                <property name="left_attach">0</property>
208
+                <property name="top_attach">0</property>
209
+              </packing>
210
+            </child>
211
+            <child>
212
+              <object class="GtkButton" id="delete_place">
213
+                <property name="label" translatable="yes">Delete</property>
214
+                <property name="visible">True</property>
215
+                <property name="sensitive">False</property>
216
+                <property name="can_focus">True</property>
217
+                <property name="receives_default">True</property>
218
+                <property name="tooltip_text" translatable="yes">Delete associated place.</property>
219
+                <signal name="clicked" handler="on_clicked_button" swapped="no"/>
220
+              </object>
221
+              <packing>
222
+                <property name="left_attach">3</property>
223
+                <property name="top_attach">0</property>
224
+              </packing>
225
+            </child>
226
+            <child>
227
+              <object class="GtkButton" id="close_place">
228
+                <property name="label" translatable="yes">Close</property>
229
+                <property name="visible">True</property>
230
+                <property name="can_focus">True</property>
231
+                <property name="receives_default">True</property>
232
+                <property name="tooltip_text" translatable="yes">Close this window.</property>
233
+                <signal name="clicked" handler="on_clicked_button" swapped="no"/>
234
+              </object>
235
+              <packing>
236
+                <property name="left_attach">4</property>
237
+                <property name="top_attach">0</property>
238
+              </packing>
239
+            </child>
240
+            <child>
241
+              <object class="GtkButton" id="new_place">
242
+                <property name="label" translatable="yes">New</property>
243
+                <property name="visible">True</property>
244
+                <property name="can_focus">True</property>
245
+                <property name="receives_default">True</property>
246
+                <property name="tooltip_text" translatable="yes">Create a new place to associate.</property>
247
+              </object>
248
+              <packing>
249
+                <property name="left_attach">1</property>
250
+                <property name="top_attach">0</property>
251
+              </packing>
252
+            </child>
253
+          </object>
254
+          <packing>
255
+            <property name="left_attach">0</property>
256
+            <property name="top_attach">1</property>
257
+          </packing>
258
+        </child>
259
+      </object>
260
+    </child>
261
+  </template>
262
+</interface>

+ 26
- 3
lib/db.vala View File

@@ -29,7 +29,11 @@ namespace LibSernatur {
29 29
 			/**
30 30
 			 * Connection error
31 31
 			 */
32
-			CONNECT
32
+			CONNECT,
33
+			/**
34
+			 * Escape error
35
+			 */
36
+			ESCAPE
33 37
 		}
34 38
 
35 39
 		/**
@@ -49,7 +53,7 @@ namespace LibSernatur {
49 53
 		/**
50 54
 		 * Class to handle database connections
51 55
 		 */
52
-		public class Connection : GLib.Object {
56
+		public class Connection : Object {
53 57
 			/**
54 58
 			 * The database connection
55 59
 			 */
@@ -71,7 +75,26 @@ namespace LibSernatur {
71 75
 				if (db.get_status () != Postgres.ConnectionStatus.OK) {
72 76
 					throw new PostgresError.CONNECT (db.get_error_message ());
73 77
 				}
74
-				GLib.print (dgettext (null, "Postgresql server version:") + " %d\n", db.get_server_version ());
78
+				GLib.print (_ ("Postgresql server version:") + " %d\n", db.get_server_version ());
79
+			}
80
+
81
+			/**
82
+			 * Escape a string to be safe to use in Postgresql queries
83
+			 * @param str The string to escape
84
+			 * @return Returns the escaped string
85
+			 * @throws PostgresError Thrown if there was some problem escaping the string
86
+			 */
87
+			public string escape (string str) throws PostgresError {
88
+				string* to = malloc ((sizeof (string) * str.length * 2) + 1); // to has to be double the size of str + 1
89
+				int error_code;
90
+				db.escape_string_conn (to, str, str.length, out error_code);
91
+				if (error_code != 0) {
92
+					throw new PostgresError.ESCAPE (db.get_error_message ());
93
+				}
94
+
95
+				string result = to;
96
+				free (to);
97
+				return result;
75 98
 			}
76 99
 		}
77 100
 	}

+ 6
- 6
lib/db/arrienda.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Arrienda class based on the database table
22 22
 		 */
23
-		public class Arrienda : GLib.Object {
23
+		public class Arrienda : Object {
24 24
 			/**
25 25
 			 * The price
26 26
 			 */
@@ -54,11 +54,11 @@ namespace LibSernatur {
54 54
 
55 55
 			/**
56 56
 			 * Get all tuples and fields from database
57
-			 * @param conn The database connection to use
57
+			 * @param conn.db.The database conn.db.ction to use
58 58
 			 * @return Returns a list of Arrienda
59 59
 			 */
60
-			public static List<Arrienda> get_all_arriendas (Database conn) {
61
-				var res = conn.exec ("
60
+			public static List<Arrienda> get_all_arriendas (Connection conn) {
61
+				var res = conn.db.exec ("
62 62
 SELECT A.precio, A.fecha_devolucion,
63 63
 V.patente, V.ano_vehiculo, V.marca, V.capacidad,
64 64
 E.rut_empresa, E.nombre_empresa, E.contacto, E.telefono
@@ -68,9 +68,9 @@ JOIN empresa E ON (A.rut_empresa = E.rut_empresa)
68 68
 				");
69 69
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
70 70
 					#if DEBUG
71
-						error (conn.get_error_message ());
71
+						error (conn.db.get_error_message ());
72 72
 					#else
73
-						warning (conn.get_error_message ());
73
+						warning (conn.db.get_error_message ());
74 74
 						return new List<Arrienda> ();
75 75
 					#endif
76 76
 				}

+ 71
- 6
lib/db/asociado.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Asociado class based on the database table
22 22
 		 */
23
-		public class Asociado : GLib.Object {
23
+		public class Asociado : Object {
24 24
 			public string fecha_llegada { get; set; default = ""; }
25 25
 			public string hora_llegada { get; set; default = ""; }
26 26
 			public string fecha_salida { get; set; default = ""; }
@@ -48,11 +48,11 @@ namespace LibSernatur {
48 48
 
49 49
 			/**
50 50
 			 * Get all tuples and fields from database
51
-			 * @param conn The database connection to use
51
+			 * @param conn.db.The database conn.db.ction to use
52 52
 			 * @return Returns a list of Asociado
53 53
 			 */
54
-			public static List<Asociado> get_all_asociados (Database conn) {
55
-				var res = conn.exec ("
54
+			public static List<Asociado> get_all_asociados (Connection conn) {
55
+				var res = conn.db.exec ("
56 56
 SELECT A.fecha_llegada, A.hora_llegada, A.fecha_salida, A.hora_salida,
57 57
 T.id_tour, T.nombre_tour, T.costo_indiv, T.costo_grupal, T.minima_personas,
58 58
 C.id_ciudad, C.nombre_ciudad,
@@ -70,9 +70,9 @@ JOIN region R2 ON (C2.id_region = R2.id_region)
70 70
 				");
71 71
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
72 72
 					#if DEBUG
73
-						error (conn.get_error_message ());
73
+						error (conn.db.get_error_message ());
74 74
 					#else
75
-						warning (conn.get_error_message ());
75
+						warning (conn.db.get_error_message ());
76 76
 						return new List<Asociado> ();
77 77
 					#endif
78 78
 				}
@@ -99,7 +99,72 @@ JOIN region R2 ON (C2.id_region = R2.id_region)
99 99
 								)
100 100
 							),
101 101
 							new Lugar (wra.get_int_n (i, "id_lugar"),
102
+								wra.get_string_n (i, "nombre_lugar"),
103
+								wra.get_int_n (i, "valor_entrada"),
104
+								wra.get_int_n (i, "nivel"),
105
+								new Ciudad (wra.get_int_n (i, "id_ciudad_lugar"),
106
+									wra.get_string_n (i, "nombre_ciudad_lugar"),
107
+									new Region (wra.get_int_n (i, "id_region_lugar"),
108
+										wra.get_string_n (i, "nombre_region_lugar")
109
+									)
110
+								)
111
+							)
112
+						);
113
+						list.append (asociado);
114
+					}
115
+					catch (Error e) {
116
+						#if DEBUG
117
+							error (e.message);
118
+						#else
119
+							warning (e.message);
120
+						#endif
121
+					}
122
+				}
123
+				return list;
124
+			}
125
+
126
+			/**
127
+			 * Get all tuples and fields from database
128
+			 * @param conn.db.The database conn.db.ction to use
129
+			 * @return Returns a list of Asociado based off a tour id
130
+			 */
131
+			public static List<Asociado> get_all_asociados_by_tour (Connection conn, Tour tour) throws PostgresError, DBError {
132
+				if (tour.id_tour == 0) {
133
+					throw new DBError.INVALID_VALUE (dgettext (null, "The id of the tour is invalid!"));
134
+				}
135
+				var res = conn.db.exec (Query.get_query (conn, Query.Type.SELECT_ALL_ASSOCIATED_BY_TOUR, tour));
136
+				if (res.get_status () != ExecStatus.TUPLES_OK) {
137
+					#if DEBUG
138
+						error (conn.db.get_error_message ());
139
+					#else
140
+						warning (conn.db.get_error_message ());
141
+						return new List<Asociado> ();
142
+					#endif
143
+				}
144
+
145
+				var wra = new ResultWrapper (res);
146
+				List<Asociado> list = new List<Asociado> ();
147
+				int n = res.get_n_tuples ();
148
+				for (int i = 0; i < n; i++) {
149
+					try {
150
+						var asociado = new Asociado (wra.get_string_n (i, "fecha_llegada"),
151
+							wra.get_string_n (i, "hora_llegada"),
152
+							wra.get_string_n (i, "fecha_salida"),
153
+							wra.get_string_n (i, "hora_salida"),
154
+							new Tour (wra.get_int_n (i, "id_tour"),
102 155
 								wra.get_string_n (i, "nombre_tour"),
156
+								wra.get_int_n (i, "costo_indiv"),
157
+								wra.get_int_n (i, "costo_grupal"),
158
+								wra.get_int_n (i, "minima_personas"),
159
+								new Ciudad (wra.get_int_n (i, "id_ciudad"),
160
+									wra.get_string_n (i, "nombre_ciudad"),
161
+									new Region (wra.get_int_n (i, "id_region"),
162
+										wra.get_string_n (i, "nombre_region")
163
+									)
164
+								)
165
+							),
166
+							new Lugar (wra.get_int_n (i, "id_lugar"),
167
+								wra.get_string_n (i, "nombre_lugar"),
103 168
 								wra.get_int_n (i, "valor_entrada"),
104 169
 								wra.get_int_n (i, "nivel"),
105 170
 								new Ciudad (wra.get_int_n (i, "id_ciudad_lugar"),

+ 6
- 6
lib/db/categoria.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Categoria class based on the database table
22 22
 		 */
23
-		public class Categoria : GLib.Object {
23
+		public class Categoria : Object {
24 24
 			/**
25 25
 			 * The id of the category
26 26
 			 */
@@ -42,18 +42,18 @@ namespace LibSernatur {
42 42
 
43 43
 			/**
44 44
 			 * Get all tuples and fields from database
45
-			 * @param conn The database connection to use
45
+			 * @param conn.db.The database conn.db.ction to use
46 46
 			 * @return Returns a list of Categoria
47 47
 			 */
48
-			public static List<Categoria> get_all_categorias (Database conn) {
49
-				var res = conn.exec ("
48
+			public static List<Categoria> get_all_categorias (Connection conn) {
49
+				var res = conn.db.exec ("
50 50
 SELECT id_categoria, descripcion_categoria FROM categoria
51 51
 				");
52 52
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
53 53
 					#if DEBUG
54
-						error (conn.get_error_message ());
54
+						error (conn.db.get_error_message ());
55 55
 					#else
56
-						warning (conn.get_error_message ());
56
+						warning (conn.db.get_error_message ());
57 57
 						return new List<Categoria> ();
58 58
 					#endif
59 59
 				}

+ 11
- 11
lib/db/ciudad.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Ciudad class based on the database table
22 22
 		 */
23
-		public class Ciudad : GLib.Object {
23
+		public class Ciudad : Object {
24 24
 			/**
25 25
 			 * The id of the city
26 26
 			 */
@@ -48,11 +48,11 @@ namespace LibSernatur {
48 48
 
49 49
 			/**
50 50
 			 * Get all tuples and fields from database
51
-			 * @param conn The database connection to use
51
+			 * @param conn.db.The database conn.db.ction to use
52 52
 			 * @return Returns a list of Ciudad
53 53
 			 */
54
-			public static List<Ciudad> get_all_ciudades (Database conn) {
55
-				var res = conn.exec ("
54
+			public static List<Ciudad> get_all_ciudades (Connection conn) {
55
+				var res = conn.db.exec ("
56 56
 SELECT C.id_ciudad, C.nombre_ciudad,
57 57
 R.id_region, R.nombre_region
58 58
 FROM ciudad C
@@ -60,9 +60,9 @@ JOIN region R ON (C.id_region = R.id_region)
60 60
 				");
61 61
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
62 62
 					#if DEBUG
63
-						error (conn.get_error_message ());
63
+						error (conn.db.get_error_message ());
64 64
 					#else
65
-						warning (conn.get_error_message ());
65
+						warning (conn.db.get_error_message ());
66 66
 						return new List<Ciudad> ();
67 67
 					#endif
68 68
 				}
@@ -93,12 +93,12 @@ JOIN region R ON (C.id_region = R.id_region)
93 93
 
94 94
 			/**
95 95
 			 * Get all tuples and fields from database that are within a certain region
96
-			 * @param conn The database connection to use
96
+			 * @param conn.db.The database conn.db.ction to use
97 97
 			 * @param region_id The id of the region to filter that results
98 98
 			 * @return Returns a list of Ciudad
99 99
 			 */
100
-			public static List<Ciudad> get_all_ciudades_in_region(Database conn, uint region_id) {
101
-				var res = conn.exec ("
100
+			public static List<Ciudad> get_all_ciudades_in_region(Connection conn, uint region_id) {
101
+				var res = conn.db.exec ("
102 102
 SELECT C.id_ciudad, C.nombre_ciudad,
103 103
 R.id_region, R.nombre_region
104 104
 FROM ciudad C
@@ -107,9 +107,9 @@ WHERE (R.id_region = " + region_id.to_string () + ")
107 107
 				");
108 108
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
109 109
 					#if DEBUG
110
-						error (conn.get_error_message ());
110
+						error (conn.db.get_error_message ());
111 111
 					#else
112
-						warning (conn.get_error_message ());
112
+						warning (conn.db.get_error_message ());
113 113
 						return new List<Ciudad> ();
114 114
 					#endif
115 115
 				}

+ 6
- 6
lib/db/contacto_emergencia.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The ContactoEmergencia class based on the database table
22 22
 		 */
23
-		public class ContactoEmergencia : GLib.Object {
23
+		public class ContactoEmergencia : Object {
24 24
 			/**
25 25
 			 * The id of the contact
26 26
 			 */
@@ -48,16 +48,16 @@ namespace LibSernatur {
48 48
 
49 49
 			/**
50 50
 			 * Get all tuples and fields from database
51
-			 * @param conn The database connection to use
51
+			 * @param conn.db.The database conn.db.ction to use
52 52
 			 * @return Returns a list of ContactoEmergencia
53 53
 			 */
54
-			public static List<ContactoEmergencia> get_all_contactos (Database conn) {
55
-				var res = conn.exec ("SELECT id_contacto, telefono_emergencia, nombre_emergencia FROM contacto_emergencia");
54
+			public static List<ContactoEmergencia> get_all_contactos (Connection conn) {
55
+				var res = conn.db.exec ("SELECT id_contacto, telefono_emergencia, nombre_emergencia FROM contacto_emergencia");
56 56
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
57 57
 					#if DEBUG
58
-						error (conn.get_error_message ());
58
+						error (conn.db.get_error_message ());
59 59
 					#else
60
-						warning (conn.get_error_message ());
60
+						warning (conn.db.get_error_message ());
61 61
 						return new List<ContactoEmergencia> ();
62 62
 					#endif
63 63
 				}

+ 6
- 6
lib/db/descuento.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Descuento class based on the database table
22 22
 		 */
23
-		public class Descuento : GLib.Object {
23
+		public class Descuento : Object {
24 24
 			/**
25 25
 			 * The id of the discount
26 26
 			 */
@@ -48,18 +48,18 @@ namespace LibSernatur {
48 48
 
49 49
 			/**
50 50
 			 * Get all tuples and fields from database
51
-			 * @param conn The database connection to use
51
+			 * @param conn.db.The database conn.db.ction to use
52 52
 			 * @return Returns a list of Descuento
53 53
 			 */
54
-			public static List<Descuento> get_all_descuentos (Database conn) {
55
-				var res = conn.exec ("
54
+			public static List<Descuento> get_all_descuentos (Connection conn) {
55
+				var res = conn.db.exec ("
56 56
 SELECT id_descuento, descripcion_descuento, porcentaje FROM descuento
57 57
 				");
58 58
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
59 59
 					#if DEBUG
60
-						error (conn.get_error_message ());
60
+						error (conn.db.get_error_message ());
61 61
 					#else
62
-						warning (conn.get_error_message ());
62
+						warning (conn.db.get_error_message ());
63 63
 						return new List<Descuento> ();
64 64
 					#endif
65 65
 				}

+ 6
- 6
lib/db/empresa.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Empresa class based on the database table
22 22
 		 */
23
-		public class Empresa : GLib.Object {
23
+		public class Empresa : Object {
24 24
 			/**
25 25
 			 * The RUT of the company
26 26
 			 */
@@ -54,18 +54,18 @@ namespace LibSernatur {
54 54
 
55 55
 			/**
56 56
 			 * Get all tuples and fields from database
57
-			 * @param conn The database connection to use
57
+			 * @param conn.db.The database conn.db.ction to use
58 58
 			 * @return Returns a list of Empresa
59 59
 			 */
60
-			public static List<Empresa> get_all_empresas (Database conn) {
61
-				var res = conn.exec ("
60
+			public static List<Empresa> get_all_empresas (Connection conn) {
61
+				var res = conn.db.exec ("
62 62
 SELECT rut_empresa, nombre_empresa, contacto, telefono FROM empresa
63 63
 				");
64 64
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
65 65
 					#if DEBUG
66
-						error (conn.get_error_message ());
66
+						error (conn.db.get_error_message ());
67 67
 					#else
68
-						warning (conn.get_error_message ());
68
+						warning (conn.db.get_error_message ());
69 69
 						return new List<Empresa> ();
70 70
 					#endif
71 71
 				}

+ 6
- 6
lib/db/enfermedad.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Enfermedad class based on the database table
22 22
 		 */
23
-		public class Enfermedad : GLib.Object {
23
+		public class Enfermedad : Object {
24 24
 			/**
25 25
 			 * The id of the illness
26 26
 			 */
@@ -42,18 +42,18 @@ namespace LibSernatur {
42 42
 
43 43
 			/**
44 44
 			 * Get all tuples and fields from database
45
-			 * @param conn The database connection to use
45
+			 * @param conn.db.The database conn.db.ction to use
46 46
 			 * @return Returns a list of Enfermedad
47 47
 			 */
48
-			public static List<Enfermedad> get_all_enfermedades (Database conn) {
49
-				var res = conn.exec ("
48
+			public static List<Enfermedad> get_all_enfermedades (Connection conn) {
49
+				var res = conn.db.exec ("
50 50
 SELECT id_enfermedad, descripcion_enfermedad FROM enfermedad
51 51
 				");
52 52
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
53 53
 					#if DEBUG
54
-						error (conn.get_error_message ());
54
+						error (conn.db.get_error_message ());
55 55
 					#else
56
-						warning (conn.get_error_message ());
56
+						warning (conn.db.get_error_message ());
57 57
 						return new List<Enfermedad> ();
58 58
 					#endif
59 59
 				}

+ 6
- 6
lib/db/especialidad.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Esepcialidad class based on the database table
22 22
 		 */
23
-		public class Especialidad : GLib.Object {
23
+		public class Especialidad : Object {
24 24
 			/**
25 25
 			 * The id of the specialty
26 26
 			 */
@@ -42,18 +42,18 @@ namespace LibSernatur {
42 42
 
43 43
 			/**
44 44
 			 * Get all tuples and fields from database
45
-			 * @param conn The database connection to use
45
+			 * @param conn.db.The database conn.db.ction to use
46 46
 			 * @return Returns a list of Especialidad
47 47
 			 */
48
-			public static List<Especialidad> get_all_especialidades (Database conn) {
49
-				var res = conn.exec ("
48
+			public static List<Especialidad> get_all_especialidades (Connection conn) {
49
+				var res = conn.db.exec ("
50 50
 SELECT id_especialidad, descripcion_especialidad FROM especialidad
51 51
 				");
52 52
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
53 53
 					#if DEBUG
54
-						error (conn.get_error_message ());
54
+						error (conn.db.get_error_message ());
55 55
 					#else
56
-						warning (conn.get_error_message ());
56
+						warning (conn.db.get_error_message ());
57 57
 						return new List<Especialidad> ();
58 58
 					#endif
59 59
 				}

+ 6
- 6
lib/db/guia.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Guia class based on the database table
22 22
 		 */
23
-		public class Guia : GLib.Object {
23
+		public class Guia : Object {
24 24
 			/**
25 25
 			 * The RUT of the guide
26 26
 			 */
@@ -60,11 +60,11 @@ namespace LibSernatur {
60 60
 
61 61
 			/**
62 62
 			 * Get all tuples and fields from database
63
-			 * @param conn The database connection to use
63
+			 * @param conn.db.The database conn.db.ction to use
64 64
 			 * @return Returns a list of Guia
65 65
 			 */
66
-			public static List<Guia> get_all_guias (Database conn) {
67
-				var res = conn.exec ("
66
+			public static List<Guia> get_all_guias (Connection conn) {
67
+				var res = conn.db.exec ("
68 68
 SELECT G.rut_guia, G.nombre_guia, G.calle, G.numero,
69 69
 C.id_ciudad, C.nombre_ciudad,
70 70
 R.id_region, R.nombre_region
@@ -74,9 +74,9 @@ JOIN region R ON (C.id_region = R.id_region)
74 74
 				");
75 75
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
76 76
 					#if DEBUG
77
-						error (conn.get_error_message ());
77
+						error (conn.db.get_error_message ());
78 78
 					#else
79
-						warning (conn.get_error_message ());
79
+						warning (conn.db.get_error_message ());
80 80
 						return new List<Guia> ();
81 81
 					#endif
82 82
 				}

+ 6
- 6
lib/db/lugar.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Lugar class based on the database table
22 22
 		 */
23
-		public class Lugar : GLib.Object {
23
+		public class Lugar : Object {
24 24
 			/**
25 25
 			 * The id of the place
26 26
 			 */
@@ -60,11 +60,11 @@ namespace LibSernatur {
60 60
 
61 61
 			/**
62 62
 			 * Get all tuples and fields from database
63
-			 * @param conn The database connection to use
63
+			 * @param conn.db.The database conn.db.ction to use
64 64
 			 * @return Returns a list of Lugar
65 65
 			 */
66
-			public static List<Lugar> get_all_lugares (Database conn) {
67
-				var res = conn.exec ("
66
+			public static List<Lugar> get_all_lugares (Connection conn) {
67
+				var res = conn.db.exec ("
68 68
 SELECT L.id_lugar, L.nombre_lugar, L.valor_entrada, L.nivel,
69 69
 C.id_ciudad, C.nombre_ciudad,
70 70
 R.id_region, R.nombre_region
@@ -74,9 +74,9 @@ JOIN region R ON (C.id_region = R.id_region)
74 74
 				");
75 75
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
76 76
 					#if DEBUG
77
-						error (conn.get_error_message ());
77
+						error (conn.db.get_error_message ());
78 78
 					#else
79
-						warning (conn.get_error_message ());
79
+						warning (conn.db.get_error_message ());
80 80
 						return new List<Lugar> ();
81 81
 					#endif
82 82
 				}

+ 6
- 6
lib/db/participa.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Participa class based on the database table
22 22
 		 */
23
-		public class Participa : GLib.Object {
23
+		public class Participa : Object {
24 24
 			/**
25 25
 			 * The tour
26 26
 			 */
@@ -48,11 +48,11 @@ namespace LibSernatur {
48 48
 
49 49
 			/**
50 50
 			 * Get all tuples and fields from database
51
-			 * @param conn The database connection to use
51
+			 * @param conn.db.The database conn.db.ction to use
52 52
 			 * @return Returns a list of Participa
53 53
 			 */
54
-			public static List<Participa> get_all_participas (Database conn) {
55
-				var res = conn.exec ("
54
+			public static List<Participa> get_all_participas (Connection conn) {
55
+				var res = conn.db.exec ("
56 56
 SELECT T.id_tour, T.nombre_tour, T.costo_indiv, T.costo_grupal, T.minima_personas,
57 57
 C.id_ciudad, C.nombre_ciudad,
58 58
 R.id_region, R.nombre_region,
@@ -71,9 +71,9 @@ JOIN categoria C3 ON (P.id_categoria = C3.id_categoria)
71 71
 				");
72 72
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
73 73
 					#if DEBUG
74
-						error (conn.get_error_message ());
74
+						error (conn.db.get_error_message ());
75 75
 					#else
76
-						warning (conn.get_error_message ());
76
+						warning (conn.db.get_error_message ());
77 77
 						return new List<Participa> ();
78 78
 					#endif
79 79
 				}

+ 6
- 6
lib/db/posee.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Posee class based on the database table
22 22
 		 */
23
-		public class Posee : GLib.Object {
23
+		public class Posee : Object {
24 24
 			/**
25 25
 			 * The specialty level
26 26
 			 */
@@ -48,11 +48,11 @@ namespace LibSernatur {
48 48
 
49 49
 			/**
50 50
 			 * Get all tuples and fields from database
51
-			 * @param conn The database connection to use
51
+			 * @param conn.db.The database conn.db.ction to use
52 52
 			 * @return Returns a list of Posee
53 53
 			 */
54
-			public static List<Posee> get_all_posees (Database conn) {
55
-				var res = conn.exec ("
54
+			public static List<Posee> get_all_posees (Connection conn) {
55
+				var res = conn.db.exec ("
56 56
 SELECT P.nivel_especialidad,
57 57
 G.rut_guia, G.nombre_guia, G.calle, G.numero,
58 58
 C.id_ciudad, C.nombre_ciudad,
@@ -66,9 +66,9 @@ JOIN especialidad E ON (P.id_especialidad = E.id_especialidad)
66 66
 				");
67 67
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
68 68
 					#if DEBUG
69
-						error (conn.get_error_message ());
69
+						error (conn.db.get_error_message ());
70 70
 					#else
71
-						warning (conn.get_error_message ());
71
+						warning (conn.db.get_error_message ());
72 72
 						return new List<Posee> ();
73 73
 					#endif
74 74
 				}

+ 6
- 6
lib/db/realiza.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Realiza class based on the database table
22 22
 		 */
23
-		public class Realiza : GLib.Object {
23
+		public class Realiza : Object {
24 24
 			/**
25 25
 			 * The tour
26 26
 			 */
@@ -48,11 +48,11 @@ namespace LibSernatur {
48 48
 
49 49
 			/**
50 50
 			 * Get all tuples and fields from database
51
-			 * @param conn The database connection to use
51
+			 * @param conn.db.The database conn.db.ction to use
52 52
 			 * @return Returns a list of Realiza
53 53
 			 */
54
-			public static List<Realiza> get_all_realizas (Database conn) {
55
-				var res = conn.exec ("
54
+			public static List<Realiza> get_all_realizas (Connection conn) {
55
+				var res = conn.db.exec ("
56 56
 SELECT T.id_tour, T.nombre_tour, T.costo_indiv, T.costo_grupal, T.minima_personas,
57 57
 C.id_ciudad, C.nombre_ciudad,
58 58
 R.id_region, R.nombre_region,
@@ -69,9 +69,9 @@ JOIN descuento D ON (RE.id_descuento = D.id_descuento)
69 69
 				");
70 70
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
71 71
 					#if DEBUG
72
-						error (conn.get_error_message ());
72
+						error (conn.db.get_error_message ());
73 73
 					#else
74
-						warning (conn.get_error_message ());
74
+						warning (conn.db.get_error_message ());
75 75
 						return new List<Realiza> ();
76 76
 					#endif
77 77
 				}

+ 6
- 6
lib/db/region.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Region class based on the database table
22 22
 		 */
23
-		public class Region : GLib.Object {
23
+		public class Region : Object {
24 24
 			/**
25 25
 			 * The id of the region
26 26
 			 */
@@ -42,18 +42,18 @@ namespace LibSernatur {
42 42
 
43 43
 			/**
44 44
 			 * Get all tuples and fields from database
45
-			 * @param conn The database connection to use
45
+			 * @param conn.db.The database conn.db.ction to use
46 46
 			 * @return Returns a list of Region
47 47
 			 */
48
-			public static List<Region> get_all_regiones (Database conn) {
49
-				var res = conn.exec ("
48
+			public static List<Region> get_all_regiones (Connection conn) {
49
+				var res = conn.db.exec ("
50 50
 SELECT id_region, nombre_region FROM region
51 51
 				");
52 52
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
53 53
 					#if DEBUG
54
-						error (conn.get_error_message ());
54
+						error (conn.db.get_error_message ());
55 55
 					#else
56
-						warning (conn.get_error_message ());
56
+						warning (conn.db.get_error_message ());
57 57
 						return new List<Region> ();
58 58
 					#endif
59 59
 				}

+ 6
- 6
lib/db/regiones_sin_descuento.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The RegionesSinDescuento class based on the database table
22 22
 		 */
23
-		public class RegionesSinDescuento : GLib.Object {
23
+		public class RegionesSinDescuento : Object {
24 24
 			/**
25 25
 			 * The name of the region
26 26
 			 */
@@ -41,18 +41,18 @@ namespace LibSernatur {
41 41
 
42 42
 			/**
43 43
 			 * Get all tuples and fields from database
44
-			 * @param conn The database connection to use
44
+			 * @param conn.db.The database conn.db.ction to use
45 45
 			 * @return Returns a list of RegionesSinDescuento
46 46
 			 */
47
-			public static List<RegionesSinDescuento> get_all_regions_without_discount (Database conn) {
48
-				var res = conn.exec ("
47
+			public static List<RegionesSinDescuento> get_all_regions_without_discount (Connection conn) {
48
+				var res = conn.db.exec ("
49 49
 SELECT nombreRegion, cantidad FROM REGIONES_SINDESCUENTO
50 50
 				");
51 51
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
52 52
 					#if DEBUG
53
-						error (conn.get_error_message ());
53
+						error (conn.db.get_error_message ());
54 54
 					#else
55
-						warning (conn.get_error_message ());
55
+						warning (conn.db.get_error_message ());
56 56
 						return new List<RegionesSinDescuento> ();
57 57
 					#endif
58 58
 				}

+ 6
- 6
lib/db/requerir_auto.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The RequerirAuto class based on the database table
22 22
 		 */
23
-		public class RequerirAuto : GLib.Object {
23
+		public class RequerirAuto : Object {
24 24
 			/**
25 25
 			 * The chofer
26 26
 			 */
@@ -48,11 +48,11 @@ namespace LibSernatur {
48 48
 
49 49
 			/**
50 50
 			 * Get all tuples and fields from database
51
-			 * @param conn The database connection to use
51
+			 * @param conn.db.The database conn.db.ction to use
52 52
 			 * @return Returns a list of RequerirAuto
53 53
 			 */
54
-			public static List<RequerirAuto> get_all_requerir_autos (Database conn) {
55
-				var res = conn.exec ("
54
+			public static List<RequerirAuto> get_all_requerir_autos (Connection conn) {
55
+				var res = conn.db.exec ("
56 56
 SELECT R.chofer,
57 57
 T.id_tour, T.nombre_tour, T.costo_indiv, T.costo_grupal, T.minima_personas,
58 58
 C.id_ciudad, C.nombre_ciudad,
@@ -66,9 +66,9 @@ Join vehiculo V ON (R.patente = V.patente)
66 66
 				");
67 67
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
68 68
 					#if DEBUG
69
-						error (conn.get_error_message ());
69
+						error (conn.db.get_error_message ());
70 70
 					#else
71
-						warning (conn.get_error_message ());
71
+						warning (conn.db.get_error_message ());
72 72
 						return new List<RequerirAuto> ();
73 73
 					#endif
74 74
 				}

+ 6
- 6
lib/db/tiene_enfermedad.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The TieneEnfermedad class based on the database table
22 22
 		 */
23
-		public class TieneEnfermedad : GLib.Object {
23
+		public class TieneEnfermedad : Object {
24 24
 			/**
25 25
 			 * The tourist
26 26
 			 */
@@ -42,11 +42,11 @@ namespace LibSernatur {
42 42
 
43 43
 			/**
44 44
 			 * Get all tuples and fields from database
45
-			 * @param conn The database connection to use
45
+			 * @param conn.db.The database conn.db.ction to use
46 46
 			 * @return Returns a list of TieneEnfermedad
47 47
 			 */
48
-			public static List<TieneEnfermedad> get_all_tiene_enfermedades (Database conn) {
49
-				var res = conn.exec ("
48
+			public static List<TieneEnfermedad> get_all_tiene_enfermedades (Connection conn) {
49
+				var res = conn.db.exec ("
50 50
 SELECT T.rut_turista, T.nombre_turista, T.fecha_nacimento,
51 51
 C.id_contacto, C.telefono_emergencia, C.nombre_emergencia,
52 52
 E.id_enfermedad, E.descripcion_enfermedad
@@ -57,9 +57,9 @@ JOIN enfermedad E ON (TE.id_enfermedad = E.id_enfermedad)
57 57
 				");
58 58
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
59 59
 					#if DEBUG
60
-						error (conn.get_error_message ());
60
+						error (conn.db.get_error_message ());
61 61
 					#else
62
-						warning (conn.get_error_message ());
62
+						warning (conn.db.get_error_message ());
63 63
 						return new List<TieneEnfermedad> ();
64 64
 					#endif
65 65
 				}

+ 6
- 6
lib/db/total_arriendos.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The TotalArriendos class based on the database table
22 22
 		 */
23
-		public class TotalArriendos : GLib.Object {
23
+		public class TotalArriendos : Object {
24 24
 			/**
25 25
 			 * The total of rented vehicles
26 26
 			 */
@@ -36,18 +36,18 @@ namespace LibSernatur {
36 36
 
37 37
 			/**
38 38
 			 * Get all tuples and fields from database
39
-			 * @param conn The database connection to use
39
+			 * @param conn.db.The database conn.db.ction to use
40 40
 			 * @return Returns a list of TotalArriendos
41 41
 			 */
42
-			public static List<TotalArriendos> get_all_rent_totals (Database conn) {
43
-				var res = conn.exec ("
42
+			public static List<TotalArriendos> get_all_rent_totals (Connection conn) {
43
+				var res = conn.db.exec ("
44 44
 SELECT TotalArriendo FROM TOTAL_ARRIENDOS
45 45
 				");
46 46
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
47 47
 					#if DEBUG
48
-						error (conn.get_error_message ());
48
+						error (conn.db.get_error_message ());
49 49
 					#else
50
-						warning (conn.get_error_message ());
50
+						warning (conn.db.get_error_message ());
51 51
 						return new List<TotalArriendos> ();
52 52
 					#endif
53 53
 				}

+ 6
- 6
lib/db/total_coordinadores.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The TotalCoordinadores class based on the database table
22 22
 		 */
23
-		public class TotalCoordinadores : GLib.Object {
23
+		public class TotalCoordinadores : Object {
24 24
 			/**
25 25
 			 * The id of the region
26 26
 			 */
@@ -48,18 +48,18 @@ namespace LibSernatur {
48 48
 
49 49
 			/**
50 50
 			 * Get all tuples and fields from database
51
-			 * @param conn The database connection to use
51
+			 * @param conn.db.The database conn.db.ction to use
52 52
 			 * @return Returns a list of TotalCoordinadores
53 53
 			 */
54
-			public static List<TotalCoordinadores> get_all_coordinator_totals (Database conn) {
55
-				var res = conn.exec ("
54
+			public static List<TotalCoordinadores> get_all_coordinator_totals (Connection conn) {
55
+				var res = conn.db.exec ("
56 56
 SELECT idT, nombreT, TotalCoordinadores FROM TOTAL_COORDINADORES
57 57
 				");
58 58
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
59 59
 					#if DEBUG
60
-						error (conn.get_error_message ());
60
+						error (conn.db.get_error_message ());
61 61
 					#else
62
-						warning (conn.get_error_message ());
62
+						warning (conn.db.get_error_message ());
63 63
 						return new List<TotalCoordinadores> ();
64 64
 					#endif
65 65
 				}

+ 6
- 6
lib/db/total_turistas.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The TotalTuristas class based on the database table
22 22
 		 */
23
-		public class TotalTuristas : GLib.Object {
23
+		public class TotalTuristas : Object {
24 24
 			/**
25 25
 			 * The id of the tour
26 26
 			 */
@@ -48,18 +48,18 @@ namespace LibSernatur {
48 48
 
49 49
 			/**
50 50
 			 * Get all tuples and fields from database
51
-			 * @param conn The database connection to use
51
+			 * @param conn.db.The database conn.db.ction to use
52 52
 			 * @return Returns a list of TotalTuristas
53 53
 			 */
54
-			public static List<TotalTuristas> get_all_tourist_totals (Database conn) {
55
-				var res = conn.exec ("
54
+			public static List<TotalTuristas> get_all_tourist_totals (Connection conn) {
55
+				var res = conn.db.exec ("
56 56
 SELECT idT, nombreT, TotalTuristas FROM TOTAL_TURISTAS
57 57
 				");
58 58
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
59 59
 					#if DEBUG
60
-						error (conn.get_error_message ());
60
+						error (conn.db.get_error_message ());
61 61
 					#else
62
-						warning (conn.get_error_message ());
62
+						warning (conn.db.get_error_message ());
63 63
 						return new List<TotalTuristas> ();
64 64
 					#endif
65 65
 				}

+ 6
- 6
lib/db/total_vehiculos.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The TotalVehiculos class based on the database table
22 22
 		 */
23
-		public class TotalVehiculos : GLib.Object {
23
+		public class TotalVehiculos : Object {
24 24
 			/**
25 25
 			 * The total of vehicles
26 26
 			 */
@@ -36,18 +36,18 @@ namespace LibSernatur {
36 36
 
37 37
 			/**
38 38
 			 * Get all tuples and fields from database
39
-			 * @param conn The database connection to use
39
+			 * @param conn.db.The database conn.db.ction to use
40 40
 			 * @return Returns a list of TotalVehiculos
41 41
 			 */
42
-			public static List<TotalVehiculos> get_all_vehicle_totals (Database conn) {
43
-				var res = conn.exec ("
42
+			public static List<TotalVehiculos> get_all_vehicle_totals (Connection conn) {
43
+				var res = conn.db.exec ("
44 44
 SELECT TotalVeh FROM TOTAL_VEHICULOS
45 45
 				");
46 46
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
47 47
 					#if DEBUG
48
-						error (conn.get_error_message ());
48
+						error (conn.db.get_error_message ());
49 49
 					#else
50
-						warning (conn.get_error_message ());
50
+						warning (conn.db.get_error_message ());
51 51
 						return new List<TotalVehiculos> ();
52 52
 					#endif
53 53
 				}

+ 48
- 13
lib/db/tour.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Tour class based on the database table
22 22
 		 */
23
-		public class Tour : GLib.Object {
23
+		public class Tour : Object {
24 24
 			/**
25 25
 			 * The tour id
26 26
 			 */
@@ -69,13 +69,13 @@ namespace LibSernatur {
69 69
 			 * @param conn The database connection to use
70 70
 			 * @return Returns a list of Tour
71 71
 			 */
72
-			public static List<Tour> get_all_tours (Database conn) {
73
-				var res = conn.exec (Query.get_query (Query.Type.SELECT_ALL_TOURS, null));
72
+			public static List<Tour> get_all_tours (Connection conn) throws PostgresError {
73
+				var res = conn.db.exec (Query.get_query (conn, Query.Type.SELECT_ALL_TOURS, null));
74 74
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
75 75
 					#if DEBUG
76
-						error (conn.get_error_message ());
76
+						error (conn.db.get_error_message ());
77 77
 					#else
78
-						warning (conn.get_error_message ());
78
+						warning (conn.db.get_error_message ());
79 79
 						return new List<Tour> ();
80 80
 					#endif
81 81
 				}
@@ -116,16 +116,51 @@ namespace LibSernatur {
116 116
 			 * @param tour The tour to update
117 117
 			 * @throws DBError Thrown if the data in the object is invalid
118 118
 			 */
119
-			public static void update_tour (Database conn, Tour tour) throws DBError {
119
+			public static void update_tour (Connection conn, Tour tour) throws PostgresError, DBError {
120 120
 				if (tour.id_tour == 0) {
121 121
 					throw new DBError.INVALID_VALUE (dgettext (null, "The id of the tour is invalid!"));
122 122
 				}
123
-				var res = conn.exec (Query.get_query (Query.Type.UPDATE_TOUR, tour));
123
+				var res = conn.db.exec (Query.get_query (conn, Query.Type.UPDATE_TOUR, tour));
124 124
 				if (res.get_status () != ExecStatus.COMMAND_OK) {
125 125
 					#if DEBUG
126
-						error (conn.get_error_message ());
126
+						error (conn.db.get_error_message ());
127 127
 					#else
128
-						warning (conn.get_error_message ());
128
+						warning (conn.db.get_error_message ());
129
+					#endif
130
+				}
131
+			}
132
+
133
+			/**
134
+			 * Insert a tour in the database
135
+			 * @param conn The database connection
136
+			 * @param tour The tour to insert
137
+			 * @return Returns the id of the tuple inserted
138
+			 * @throws DBError Thrown if the data in the object is invalid
139
+			 */
140
+			public static uint insert_tour (Connection conn, Tour tour) throws PostgresError, DBError {
141
+				if (tour.id_tour != 0) {
142
+					throw new DBError.INVALID_VALUE (dgettext (null, "The id of the tour is invalid!"));
143
+				}
144
+				var res = conn.db.exec (Query.get_query (conn, Query.Type.INSERT_TOUR, tour));
145
+				// This uses TUPLES_OK because it returns a result which is hte id of the inserted tour
146
+				if (res.get_status () != ExecStatus.TUPLES_OK) {
147
+					#if DEBUG
148
+						error (conn.db.get_error_message ());
149
+					#else
150
+						warning (conn.db.get_error_message ());
151
+					#endif
152
+				}
153
+
154
+				var wra = new ResultWrapper (res);
155
+				try {
156
+					return wra.get_int_n (0, "id_tour");
157
+				}
158
+				catch (Error e) {
159
+					#if DEBUG
160
+						error (e.message);
161
+					#else
162
+						warning (e.message);
163
+						return 0;
129 164
 					#endif
130 165
 				}
131 166
 			}
@@ -136,19 +171,19 @@ namespace LibSernatur {
136 171
 			 * @param tour The tour to update
137 172
 			 * @throws DBError Thrown if the data in the object is invalid
138 173
 			 */
139
-			public static void delete_tour (Database conn, Tour tour) throws DBError {
174
+			public static void delete_tour (Connection conn, Tour tour) throws PostgresError, DBError {
140 175
 				if (tour.id_tour == 0) {
141 176
 					throw new DBError.INVALID_VALUE (dgettext (null, "The id of the tour is invalid!"));
142 177
 				}
143
-				var res = conn.exec (Query.get_query (Query.Type.DELETE_TOUR, tour));
178
+				var res = conn.db.exec (Query.get_query (conn, Query.Type.DELETE_TOUR, tour));
144 179
 				if (res.get_status () != ExecStatus.COMMAND_OK) {
145 180
 					if (res.get_error_field (FieldCode.SQLSTATE) == "23503") {
146 181
 						throw new DBError.FOREIGN_KEY_CONSTAINT (res.get_error_field (FieldCode.MESSAGE_PRIMARY));
147 182
 					}
148 183
 					#if DEBUG
149
-						error (conn.get_error_message ());
184
+						error (conn.db.get_error_message ());
150 185
 					#else
151
-						warning (conn.get_error_message ());
186
+						warning (conn.db.get_error_message ());
152 187
 					#endif
153 188
 				}
154 189
 			}

+ 6
- 6
lib/db/turista.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Turista class based on the database table
22 22
 		 */
23
-		public class Turista : GLib.Object {
23
+		public class Turista : Object {
24 24
 			/**
25 25
 			 * The RUT of the tourist
26 26
 			 */
@@ -54,11 +54,11 @@ namespace LibSernatur {
54 54
 
55 55
 			/**
56 56
 			 * Get all tuples and fields from database
57
-			 * @param conn The database connection to use
57
+			 * @param conn.db.The database conn.db.ction to use
58 58
 			 * @return Returns a list of Turista
59 59
 			 */
60
-			public static List<Turista> get_all_turistas (Database conn) {
61
-				var res = conn.exec ("
60
+			public static List<Turista> get_all_turistas (Connection conn) {
61
+				var res = conn.db.exec ("
62 62
 SELECT T.rut_turista, T.nombre_turista, T.fecha_nacimento,
63 63
 C.id_contacto, C.telefono_emergencia, C.nombre_emergencia
64 64
 FROM turista T
@@ -66,9 +66,9 @@ JOIN contacto_emergencia C ON (T.id_contacto = C.id_contacto)
66 66
 				");
67 67
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
68 68
 					#if DEBUG
69
-						error (conn.get_error_message ());
69
+						error (conn.db.get_error_message ());
70 70
 					#else
71
-						warning (conn.get_error_message ());
71
+						warning (conn.db.get_error_message ());
72 72
 						return new List<Turista> ();
73 73
 					#endif
74 74
 				}

+ 6
- 6
lib/db/valores_tours.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The ValoresTours class based on the database table
22 22
 		 */
23
-		public class ValoresTours : GLib.Object {
23
+		public class ValoresTours : Object {
24 24
 			/**
25 25
 			 * The id of the tour
26 26
 			 */
@@ -48,18 +48,18 @@ namespace LibSernatur {
48 48
 
49 49
 			/**
50 50
 			 * Get all tuples and fields from database
51
-			 * @param conn The database connection to use
51
+			 * @param conn.db.The database conn.db.ction to use
52 52
 			 * @return Returns a list of ValoresTours
53 53
 			 */
54
-			public static List<ValoresTours> get_all_tour_sales (Database conn) {
55
-				var res = conn.exec ("
54
+			public static List<ValoresTours> get_all_tour_sales (Connection conn) {
55
+				var res = conn.db.exec ("
56 56
 SELECT idT, nombreT, TotalVentas FROM VALORES_TOURS
57 57
 				");
58 58
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
59 59
 					#if DEBUG
60
-						error (conn.get_error_message ());
60
+						error (conn.db.get_error_message ());
61 61
 					#else
62
-						warning (conn.get_error_message ());
62
+						warning (conn.db.get_error_message ());
63 63
 						return new List<ValoresTours> ();
64 64
 					#endif
65 65
 				}

+ 6
- 6
lib/db/vehiculo.vala View File

@@ -20,7 +20,7 @@ namespace LibSernatur {
20 20
 		/**
21 21
 		 * The Vehiculo class based on the database table
22 22
 		 */
23
-		public class Vehiculo : GLib.Object {
23
+		public class Vehiculo : Object {
24 24
 			/**
25 25
 			 * The license plate
26 26
 			 */
@@ -54,18 +54,18 @@ namespace LibSernatur {
54 54
 
55 55
 			/**
56 56
 			 * Get all tuples and fields from database
57
-			 * @param conn The database connection to use
57
+			 * @param conn.db.The database conn.db.ction to use
58 58
 			 * @return Returns a list of Vehiculo
59 59
 			 */
60
-			public static List<Vehiculo> get_all_vehiculos (Database conn) {
61
-				var res = conn.exec ("
60
+			public static List<Vehiculo> get_all_vehiculos (Connection conn) {
61
+				var res = conn.db.exec ("
62 62
 SELECT patente, ano_vehiculo, marca, capacidad FROM vehiculo
63 63
 				");
64 64
 				if (res.get_status () != ExecStatus.TUPLES_OK) {
65 65
 					#if DEBUG
66
-						error (conn.get_error_message ());
66
+						error (conn.db.get_error_message ());
67 67
 					#else
68
-						warning (conn.get_error_message ());
68
+						warning (conn.db.get_error_message ());
69 69
 						return new List<Vehiculo> ();
70 70
 					#endif
71 71
 				}

+ 30
- 30
lib/db/views.vala View File

@@ -24,21 +24,21 @@ namespace LibSernatur {
24 24
 			/**
25 25
 			 * The Q1 class based on the database table
26 26
 			 */
27
-			public class Q1 : GLib.Object {
27
+			public class Q1 : Object {
28 28
 				/**
29 29
 				 * Get all tuples and fields from database
30
-				 * @param conn The database connection to use
30
+				 * @param conn.db.The database conn.db.ction to use
31 31
 				 * @return Returns a list of RegionesSinDescuento
32 32
 				 */
33
-				public static List<RegionesSinDescuento> get_regions_without_discount (Database conn) {
34
-					var res = conn.exec ("
33
+				public static List<RegionesSinDescuento> get_regions_without_discount (Connection conn) {
34
+					var res = conn.db.exec ("
35 35
 SELECT nombreRegion, cantidad FROM REGIONES_SINDESCUENTO WHERE (cantidad = (SELECT MAX(cantidad) FROM REGIONES_SINDESCUENTO))
36 36
 					");
37 37
 					if (res.get_status () != ExecStatus.TUPLES_OK) {
38 38
 						#if DEBUG
39
-							error (conn.get_error_message ());
39
+							error (conn.db.get_error_message ());
40 40
 						#else
41
-							warning (conn.get_error_message ());
41
+							warning (conn.db.get_error_message ());
42 42
 							return new List<RegionesSinDescuento> ();
43 43
 						#endif
44 44
 					}
@@ -68,7 +68,7 @@ SELECT nombreRegion, cantidad FROM REGIONES_SINDESCUENTO WHERE (cantidad = (SELE
68 68
 			/**
69 69
 			 * The Q2 class based on the database table
70 70
 			 */
71
-			public class Q2 : GLib.Object {
71
+			public class Q2 : Object {
72 72
 				/**
73 73
 				 * The name of the tour
74 74
 				 */
@@ -90,19 +90,19 @@ SELECT nombreRegion, cantidad FROM REGIONES_SINDESCUENTO WHERE (cantidad = (SELE
90 90
 
91 91
 				/**
92 92
 				 * Get all tuples and fields from database
93
-				 * @param conn The database connection to use
93
+				 * @param conn.db.The database conn.db.ction to use
94 94
 				 * @return Returns a list of Q2
95 95
 				 */
96
-				public static List<Q2> get_value_received (Database conn) {
97
-					var res = conn.exec ("
96
+				public static List<Q2> get_value_received (Connection conn) {
97
+					var res = conn.db.exec ("
98 98
 SELECT V.nombreT, (V.TotalVentas - COALESCE(MAX(T.TotalDescuentos), 0)) AS ValorTotalRecibido
99 99
 FROM VALORES_TOURS V FULL JOIN TOUR_DESCUENTOS T ON (T.idT = V.idT) GROUP BY (V.nombreT, V.TotalVentas)
100 100
 					");
101 101
 					if (res.get_status () != ExecStatus.TUPLES_OK) {
102 102
 						#if DEBUG
103
-							error (conn.get_error_message ());
103
+							error (conn.db.get_error_message ());
104 104
 						#else
105
-							warning (conn.get_error_message ());
105
+							warning (conn.db.get_error_message ());
106 106
 							return new List<Q2> ();
107 107
 						#endif
108 108
 					}
@@ -132,22 +132,22 @@ FROM VALORES_TOURS V FULL JOIN TOUR_DESCUENTOS T ON (T.idT = V.idT) GROUP BY (V.
132 132
 			/**
133 133
 			 * The Q3 class based on the database table
134 134
 			 */
135
-			public class Q3 : GLib.Object {
135
+			public class Q3 : Object {
136 136
 				/**
137 137
 				 * Get all tuples and fields from database
138
-				 * @param conn The database connection to use
138
+				 * @param conn.db.The database conn.db.ction to use
139 139
 				 * @return Returns a list of TotalCoordinadores
140 140
 				 */
141
-				public static List<TotalCoordinadores> get_total_coordinators (Database conn) {
142
-					var res = conn.exec ("
141
+				public static List<TotalCoordinadores> get_total_coordinators (Connection conn) {
142
+					var res = conn.db.exec ("
143 143
 SELECT nombreT, TotalCoordinadores
144 144
 FROM TOTAL_COORDINADORES WHERE (TotalCoordinadores = (SELECT MAX(TotalCoordinadores) FROM TOTAL_COORDINADORES))
145 145
 					");
146 146
 					if (res.get_status () != ExecStatus.TUPLES_OK) {
147 147
 						#if DEBUG
148
-							error (conn.get_error_message ());
148
+							error (conn.db.get_error_message ());
149 149
 						#else
150
-							warning (conn.get_error_message ());
150
+							warning (conn.db.get_error_message ());
151 151
 							return new List<TotalCoordinadores> ();
152 152
 						#endif
153 153
 					}
@@ -178,21 +178,21 @@ FROM TOTAL_COORDINADORES WHERE (TotalCoordinadores = (SELECT MAX(TotalCoordinado
178 178
 			/**
179 179
 			 * The Q4 class based on the database table
180 180
 			 */
181
-			public class Q4 : GLib.Object {
181
+			public class Q4 : Object {
182 182
 				/**
183 183
 				 * Get all tuples and fields from database
184
-				 * @param conn The database connection to use
184
+				 * @param conn.db.The database conn.db.ction to use
185 185
 				 * @return Returns a list of TotalTuristas
186 186
 				 */
187
-				public static List<TotalTuristas> get_total_tourists (Database conn) {
188
-					var res = conn.exec ("
187
+				public static List<TotalTuristas> get_total_tourists (Connection conn) {
188
+					var res = conn.db.exec ("
189 189
 SELECT nombreT, TotalTuristas FROM TOTAL_TURISTAS WHERE (TotalTuristas = (SELECT MAX(TotalTuristas) FROM TOTAL_TURISTAS))
190 190
 					");
191 191
 					if (res.get_status () != ExecStatus.TUPLES_OK) {
192 192
 						#if DEBUG
193
-							error (conn.get_error_message ());
193
+							error (conn.db.get_error_message ());
194 194
 						#else
195
-							warning (conn.get_error_message ());
195
+							warning (conn.db.get_error_message ());
196 196
 							return new List<TotalTuristas> ();
197 197
 						#endif
198 198
 					}
@@ -223,7 +223,7 @@ SELECT nombreT, TotalTuristas FROM TOTAL_TURISTAS WHERE (TotalTuristas = (SELECT
223 223
 			/**
224 224
 			 * The Q5 class based on the database table
225 225
 			 */
226
-			public class Q5 : GLib.Object {
226
+			public class Q5 : Object {
227 227
 				/**
228 228
 				 * The percentage of cars that were rented and used
229 229
 				 */
@@ -239,20 +239,20 @@ SELECT nombreT, TotalTuristas FROM TOTAL_TURISTAS WHERE (TotalTuristas = (SELECT
239 239
 
240 240
 				/**
241 241
 				 * Get all tuples and fields from database
242
-				 * @param conn The database connection to use
242
+				 * @param conn.db.The database conn.db.ction to use
243 243
 				 * @return Returns a list of Q5
244 244
 				 */
245
-				public static List<Q5> get_percentage (Database conn) {
246
-					var res = conn.exec ("
245
+				public static List<Q5> get_percentage (Connection conn) {
246
+					var res = conn.db.exec ("
247 247
 SELECT
248 248
   (cast(T1.totalarriendo AS DECIMAL(3,2)) / cast(T2.totalveh AS DECIMAL(3,2))) AS porcentaje
249 249
 FROM total_arriendos AS T1, total_vehiculos AS T2
250 250
 					");
251 251
 					if (res.get_status () != ExecStatus.TUPLES_OK) {
252 252
 						#if DEBUG
253
-							error (conn.get_error_message ());
253
+							error (conn.db.get_error_message ());
254 254
 						#else
255
-							warning (conn.get_error_message ());
255
+							warning (conn.db.get_error_message ());
256 256
 							return new List<Q5> ();
257 257
 						#endif
258 258
 					}

+ 2
- 2
lib/dbwrapper.vala View File

@@ -33,7 +33,7 @@ namespace LibSernatur {
33 33
 			/**
34 34
 			 * This is a wrapper for Postgresql results
35 35
 			 */
36
-			public class ResultWrapper : GLib.Object {
36
+			public class ResultWrapper : Object {
37 37
 				/**
38 38
 				 * The result that this is wrapped around
39 39
 				 */
@@ -135,7 +135,7 @@ namespace LibSernatur {
135 135
 				 */
136 136
 				private int check_field_found (int field_num, string name) throws Field {
137 137
 					if (field_num == -1) {
138
-						throw new Field.NOTFOUND (dgettext (null, "The field %s was not found in the query results!"), name);
138
+						throw new Field.NOTFOUND (_ ("The field %s was not found in the query results!"), name);
139 139
 					}
140 140
 					return field_num;
141 141
 				}

+ 6
- 6
lib/misc.vala View File

@@ -39,7 +39,7 @@ namespace LibSernatur {
39 39
 		/**
40 40
 		 * This class converts a float or double into a percentage string
41 41
 		 */
42
-		public class Percentage : GLib.Object {
42
+		public class Percentage : Object {
43 43
 			/**
44 44
 			 * Format a float into a percentage string
45 45
 			 * @param value The value to convert
@@ -63,7 +63,7 @@ namespace LibSernatur {
63 63
 		/**
64 64
 		 * This class handles making money look pretty
65 65
 		 */
66
-		public class Money : GLib.Object {
66
+		public class Money : Object {
67 67
 			/**
68 68
 			 * Format an int to look pretty
69 69
 			 * @param value The value to format
@@ -131,7 +131,7 @@ namespace LibSernatur {
131 131
 		/**
132 132
 		 * This class handles parsing and validation of RUTs
133 133
 		 */
134
-		public class Rut : GLib.Object {
134
+		public class Rut : Object {
135 135
 			/**
136 136
 			 * The cleaned RUT
137 137
 			 */
@@ -177,7 +177,7 @@ namespace LibSernatur {
177 177
 				try {
178 178
 					var regex = new Regex ("^[ ]*([0-9.]{0,11}[\\-]?[0-9kK])?[ ]*$");
179 179
 					if (!regex.match (rut)) {
180
-						throw new InvalidRut.INVALID (dgettext (null, "The RUT %s has an invalid character!"), rut);
180
+						throw new InvalidRut.INVALID (_ ("The RUT %s has an invalid character!"), rut);
181 181
 					}
182 182
 				}
183 183
 				catch (Error e) {
@@ -193,12 +193,12 @@ namespace LibSernatur {
193 193
 					new_rut = new_rut.strip ();
194 194
 					rut = regex.replace (new_rut, new_rut.length, 0, "");
195 195
 					if (int.parse (rut.substring (0, rut.length - 1)) > 100000000) {
196
-						throw new InvalidRut.TOOLARGE (dgettext (null, "The RUT %s is too big!"), rut);
196
+						throw new InvalidRut.TOOLARGE (_ ("The RUT %s is too big!"), rut);
197 197
 					}
198 198
 					this.verifier = rut.get_char (rut.length - 1);
199 199
 					this.clean_rut = rut.substring (0, rut.length - 1);
200 200
 					if (generate_verfifier (this.clean_rut) != this.verifier) {
201
-						throw new InvalidRut.INVALIDVERIFIER (dgettext (null, "The verifier %C is invalid!"), this.verifier);
201
+						throw new InvalidRut.INVALIDVERIFIER (_ ("The verifier %C is invalid!"), this.verifier);
202 202
 					}
203 203
 					pretty();
204 204
 				}

+ 39
- 5
lib/queries.vala View File

@@ -17,15 +17,16 @@ namespace LibSernatur {
17 17
 		/**
18 18
 		 * The queries to use to work in the database
19 19
 		 */
20
-		public class Query < T > : GLib.Object {
20
+		public class Query < T > : Object {
21 21
 			public enum Type {
22 22
 				SELECT_ALL_TOURS,
23 23
 				INSERT_TOUR,
24 24
 				UPDATE_TOUR,
25
-				DELETE_TOUR
25
+				DELETE_TOUR,
26
+				SELECT_ALL_ASSOCIATED_BY_TOUR
26 27
 			}
27 28
 
28
-			public static string get_query (Type type, T? t) {
29
+			public static string get_query (Connection conn, Type type, T? t) throws PostgresError {
29 30
 				switch (type) {
30 31
 					case SELECT_ALL_TOURS:
31 32
 						return "
@@ -39,16 +40,49 @@ JOIN region R ON (C.id_region = R.id_region)";
39 40
 						Tour tour = (Tour) t;
40 41
 						return "
41 42
 UPDATE tour SET
42
-	nombre_tour = '" + tour.nombre_tour + "',
43
+	nombre_tour = '" + conn.escape (tour.nombre_tour) + "',
43 44
 	costo_indiv = " + tour.costo_indiv.to_string () + ",
44 45
 	costo_grupal = " + tour.costo_grupal.to_string () + ",
45
-	minima_personas = " + tour.minima_personas.to_string () + "
46
+	minima_personas = " + tour.minima_personas.to_string () + ",
47
+	id_ciudad = " + tour.ciudad.id_ciudad.to_string () + "
46 48
 WHERE id_tour = " + tour.id_tour.to_string ();
49
+					case INSERT_TOUR:
50
+						Tour tour = (Tour) t;
51
+						return "
52
+INSERT INTO tour
53
+(nombre_tour, costo_indiv, costo_grupal, minima_personas, id_ciudad)
54
+VALUES
55
+(
56
+'" + conn.escape (tour.nombre_tour) + "',
57
+" + tour.costo_indiv.to_string () + ",
58
+" + tour.costo_grupal.to_string () + ",
59
+" + tour.minima_personas.to_string () + ",
60
+" + tour.ciudad.id_ciudad.to_string () + "
61
+)
62
+RETURNING id_tour";
47 63
 					case DELETE_TOUR:
48 64
 						Tour tour = (Tour) t;
49 65
 						return "
50 66
 DELETE FROM tour
51 67
 WHERE id_tour = " + tour.id_tour.to_string ();
68
+					case SELECT_ALL_ASSOCIATED_BY_TOUR:
69
+						Tour tour = (Tour) t;
70
+							return "
71
+SELECT A.fecha_llegada, A.hora_llegada, A.fecha_salida, A.hora_salida,
72
+T.id_tour, T.nombre_tour, T.costo_indiv, T.costo_grupal, T.minima_personas,
73
+C.id_ciudad, C.nombre_ciudad,
74
+R.id_region, R.nombre_region,
75
+L.id_lugar, L.nombre_lugar, L.valor_entrada, L.nivel,
76
+C2.id_ciudad AS id_ciudad_lugar, C2.nombre_ciudad AS nombre_ciudad_lugar,
77
+R2.id_region AS id_region_lugar, R2.nombre_region AS nombre_region_lugar
78
+FROM asociado A
79
+JOIN tour T ON (A.id_tour = T.id_tour)
80
+JOIN ciudad C ON (T.id_ciudad = C.id_ciudad)
81
+JOIN region R ON (C.id_region = R.id_region)
82
+JOIN lugar L ON (A.id_lugar = L.id_lugar)
83
+JOIN ciudad C2 ON (L.id_ciudad = C2.id_ciudad)
84
+JOIN region R2 ON (C2.id_region = R2.id_region)
85
+WHERE t.id_tour = " + tour.id_tour.to_string ();
52 86
 					default:
53 87
 						return "";
54 88
 				}

+ 1
- 1
po/LINGUAS View File

@@ -1 +1 @@
1
-es
1
+es es_CL

+ 2
- 0
po/POTFILES View File

@@ -5,11 +5,13 @@ src/sernatur.vala
5 5
 src/main_window.vala
6 6
 src/tour_list.vala
7 7
 src/tour_editor.vala
8
+src/tour_places.vala
8 9
 src/query_window.vala
9 10
 data/ui/main.window.ui
10 11
 data/ui/main.splash.ui
11 12
 data/ui/tour.list.ui
12 13
 data/ui/tour.editor.ui
14
+data/ui/tour.places.ui
13 15
 data/ui/query.window.ui
14 16
 data/ui/query.tree.ui
15 17
 data/gschema/cl.cromer.ubb.sernatur.db.gschema.xml

+ 102
- 40
po/es.po View File

@@ -7,8 +7,8 @@ msgid ""
7 7
 msgstr ""
8 8
 "Project-Id-Version: sernatur\n"
9 9
 "Report-Msgid-Bugs-To: \n"
10
-"POT-Creation-Date: 2019-01-17 09:59-0300\n"
11
-"PO-Revision-Date: 2019-01-17 10:01-0300\n"
10
+"POT-Creation-Date: 2019-01-18 17:59-0300\n"
11
+"PO-Revision-Date: 2019-01-18 18:02-0300\n"
12 12
 "Last-Translator: Chris Cromer <chris@cromer.cl>\n"
13 13
 "Language-Team: none\n"
14 14
 "Language: es\n"
@@ -47,7 +47,7 @@ msgstr "El verificador %C es invalido!"
47 47
 #: src/sernatur.vala:88
48 48
 #, c-format
49 49
 msgid "Error: %s\n"
50
-msgstr "Error %s\n"
50
+msgstr "Error: %s\n"
51 51
 
52 52
 #: src/sernatur.vala:89
53 53
 #, c-format
@@ -65,39 +65,44 @@ msgstr "Versión de SERNATUR: "
65 65
 msgid "Error: Could not connect to the database!"
66 66
 msgstr "Error: No se puede conectar al base de datos!"
67 67
 
68
-#: src/main_window.vala:228 src/tour_list.vala:205 src/tour_list.vala:220
68
+#: src/main_window.vala:228 src/tour_list.vala:215 src/tour_list.vala:231
69 69
 msgid "Error"
70 70
 msgstr "Error"
71 71
 
72
-#: src/tour_list.vala:181
72
+#: src/tour_list.vala:185
73 73
 msgid "Are you sure you wish to delete this tour?"
74 74
 msgstr "¿Usted está seguro que quiere borrar este tour?"
75 75
 
76
-#: src/tour_list.vala:201
76
+#: src/tour_list.vala:192
77
+msgid "Are you sure you wish to delete these tours?"
78
+msgstr "¿Usted está seguro que quiere borrar estos tour?"
79
+
80
+#: src/tour_list.vala:211
81
+#, c-format
77 82
 msgid ""
78
-"Error: Could not delete tour because there are still associated arrival and "
79
-"departure dates and times!"
83
+"Error: Could not delete tour \"%s\" because either this tour has been taken "
84
+"or is still associated with a place or vehicle!"
80 85
 msgstr ""
81
-"Error: No se puede borrar el tour porque todavía hay fechas y horas de "
82
-"llegada y salida asociado al tour!"
86
+"Error: No se puede borrar el tour \"%s\" porque este tour ya fue realizado "
87
+"o todavía esta asociado con lugares ó vehículos!"
83 88
 
84
-#: src/query_window.vala:290 data/ui/main.window.ui:143
89
+#: src/query_window.vala:290 data/ui/main.window.ui:136
85 90
 msgid "(Q1) Regions with discounts"
86 91
 msgstr "(Q1) Regiones sin descuentos"
87 92
 
88
-#: src/query_window.vala:303 data/ui/main.window.ui:151
93
+#: src/query_window.vala:303 data/ui/main.window.ui:144
89 94
 msgid "(Q2) Tour values"
90 95
 msgstr "(Q2) Valores tour"
91 96
 
92
-#: src/query_window.vala:316 data/ui/main.window.ui:159
97
+#: src/query_window.vala:316 data/ui/main.window.ui:152
93 98
 msgid "(Q3) Coordinator total"
94 99
 msgstr "(Q3) Total de coordinadores"
95 100
 
96
-#: src/query_window.vala:329 data/ui/main.window.ui:167
101
+#: src/query_window.vala:329 data/ui/main.window.ui:160
97 102
 msgid "(Q4) Tourist total"
98 103
 msgstr "(Q4) Total de turistas"
99 104
 
100
-#: src/query_window.vala:342 data/ui/main.window.ui:175
105
+#: src/query_window.vala:342 data/ui/main.window.ui:168
101 106
 msgid "(Q5) Vehicle total"
102 107
 msgstr "(Q5) Total de vehículos"
103 108
 
@@ -110,34 +115,30 @@ msgid "Tours"
110 115
 msgstr "Tours"
111 116
 
112 117
 #: data/ui/main.window.ui:62
113
-msgid "Places"
114
-msgstr "Lugares"
115
-
116
-#: data/ui/main.window.ui:69
117 118
 msgid "Staff"
118 119
 msgstr "Empleados"
119 120
 
120
-#: data/ui/main.window.ui:77
121
+#: data/ui/main.window.ui:70
121 122
 msgid "Tourists"
122 123
 msgstr "Turistas"
123 124
 
124
-#: data/ui/main.window.ui:87
125
+#: data/ui/main.window.ui:80
125 126
 msgid "Illnesses"
126 127
 msgstr "Enfermedades"
127 128
 
128
-#: data/ui/main.window.ui:95
129
+#: data/ui/main.window.ui:88
129 130
 msgid "Participate"
130 131
 msgstr "Participar"
131 132
 
132
-#: data/ui/main.window.ui:107
133
+#: data/ui/main.window.ui:100
133 134
 msgid "Vehicles"
134 135
 msgstr "Vehículos"
135 136
 
136
-#: data/ui/main.window.ui:121
137
+#: data/ui/main.window.ui:114
137 138
 msgid "Quit"
138 139
 msgstr "Salir"
139 140
 
140
-#: data/ui/main.window.ui:133
141
+#: data/ui/main.window.ui:126
141 142
 msgid "_Views"
142 143
 msgstr "_Vistas"
143 144
 
@@ -145,59 +146,64 @@ msgstr "_Vistas"
145 146
 msgid "Christopher Cromer"
146 147
 msgstr "Christopher Cromer"
147 148
 
148
-#: data/ui/tour.list.ui:68 data/ui/tour.editor.ui:54 data/ui/query.tree.ui:80
149
+#: data/ui/tour.list.ui:69 data/ui/tour.editor.ui:54 data/ui/query.tree.ui:80
149 150
 #: data/ui/query.tree.ui:120 data/ui/query.tree.ui:160
150 151
 msgid "Tour Name"
151 152
 msgstr "Nombre del Tour"
152 153
 
153
-#: data/ui/tour.list.ui:82 data/ui/tour.editor.ui:87
154
+#: data/ui/tour.list.ui:83 data/ui/tour.editor.ui:87
154 155
 msgid "Individual Cost"
155 156
 msgstr "Costo Individual"
156 157
 
157
-#: data/ui/tour.list.ui:96 data/ui/tour.editor.ui:103
158
+#: data/ui/tour.list.ui:97 data/ui/tour.editor.ui:103
158 159
 msgid "Group Cost"
159 160
 msgstr "Costo Grupal"
160 161
 
161
-#: data/ui/tour.list.ui:110 data/ui/tour.editor.ui:119
162
+#: data/ui/tour.list.ui:111 data/ui/tour.editor.ui:119
162 163
 msgid "Minimum People"
163 164
 msgstr "Mínima Personas"
164 165
 
165
-#: data/ui/tour.list.ui:124 data/ui/tour.editor.ui:187
166
+#: data/ui/tour.list.ui:125 data/ui/tour.editor.ui:187
166 167
 msgid "City"
167 168
 msgstr "Ciudad"
168 169
 
169
-#: data/ui/tour.list.ui:138 data/ui/tour.editor.ui:135
170
+#: data/ui/tour.list.ui:139 data/ui/tour.editor.ui:135
170 171
 msgid "Region"
171 172
 msgstr "Región"
172 173
 
173
-#: data/ui/tour.list.ui:170
174
+#: data/ui/tour.list.ui:171 data/ui/tour.places.ui:185
174 175
 msgid "Edit"
175 176
 msgstr "Editar"
176 177
 
177
-#: data/ui/tour.list.ui:175
178
+#: data/ui/tour.list.ui:176
178 179
 msgid "Edit selected tour."
179 180
 msgstr "Editar el tour seleccionado."
180 181
 
181
-#: data/ui/tour.list.ui:185
182
+#: data/ui/tour.list.ui:186 data/ui/tour.places.ui:243
182 183
 msgid "New"
183 184
 msgstr "Nuevo"
184 185
 
185
-#: data/ui/tour.list.ui:189
186
+#: data/ui/tour.list.ui:190
186 187
 msgid "Create a new tour."
187 188
 msgstr "Crear un tour nuevo."
188 189
 
189
-#: data/ui/tour.list.ui:199
190
+#: data/ui/tour.list.ui:200 data/ui/tour.places.ui:214
190 191
 msgid "Delete"
191 192
 msgstr "Borrar"
192 193
 
193
-#: data/ui/tour.list.ui:203
194
+#: data/ui/tour.list.ui:205
194 195
 msgid "Delete selected tour."
195 196
 msgstr "Borrar el tour seleccionado."
196 197
 
197
-#: data/ui/tour.list.ui:214 data/ui/query.window.ui:67
198
+#: data/ui/tour.list.ui:215 data/ui/tour.places.ui:229
199
+#: data/ui/query.window.ui:67
198 200
 msgid "Close"
199 201
 msgstr "Cerrar"
200 202
 
203
+#: data/ui/tour.list.ui:219 data/ui/tour.places.ui:233
204
+msgid "Close this window."
205
+msgstr "Cerrar esta ventana."
206
+
201 207
 #: data/ui/tour.editor.ui:29
202 208
 msgid "Tour Editor"
203 209
 msgstr "Editor de Tour"
@@ -218,14 +224,70 @@ msgstr "Cancelar"
218 224
 msgid "Cancel the modification of this tour."
219 225
 msgstr "Cancelar la modificación de este tour."
220 226
 
221
-#: data/ui/tour.editor.ui:306
227
+#: data/ui/tour.editor.ui:306 data/ui/tour.places.ui:23
228
+msgid "Places"
229
+msgstr "Lugares"
230
+
231
+#: data/ui/tour.editor.ui:310
232
+msgid "Add or edit places."
233
+msgstr "Agregar o editar places."
234
+
235
+#: data/ui/tour.editor.ui:325
222 236
 msgid "Save"
223 237
 msgstr "Guardar"
224 238
 
225
-#: data/ui/tour.editor.ui:310
239
+#: data/ui/tour.editor.ui:329
226 240
 msgid "Save this tour."
227 241
 msgstr "Guardar este tour."
228 242
 
243
+#: data/ui/tour.places.ui:69
244
+msgid "Place Name"
245
+msgstr "Nombre de Lugar"
246
+
247
+#: data/ui/tour.places.ui:83
248
+msgid "Ticket Price"
249
+msgstr "Valor Entrada"
250
+
251
+#: data/ui/tour.places.ui:97
252
+msgid "Difficulty"
253
+msgstr "Dificultad"
254
+
255
+#: data/ui/tour.places.ui:111
256
+msgid "Arrival Date"
257
+msgstr "Fecha de Llegada"
258
+
259
+#: data/ui/tour.places.ui:125
260
+msgid "Arrival Time"
261
+msgstr "Hora de Llegada"
262
+
263
+#: data/ui/tour.places.ui:139
264
+msgid "Departure Date"
265
+msgstr "Fecha de Salida"
266
+
267
+#: data/ui/tour.places.ui:153
268
+msgid "Departure Time"
269
+msgstr "Hora de Salida"
270
+
271
+#: data/ui/tour.places.ui:190
272
+msgid "Edit associated place."
273
+msgstr "Edit lugar asociado."
274
+
275
+#: data/ui/tour.places.ui:200
276
+msgid "Add"
277
+msgstr "Agregar"
278
+
279
+#: data/ui/tour.places.ui:204
280
+msgid "Associate this tour with an existing place."
281
+msgstr "Asociar este tour con un lugar que ya existe."
282
+
283
+#: data/ui/tour.places.ui:219
284
+msgid "Delete associated place."
285
+msgstr "Borrar lugar asociado."
286
+
287
+#: data/ui/tour.places.ui:247
288
+msgid "Create a new place to associate."
289
+msgstr "Crear un lugar nuevo para asociar con el tour."
290
+
229 291
 #: data/ui/query.window.ui:85
230 292
 msgid "Run"
231 293
 msgstr "Correr"

+ 374
- 0
po/es_CL.po View File

@@ -0,0 +1,374 @@
1
+# Spanish translations for sernatur package.
2
+# Copyright (C) 2018-2019 THE sernatur'S COPYRIGHT HOLDER
3
+# This file is distributed under the same license as the sernatur package.
4
+# Automatically generated, 2019.
5
+#
6
+msgid ""
7
+msgstr ""
8
+"Project-Id-Version: sernatur\n"
9
+"Report-Msgid-Bugs-To: \n"
10
+"POT-Creation-Date: 2019-01-18 17:59-0300\n"
11
+"PO-Revision-Date: 2019-01-18 18:02-0300\n"
12
+"Last-Translator: Chris Cromer <chris@cromer.cl>\n"
13
+"Language-Team: none\n"
14
+"Language: es\n"
15
+"MIME-Version: 1.0\n"
16
+"Content-Type: text/plain; charset=UTF-8\n"
17
+"Content-Transfer-Encoding: 8bit\n"
18
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
19
+"X-Generator: Poedit 2.0.6\n"
20
+"X-Poedit-SourceCharset: UTF-8\n"
21
+"X-Poedit-Basepath: .\n"
22
+
23
+#: lib/db.vala:74
24
+msgid "Postgresql server version:"
25
+msgstr "Versión de la wea de Postgresql:"
26
+
27
+#: lib/dbwrapper.vala:138
28
+#, c-format
29
+msgid "The field %s was not found in the query results!"
30
+msgstr "La wea %s no estaba en los resultados de la wea!"
31
+
32
+#: lib/misc.vala:180
33
+#, c-format
34
+msgid "The RUT %s has an invalid character!"
35
+msgstr "La wea %s tiene una wea invalido!"
36
+
37
+#: lib/misc.vala:196
38
+#, c-format
39
+msgid "The RUT %s is too big!"
40
+msgstr "La wea %s es demasiado grande!"
41
+
42
+#: lib/misc.vala:201
43
+#, c-format
44
+msgid "The verifier %C is invalid!"
45
+msgstr "La wea %C es invalido!"
46
+
47
+#: src/sernatur.vala:88
48
+#, c-format
49
+msgid "Error: %s\n"
50
+msgstr "Puta la wea: %s\n"
51
+
52
+#: src/sernatur.vala:89
53
+#, c-format
54
+msgid "Run '%s --help' to see a full list of available command line options.\n"
55
+msgstr ""
56
+"Correr '%s --help' para ver una lista completa de las weas que se puede usar "
57
+"en la consola.\n"
58
+
59
+#: src/sernatur.vala:94
60
+msgid "SERNATUR version: "
61
+msgstr "Versión de SERNATUR: "
62
+
63
+#: src/main_window.vala:216
64
+msgid "Error: Could not connect to the database!"
65
+msgstr "Puta la wea: No se puede conectar al base de datos!"
66
+
67
+#: src/main_window.vala:228 src/tour_list.vala:215 src/tour_list.vala:231
68
+msgid "Error"
69
+msgstr "Puta la wea"
70
+
71
+#: src/tour_list.vala:185
72
+msgid "Are you sure you wish to delete this tour?"
73
+msgstr "¿Weon, está seguro que quiere borrar esta wea?"
74
+
75
+#: src/tour_list.vala:192
76
+msgid "Are you sure you wish to delete these tours?"
77
+msgstr "¿Weon, está seguro que quiere borrar estas weas?"
78
+
79
+#: src/tour_list.vala:211
80
+#, c-format
81
+msgid ""
82
+"Error: Could not delete tour \"%s\" because either this tour has been taken "
83
+"or is still associated with a place or vehicle!"
84
+msgstr ""
85
+"Puta la wea: No se puede borrar la wea \"%s\" porque esta wea ya fue "
86
+"realizada o la wea todavía esta asociado con lugares ó vehículos!"
87
+
88
+#: src/query_window.vala:290 data/ui/main.window.ui:136
89
+msgid "(Q1) Regions with discounts"
90
+msgstr "(Q1) Regiones sin descuentos"
91
+
92
+#: src/query_window.vala:303 data/ui/main.window.ui:144
93
+msgid "(Q2) Tour values"
94
+msgstr "(Q2) Valores tour"
95
+
96
+#: src/query_window.vala:316 data/ui/main.window.ui:152
97
+msgid "(Q3) Coordinator total"
98
+msgstr "(Q3) Total de coordinadores"
99
+
100
+#: src/query_window.vala:329 data/ui/main.window.ui:160
101
+msgid "(Q4) Tourist total"
102
+msgstr "(Q4) Total de turistas"
103
+
104
+#: src/query_window.vala:342 data/ui/main.window.ui:168
105
+msgid "(Q5) Vehicle total"
106
+msgstr "(Q5) Total de vehículos"
107
+
108
+#: data/ui/main.window.ui:44
109
+msgid "_Menu"
110
+msgstr "_Menú"
111
+
112
+#: data/ui/main.window.ui:54 data/ui/tour.list.ui:23
113
+msgid "Tours"
114
+msgstr "Tours"
115
+
116
+#: data/ui/main.window.ui:62
117
+msgid "Staff"
118
+msgstr "Weones flojos"
119
+
120
+#: data/ui/main.window.ui:70
121
+msgid "Tourists"
122
+msgstr "Weones visitores"
123
+
124
+#: data/ui/main.window.ui:80
125
+msgid "Illnesses"
126
+msgstr "Enfermedades"
127
+
128
+#: data/ui/main.window.ui:88
129
+msgid "Participate"
130
+msgstr "Participar"
131
+
132
+#: data/ui/main.window.ui:100
133
+msgid "Vehicles"
134
+msgstr "Vehículos"
135
+
136
+#: data/ui/main.window.ui:114
137
+msgid "Quit"
138
+msgstr "Salir de la wea"
139
+
140
+#: data/ui/main.window.ui:126
141
+msgid "_Views"
142
+msgstr "_Vistas"
143
+
144
+#: data/ui/main.splash.ui:46
145
+msgid "Christopher Cromer"
146
+msgstr "Christopher Cromer (El Weon Gringo)"
147
+
148
+#: data/ui/tour.list.ui:69 data/ui/tour.editor.ui:54 data/ui/query.tree.ui:80
149
+#: data/ui/query.tree.ui:120 data/ui/query.tree.ui:160
150
+msgid "Tour Name"
151
+msgstr "Nombre de la Wea"
152
+
153
+#: data/ui/tour.list.ui:83 data/ui/tour.editor.ui:87
154
+msgid "Individual Cost"
155
+msgstr "Costo Individual"
156
+
157
+#: data/ui/tour.list.ui:97 data/ui/tour.editor.ui:103
158
+msgid "Group Cost"
159
+msgstr "Costo Grupal"
160
+
161
+#: data/ui/tour.list.ui:111 data/ui/tour.editor.ui:119
162
+msgid "Minimum People"
163
+msgstr "Mínima de Weones"
164
+
165
+#: data/ui/tour.list.ui:125 data/ui/tour.editor.ui:187
166
+msgid "City"
167
+msgstr "Ciudad"
168
+
169
+#: data/ui/tour.list.ui:139 data/ui/tour.editor.ui:135
170
+msgid "Region"
171
+msgstr "Región"
172
+
173
+#: data/ui/tour.list.ui:171 data/ui/tour.places.ui:185
174
+msgid "Edit"
175
+msgstr "Editar la wea"
176
+
177
+#: data/ui/tour.list.ui:176
178
+msgid "Edit selected tour."
179
+msgstr "Editar la wea seleccionado."
180
+
181
+#: data/ui/tour.list.ui:186 data/ui/tour.places.ui:243
182
+msgid "New"
183
+msgstr "Nueva wea"
184
+
185
+#: data/ui/tour.list.ui:190
186
+msgid "Create a new tour."
187
+msgstr "Crear una wea nueva."
188
+
189
+#: data/ui/tour.list.ui:200 data/ui/tour.places.ui:214
190
+msgid "Delete"
191
+msgstr "Borrar la wea"
192
+
193
+#: data/ui/tour.list.ui:205
194
+msgid "Delete selected tour."
195
+msgstr "Borrar la wea seleccionado."
196
+
197
+#: data/ui/tour.list.ui:215 data/ui/tour.places.ui:229
198
+#: data/ui/query.window.ui:67
199
+msgid "Close"
200
+msgstr "Cerrar la wea"
201
+
202
+#: data/ui/tour.list.ui:219 data/ui/tour.places.ui:233
203
+msgid "Close this window."
204
+msgstr "Cerrar la wea."
205
+
206
+#: data/ui/tour.editor.ui:29
207
+msgid "Tour Editor"
208
+msgstr "Editor de la Wea"
209
+
210
+#: data/ui/tour.editor.ui:234
211
+msgid "Create a new region by typing here."
212
+msgstr "Crear una nueva wea con escribir aquí."
213
+
214
+#: data/ui/tour.editor.ui:262
215
+msgid "Create a new city by typing here."
216
+msgstr "Crear una nueva wea con escribir aquí."
217
+
218
+#: data/ui/tour.editor.ui:287
219
+msgid "Cancel"
220
+msgstr "Cancelar la wea"
221
+
222
+#: data/ui/tour.editor.ui:291
223
+msgid "Cancel the modification of this tour."
224
+msgstr "Cancelar la modificación de esta wea."
225
+
226
+#: data/ui/tour.editor.ui:306 data/ui/tour.places.ui:23
227
+msgid "Places"
228
+msgstr "Lugares"
229
+
230
+#: data/ui/tour.editor.ui:310
231
+msgid "Add or edit places."
232
+msgstr "Agregar o editar places."
233
+
234
+#: data/ui/tour.editor.ui:325
235
+msgid "Save"
236
+msgstr "Guardar la wea"
237
+
238
+#: data/ui/tour.editor.ui:329
239
+msgid "Save this tour."
240
+msgstr "Guardar esta wea."
241
+
242
+#: data/ui/tour.places.ui:69
243
+msgid "Place Name"
244
+msgstr "Nombre de la Wea"
245
+
246
+#: data/ui/tour.places.ui:83
247
+msgid "Ticket Price"
248
+msgstr "Valor de la Wea"
249
+
250
+#: data/ui/tour.places.ui:97
251
+msgid "Difficulty"
252
+msgstr "Dificultad"
253
+
254
+#: data/ui/tour.places.ui:111
255
+msgid "Arrival Date"
256
+msgstr "Fecha de Llegada"
257
+
258
+#: data/ui/tour.places.ui:125
259
+msgid "Arrival Time"
260
+msgstr "Hora de Llegada"
261
+
262
+#: data/ui/tour.places.ui:139
263
+msgid "Departure Date"
264
+msgstr "Fecha de Salida"
265
+
266
+#: data/ui/tour.places.ui:153
267
+msgid "Departure Time"
268
+msgstr "Hora de Salida"
269
+
270
+#: data/ui/tour.places.ui:190
271
+msgid "Edit associated place."
272
+msgstr "Edit lugar asociado."
273
+
274
+#: data/ui/tour.places.ui:200
275
+msgid "Add"
276
+msgstr "Agregar una wea"
277
+
278
+#: data/ui/tour.places.ui:204
279
+msgid "Associate this tour with an existing place."
280
+msgstr "Asociar esta wea con un lugar que ya existe."
281
+
282
+#: data/ui/tour.places.ui:219
283
+msgid "Delete associated place."
284
+msgstr "Borrar la wea asociado."
285
+
286
+#: data/ui/tour.places.ui:247
287
+msgid "Create a new place to associate."
288
+msgstr "Crear una wea nueva para asociar con el tour."
289
+
290
+#: data/ui/query.window.ui:85
291
+msgid "Run"
292
+msgstr "Correr la wea"
293
+
294
+#: data/ui/query.window.ui:127
295
+msgid "Statement"
296
+msgstr "Enunciado"
297
+
298
+#: data/ui/query.window.ui:157
299
+msgid "View and Query"
300
+msgstr "Vista y Consulta"
301
+
302
+#: data/ui/query.tree.ui:40
303
+msgid "Region Name"
304
+msgstr "Nombre de Región"