#include <libgtkform/form.h>
#include <libgtkform/fielddatetime.h>
+#include <libsolipa/utils.h>
+
+#include <libterritorio/comuni.h>
#include "persona.h"
#include "personaincarico.h"
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,
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;
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);
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);
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,
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)
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));
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));
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));