diff --git a/ba/ba1103.cpp b/ba/ba1103.cpp
index a2fa14024..da72c39d9 100755
--- a/ba/ba1103.cpp
+++ b/ba/ba1103.cpp
@@ -140,7 +140,7 @@ static int is_active_firm(long codditta)
   return 0;
 }
 
-static TXmlItem&  set_attr(TXmlItem& root, const char* name, const char* value)
+static TXmlItem& set_attr(TXmlItem& root, const char* name, const char* value)
 {
   TXmlItem& c = find_or_create_child(root, "attr");
   c.SetAttr("Name", name);
@@ -195,6 +195,7 @@ bool save_campo_xml()
 
   const TDongle& d = dongle();
   TXmlItem& chiavetta = find_or_create_child(root, "dongle", true);
+  chiavetta.SetAttr("OEM", get_oem_info("OEM"));
   chiavetta.SetAttr("Number", d.number());
   chiavetta.SetAttr("Users",  d.max_users());
   chiavetta.SetAttr("Year",   d.year_assist());
diff --git a/ba/ba1500.cpp b/ba/ba1500.cpp
index 7a7721e2e..379a4dbf9 100755
--- a/ba/ba1500.cpp
+++ b/ba/ba1500.cpp
@@ -357,23 +357,29 @@ void TAttivazione_moduli::garble_year(word y, TString& str1, TString& str2) cons
 
 void TAttivazione_moduli::build_key_column()
 {       
+  TWait_cursor hourglass;
   TSheet_field& sf = _msk->sfield(F_MODULI);
   sf.enable_column(F_KEY, false);
 
+  const TDongle& d = dongle();
   TString8 tmp1, tmp2;
   FOR_EACH_SHEET_ROW_BACK(sf, i, riga)
   {   
     if (!sf.cell_disabled(i, 1))
     {
-      int module = riga->get_int(2);
+      const int module = riga->get_int(2);
       garble_module(module, tmp1, tmp2);
-      riga->add(tmp1, 3);
+#ifdef DBG
+      if (d.type() == _developer_dongle)
+        riga->add(tmp2, 3); else  // Backdoor di debug: mostra chiave web
+#endif
+      riga->add(tmp1, 3);         // Normalmente mostra chiave hardware
     }  
   }
   sf.force_update();
   
-  _msk->set(F_USERS, ::dongle().max_users());
-  _msk->set(F_ASSIST, ::dongle().year_assist());
+  _msk->set(F_USERS, d.max_users());
+  _msk->set(F_ASSIST, d.year_assist());
 }
 
 bool TAttivazione_moduli::burn_dongle()
@@ -979,7 +985,11 @@ bool TAttivazione_moduli::create()
   _msk->set_handler(F_CHANGEUSERS, change_users_handler);
   _msk->set_handler(F_CHANGEASSIST, change_assist_handler);
   _msk->set_handler(DLG_PRINT, print_handler);
-  const TDongleType mydongle = ::dongle().type();
+  TDongleType mydongle = ::dongle().type();
+#ifdef DBG
+  if (mydongle == _developer_dongle && is_power_reseller(true))
+    mydongle = _aga_dongle;
+#endif
 
   if (mydongle == _aga_dongle)
   {                                  
diff --git a/ba/ba1600.cpp b/ba/ba1600.cpp
index d440323d7..0536199c0 100755
--- a/ba/ba1600.cpp
+++ b/ba/ba1600.cpp
@@ -168,7 +168,7 @@ int TInstall_ini::build_app_list(const TString& module, TString_array& a)
     TAssoc_array& varlist = list_variables(paragraph);
     FOR_EACH_ASSOC_STRING(varlist, obj, key, str)
     {                                 
-      int num;
+      int num = 0;
       if (sscanf(key, "Edit_%d", &num) == 1)
       {
         row = "Edit";
@@ -1895,7 +1895,7 @@ long TFascicolator_mask::find_signature(const TFilename& filename, const char* s
     {            
       if (compare == 0)
       {
-        position = infile.tellg();
+        position = (long)infile.tellg();
         position--;
       }
       compare++;
diff --git a/ba/ba1700.cpp b/ba/ba1700.cpp
index b7ae22ba5..e58098103 100755
--- a/ba/ba1700.cpp
+++ b/ba/ba1700.cpp
@@ -11,6 +11,7 @@
 #include <utility.h>
 
 #include "ba1.h"
+#include "ba1103.h"
 #include "ba1500.h"
 #include "ba1600.h"
 #include "ba1700a.h"
@@ -145,6 +146,7 @@ protected:
   void parse_internet_path(TString& http_server, TFilename& http_path) const;
   bool is_program_dir(const TFilename& path);
   bool is_visible_patch(TConfig& ini) const;
+  bool check_customer() const;
 
 public:
   bool installed() const { return _installed;}
@@ -326,6 +328,8 @@ int TInstaller_mask::precheck_modules(bool only_newer)
 	bool check_enabled = true;
   _setup_run = false; //inizializzazione del flag di controllo di lancio di setup.exe
 
+  const bool good_customer = check_customer();
+
   TString_array& a = rows_array();
   FOR_EACH_ARRAY_ROW(a, r, row)
   {
@@ -351,11 +355,14 @@ int TInstaller_mask::precheck_modules(bool only_newer)
         disable_row(r);
       }
 
+      if (chk && !good_customer && cod_module != "sy")
+        chk = false;
+
 			if (check_enabled)
         check(r, chk);
 
-      if (chk && only_newer && (cod_module == "sy" || cod_module == "sr"))  //se viene checkato il modulo sy (sistema) e/o sr (servers)deve togliere..
-      {                                                                       //..la possibilita' di installare altri moduli..
+      if (chk && only_newer && (cod_module == "sy" || cod_module == "sr")) // se viene checkato il modulo sy (sistema) e/o sr (servers)
+      {                                                                    // deve togliere la possibilita' di installare altri moduli.
         for (int i = 0; i < a.items(); i++)
         {
           if (i != r) 
@@ -369,6 +376,26 @@ int TInstaller_mask::precheck_modules(bool only_newer)
     } //if(modnumber>=0...
   } //FOR_EACH_ARRAY_ROW...
   force_update(); // Indispensabile per vedere le righe aggiornate sullo sheet
+
+  enable(F_INSTALL, good_customer);
+  if (!good_customer)
+  {
+    send_campo_xml();
+
+    TString html;
+    html << "<html><body>"
+         << "<h5>Attenzione: chiave " << dongle().number() << " non riconosciuta.</h5>\n" 
+         << "<p align=justify>Al fine di poter riattivare la chiave <b>" << dongle().product().before(" ") 
+         << "</b> in oggetto e poter quindi effettuare il download di eventuali aggiornamenti software, "
+         << "La preghiamo di contattare Sirio informatica e sistemi ai seguenti riferimenti:</p><br/>"
+         << "<ul><li>Sara Coppini, segreteria commerciale: "
+         << "<a href=mailto:scoppini@sirio-is.it>scoppini@sirio-is.it</a> Tel. 348-9897249</li>"
+         << "<li>Morena Martini, responsabile commerciale canale: "
+         << "<a href=mailto:mmartini@sirio-is.it>mmartini@sirio-is.it</a> Tel. 349-3421433</li></ul>"
+         << "</body></html>";
+    error_box(html);
+  }
+
   return items();
 }
 
@@ -414,6 +441,19 @@ void TInstaller_mask::update_version()
   force_update();
 }
 
+bool TInstaller_mask::check_customer() const
+{
+  Tdninst dninst;
+  bool good = dninst.find_serno();
+  if (good)
+  {
+    TString msg; 
+    good = dninst.test_cmdline("MustCall", false, msg) == 0;
+  }
+  return good;
+}
+
+
 // Cerca nel percorso specificato sulla maschera tutti i possibili files .ini
 // utilizzabili per un'installazione e li inserisce nello spreadsheet
 bool TInstaller_mask::autoload()
diff --git a/ba/ba7100.cpp b/ba/ba7100.cpp
index d7602f394..a9624a984 100755
--- a/ba/ba7100.cpp
+++ b/ba/ba7100.cpp
@@ -481,7 +481,8 @@ class TMailer_mask : public TAutomask
 protected:
   virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
   virtual long handler(WINDOW win, EVENT* ep);
-
+  void log(const char* text);
+  
 protected:
   bool file2app(const TString& file, TString& app) const;
   void expand_tabs(TMail_message& str, const int tab = 8) const;
@@ -504,6 +505,7 @@ public:
   void fill_messages();
   bool save_sheet_line(int& err, int line = -1);
   void save_all_lines();
+  void exec_scripts();
   void auto_save_all();
 
   void save() const;
@@ -727,11 +729,14 @@ void TMailer_mask::fill_messages()
   else
   {
     mailer = "POP3";
-    xvtil_statbar_set(TR("Ricezione messaggi POP3..."));
-    do_events();
-    mailbox.logon(server, user, password);
-    mailbox.get(_box);
-    mailbox.logoff();
+    if (server.full())
+    {
+      xvtil_statbar_set(TR("Ricezione messaggi POP3..."));
+      do_events();
+      mailbox.logon(server, user, password);
+      mailbox.get(_box);
+      mailbox.logoff();
+    }
   }
 
   TSheet_field& sf = sfield(F_MESSAGES);
@@ -1217,23 +1222,38 @@ void TMailer_mask::find_redundant_messages()
   }
 }
 
+void TMailer_mask::log(const char* text)
+{
+  TBrowsefile_field& bf = (TBrowsefile_field&)field(F_LOG);
+  TViswin& vv = bf.vis_win();
+ 
+  if (text && *text)
+  {
+    time_t tempo; time(&tempo);
+    const struct tm* d = localtime(&tempo);
+    TString256 msg;
+    msg.format("- %02d-%02d-%04d %02d:%02d:%02d %s",
+               d->tm_mday, d->tm_mon+1, 1900+d->tm_year,
+               d->tm_hour, d->tm_min, d->tm_sec,
+               text);
+    vv.add_line(msg);
+  }
+  else
+  {
+    vv.add_line("");
+    vv.goto_end();
+  }
+}
+
 void TMailer_mask::save_all_lines()
 {            
 	if (_mail_semaphore != 0)
 		return;
 	_mail_semaphore = 1;
 
-  TBrowsefile_field& bf = (TBrowsefile_field&)field(F_LOG);
-  TViswin& vv = bf.vis_win();
-
   TString msg;
   
-  time_t tempo; time(&tempo);
-  const struct tm* d = localtime(&tempo);
-  msg.format(FR("- Inizio elaborazione: %02d-%02d-%04d %02d:%02d:%02d"), 
-             d->tm_mday, d->tm_mon+1, 1900+d->tm_year,
-             d->tm_hour, d->tm_min, d->tm_sec);
-  vv.add_line(msg);
+  log(TR("Inizio elaborazione"));
   
   find_redundant_messages();
 
@@ -1281,22 +1301,17 @@ void TMailer_mask::save_all_lines()
       else
         msg << "ignorato in quanto transazione non riconosciuta";
     }
-    vv.add_line(msg);
+    log(msg);
   }      
   
-  time(&tempo);
-  d = localtime(&tempo);
-  msg.format("- Fine elaborazione: %02d-%02d-%04d %02d:%02d:%02d", 
-             d->tm_mday, d->tm_mon+1, 1900+d->tm_year,
-             d->tm_hour, d->tm_min, d->tm_sec);
-  vv.add_line(msg);
-  vv.add_line("");
-  vv.goto_end();
+  log(TR("Fine elaborazione"));
+  log("");
 
   sf.force_update(); // Fai apparire tutte le X
   
-  enable(DLG_DELREC);
+  TBrowsefile_field& bf = (TBrowsefile_field&)field(F_LOG);
   enable(DLG_DELLOG, bf.lines() > 0);
+  enable(DLG_DELREC);
 
 #ifdef DBG
   one_saved &= yesno_box("Si desidera eliminare i messaggi processati?");
@@ -1310,6 +1325,36 @@ void TMailer_mask::save_all_lines()
   }
 }
 
