Index: main/plugin-odf-export/i18n/messages_en.xml
===================================================================
--- main/plugin-odf-export/i18n/messages_en.xml	(revision 40537)
+++ main/plugin-odf-export/i18n/messages_en.xml	(working copy)
@@ -34,6 +34,8 @@
     <message key="PLUGINS_ODF_EXPORT_SQL_CONFIG_EXPORT_ACTIVATE_DESC">Check this case to active the automatic export of ODF contents in SQL database</message>
     <message key="PLUGINS_ODF_EXPORT_SQL_CONFIG_EXPORT_HOUR">Export hour</message>
     <message key="PLUGINS_ODF_EXPORT_SQL_CONFIG_EXPORT_HOUR_DESC">Select the hour for automatic export</message>
+    <message key="PLUGINS_ODF_EXPORT_SQL_CONFIG_EXPORT_ONLY_VALIDATED">Only validated content</message>
+    <message key="PLUGINS_ODF_EXPORT_SQL_CONFIG_EXPORT_ONLY_VALIDATED_DESC">Check this case to export only validated content.</message>
     
     <!-- Export -->
     <message key="PLUGINS_ODF_EXPORT_SQL_EXPORT_ERROR_TITLE">Export failed</message>
Index: main/plugin-odf-export/i18n/messages_fr.xml
===================================================================
--- main/plugin-odf-export/i18n/messages_fr.xml	(revision 40537)
+++ main/plugin-odf-export/i18n/messages_fr.xml	(working copy)
@@ -34,6 +34,8 @@
     <message key="PLUGINS_ODF_EXPORT_SQL_CONFIG_EXPORT_ACTIVATE_DESC">Cochez cette case pour activer l'export automatique de l'offre de formation en base de données SQL.</message>
     <message key="PLUGINS_ODF_EXPORT_SQL_CONFIG_EXPORT_HOUR">Heure de l'export</message>
     <message key="PLUGINS_ODF_EXPORT_SQL_CONFIG_EXPORT_HOUR_DESC">Sélectionnez l'heure de l'export automatique.</message>
+    <message key="PLUGINS_ODF_EXPORT_SQL_CONFIG_EXPORT_ONLY_VALIDATED">Seulement les contenus validés</message>
+    <message key="PLUGINS_ODF_EXPORT_SQL_CONFIG_EXPORT_ONLY_VALIDATED_DESC">Cochez cette case pour exporter seulement les contenus validés.</message>
     
     <!-- Export -->
     <message key="PLUGINS_ODF_EXPORT_SQL_EXPORT_ERROR_TITLE">Echec de l'export</message>
Index: main/plugin-odf-export/plugin.xml
===================================================================
--- main/plugin-odf-export/plugin.xml	(revision 40537)
+++ main/plugin-odf-export/plugin.xml	(working copy)
@@ -92,6 +92,13 @@
             <group i18n="true">PLUGINS_ODF_EXPORT_SQL_CONFIG_GROUP</group>
             <widget>hour</widget>
         </param>
+        <param type="boolean" id="odf.automatic.export.only.validated">
+            <label i18n="true">PLUGINS_ODF_EXPORT_SQL_CONFIG_EXPORT_ONLY_VALIDATED</label>
+            <description i18n="true">PLUGINS_ODF_EXPORT_SQL_CONFIG_EXPORT_ONLY_VALIDATED_DESC</description>
+            <default-value>false</default-value>
+            <category i18n="true">plugin.odf:PLUGINS_ODF_CONFIG_CATEGORY</category>
+            <group i18n="true">PLUGINS_ODF_EXPORT_SQL_CONFIG_GROUP</group>
+        </param>
     </config>
     
 
@@ -116,6 +123,7 @@
         <config>
             <param-ref id="odf.automatic.export.activate"/>
             <param-ref id="odf.automatic.export.hour"/>
+            <param-ref id="odf.automatic.export.only.validated" />
             <param-ref id="odf.export.sql.jdbc.driver"/>
             <param-ref id="odf.export.sql.jdbc.url"/>
             <param-ref id="odf.export.sql.jdbc.user"/>
Index: main/plugin-odf-export/src/org/ametys/odf/export/ExportManager.java
===================================================================
--- main/plugin-odf-export/src/org/ametys/odf/export/ExportManager.java	(revision 40537)
+++ main/plugin-odf-export/src/org/ametys/odf/export/ExportManager.java	(working copy)
@@ -21,6 +21,7 @@
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
@@ -63,6 +64,9 @@
 import org.ametys.plugins.repository.metadata.UnknownMetadataException;
 import org.ametys.plugins.repository.metadata.jcr.JCRCompositeMetadata;
 import org.ametys.plugins.repository.query.expression.Expression.Operator;
