]> saetta.ns0.it Git - solipa/organigramma/commitdiff
Aggiunta l'immagine al tipo recapito (closes #664).
authorAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Mon, 3 Jun 2013 11:29:43 +0000 (13:29 +0200)
committerAndrea Zagli <a.zagli@comune.scandicci.fi.it>
Mon, 3 Jun 2013 11:29:43 +0000 (13:29 +0200)
.cproject
data/organigramma/gui/organigramma.gui
docs/DBChangelog
docs/organigramma.sql
docs/organigramma/examples/organigramma.conf
installers/win/organigramma.conf
libreria/Makefile.am
src/Makefile.am
src/commons.h
src/main.c
src/tiporecapito.c

index d6c540384a50416f3ebacee39a201717e723fb67..61716b28b014486e740d5e421abdd2e3c3a856b9 100644 (file)
--- a/.cproject
+++ b/.cproject
@@ -31,6 +31,7 @@
                                                                        <listOptionValue builtIn="false" value="&quot;C:\mingw\include\glib-2.0&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;C:\mingw\include\gtk-2.0&quot;"/>
                                                                        <listOptionValue builtIn="false" value="&quot;C:\mingw\include\libgda-4.0&quot;"/>
+                                                                       <listOptionValue builtIn="false" value="&quot;C:\Program Files\PostgreSQL\8.4\include&quot;"/>
                                                                </option>
                                                                <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.120162119" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
                                                        </tool>
index 0616fb87ea7582355f8ebefbc6e8cc499f6782b1..586bba1f1aa93d94598ac38601bf40e3ac4efc2f 100644 (file)
     <property name="title" translatable="yes">Tipo nodo - Gestione organigramma</property>
     <property name="modal">True</property>
     <property name="window_position">center-on-parent</property>
+    <property name="default_width">500</property>
     <property name="destroy_with_parent">True</property>
     <child>
       <object class="GtkVBox" id="vbox3">
     <property name="title" translatable="yes">Tipo recapito - Gestione organigramma</property>
     <property name="modal">True</property>
     <property name="window_position">center-on-parent</property>
+    <property name="default_width">500</property>
     <property name="destroy_with_parent">True</property>
     <child>
       <object class="GtkVBox" id="vbox4">
           <object class="GtkTable" id="table3">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="n_rows">2</property>
+            <property name="n_rows">3</property>
             <property name="n_columns">2</property>
             <property name="column_spacing">5</property>
             <property name="row_spacing">5</property>
                 <property name="y_options">GTK_FILL</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkFrame" id="frame3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label_xalign">0</property>
+                <child>
+                  <object class="GtkAlignment" id="alignment1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="border_width">5</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                </child>
+                <child type="label">
+                  <object class="GtkLabel" id="label190">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label" translatable="yes">&lt;b&gt;Immagine&lt;/b&gt;</property>
+                    <property name="use_markup">True</property>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="right_attach">2</property>
+                <property name="top_attach">2</property>
+                <property name="bottom_attach">3</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">True</property>
index 5f62a67eb486f761f5b49207b2f1cd9cbe380fda..d47d9997c3962de12d866b5b8aa8d2cb6a6cdf45 100644 (file)
@@ -37,3 +37,8 @@ CREATE TABLE struttura_collegamenti
        status character varying(1) DEFAULT ''::character varying,
        CONSTRAINT struttura_collegamenti_pkey PRIMARY KEY (id)
 );
+
+ALTER TABLE tipi_recapito ADD COLUMN immagine_percorso character varying(255) DEFAULT '';
+ALTER TABLE tipi_recapito ADD COLUMN immagine_contenuto integer DEFAULT 0;
+ALTER TABLE tipi_recapito ADD COLUMN immagine_file_data timestamp without time zone;
+ALTER TABLE tipi_recapito ADD COLUMN immagine_file_dimensione bigint DEFAULT 0;
index 758b40d12442849cc6e6734e15a842e1691f3eb7..0c94aed11b5e9511d5bb5ab7bd79bf287dde5363 100644 (file)
@@ -4,7 +4,7 @@
 
 -- Dumped from database version 8.4.17
 -- Dumped by pg_dump version 9.2.2
