diff --git a/htdocs/core/db/pgsql.class.php b/htdocs/core/db/pgsql.class.php
index c4282fa8abd14c8ccdfc1a6e2fad8bd3cd8045b6..255b2c6e66fc777c7e1921c5d2375850ca166ef6 100644
--- a/htdocs/core/db/pgsql.class.php
+++ b/htdocs/core/db/pgsql.class.php
@@ -58,8 +58,8 @@ class DoliDBPgsql
 	var $lastquery;
 	// Saved last error
 	var $lastqueryerror;
-	var $lasterror;
-	var $lasterrno;
+	var $lasterror;
+	var $lasterrno;
 	
 	var $unescapeslashquot=0;              // By default we do not force the unescape of \'. This is used only to process sql with mysql escaped data.
 	var $standard_conforming_strings=1;    // Database has option standard_conforming_strings to on
diff --git a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
index d3611f2bea87ee4b2ff32424ce7bcde41afbb0a4..dbc7cdd8c9f2b331c9cdb5e51a769e82144a6115 100644
--- a/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
+++ b/htdocs/core/modules/facture/doc/doc_generic_invoice_odt.modules.php
@@ -55,7 +55,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
 		$langs->load("companies");
 
 		$this->db = $db;
-		$this->name = "ODT templates";
+		$this->name = "ODT/ODS templates";
 		$this->description = $langs->trans("DocumentModelOdt");
 		$this->scandir = 'FACTURE_ADDON_PDF_ODT_PATH';	// Name of constant that is used to save list of directories to scan
 
@@ -114,6 +114,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
 		'object_source_invoice_ref'=>$invoice_source->ref,
         'object_hour'=>dol_print_date($object->date,'hour'),
 		'object_date'=>dol_print_date($object->date,'day'),
+		'object_date_rfc'=>dol_print_date($object->date,'dayrfc'),
 		'object_date_limit'=>dol_print_date($object->date_lim_reglement,'day'),
 		'object_date_creation'=>dol_print_date($object->date_creation,'day'),
 		'object_date_modification'=>(! empty($object->date_modification)?dol_print_date($object->date_modification,'day'):''),
@@ -220,7 +221,7 @@ class doc_generic_invoice_odt extends ModelePDFFactures
 			if (! is_dir($tmpdir)) $texttitle.=img_warning($langs->trans("ErrorDirNotFound",$tmpdir),0);
 			else
 			{
-				$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.odt');
+				$tmpfiles=dol_dir_list($tmpdir,'files',0,'\.(ods|odt)');
 				if (count($tmpfiles)) $listoffiles=array_merge($listoffiles,$tmpfiles);
 			}
 		}
diff --git a/htdocs/document.php b/htdocs/document.php
index c3c7e1fc523669fdfbaea0ae57645bf290434b91..9815bbdd7e6f8189e218b917a1c83a5ab01d6fb6 100644
--- a/htdocs/document.php
+++ b/htdocs/document.php
@@ -178,4 +178,4 @@ header('Pragma: public');
 
 readfile($original_file_osencoded);
 
-if (is_object($db)) $db->close();
+if (is_object($db)) $db->close();
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 1646c7f271eb1d0b9b747eab73c8f243b43146fd..90c7489089eeabf8eeb21184de6dea2fccfa3177 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -313,7 +313,7 @@ LanguageFilesCachedIntoShmopSharedMemory=Files .lang loaded in shared memory
 ExamplesWithCurrentSetup=Examples with current running setup
 ListOfDirectories=List of OpenDocument templates directories
 ListOfDirectoriesForModelGenODT=List of directories containing templates files with OpenDocument format.<br><br>Put here full path of directories.<br>Add a carriage return between eah directory.<br>To add a directory of the GED module, add here <b>DOL_DATA_ROOT/ecm/yourdirectoryname</b>.<br><br>Files in those directories must end with <b>.odt</b>. 
-NumberOfModelFilesFound=Number of ODT templates files found in those directories
+NumberOfModelFilesFound=Number of ODT/ODS templates files found in those directories
 ExampleOfDirectoriesForModelGen=Examples of syntax:<br>c:\mydir<br>/home/mydir<br>DOL_DATA_ROOT/ecm/ecmdir
 FollowingSubstitutionKeysCanBeUsed=<br>To know how to create your odt document templates, before storing them in those directories, read wiki documentation: 
 FullListOnOnlineDocumentation=http://wiki.dolibarr.org/index.php/Create_an_ODT_document_template