+void TMailer_mask::exec_scripts()
+{
+  TSheet_field& sf = sfield(F_SCRIPTS);
+  if (_mail_semaphore != 0 || sf.items()== 0)
+		return;
+	_mail_semaphore = 1;
+
+  TString cmd, des;
+  FOR_EACH_SHEET_ROW(sf, nrow, row) if (row->starts_with("X"))
+  {
+    row->get(1, cmd);
+    if (cmd.full())
+    {
+      row->get(2, des);
+      log(des.full() ? des : cmd); 
+      TExternal_app app(cmd);
+      const long ret = app.run();
+      if (ret != 0)
+      {
+        TString80 msg; msg.format(FR("Errore %ld nell'esecuzione di %s"), ret, (const char*)cmd);
+        log(msg);
+      }
+    }
+  }
+
+  log(""); 
+
+  _mail_semaphore = 0;
+}
+
 bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 {
   switch (o.dlg())
@@ -1331,7 +1376,7 @@ bool TMailer_mask::on_field_event(TOperable_field& o, TField_event e, long jolly
         if (_timer_id == XVT_TIMER_ERROR)
           return error_box("Impossibile impostare il timer");
 			}
-      }
+    }
     break;
   case F_MESSAGES:
     if (e == fe_init)
@@ -1477,6 +1522,8 @@ void TMailer_mask::auto_save_all()
 			fill_messages();
     if (_interval > 0 && sf.items() > 0)
       save_all_lines();
