From e4ffe630d76288f9f90f3356f9476e96095ee3c9 Mon Sep 17 00:00:00 2001 From: Andrea Zagli Date: Wed, 28 Nov 2012 10:29:15 +0100 Subject: [PATCH] Integrazione con territorio di persona. Controllo codice fiscale di persona. Aggiustamenti vari alle definizioni dei form. --- data/organigramma/form/persona_ufficio.form | 1 + .../form/profilo_professionale.form | 4 +- data/organigramma/form/struttura.form | 4 +- data/organigramma/form/tipo_nodo.form | 4 +- data/organigramma/form/tipo_prestazione.form | 4 +- .../form/tipo_rapporto_lavoro.form | 4 +- data/organigramma/form/tipo_recapito.form | 4 +- data/organigramma/form/titolo.form | 8 +- data/organigramma/form/ufficio.form | 5 +- data/organigramma/form/ufficio_orario.form | 4 +- data/organigramma/form/ufficio_recapito.form | 4 +- data/organigramma/form/ufficio_stanza.form | 3 + src/persona.c | 114 +++++++++++++----- src/struttura.c | 2 + src/ufficio.c | 2 + 15 files changed, 123 insertions(+), 44 deletions(-) diff --git a/data/organigramma/form/persona_ufficio.form b/data/organigramma/form/persona_ufficio.form index 0dc2831..410ed4f 100644 --- a/data/organigramma/form/persona_ufficio.form +++ b/data/organigramma/form/persona_ufficio.form @@ -37,6 +37,7 @@ date %d/%m/%Y + t diff --git a/data/organigramma/form/profilo_professionale.form b/data/organigramma/form/profilo_professionale.form index ece4467..fbdf9f4 100644 --- a/data/organigramma/form/profilo_professionale.form +++ b/data/organigramma/form/profilo_professionale.form @@ -11,7 +11,9 @@ - + + t + diff --git a/data/organigramma/form/struttura.form b/data/organigramma/form/struttura.form index a3b6523..b043305 100644 --- a/data/organigramma/form/struttura.form +++ b/data/organigramma/form/struttura.form @@ -11,7 +11,9 @@ - + + t + diff --git a/data/organigramma/form/tipo_nodo.form b/data/organigramma/form/tipo_nodo.form index 4aef8b0..8ecaae9 100644 --- a/data/organigramma/form/tipo_nodo.form +++ b/data/organigramma/form/tipo_nodo.form @@ -11,7 +11,9 @@ - + + t + diff --git a/data/organigramma/form/tipo_prestazione.form b/data/organigramma/form/tipo_prestazione.form index b1facfe..9f07dd6 100644 --- a/data/organigramma/form/tipo_prestazione.form +++ b/data/organigramma/form/tipo_prestazione.form @@ -11,7 +11,9 @@ - + + t + diff --git a/data/organigramma/form/tipo_rapporto_lavoro.form b/data/organigramma/form/tipo_rapporto_lavoro.form index 0f14e97..ceb42df 100644 --- a/data/organigramma/form/tipo_rapporto_lavoro.form +++ b/data/organigramma/form/tipo_rapporto_lavoro.form @@ -11,7 +11,9 @@ - + + t + diff --git a/data/organigramma/form/tipo_recapito.form b/data/organigramma/form/tipo_recapito.form index e5a3cb5..5d743af 100644 --- a/data/organigramma/form/tipo_recapito.form +++ b/data/organigramma/form/tipo_recapito.form @@ -11,7 +11,9 @@ - + + t + diff --git a/data/organigramma/form/titolo.form b/data/organigramma/form/titolo.form index 186747e..fea144b 100644 --- a/data/organigramma/form/titolo.form +++ b/data/organigramma/form/titolo.form @@ -11,11 +11,15 @@ - + + t + - + + t + diff --git a/data/organigramma/form/ufficio.form b/data/organigramma/form/ufficio.form index ae4d76b..d2ab817 100644 --- a/data/organigramma/form/ufficio.form +++ b/data/organigramma/form/ufficio.form @@ -25,11 +25,14 @@ + t - + + t + diff --git a/data/organigramma/form/ufficio_orario.form b/data/organigramma/form/ufficio_orario.form index a02ff04..4291a8e 100644 --- a/data/organigramma/form/ufficio_orario.form +++ b/data/organigramma/form/ufficio_orario.form @@ -16,7 +16,9 @@ - + + t + diff --git a/data/organigramma/form/ufficio_recapito.form b/data/organigramma/form/ufficio_recapito.form index 96f41a1..034a86d 100644 --- a/data/organigramma/form/ufficio_recapito.form +++ b/data/organigramma/form/ufficio_recapito.form @@ -26,7 +26,9 @@ - + + t + diff --git a/data/organigramma/form/ufficio_stanza.form b/data/organigramma/form/ufficio_stanza.form index 3dd2736..c968435 100644 --- a/data/organigramma/form/ufficio_stanza.form +++ b/data/organigramma/form/ufficio_stanza.form @@ -17,16 +17,19 @@ + t + t + t diff --git a/src/persona.c b/src/persona.c index ce7baa0..f812ee6 100644 --- a/src/persona.c +++ b/src/persona.c @@ -19,6 +19,9 @@ #include #include +#include + +#include #include "persona.h" #include "personaincarico.h" @@ -66,10 +69,15 @@ static void organigramma_persona_on_ufficio_aggiornato (gpointer instance, gpoin static void organigramma_persona_on_ufficio_recapito_aggiornato (gpointer instance, gpointer user_data); static void organigramma_persona_on_recapito_aggiornato (gpointer instance, gpointer user_data); +static void organigramma_persona_on_comune_selezionato (gpointer instance, guint id, gpointer user_data); + static gboolean organigramma_persona_on_w_organigramma_persona_delete_event (GtkWidget *widget, GdkEvent *event, gpointer user_data); +static void organigramma_persona_on_btn_ricerca_comune_clicked (GtkButton *button, + gpointer user_data); + static void organigramma_persona_on_btn_incarico_nuovo_clicked (GtkButton *button, gpointer user_data); static void organigramma_persona_on_btn_incarico_modifica_clicked (GtkButton *button, @@ -327,64 +335,69 @@ OrganigrammaPersona g_signal_connect (priv->sel_uffici, "changed", G_CALLBACK (organigramma_persona_on_uffici_sel_changed), (gpointer)a); + g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button89")), + "clicked", G_CALLBACK (organigramma_persona_on_btn_ricerca_comune_clicked), (gpointer)a); + g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button79")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_incarico_nuovo_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_incarico_nuovo_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button80")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_incarico_modifica_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_incarico_modifica_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button81")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_incarico_elimina_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_incarico_elimina_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview16")), - "row-activated", G_CALLBACK (organigramma_persona_on_trv_incarichi_row_activated), (gpointer *)a); + "row-activated", G_CALLBACK (organigramma_persona_on_trv_incarichi_row_activated), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button70")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_nodo_nuovo_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_nodo_nuovo_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button71")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_nodo_modifica_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_nodo_modifica_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button72")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_nodo_elimina_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_nodo_elimina_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview13")), - "row-activated", G_CALLBACK (organigramma_persona_on_trv_nodi_row_activated), (gpointer *)a); + "row-activated", G_CALLBACK (organigramma_persona_on_trv_nodi_row_activated), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button73")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_nodo_recapito_nuovo_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_nodo_recapito_nuovo_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button74")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_nodo_recapito_modifica_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_nodo_recapito_modifica_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button75")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_nodo_recapito_elimina_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_nodo_recapito_elimina_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview14")), - "row-activated", G_CALLBACK (organigramma_persona_on_trv_nodo_recapiti_row_activated), (gpointer *)a); + "row-activated", G_CALLBACK (organigramma_persona_on_trv_nodo_recapiti_row_activated), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button62")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_ufficio_nuovo_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_ufficio_nuovo_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button63")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_ufficio_modifica_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_ufficio_modifica_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button64")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_ufficio_elimina_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_ufficio_elimina_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview11")), - "row-activated", G_CALLBACK (organigramma_persona_on_trv_uffici_row_activated), (gpointer *)a); + "row-activated", G_CALLBACK (organigramma_persona_on_trv_uffici_row_activated), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button67")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_ufficio_recapito_nuovo_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_ufficio_recapito_nuovo_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button68")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_ufficio_recapito_modifica_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_ufficio_recapito_modifica_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button69")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_ufficio_recapito_elimina_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_ufficio_recapito_elimina_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview12")), - "row-activated", G_CALLBACK (organigramma_persona_on_trv_ufficio_recapiti_row_activated), (gpointer *)a); + "row-activated", G_CALLBACK (organigramma_persona_on_trv_ufficio_recapiti_row_activated), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button76")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_recapito_nuovo_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_recapito_nuovo_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button77")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_recapito_modifica_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_recapito_modifica_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "button78")), - "clicked", G_CALLBACK (organigramma_persona_on_btn_recapito_elimina_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_recapito_elimina_clicked), (gpointer)a); g_signal_connect (G_OBJECT (gtk_builder_get_object (priv->commons->gtkbuilder, "treeview15")), - "row-activated", G_CALLBACK (organigramma_persona_on_trv_recapiti_row_activated), (gpointer *)a); + "row-activated", G_CALLBACK (organigramma_persona_on_trv_recapiti_row_activated), (gpointer)a); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button65"), - "clicked", G_CALLBACK (organigramma_persona_on_btn_annulla_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_annulla_clicked), (gpointer)a); g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button66"), - "clicked", G_CALLBACK (organigramma_persona_on_btn_salva_clicked), (gpointer *)a); + "clicked", G_CALLBACK (organigramma_persona_on_btn_salva_clicked), (gpointer)a); + + gtk_form_clear (priv->form); priv->id = id; @@ -438,13 +451,9 @@ organigramma_persona_carica (OrganigrammaPersona *persona) static void organigramma_persona_salva (OrganigrammaPersona *persona) { - GError *error = NULL; gchar *sql; GtkWidget *dialog; - GDate *da; - GDate *a; - OrganigrammaPersonaClass *klass = ORGANIGRAMMA_PERSONA_GET_CLASS (persona); OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (persona); @@ -454,6 +463,16 @@ organigramma_persona_salva (OrganigrammaPersona *persona) return; } + if (!solipa_chk_codice_fiscale (gtk_entry_get_text (GTK_ENTRY (gtk_builder_get_object (priv->commons->gtkbuilder, "entry28"))), TRUE)) + { + solipa_message_dialog (priv->w, + GTK_MESSAGE_WARNING, + GTK_BUTTONS_OK, + "Codice fiscale errato."); + gtk_widget_grab_focus (GTK_WIDGET (gtk_builder_get_object (priv->commons->gtkbuilder, "entry28"))); + return; + } + if (priv->id == 0) { sql = gtk_form_get_sql (priv->form, GTK_FORM_SQL_INSERT); @@ -1152,6 +1171,16 @@ organigramma_persona_on_recapito_aggiornato (gpointer instance, gpointer user_da organigramma_persona_carica_recapiti (persona); } +static void +organigramma_persona_on_comune_selezionato (gpointer instance, guint id, gpointer user_data) +{ + OrganigrammaPersona *ia = (OrganigrammaPersona *)user_data; + + OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (ia); + + gtk_form_widget_set_value_stringify (gtk_form_get_form_widget_from_name (priv->form, "label110"), g_strdup_printf ("%d", id)); +} + static gboolean organigramma_persona_on_w_organigramma_persona_delete_event (GtkWidget *widget, GdkEvent *event, @@ -1160,6 +1189,25 @@ organigramma_persona_on_w_organigramma_persona_delete_event (GtkWidget *widget, return !organigramma_persona_conferma_chiusura ((OrganigrammaPersona *)user_data); } +static void +organigramma_persona_on_btn_ricerca_comune_clicked (GtkButton *button, + gpointer user_data) +{ + GtkWidget *w; + + OrganigrammaPersona *ia = (OrganigrammaPersona *)user_data; + OrganigrammaPersonaPrivate *priv = ORGANIGRAMMA_PERSONA_GET_PRIVATE (ia); + + TerritorioComuni *v = territorio_comuni_new (priv->commons->territorio_commons, TRUE); + + g_signal_connect (G_OBJECT (v), "selezionato", + G_CALLBACK (organigramma_persona_on_comune_selezionato), user_data); + + w = territorio_comuni_get_widget (v); + gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w)); + gtk_widget_show (w); +} + static void organigramma_persona_on_btn_incarico_nuovo_clicked (GtkButton *button, gpointer user_data) @@ -1482,7 +1530,7 @@ organigramma_persona_on_btn_ufficio_nuovo_clicked (GtkButton *button, OrganigrammaPersonaUfficio *a = organigramma_persona_ufficio_new (priv->commons, 0, priv->id); g_signal_connect (G_OBJECT (a), "aggiornato", - G_CALLBACK (organigramma_persona_on_ufficio_aggiornato), (gpointer)persona); + G_CALLBACK (organigramma_persona_on_ufficio_aggiornato), user_data); w = organigramma_persona_ufficio_get_widget (a); gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w)); @@ -1597,7 +1645,7 @@ organigramma_persona_on_btn_ufficio_recapito_nuovo_clicked (GtkButton *button, OrganigrammaPersonaUfficioRecapito *a = organigramma_persona_ufficio_recapito_new (priv->commons, 0, priv->id, id_uffici); g_signal_connect (G_OBJECT (a), "aggiornato", - G_CALLBACK (organigramma_persona_on_ufficio_recapito_aggiornato), (gpointer)persona); + G_CALLBACK (organigramma_persona_on_ufficio_recapito_aggiornato), user_data); w = organigramma_persona_ufficio_recapito_get_widget (a); gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w)); @@ -1704,7 +1752,7 @@ organigramma_persona_on_btn_recapito_nuovo_clicked (GtkButton *button, OrganigrammaPersonaRecapito *a = organigramma_persona_recapito_new (priv->commons, 0, priv->id); g_signal_connect (G_OBJECT (a), "aggiornato", - G_CALLBACK (organigramma_persona_on_recapito_aggiornato), (gpointer)persona); + G_CALLBACK (organigramma_persona_on_recapito_aggiornato), user_data); w = organigramma_persona_recapito_get_widget (a); gtk_window_set_transient_for (GTK_WINDOW (w), GTK_WINDOW (priv->w)); diff --git a/src/struttura.c b/src/struttura.c index de16ed7..550013e 100644 --- a/src/struttura.c +++ b/src/struttura.c @@ -190,6 +190,8 @@ OrganigrammaStruttura g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button40"), "clicked", G_CALLBACK (organigramma_struttura_on_btn_salva_clicked), (gpointer *)a); + gtk_form_clear (priv->form); + priv->id = id; if (priv->id == 0) diff --git a/src/ufficio.c b/src/ufficio.c index 76e8aae..9952bb4 100644 --- a/src/ufficio.c +++ b/src/ufficio.c @@ -307,6 +307,8 @@ OrganigrammaUfficio g_signal_connect (gtk_builder_get_object (priv->commons->gtkbuilder, "button30"), "clicked", G_CALLBACK (organigramma_ufficio_on_btn_salva_clicked), (gpointer *)a); + gtk_form_clear (priv->form); + priv->id = id; if (priv->id == 0) -- 2.49.0