@@ -1002,7 +1002,7 @@ ModuleCompanyCodeDigitaria=Accountancy code depends on third party code. The cod
 UseNotifications=Use notifications
 NotificationsDesc=EMails notifications feature allows you to silently send automatic mail, for some Dolibarr events, to third parties (customers or suppliers) that are configured to. Choice of active notification and targets contacts is made one third party at time.
 ModelModules=Documents templates
-DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT files for OpenOffice, KOffice, TextEdit,...)
+DocumentModelOdt=Generate documents from OpenDocuments templates (.ODT or .ODS files for OpenOffice, KOffice, TextEdit,...)
 WatermarkOnDraft=Watermark on draft document
 CompanyIdProfChecker=Rules on Professional Ids
 MustBeUnique=Must be unique ?
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index ef98c76c657214e5e641a19f4cc6fa6f0412ff96..f3b134eec83f7349487d8e331e31f84be0da43b2 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -314,7 +314,7 @@ LanguageFilesCachedIntoShmopSharedMemory=Fichiers .lang en mémoire partagée
 ExamplesWithCurrentSetup=Exemples avec le paramétrage actif courant
 ListOfDirectories=Liste des répertoires des modèles OpenDocument
 ListOfDirectoriesForModelGenODT=Liste des répertoires contenant des documents modèles OpenDocument.<br><br>Indiquer les chemins complets de répertoire.<br>Ajouter un retour à la ligne entre chaque répertoire.<br>Pour indiquer un répertoire du module GED, indiquer<br><b>DOL_DATA_ROOT/ecm/nomdurepertoireged</b><br><br>Les fichiers modèles dans ces répertoires doivent se terminer par <b>.odt</b>.
-NumberOfModelFilesFound=Nombre de fichiers modèles ODT trouvés dans ce(s) répertoire(s)
+NumberOfModelFilesFound=Nombre de fichiers modèles ODT/ODS trouvés dans ce(s) répertoire(s)
 ExampleOfDirectoriesForModelGen=Exemple de syntaxe :<br>c:\\mydir<br>/home/mydir<br>DOL_DATA_ROOT/ecm/ecmdir
 FollowingSubstitutionKeysCanBeUsed=<br>Pour savoir comment rédiger des modèles de document odt avant de les placer dans un de ces répertoires, consulter la documentation du wiki :
 FullListOnOnlineDocumentation=http://wiki.dolibarr.org/index.php/Créer_un_modèle_de_document_ODT
@@ -1004,7 +1004,7 @@ ModuleCompanyCodeDigitaria=Renvoie un code comptable composé suivant le code ti
 UseNotifications=Utiliser les notifications
 NotificationsDesc=La fonction des notifications par emails permet d'envoyer automatiquement un email, pour certains événements Dolibarr, aux tiers (sociétés clients, prospects ou fournisseurs) configurés pour. Le choix des notifications et contacts destinataires se fait tiers par tiers.
 ModelModules=Modèle de documents
-DocumentModelOdt=Génération depuis des modèles OpenDocument (Fichier .ODT OpenOffice, KOffice, TextEdit…)
+DocumentModelOdt=Génération depuis des modèles OpenDocument (Fichier .ODT ou .ODS OpenOffice, KOffice, TextEdit…)
 WatermarkOnDraft=Filigrane sur les documents brouillons
 CompanyIdProfChecker=Règles sur les Identifiants professionnels
 MustBeUnique=Doit être unique ?
diff --git a/htdocs/paybox/admin/paybox.php b/htdocs/paybox/admin/paybox.php
index c55574d363a77193467081ddafebfcd71f06dd1d..0871aaf71e0bbca827d416d3b850c4379d8581a0 100644
--- a/htdocs/paybox/admin/paybox.php
+++ b/htdocs/paybox/admin/paybox.php
@@ -61,8 +61,8 @@ if ($action == 'setvalue' && $user->admin)
     if (! $result > 0) $error++;
     $result=dolibarr_set_const($db, "PAYBOX_MESSAGE_KO",GETPOST('PAYBOX_MESSAGE_KO','alpha'),'chaine',0,'',$conf->entity);
 	if (! $result > 0) $error++;