+
+    exec_scripts();
   }
   else
     NFCHECK("Can't save locked mail");
@@ -1523,6 +1570,7 @@ void TMailer_mask::save() const
   ini.set("DelCancel", get(F_DELCANCEL));
   save_sheet(ini, F_ADDRESSES, "Recipient");
   save_sheet(ini, F_PARAMS, "Filter");
+  save_sheet(ini, F_SCRIPTS, "Script");
 }
 
 void TMailer_mask::load()
@@ -1537,6 +1585,7 @@ void TMailer_mask::load()
   set(F_DELCANCEL, ini.get("DelCancel"));
   load_sheet(ini, F_ADDRESSES, "Recipient");
   load_sheet(ini, F_PARAMS, "Filter");
+  load_sheet(ini, F_SCRIPTS, "Script");
 
   _sequential = ini.get_bool("StopOnError", "ba7");
 }
diff --git a/ba/ba7100a.h b/ba/ba7100a.h
index 50c8706f6..a6862fa62 100755
--- a/ba/ba7100a.h
+++ b/ba/ba7100a.h
@@ -5,13 +5,15 @@
 #define F_TIMER     205
 #define F_TRACKING  206
 #define F_BACKUP    207
+#define F_DELCANCEL 208
 
 #define F_MESSAGES  210
 #define F_ADDRESSES 211
 #define F_PARAMS    212
