diff --git a/htdocs/install/upgrade2.php b/htdocs/install/upgrade2.php
index 3307d42c98c..4e98f8ba6e6 100644
--- a/htdocs/install/upgrade2.php
+++ b/htdocs/install/upgrade2.php
@@ -157,6 +157,8 @@ if (isset($_POST['action']) && $_POST['action'] == 'upgrade')
migrate_contracts_date2($db,$langs,$conf);
migrate_contracts_date3($db,$langs,$conf);
+
+ migrate_fichinter_date1($db,$langs,$conf);
migrate_contracts_open($db,$langs,$conf);
@@ -712,6 +714,34 @@ function migrate_contracts_date3($db,$langs,$conf)
print '';
}
+/*
+ * Mise a jour des dates tms de fiche d'intervention
+ */
+function migrate_fichinter_date1($db,$langs,$conf)
+{
+ print '
';
+
+ print ' ';
+ print ''.$langs->trans('MigrationFichinterIncoherentTmsDateUpdate')." \n";
+
+ $sql1="update llx_fichinter set tms=datec where tms < datec";
+ $resql1 = $db->query($sql1);
+ if (! $resql1) dolibarr_print_error($db);
+ if ($db->affected_rows() > 0)
+ print $langs->trans('MigrationFchinterIncoherentTmsDateUpdateSuccess')." \n";
+ else
+ print $langs->trans('MigrationFichinterIncoherentTmsDateNothingToUpdate')." \n";
+ $sql2="update llx_fichinter set tms=date_valid where tms < date_valid";
+ $resql2 = $db->query($sql2);
+ if (! $resql2) dolibarr_print_error($db);
+ if ($db->affected_rows() > 0)
+ print $langs->trans('MigrationFchinterIncoherentTmsDateUpdateSuccess')." \n";
+ else
+ print $langs->trans('MigrationFichinterIncoherentTmsDateNothingToUpdate')." \n";
+
+ print ' |
';
+}
+
/*
* Reouverture des contrats qui ont au moins une ligne non fermée
diff --git a/mysql/migration/2.1.0-2.2.0.sql b/mysql/migration/2.1.0-2.2.0.sql
index 52a181e2040..761a8c3b70d 100644
--- a/mysql/migration/2.1.0-2.2.0.sql
+++ b/mysql/migration/2.1.0-2.2.0.sql
@@ -684,4 +684,5 @@ insert into llx_c_type_contact(rowid, element, source, code, libelle, active ) v
ALTER TABLE llx_fichinter CHANGE note description text DEFAULT NULL;
ALTER TABLE llx_fichinter ADD COLUMN note_private text DEFAULT NULL after description;
-ALTER TABLE llx_fichinter ADD COLUMN note_public text DEFAULT NULL after note_private;
\ No newline at end of file
+ALTER TABLE llx_fichinter ADD COLUMN note_public text DEFAULT NULL after note_private;
+ALTER TABLE llx_fichinter ADD COLUMN tms timestamp after ref;
\ No newline at end of file
diff --git a/mysql/tables/llx_fichinter.sql b/mysql/tables/llx_fichinter.sql
index 68894e4b575..2c3c9156b3b 100644
--- a/mysql/tables/llx_fichinter.sql
+++ b/mysql/tables/llx_fichinter.sql
@@ -26,6 +26,7 @@ create table llx_fichinter
fk_soc integer NOT NULL,
fk_projet integer DEFAULT 0, -- projet auquel est rattache la fiche
ref varchar(30) NOT NULL, -- number
+ tms timestamp,
datec datetime, -- date de creation
date_valid datetime, -- date de validation
datei date, -- date de l'intervention
diff --git a/mysql/tables/llx_societe.sql b/mysql/tables/llx_societe.sql
index 139112dc5c9..8ca4353e3db 100644
--- a/mysql/tables/llx_societe.sql
+++ b/mysql/tables/llx_societe.sql
@@ -32,7 +32,7 @@ create table llx_societe
code_client varchar(15), -- code client
code_fournisseur varchar(15), -- code founisseur
code_compta varchar(15), -- code compta client
- code_compta_fournisseur varchar(15), -- code compta founisseur
+ code_compta_fournisseur varchar(15), -- code compta founisseur
address varchar(255), -- company adresse
cp varchar(10), -- zipcode
ville varchar(50), -- town