-	$result=dolibarr_set_const($db, "PAYBOX_PAYONLINE_SENDEMAIL",GETPOST('PAYBOX_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
-	if (! $result > 0) $error++;
+	$result=dolibarr_set_const($db, "PAYBOX_PAYONLINE_SENDEMAIL",GETPOST('PAYBOX_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
+	if (! $result > 0) $error++;
 	
     if (! $error)
   	{
@@ -93,12 +93,12 @@ llxHeader();
 $linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
 print_fiche_titre($langs->trans("PayBoxSetup"),$linkback,'setup');
 
-$h = 0;
-$head = array();
-
-$head[$h][0] = DOL_URL_ROOT."/paybox/admin/paybox.php";
-$head[$h][1] = $langs->trans("Account");
-$head[$h][2] = 'payboxaccount';
+$h = 0;
+$head = array();
+
+$head[$h][0] = DOL_URL_ROOT."/paybox/admin/paybox.php";
+$head[$h][1] = $langs->trans("Account");
+$head[$h][2] = 'payboxaccount';
 $h++;
 
 dol_fiche_head($head, 'payboxaccount', '');
@@ -198,17 +198,17 @@ $doleditor=new DolEditor('PAYBOX_MESSAGE_KO',$conf->global->PAYBOX_MESSAGE_KO,''
 $doleditor->Create();
 print '</td></tr>';
 
-$var=!$var;
-print '<tr '.$bc[$var].'><td>';
-print $langs->trans("PAYBOX_PAYONLINE_SENDEMAIL").'</td><td>';
-print '<input size="32" type="email" name="PAYBOX_PAYONLINE_SENDEMAIL" value="'.$conf->global->PAYBOX_PAYONLINE_SENDEMAIL.'">';
-print ' &nbsp; '.$langs->trans("Example").': myemail@myserver.com';
-print '</td></tr>';
+$var=!$var;
+print '<tr '.$bc[$var].'><td>';
+print $langs->trans("PAYBOX_PAYONLINE_SENDEMAIL").'</td><td>';
+print '<input size="32" type="email" name="PAYBOX_PAYONLINE_SENDEMAIL" value="'.$conf->global->PAYBOX_PAYONLINE_SENDEMAIL.'">';
+print ' &nbsp; '.$langs->trans("Example").': myemail@myserver.com';
+print '</td></tr>';
 
 print '<tr><td colspan="2" align="center"><br><input type="submit" class="button" value="'.$langs->trans("Modify").'"></td></tr>';
 print '</table></form>';
 
-dol_fiche_end();
+dol_fiche_end();
 
 print '<br><br>';
 
diff --git a/htdocs/paypal/admin/paypal.php b/htdocs/paypal/admin/paypal.php
index 998f724dc685e166a766062526e90d7c408c8125..c91e2ff0c80d3beaf968cec6ff7fbb2f7db9fb54 100644
--- a/htdocs/paypal/admin/paypal.php
+++ b/htdocs/paypal/admin/paypal.php
@@ -67,8 +67,8 @@ if ($action == 'setvalue' && $user->admin)
     if (! $result > 0) $error++;
     $result=dolibarr_set_const($db, "PAYPAL_MESSAGE_KO",GETPOST('PAYPAL_MESSAGE_KO'),'chaine',0,'',$conf->entity);
 	if (! $result > 0) $error++;
-	$result=dolibarr_set_const($db, "PAYPAL_PAYONLINE_SENDEMAIL",GETPOST('PAYPAL_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
-	if (! $result > 0) $error++;
+	$result=dolibarr_set_const($db, "PAYPAL_PAYONLINE_SENDEMAIL",GETPOST('PAYPAL_PAYONLINE_SENDEMAIL'),'chaine',0,'',$conf->entity);
+	if (! $result > 0) $error++;
 	
 	if (! $error)
   	{
@@ -203,12 +203,12 @@ $doleditor=new DolEditor('PAYPAL_MESSAGE_KO',$conf->global->PAYPAL_MESSAGE_KO,''
 $doleditor->Create();
 print '</td></tr>';
 
-$var=!$var;
-print '<tr '.$bc[$var].'><td>';
-print $langs->trans("PAYPAL_PAYONLINE_SENDEMAIL").'</td><td>';
+$var=!$var;
+print '<tr '.$bc[$var].'><td>';
+print $langs->trans("PAYPAL_PAYONLINE_SENDEMAIL").'</td><td>';
 print '<input size="32" type="email" name="PAYPAL_PAYONLINE_SENDEMAIL" value="'.$conf->global->PAYPAL_PAYONLINE_SENDEMAIL.'">';
 print ' &nbsp; '.$langs->trans("Example").': myemail@myserver.com';
-print '</td></tr>';
+print '</td></tr>';
 
 $var=true;
 print '<tr class="liste_titre">';