+#define F_SCRIPTS   213
 
-#define F_LOG       213
-#define DLG_DELLOG  214
+#define F_LOG       220
+#define DLG_DELLOG  221
 
 #define F_CHECKED   101
 #define F_SENDER    102
@@ -21,14 +23,17 @@
 #define F_BODY      106
 #define F_MAILER    107
 #define F_ID        108
-#define F_DELCANCEL 109
 
 #define F_DEST      101 
 #define F_GROUP     102
 
-
 #define F_FILE      102
 #define F_OPERATOR  103
 #define F_EXPR      104
 
+// #define F_CHECKED   101
+#define F_COMMAND   102
+#define F_DESCR     103
+
+
 #define G_SUPERUSER 10
diff --git a/ba/ba7100a.uml b/ba/ba7100a.uml
index bdb40bdc8..dd9639f78 100755
--- a/ba/ba7100a.uml
+++ b/ba/ba7100a.uml
@@ -11,7 +11,7 @@ END
 BUTTON DLG_DELREC 10 2
 BEGIN
   PROMPT -11 -1 "Transazioni"
-  PICTURE BMP_DELREC
+  PICTURE TOOL_DELREC
 END
   
 BUTTON DLG_NULL 2 2
@@ -23,7 +23,7 @@ END
 BUTTON DLG_PRINT 10 2
 BEGIN
   PROMPT -22 -1 ""
-  PICTURE BMP_PRINT
+  PICTURE TOOL_PRINT
 END
 
 BUTTON DLG_DELLOG 10 2
@@ -166,6 +166,20 @@ END
 
 ENDPAGE
 
+PAGE "Script" 0 0 0 -2
+
+SPREADSHEET F_SCRIPTS 0 -1
+BEGIN
+  PROMPT 0 1 ""
+  ITEM "@1"
+  ITEM "Comando@50"
+  ITEM "Descrizione@50"
+  GROUP G_SUPERUSER
+  FLAGS "|"
+END
+
+ENDPAGE
+
 PAGE "Log" 0 0 0 -2
 
 BROWSEFILE F_LOG -3 -1
@@ -225,11 +239,14 @@ BEGIN
   FLAGS "D"
 END
 
