-- Dumped from database version 8.4.17
-- Dumped by pg_dump version 9.2.2
--- Started on 2013-06-04 11:22:03
+-- Started on 2013-06-04 11:28:25
SET statement_timeout = 0;
SET client_encoding = 'UTF8';
nome character varying(100) DEFAULT ''::character varying,
descrizione text DEFAULT ''::text,
status character varying(1) DEFAULT ''::character varying,
- id_uffici integer DEFAULT 0
+ id_uffici integer DEFAULT 0,
+ immagine_percorso character varying(255) DEFAULT ''::character varying,
+ immagine_contenuto integer DEFAULT 0,
+ immagine_file_data timestamp without time zone,
+ immagine_file_dimensione bigint DEFAULT 0
);
--
--- TOC entry 2014 (class 2606 OID 59289)
+-- TOC entry 2017 (class 2606 OID 59289)
-- Name: nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2054 (class 2606 OID 61360)
+-- TOC entry 2057 (class 2606 OID 61360)
-- Name: persona_incarichi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2044 (class 2606 OID 61305)
+-- TOC entry 2047 (class 2606 OID 61305)
-- Name: persona_nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2046 (class 2606 OID 61321)
+-- TOC entry 2049 (class 2606 OID 61321)
-- Name: persona_nodo_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2040 (class 2606 OID 61279)
+-- TOC entry 2043 (class 2606 OID 61279)
-- Name: persona_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2038 (class 2606 OID 61252)
+-- TOC entry 2041 (class 2606 OID 61252)
-- Name: persona_uffici_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2042 (class 2606 OID 61294)
+-- TOC entry 2045 (class 2606 OID 61294)
-- Name: persona_ufficio_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2034 (class 2606 OID 61235)
+-- TOC entry 2037 (class 2606 OID 61235)
-- Name: persone_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2048 (class 2606 OID 61328)
+-- TOC entry 2051 (class 2606 OID 61328)
-- Name: posizioni_economiche_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2052 (class 2606 OID 61342)
+-- TOC entry 2055 (class 2606 OID 61342)
-- Name: profili_professionali_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2058 (class 2606 OID 618188)
+-- TOC entry 2061 (class 2606 OID 618188)
-- Name: ruoli_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2064 (class 2606 OID 626437)
+-- TOC entry 2067 (class 2606 OID 626437)
-- Name: struttura_allegati_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2062 (class 2606 OID 626378)
+-- TOC entry 2065 (class 2606 OID 626378)
-- Name: struttura_collegamenti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2024 (class 2606 OID 59356)
+-- TOC entry 2027 (class 2606 OID 59356)
-- Name: struttura_indirizzi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2022 (class 2606 OID 59339)
+-- TOC entry 2025 (class 2606 OID 59339)
-- Name: strutture_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2016 (class 2606 OID 59296)
+-- TOC entry 2019 (class 2606 OID 59296)
-- Name: tipi_nodo_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2050 (class 2606 OID 61335)
+-- TOC entry 2053 (class 2606 OID 61335)
-- Name: tipi_prestazione_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2036 (class 2606 OID 61242)
+-- TOC entry 2039 (class 2606 OID 61242)
-- Name: tipi_rapporto_lavoro_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2018 (class 2606 OID 59303)
+-- TOC entry 2021 (class 2606 OID 59303)
-- Name: tipi_recapito_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2032 (class 2606 OID 61226)
+-- TOC entry 2035 (class 2606 OID 61226)
-- Name: titoli_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2020 (class 2606 OID 59321)
+-- TOC entry 2023 (class 2606 OID 59321)
-- Name: uffici_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2066 (class 2606 OID 626452)
+-- TOC entry 2069 (class 2606 OID 626452)
-- Name: ufficio_allegati_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2060 (class 2606 OID 626366)
+-- TOC entry 2063 (class 2606 OID 626366)
-- Name: ufficio_collegamenti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2026 (class 2606 OID 59366)
+-- TOC entry 2029 (class 2606 OID 59366)
-- Name: ufficio_nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2028 (class 2606 OID 59408)
+-- TOC entry 2031 (class 2606 OID 59408)
-- Name: ufficio_orari_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2030 (class 2606 OID 59419)
+-- TOC entry 2033 (class 2606 OID 59419)
-- Name: ufficio_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
--
--- TOC entry 2056 (class 2606 OID 61430)
+-- TOC entry 2059 (class 2606 OID 61430)
-- Name: ufficio_stanze_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--
ADD CONSTRAINT ufficio_stanze_pkey PRIMARY KEY (id);
--- Completed on 2013-06-04 11:22:03
+-- Completed on 2013-06-04 11:28:25
--
-- PostgreSQL database dump complete
#include <config.h>
#endif
+#include <libpq-fe.h>
+
#include <libautoz/autoz.h>
#include <libgtkform/form.h>
#include <libgtkform/fielddatetime.h>
GtkTreeSelection *sel_collegamenti;
GtkTreeSelection *sel_allegati;
+ SolipaAllegato *sallegato;
+
gint id;
};
"lstore_ufficio_allegati",
NULL);
+ priv->sallegato = solipa_allegato_new (commons->solipa);
+ if (priv->sallegato != NULL)
+ {
+ solipa_allegato_add_to_gtkform (priv->sallegato, priv->form,
+ "immagine_percorso", "immagine_file_data", "immagine_file_dimensione");
+ solipa_allegato_con_salva_in_db (priv->sallegato, FALSE);
+ gtk_container_add (GTK_CONTAINER (gtk_builder_get_object (priv->commons->gtkbuilder, "alignment4")),
+ solipa_allegato_get_widget (priv->sallegato));
+ }
+
priv->sel_nodi = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview7")));
priv->sel_stanze = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview23")));
priv->sel_recapiti = gtk_tree_view_get_selection (GTK_TREE_VIEW (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview6")));
gtk_form_set_sensitive_by_name (priv->form, TRUE, "hbox2", "hbox19", "hbox4", "hbox9", "hbox21", "hbox24", NULL);
}
+ /* salvo l'atto_allegato nel db */
+ /* devo utilizzare le funzioni native di postgres
+ * perché quelle di libgda non sembrano funzionare sotto windows */
+ Oid oid;
+ const gchar *percorso;
+
+ percorso = solipa_allegato_get_percorso (priv->sallegato);
+
+ if (PQexec (priv->commons->pgcon, "BEGIN") == NULL)
+ {
+ if (priv->id == 0)
+ {
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
+ }
+
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Errore durante il salvataggio: allegato non importato nel database (impossibile aprire la transazione).");
+ return;
+ }
+
+ oid = lo_import (priv->commons->pgcon, percorso);
+
+ if (oid > 0)
+ {
+ sql = g_strdup_printf ("UPDATE uffici"
+ " SET immagine_contenuto = %d,"
+ " immagine_percorso = '%s'"
+ " WHERE id = %d",
+ oid,
+ gdaex_strescape (g_path_get_basename (percorso), NULL),
+ priv->id);
+ if (gdaex_execute (priv->commons->gdaex, sql) < 1)
+ {
+ g_free (sql);
+
+ if (priv->id == 0)
+ {
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
+ }
+
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Errore durante il salvataggio.");
+ return;
+ }
+ g_free (sql);
+
+ organigramma_ufficio_carica (ufficio);
+ }
+ else
+ {
+ if (priv->id == 0)
+ {
+ gtk_label_set_text (GTK_LABEL (priv->objects[LBL_ID]), "");
+ }
+
+ solipa_message_dialog (priv->w,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ "Errore durante il salvataggio: allegato non importato nel database.");
+ return;
+ }
+
+ PQexec (priv->commons->pgcon, "COMMIT");
+
solipa_message_dialog (priv->w,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,