+import org.ametys.plugins.repository.version.VersionableAmetysObject;
+import org.ametys.plugins.workflow.Workflow;
+import org.ametys.runtime.config.Config;
 import org.ametys.runtime.datasource.ConnectionHelper;
 import org.ametys.runtime.datasource.ConnectionHelper.DatabaseType;
 import org.ametys.runtime.util.I18nUtils;
@@ -102,6 +106,9 @@
     /** The i18n translator. */
     protected I18nUtils _i18nTranslator;
     
+    /** The workflow component */
+    protected Workflow _workflow;
+    
     /** The connection to the database. */
     protected Connection _connection;
     
@@ -125,6 +132,7 @@
         _contentTypeExtensionPoint = (ContentTypeExtensionPoint) sManager.lookup(ContentTypeExtensionPoint.ROLE);
         _resolver = (AmetysObjectResolver) sManager.lookup(AmetysObjectResolver.ROLE);
         _i18nTranslator = (I18nUtils) sManager.lookup(I18nUtils.ROLE);
+        _workflow = (Workflow) sManager.lookup(Workflow.ROLE);
     }
     
     @Override
@@ -1073,19 +1081,36 @@
         int nbContentFilled = 0;
         for (Content content : contents)
         {
-            String id = content.getId();
-            stmt.setString(1, id);
-            
-            Counter fillIndex = new Counter(2);
-            
-            CompositeMetadata metadata = content.getMetadataHolder();
-            fillCompositeMetadata(fillIndex, content, cType, metadata, tableName, id, "", stmt);
-            
-            nbContentFilled++;
-            _contentTypeInfos.get(contentTypeId).put("nbFilled", nbContentFilled);
+            List<String> labels = Arrays.asList(((VersionableAmetysObject) content).getAllLabels());
+            boolean exportContent = true;
+            if (Config.getInstance().getValueAsBoolean("odf.automatic.export.only.validated"))
+            {
+                if (labels.contains("Live"))
+                {
+                    ((VersionableAmetysObject) content).switchToLabel("Live");
+                }
+                else
+                {
+                    exportContent = false;
+                }
+            }
             
-            getLogger().debug(stmt.toString());
-            stmt.addBatch();
+            if (exportContent)
+            {
+                String id = content.getId();
+                stmt.setString(1, id);
+                
+                Counter fillIndex = new Counter(2);
+                
+                CompositeMetadata metadata = content.getMetadataHolder();
+                fillCompositeMetadata(fillIndex, content, cType, metadata, tableName, id, "", stmt);
+                
+                nbContentFilled++;
+                _contentTypeInfos.get(contentTypeId).put("nbFilled", nbContentFilled);
+                
+                getLogger().debug(stmt.toString());
+                stmt.addBatch();
+            }
         }
 
         stmt.executeBatch();
Index: main/plugin-odf-export/src/org/ametys/odf/export/ODFExportManager.java
===================================================================
--- main/plugin-odf-export/src/org/ametys/odf/export/ODFExportManager.java	(revision 40537)
+++ main/plugin-odf-export/src/org/ametys/odf/export/ODFExportManager.java	(working copy)
@@ -35,6 +35,7 @@
 import org.ametys.odf.translation.TranslationHelper;
 import org.ametys.plugins.repository.AmetysObject;
 import org.ametys.plugins.repository.TraversableAmetysObject;
+import org.ametys.plugins.repository.UnknownAmetysObjectException;
 import org.ametys.plugins.repository.metadata.CompositeMetadata;
 import org.ametys.runtime.datasource.ConnectionHelper;
 import org.ametys.runtime.util.I18nizableText;
@@ -692,16 +693,25 @@
             int position = 0;
             for (String courseId : courseList.getCourses())
             {
-                stmt.setString(1, idCourseList);
-                stmt.setString(2, courseId);
-                stmt.setInt(3, position);
-                position++;
-                
-                getLogger().info(stmt.toString());
-                stmt.addBatch();
-                
-                Course course = _resolver.resolveById(courseId);
-                _fillAdditionnalValueForProgramODF(course, "course");
+                Course course = null;
+                try
+                {
+                    course = _resolver.resolveById(courseId);
+                    
+                    stmt.setString(1, idCourseList);
+                    stmt.setString(2, courseId);
+                    stmt.setInt(3, position);
+                    position++;
+                    
+                    getLogger().info(stmt.toString());
+                    stmt.addBatch();
+                    
+                    _fillAdditionnalValueForProgramODF(course, "course");
+                }
+                catch (UnknownAmetysObjectException e)
+                {
+                    getLogger().warn("An error occurred : the course content with id '" + courseId + "' doesn't exist anymore. It can't be exported in SQL.");
+                }
             }
             
             getLogger().info(stmt.toString());