+ENDPAGE
+
+TOOLBAR "Topbar" 0 0 0 2
+
 BUTTON DLG_USER 10 2
 BEGIN
   PROMPT -12 -1 ""
-  PICTURE BMP_SAVEREC
-  PICTURE BMP_SAVERECDN
+  PICTURE TOOL_SAVEREC
 END
 
 BUTTON DLG_CANCEL 10 2
@@ -254,6 +271,10 @@ BEGIN
   PROMPT 1 2 "Gruppo    "
 END
 
+ENDPAGE
+
+TOOLBAR "Topbar" 0 0 0 2
+
 BUTTON DLG_OK 10 2
 BEGIN
   PROMPT -13 -1 ""
@@ -301,6 +322,51 @@ BEGIN
   PROMPT 1 3 "Espressione "
 END
 
+ENDPAGE
+
+TOOLBAR "Topbar" 0 0 0 2
+
+BUTTON DLG_OK 10 2
+BEGIN
+  PROMPT -13 -1 ""
+END
+
+BUTTON DLG_DELREC 10 2
+BEGIN
+  PROMPT -23 -1 ""
+  PICTURE BMP_DELREC
+END
+
+BUTTON DLG_CANCEL 10 2
+BEGIN
+  PROMPT -33 -1 ""
+END
+
+ENDPAGE
+
+ENDMASK
+
+PAGE "Script" -1 -1 70 5
+
+BOOLEAN F_CHECKED
+BEGIN
+  PROMPT 1 1 "Attivo"
+END
+
+STRING F_COMMAND 80 50
+BEGIN
+  PROMPT 1 2 "Comando     "
+END
+
+STRING F_DESCR 50
+BEGIN
+  PROMPT 1 3 "Descrizione "
+END
+
+ENDPAGE
+
+TOOLBAR "Topbar" 0 0 0 2
+
 BUTTON DLG_OK 10 2
 BEGIN
   PROMPT -13 -1 ""
diff --git a/ba/ba8500.h b/ba/ba8500.h
index 74c21bb81..31664e986 100755
--- a/ba/ba8500.h
+++ b/ba/ba8500.h
@@ -9,7 +9,6 @@
 #include <report.h>
 #endif
 
-
 class TKlarkKent_app : public TSkeleton_application
 {
 protected:
diff --git a/ba/batbiva.uml b/ba/batbiva.uml
index 9ef38c5a2..0af54f52f 100755
--- a/ba/batbiva.uml
+++ b/ba/batbiva.uml
@@ -103,29 +103,6 @@ BEGIN
   HELP "Inserire la percentuale teorica dell'imposta"
 END
 
-#ifdef COVER
-
-NUMBER FLD_TABIVA_I1 1
-BEGIN
-  PROMPT 3 4 "Detraibilita' "
-  SHEET "Codice|Tipo detraibilita'@75"
-  INPUT FLD_TABIVA_I1
-  ITEM " |Regime normale"
-  ITEM "1|IVA indetraibile su acquisti riferiti a ricavi esenti"
-  ITEM "3|IVA indicata per passaggi interni al solo fine del calcolo di ventilazione"
-  ITEM "9|IVA non detraibile per l'articolo 19"
-  OUTPUT FLD_TABIVA_I1
-  OUTPUT FLD_DETRAZIONE
-  FIELD I1
-END
-
-STRING FLD_DETRAZIONE 80 52
-BEGIN
-  PROMPT 22 4 ""
-  FLAGS "D"
-END
-
-#endif
 
 GROUPBOX DLG_NULL 78 5
 BEGIN
@@ -136,7 +113,7 @@ LIST FLD_TABIVA_S7 1 35
 BEGIN
   PROMPT 2 6 "Cessioni "
   FIELD S7
-  ITEM " |Non in allegato"
+  ITEM " |Non rilevante"
   ITEM "1|1 - Imponibile"
   ITEM "2|2 - Non imponibile"
   ITEM "3|3 - Esente"
@@ -148,7 +125,7 @@ LIST FLD_TABIVA_S8 1 35
 BEGIN
   PROMPT 2 7 "Acquisti "
   FIELD S8
-  ITEM " |Non in allegato"
+  ITEM " |Non rilevante"
   ITEM "1|1 - Imponibile"
   ITEM "2|2 - Non imponibile"
   ITEM "3|3 - Esente"