--- Started on 2013-06-03 10:51:06
+-- Started on 2013-06-03 13:27:01
 
 SET statement_timeout = 0;
 SET client_encoding = 'UTF8';
@@ -293,7 +293,11 @@ CREATE TABLE tipi_rapporto_lavoro (
 CREATE TABLE tipi_recapito (
     id integer NOT NULL,
     nome character varying(100) DEFAULT ''::character varying,
-    status character varying(1) DEFAULT ''::character varying
+    status character varying(1) DEFAULT ''::character varying,
+    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
 );
 
 
@@ -414,7 +418,7 @@ CREATE TABLE ufficio_stanze (
 
 
 --
--- TOC entry 1988 (class 2606 OID 59289)
+-- TOC entry 1991 (class 2606 OID 59289)
 -- Name: nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -423,7 +427,7 @@ ALTER TABLE ONLY nodi
 
 
 --
--- TOC entry 2028 (class 2606 OID 61360)
+-- TOC entry 2031 (class 2606 OID 61360)
 -- Name: persona_incarichi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -432,7 +436,7 @@ ALTER TABLE ONLY persona_incarichi
 
 
 --
--- TOC entry 2018 (class 2606 OID 61305)
+-- TOC entry 2021 (class 2606 OID 61305)
 -- Name: persona_nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -441,7 +445,7 @@ ALTER TABLE ONLY persona_nodi
 
 
 --
--- TOC entry 2020 (class 2606 OID 61321)
+-- TOC entry 2023 (class 2606 OID 61321)
 -- Name: persona_nodo_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -450,7 +454,7 @@ ALTER TABLE ONLY persona_nodo_recapiti
 
 
 --
--- TOC entry 2014 (class 2606 OID 61279)
+-- TOC entry 2017 (class 2606 OID 61279)
 -- Name: persona_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -459,7 +463,7 @@ ALTER TABLE ONLY persona_recapiti
 
 
 --
--- TOC entry 2012 (class 2606 OID 61252)
+-- TOC entry 2015 (class 2606 OID 61252)
 -- Name: persona_uffici_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -468,7 +472,7 @@ ALTER TABLE ONLY persona_uffici
 
 
 --
--- TOC entry 2016 (class 2606 OID 61294)
+-- TOC entry 2019 (class 2606 OID 61294)
 -- Name: persona_ufficio_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -477,7 +481,7 @@ ALTER TABLE ONLY persona_ufficio_recapiti
 
 
 --
--- TOC entry 2008 (class 2606 OID 61235)
+-- TOC entry 2011 (class 2606 OID 61235)
 -- Name: persone_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -486,7 +490,7 @@ ALTER TABLE ONLY persone
 
 
 --
--- TOC entry 2022 (class 2606 OID 61328)
+-- TOC entry 2025 (class 2606 OID 61328)
 -- Name: posizioni_economiche_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -495,7 +499,7 @@ ALTER TABLE ONLY posizioni_economiche
 
 
 --
--- TOC entry 2026 (class 2606 OID 61342)
+-- TOC entry 2029 (class 2606 OID 61342)
 -- Name: profili_professionali_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -504,7 +508,7 @@ ALTER TABLE ONLY profili_professionali
 
 
 --
--- TOC entry 2032 (class 2606 OID 618188)
+-- TOC entry 2035 (class 2606 OID 618188)
 -- Name: ruoli_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -513,7 +517,7 @@ ALTER TABLE ONLY ruoli
 
 
 --
--- TOC entry 2036 (class 2606 OID 626378)
+-- TOC entry 2039 (class 2606 OID 626378)
 -- Name: struttura_collegamenti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -522,7 +526,7 @@ ALTER TABLE ONLY struttura_collegamenti
 
 
 --
--- TOC entry 1998 (class 2606 OID 59356)
+-- TOC entry 2001 (class 2606 OID 59356)
 -- Name: struttura_indirizzi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -531,7 +535,7 @@ ALTER TABLE ONLY struttura_indirizzi
 
 
 --
--- TOC entry 1996 (class 2606 OID 59339)
+-- TOC entry 1999 (class 2606 OID 59339)
 -- Name: strutture_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -540,7 +544,7 @@ ALTER TABLE ONLY strutture
 
 
 --
--- TOC entry 1990 (class 2606 OID 59296)
+-- TOC entry 1993 (class 2606 OID 59296)
 -- Name: tipi_nodo_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -549,7 +553,7 @@ ALTER TABLE ONLY tipi_nodo
 
 
 --
--- TOC entry 2024 (class 2606 OID 61335)
+-- TOC entry 2027 (class 2606 OID 61335)
 -- Name: tipi_prestazione_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -558,7 +562,7 @@ ALTER TABLE ONLY tipi_prestazione
 
 
 --
--- TOC entry 2010 (class 2606 OID 61242)
+-- TOC entry 2013 (class 2606 OID 61242)
 -- Name: tipi_rapporto_lavoro_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -567,7 +571,7 @@ ALTER TABLE ONLY tipi_rapporto_lavoro
 
 
 --
--- TOC entry 1992 (class 2606 OID 59303)
+-- TOC entry 1995 (class 2606 OID 59303)
 -- Name: tipi_recapito_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -576,7 +580,7 @@ ALTER TABLE ONLY tipi_recapito
 
 
 --
--- TOC entry 2006 (class 2606 OID 61226)
+-- TOC entry 2009 (class 2606 OID 61226)
 -- Name: titoli_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -585,7 +589,7 @@ ALTER TABLE ONLY titoli
 
 
 --
--- TOC entry 1994 (class 2606 OID 59321)
+-- TOC entry 1997 (class 2606 OID 59321)
 -- Name: uffici_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -594,7 +598,7 @@ ALTER TABLE ONLY uffici
 
 
 --
--- TOC entry 2034 (class 2606 OID 626366)
+-- TOC entry 2037 (class 2606 OID 626366)
 -- Name: ufficio_collegamenti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -603,7 +607,7 @@ ALTER TABLE ONLY ufficio_collegamenti
 
 
 --
--- TOC entry 2000 (class 2606 OID 59366)
+-- TOC entry 2003 (class 2606 OID 59366)
 -- Name: ufficio_nodi_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -612,7 +616,7 @@ ALTER TABLE ONLY ufficio_nodi
 
 
 --
--- TOC entry 2002 (class 2606 OID 59408)
+-- TOC entry 2005 (class 2606 OID 59408)
 -- Name: ufficio_orari_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -621,7 +625,7 @@ ALTER TABLE ONLY ufficio_orari
 
 
 --
--- TOC entry 2004 (class 2606 OID 59419)
+-- TOC entry 2007 (class 2606 OID 59419)
 -- Name: ufficio_recapiti_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -630,7 +634,7 @@ ALTER TABLE ONLY ufficio_recapiti
 
 
 --
--- TOC entry 2030 (class 2606 OID 61430)
+-- TOC entry 2033 (class 2606 OID 61430)
 -- Name: ufficio_stanze_pkey; Type: CONSTRAINT; Schema: public; Owner: -
 --
 
@@ -638,7 +642,7 @@ ALTER TABLE ONLY ufficio_stanze
     ADD CONSTRAINT ufficio_stanze_pkey PRIMARY KEY (id);
 
 
--- Completed on 2013-06-03 10:51:06
+-- Completed on 2013-06-03 13:27:02
 
 --
 -- PostgreSQL database dump complete
index 9e67dfb785cb79423440b595ba29316866aaf170..04bec93011d37bd3f5fad4021b2f4057de8cc0fb 100644 (file)
@@ -12,4 +12,5 @@ cnc_string=PostgreSQL://postgres:postgres@HOST=localhost;PORT=5432;DB_NAME=auted
 cnc_string=PostgreSQL://postgres:postgres@HOST=localhost;PORT=5432;DB_NAME=autoz
 
 [DB]
+pg_cnc_string=host=localhost dbname=organigramma user=postgres password=postgres
 cnc_string=PostgreSQL://postgres:postgres@HOST=localhost;PORT=5432;DB_NAME=organigramma
index a8a4051dc864fd4b8eed5b19ce7c0c348a5b6c1f..12eed06d8c45cf3260e9c2acbc9e899b5da32817 100644 (file)
@@ -15,5 +15,5 @@ cnc_string=PostgreSQL://postgres@HOST=panoramix.comune.scandicci.fi.it;PORT=5432
 cnc_string=PostgreSQL://postgres@HOST=panoramix.comune.scandicci.fi.it;PORT=5432;DB_NAME=audit
 
 [DB]
-pg_cnc_string=host=panoramix.comune.scandicci.fi.it dbname=opengov user=postgres
+pg_cnc_string=host=panoramix.comune.scandicci.fi.it dbname=organigramma user=postgres
 cnc_string=PostgreSQL://postgres@HOST=panoramix.comune.scandicci.fi.it;PORT=5432;DB_NAME=organigramma
index 211827b77a751e2204dc716465581b95beab781c..79049c830c5c329a2e4de61b6be13052bf801f90 100644 (file)
@@ -9,6 +9,11 @@ AM_CPPFLAGS = $(ORGANIGRAMMA_CFLAGS) \
 LIBS = $(ORGANIGRAMMA_LIBS) \
        -export-dynamic
 
+if PLATFORM_WIN32
+AM_CPPFLAGS += -I/programmi/PostgreSQL/8.4/include
+LIBS += -L/programmi/PostgreSQL/8.4/lib -lpq
+endif
+
 lib_LTLIBRARIES = liborganigramma.la
 
 liborganigramma_la_SOURCES = \
index e83fb98e4a3627e521c91223d167fefdab7529ae..86c2e9ea9a0aeede6bdd2804ce5649530966ec5b 100644 (file)
@@ -8,6 +8,11 @@ AM_CPPFLAGS = $(ORGANIGRAMMA_CFLAGS) \
 LIBS = $(ORGANIGRAMMA_LIBS) \
        -export-dynamic
 
+if PLATFORM_WIN32
+AM_CPPFLAGS += -I/programmi/PostgreSQL/8.4/include
+LIBS += -L/programmi/PostgreSQL/8.4/lib -lpq
+endif
+
 .rc.o:
        $(WINDRES) $^ -o $@
 
index 93f7d0f019f3b385bcf468fb8add17a97baf55a8..da2f9a02b1632d7a75e676c170e261078074b10d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2012 Andrea Zagli <a.zagli@comune.scandicci.fi.it>
+ * Copyright (C) 2010-2013 Andrea Zagli <a.zagli@comune.scandicci.fi.it>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
 #ifndef __ORGANIGRAMMA_COMMONS_H__
 #define __ORGANIGRAMMA_COMMONS_H__
 
+#include <libpq-fe.h>
+
 #include <gtk/gtk.h>
 
 #include <libgdaex/libgdaex.h>
 #include <libautoz/autoz.h>
 #include <libautoz/role_interface.h>
+#include <libsolipa/libsolipa.h>
 
 #include <libterritorio/commons.h>
 
@@ -40,12 +43,16 @@ typedef struct
 
                GdaEx *gdaex;
 
+               PGconn *pgcon;
+
                const gchar *guifile;
 
                const gchar *utente;
                Autoz *autoz;
                AutozIRole *role_utente;
 
+               Solipa *solipa;
+
                TerritorioCommons *territorio_commons;
        } OrganigrammaCommons;
 
index 6b7f151b17a8f8d82c53a2e657a1274cb8ddd81c..0c7dec8bc027c13a2e18d910c8c37f26bec8c420 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2012 Andrea Zagli <a.zagli@comune.scandicci.fi.it>
+ * Copyright (C) 2010-2013 Andrea Zagli <a.zagli@comune.scandicci.fi.it>
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -406,6 +406,9 @@ main (int argc, char *argv[])
                        return 0;
                }
 
+       /* inizializzo solipa */
+       commons->solipa = solipa_new ();
+
        /* leggo la stringa di connessione al db */
        error = NULL;
        cnc_string = g_key_file_get_value (config, "DB", "cnc_string", &error);
@@ -427,6 +430,28 @@ main (int argc, char *argv[])
                        g_error ("Errore nella connessione al database: %s", cnc_string);
                }
 
+       /* leggo la stringa di connessione al db nativa di postgres */
+       error = NULL;
+       cnc_string = g_key_file_get_value (config, "DB", "pg_cnc_string", &error);
+       if (cnc_string == NULL)
+               {
+                       if (error != NULL)
+                               {
+                                       g_error ("Impossibile leggere la stringa di connessione dal file di configurazione: %s", error->message);
+                               }
+                       else
+                               {
+                                       g_error ("Impossibile leggere la stringa di connessione dal file di configurazione.");
+                               }
+               }
+
+       commons->pgcon = PQconnectdb (cnc_string);
+       if (commons->pgcon == NULL
+           || PQstatus (commons->pgcon) == CONNECTION_BAD)
+               {
+                       g_error ("Errore nella connessione al database: %s", cnc_string);
+               }
+
        /* leggo la stringa di connessione al db territorio */
        error = NULL;
        cnc_string = g_key_file_get_value (config, "DB_TERRITORIO", "cnc_string", &error);
index 39868304c8909f51af3c3912a832de3efbedc7a1..fbe4e443182f39fa6312c5b1895df7834edf1052 100644 (file)
@@ -21,6 +21,8 @@
        #include <config.h>
 #endif
 
+#include <libpq-fe.h>
+
 #include <libautoz/autoz.h>
 #include <libgtkform/form.h>
 #include <libsolipa/utils.h>
@@ -70,6 +72,7 @@ struct _OrganigrammaTipoRecapitoPrivate
                GtkForm *form;
 
                GtkWidget *w;
+               SolipaAllegato *sallegato;
 
                GObject **objects;
 
@@ -149,6 +152,16 @@ OrganigrammaTipoRecapito
                                                      "label15",
                                                      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, "alignment1")),
+                                          solipa_allegato_get_widget (priv->sallegato));
+               }
+
        g_signal_connect (priv->w,
                          "delete-event", G_CALLBACK (organigramma_tipo_recapito_on_w_organigramma_tipo_recapito_delete_event), (gpointer)a);
 
@@ -202,7 +215,10 @@ organigramma_tipo_recapito_carica (OrganigrammaTipoRecapito *tipo_recapito)
 {
        OrganigrammaTipoRecapitoPrivate *priv = ORGANIGRAMMA_TIPO_RECAPITO_GET_PRIVATE (tipo_recapito);
 
-       gtk_form_fill_from_table (priv->form);
+       if (gtk_form_fill_from_table (priv->form))
+               {
+                       solipa_allegato_set_salva_in_db (priv->sallegato, TRUE);
+               }
 }
 
 static void
@@ -239,6 +255,74 @@ organigramma_tipo_recapito_salva (OrganigrammaTipoRecapito *tipo_recapito, gbool
                                        priv->id = strtol (gtk_label_get_text (GTK_LABEL (priv->objects[LBL_ID])), NULL, 10);
                                }
 
+                       /* 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 tipi_recapito"
+                                                              " 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_tipo_recapito_carica (tipo_recapito);
+                               }
+                       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,