diff --git a/.gitignore b/.gitignore
index 563dc099da33e8089d0da7a48bc33f0e86a811d3..4df9954c04b2bc8c9a0f5e667ca32259417c1d7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@
 /xml_files/*.xml
 readme-haltools.txt
 /ranking/*.csv
-
+/static/*
+/bibtex_csv_files/*.csv
\ No newline at end of file
diff --git a/hal/create_xml2hal.py b/hal/create_xml2hal.py
index 378ad885e15895f2673b3c8893237362c52d732c..7c249f991660215fbf61252fbc0b486f59e04c2d 100644
--- a/hal/create_xml2hal.py
+++ b/hal/create_xml2hal.py
@@ -1,15 +1,17 @@
 #!/usr/bin/python
-#-*- coding: utf-8 -*-
 
 from __future__ import unicode_literals
 
 import requests
 import csv
+from celery import shared_task
 
 # lib XML
 from lxml import etree
 
+from utils import mails
 
+import html
 
 #############################################################################################################################
 ###################################           BUILD XML ARTICLE CONF POSTER OUV COUV
@@ -20,13 +22,13 @@ from lxml import etree
 def createXml_sendHal(numero,listauthors, lang_title, title_publi, name_conf, nb_pages, date_pub, listdomains, type_pub, ville, pays, pays_acr, doi_value, editor_book, volume, pubmed, name_user, labo_auth_final, id_hal_user, login_user, login_depot, passwd_depot, bool_depot_preprod, bool_depot_prod):
     print ("method createXml_sendHal begin")
     ## VARIABLES CREATION XML
+    errormsg=""
 
     # Recup des donnes de la liste
     namefile = "xml_files/"+login_depot+str(numero)+".xml"
 
     file = open(namefile,"w") 
-    file.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
-
+    file.write("<?xml version=\"1.0\" encoding=\"latin1\"?>\n")
 
     tei = etree.Element("TEI")
     tei.set("xmlns","http://www.tei-c.org/ns/1.0")
@@ -42,36 +44,44 @@ def createXml_sendHal(numero,listauthors, lang_title, title_publi, name_conf, nb
 
         titleStmt = etree.SubElement(biblFull, "titleStmt")
         title = etree.SubElement(titleStmt, "title")
-        title.set("xml_lang",lang_title)          #Build from data      ### ATTENTION  remplacement xml_lang par xml:lang
+        title.set("xml_lang",lang_title)        #Build from data      ### ATTENTION  remplacement xml_lang par xml:lang
 
-        
-        title.text = title_publi.decode("utf-8")             #Build from data
+        title.text = title_publi      #Build from data
 
 
-        #print ("CREATE XML title "+str(type(title_publi))+ " title UTF8 "+title_publi.decode("utf-8")+str(type(title_publi.decode("utf-8"))))
+        #print ("CREATE XML title "+str(type(title_publi))+ " title UTF8 "+title_publi.decode("latin1")+str(type(title_publi.decode("latin1"))))
         ## TEST
         print ("createXML, id_hal user ",id_hal_user)
-
-        for auth in listauthors :
+        listauthors = listauthors.split(',')
+        for auth_all in listauthors :
+            auth_all = auth_all.strip()
+            print("auth_all {0}".format(auth_all))
+            auth = auth_all.split(' ')
+            if len(auth) != 2 :
+                errormsg+="Erreur probable sur le nom {0}, ".format(auth_all)
+            nom_auth = auth[0]
+            prenom_auth = auth[-1]
+            print("nom_auth {0} prenom_auth {1}".format(nom_auth, prenom_auth))
             author = etree.SubElement(titleStmt, "author")
             author.set("role","aut")
             persName = etree.SubElement(author, "persName")
             forename = etree.SubElement(persName, "forename")
             forename.set("type","first")
-            #print ("Author "+auth[1] + " "+auth[0])
-            prenom_auth = auth[1].decode("utf-8")
             forename.text = prenom_auth                #Build from data
             surname = etree.SubElement(persName, "surname")
-            nom_auth = auth[0].decode("utf-8")
+
             surname.text = nom_auth     
-            print ("AUTH 2 {0} {1} {2} ".format(nom_auth,prenom_auth,auth[2]))                #Build from data
-            if len(auth[2]) > 1 :
+            #print ("AUTH 2 {0} {1} {2} ".format(nom_auth,prenom_auth,auth[2]))                #Build from data
+            labstruct=""
+            if name_user in auth :
+                labstruct=labo_auth_final
+            if len(labstruct) > 1 :
                 if nom_auth == name_user and id_hal_user is not "" :
                     idno =  etree.SubElement(author, "idno")
                     idno.set("type", "idhal")
                     idno.text = id_hal_user
                 affiliation = etree.SubElement(author, "affiliation")
-                labo_author = "#"+auth[2]
+                labo_author = "#"+labstruct
                 affiliation.set("ref",labo_author)             #Build from data
 
 
@@ -89,24 +99,33 @@ def createXml_sendHal(numero,listauthors, lang_title, title_publi, name_conf, nb
     analytic = etree.SubElement(biblStruct, "analytic")
     title = etree.SubElement(analytic, "title")
     title.set("xml_lang",lang_title)          #Build from data             ### ATTENTION remplacement  xml_lang par xml:lang
-    title.text = title_publi.decode("utf-8")                  #Build from data
-
-    for auth in listauthors :
+    title.text = title_publi                  #Build from data
+
+    for auth_all in listauthors :
+        auth_all = auth_all.strip()
+        auth = auth_all.split(' ')
+        nom_auth = auth[0].strip()
+        nom_auth = nom_auth
+        prenom_auth = auth[1].strip()
+        prenom_auth = prenom_auth
         author = etree.SubElement(analytic, "author")
         author.set("role","aut")
         persName = etree.SubElement(author, "persName")
         forename = etree.SubElement(persName, "forename")
         forename.set("type","first")
-        forename.text = auth[1].decode("utf-8")                #Build from data
+        forename.text = prenom_auth               #Build from data
         surname = etree.SubElement(persName, "surname")
-        surname.text = auth[0].decode("utf-8")                    #Build from data
-        if len(auth[2]) > 1 :
-            if auth[0].decode("utf-8") == name_user and id_hal_user is not "":
+        surname.text = nom_auth                    #Build from data
+        labstruct=""
+        if name_user in auth :
+            labstruct=labo_auth_final
+        if len(labstruct) > 1 :
+            if nom_auth == name_user and id_hal_user is not "":
                 idno =  etree.SubElement(author, "idno")
                 idno.set("type", "idhal")
                 idno.text = id_hal_user
             affiliation = etree.SubElement(author, "affiliation")
-            labo_author = "#"+auth[2]
+            labo_author = "#"+labstruct
             affiliation.set("ref",labo_author)             #Build from data
 
 
@@ -114,49 +133,44 @@ def createXml_sendHal(numero,listauthors, lang_title, title_publi, name_conf, nb
     title = etree.SubElement(monogr, "title")
     if type_pub == "ART":
         title.set("level","j")
-        title.text = name_conf.decode("utf-8")                      #Build from data
-    if type_pub == "COMM":
+        title.text = name_conf                      #Build from data
+    if (type_pub == "COMM") or (type_pub == "POSTER"):
         title.set("level","m")
-        title.text = name_conf.decode("utf-8")                   #Build from data
-    if type_pub == "POSTER":
-        title.set("level","m")
-        title.text = name_conf.decode("utf-8")    
+        title.text = name_conf                   #Build from data 
     # Pour les COUV on donne le titre du livre (ici noté name_conf)
     if type_pub == "COUV":
         title = etree.SubElement(monogr, "title")
         title.set("level","m")
-        title.text = name_conf.decode("utf-8")   # ici name_conf = titre livre                    #Build from data
+        title.text = name_conf   # ici name_conf = titre livre                    #Build from data
         if len(editor_book) > 0 :
             editor = etree.SubElement(monogr, "editor")
-            editor.text = editor_book.decode("utf-8")     #Build from data
+            editor.text = editor_book     #Build from data
 
-    
     if (type_pub == "COMM") or (type_pub == "POSTER") :
         if (pays.strip() is not ""):
-    
             meeting = etree.SubElement(monogr, "meeting")
             title = etree.SubElement(meeting, "title")
-            title.text = name_conf.decode("utf-8")                    #Build from data
+            title.text = name_conf                    #Build from data
 
             date = etree.SubElement(meeting, "date")
             date.set("type","start")
             date.text = date_pub
             settlement = etree.SubElement(meeting, "settlement")
-            settlement.text = ville.decode("utf-8")
+            settlement.text = ville
             country = etree.SubElement(meeting, "country")
             country.set("key",pays_acr)
-            country.text = pays#.decode("utf-8")
+            country.text = pays
     
     imprint = etree.SubElement(monogr, "imprint")
     
     if len(volume) > 0 :
         biblScope = etree.SubElement(imprint, "biblScope")
         biblScope.set("unit","volume")
-        biblScope.text = volume#.decode("utf-8")#.strip()
+        biblScope.text = volume
     if len(nb_pages) > 0 :
         biblScope = etree.SubElement(imprint, "biblScope")
         biblScope.set("unit","pp")
-        biblScope.text = nb_pages#.decode("utf-8")#.strip()
+        biblScope.text = nb_pages
     
     date = etree.SubElement(imprint, "date")
     date.set("type","datePub")
@@ -194,8 +208,7 @@ def createXml_sendHal(numero,listauthors, lang_title, title_publi, name_conf, nb
     org.set("type","laboratory")
     org.set("xml_id",labo_auth_final)                                            ### ATTENTION remplacement  xml_id par xml:id
 
-
-    docxml = etree.tostring(tei, pretty_print=True, encoding='utf-8')
+    docxml = etree.tostring(tei, pretty_print=True)
 
     file.write(str(docxml))
 
@@ -213,46 +226,50 @@ def createXml_sendHal(numero,listauthors, lang_title, title_publi, name_conf, nb
     docxml = docxml.replace("b'<TEI","<TEI")
     docxml = docxml.replace("\\n'","")
     docxml = docxml.replace("\\n","\n")
-    print("accents")
-    docxml = str(docxml)
+    #docxml = docxml.replace('<?xml version="1.0" encoding="utf-8"?>','')
+    #docxml = docxml.replace("b'<?xml version=\'1.0\' encoding=\'latin1\'?>","<?xml version='1.0' encoding='latin1'?>")
+    #docxml = str(docxml)
+    #print(docxml)
     print(docxml)
-    docxml = docxml.replace("\\xc3\\xaa","ê")
-    docxml = docxml.replace("\\xc3\\xa9","é")
-    docxml = docxml.replace("\\xc3\\xb4","ô")
-    print(docxml)
-    
     
-    
-
     # Write the file out again
-    with open(namefile, 'w', encoding="utf-8") as file:
+    with open(namefile, 'w', encoding="utf8") as file:
         file.write(docxml)
 
-
-
+    # HEADERS request 
     headers = {
         'Packaging': 'http://purl.org/net/sword-types/AOfr',
         'Content-Type': 'text/xml',
         'On-Behalf-Of': 'login|'+login_user+';idhal|'+id_hal_user,
     }
 
+    #reponse_http = False
+    #response = ""
 
-    reponse_http = False
-    response = ""
+    code_http = 0
+    requ_msg = ""
 
     print ("createXML bool_depot_prod {0}".format(bool_depot_prod))
     # DEPOT PREPROD
     if bool_depot_preprod == True :
-        #namefile2 = "xml_files2/bdoreauCI1.xml"
+        #namefile = "xml_files2/bdoreauRI1.xml"
         data = open(namefile)
         try :
             response = requests.post('https://api-preprod.archives-ouvertes.fr/sword/hal/', headers=headers, data=data, auth=(login_depot, passwd_depot),timeout=60)
         except requests.exceptions.RequestException as e:
-            print ("ERROR REQUEST -> "+e)
+            print ("ERROR REQUEST {0}".format(e))
+            requ_msg += "ERROR REQUEST : {0} -- ".format(e)
         except requests.exceptions.Timeout as t :
-            print ("ERROR TIMEOUT REQUEST -> "+t)
+            print ("ERROR TIMEOUT REQUEST {0}".format(t))
+            requ_msg += "ERROR TIMEOUT : {0} -- ".format(t)
+
         print("response POST : code {0}".format(response.status_code))
         print("response POST : text {0}".format(response.text))
+        code_http = response.status_code
+        if (code_http != 200) and (code_http != 202) :
+            requ_msg += "RESPONSE : {0}".format(response.text)
+        else :
+            requ_msg += "RESPONSE : OK  {0}".format(errormsg)
 
     # DEPOT PROD
     if bool_depot_prod == True :
@@ -260,17 +277,20 @@ def createXml_sendHal(numero,listauthors, lang_title, title_publi, name_conf, nb
         try :
             response = requests.post('https://api.archives-ouvertes.fr/sword/hal/', headers=headers, data=data, auth=(login_depot, passwd_depot),timeout=60)
         except requests.exceptions.RequestException as e:
-            print ("ERROR REQUEST -> "+e)
+            print ("ERROR REQUEST {0}".format(e))
         except requests.exceptions.Timeout as t :
-            print ("ERROR TIMEOUT REQUEST -> "+t)            
+            print ("ERROR TIMEOUT REQUEST {0}".format(t)) 
+
         print("response POST : code {0}".format(response.status_code))
         print("response POST : text {0}".format(response.text))
-
-    print ('request POST OK')
-    if "202" in str(response) :
-        reponse_http = True
+        code_http = response.status_code
+        if (code_http != 200) and (code_http != 202) :
+            requ_msg += "RESPONSE : {0}".format(response.text)
+        else :
+            requ_msg += "RESPONSE : OK  {0}".format(errormsg)
     
-    return reponse_http
+    reponse = (code_http, requ_msg)
+    return reponse
 
 
 ####################################################################
@@ -278,6 +298,74 @@ def createXml_sendHal(numero,listauthors, lang_title, title_publi, name_conf, nb
 ##########
 ####################################################################
 
+@shared_task
+def sendselect_2hal(name_user, login_user,id_hal_user,mail_reponse,labo_auth_final,listdomains,login_depot,passwd_depot,choice_depot,list_publis_to_update,csvfile):
+
+    mail_message = "Bonjour\n\nSuite à votre demande sur l'appli Haltools, veuillez trouver ci-dessous les résultats de dépôts.\n\n"
+    with open('bibtex_csv_files/'+csvfile+'.csv', 'r', newline='', encoding='utf-8') as csv_file :
+        csvr = csv.reader(csv_file, delimiter =',')
+        for row in csvr :
+            numero = row[0]
+            listauthors = row[1]
+            title_publi = row[2]
+            name_conf = row[3]
+            nb_pages = row[4]
+            volume = row[5]
+            date_pub = row[6]
+            type_pub = row[7]
+            ville = row[9]
+            pays = row[10]
+            pays_acr = row[11]
+            doi_value = row[12]
+            editor_book = row[13]
+            lang_title = row[14]
+
+            pubmed = ""
+
+            bool_depot_preprod = False
+            bool_depot_prod = False
+            mailchoicedepot = ""
+
+            if choice_depot == "PREPROD" :
+                bool_depot_preprod = True
+                mailchoicedepot = "sur la preprod de HAL"
+            
+            #if choice_depot == "PRODHAL" :
+            #    bool_depot_prod = True
+            #    mailchoicedepot = "sur HAL"
+
+            if numero in list_publis_to_update : # ie publi selected 
+                # encodage
+
+                print("createXml_sendHal pour {0}".format(numero))
+                rep = createXml_sendHal(numero,listauthors, lang_title, title_publi, name_conf, nb_pages, date_pub, listdomains, type_pub, ville, pays, pays_acr, doi_value, editor_book, volume, pubmed, name_user, labo_auth_final, id_hal_user, login_user, login_depot, passwd_depot, bool_depot_preprod, bool_depot_prod)
+                print("Resultat pour {0} -> code : {1} - requ msg : {2}".format(numero,rep[0],rep[1]))
+                if (int(rep[0]) == 200) or (int(rep[0]) == 202) :
+                    mail_message+="La publi au numéro {0} et au titre {1} publiée en {2} a bien été déposée {3}\n".format(numero, title_publi, date_pub, mailchoicedepot)
+                    mail_message+="{0}\n\n".format(rep[1])
+                else :
+                    mail_message+="La publi au numéro {0} et au titre {1} publiée en {2} n'a pas pu être déposée {3}\n".format(numero, title_publi, date_pub, mailchoicedepot)
+                    mail_message+="L'erreur remontée est {0}\n\n".format(rep[1])
+    mail_message+="Cordialement\nL'équipe Haltools"
+    mails.sendonemail("[HALTOOLS] résultats dépôts",mail_message,mail_reponse)
+    return None
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 def create_single_xml(listauthors, lang_title, title_publi, name_conf, nb_pages, date_pub, listdomains, type_pub, ville, pays, pays_acr, doi_value, editor_book, volume, pubmed, name_user, labo_auth_final, id_hal_user, login_user):
     print ("method create_single_xml begin")
@@ -289,7 +377,7 @@ def create_single_xml(listauthors, lang_title, title_publi, name_conf, nb_pages,
     namefile = "xml_files/"+str(login_user)+"temp.xml"
 
     file = open(namefile,"w") 
-    file.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
+    file.write("<?xml version=\"1.0\" encoding=\"latin1\"?>\n")
 
 
     tei = etree.Element("TEI")
@@ -307,7 +395,7 @@ def create_single_xml(listauthors, lang_title, title_publi, name_conf, nb_pages,
         titleStmt = etree.SubElement(biblFull, "titleStmt")
         title = etree.SubElement(titleStmt, "title")
         title.set("xml_lang",lang_title)          #Build from data      ### ATTENTION  remplacement xml_lang par xml:lang
-        title.text = str(title_publi) #.decode("utf-8")                   #Build from data
+        title.text = title_publi.decode("latin1")                   #Build from data
 
         for auth in listauthors :
             author = etree.SubElement(titleStmt, "author")
@@ -315,11 +403,11 @@ def create_single_xml(listauthors, lang_title, title_publi, name_conf, nb_pages,
             persName = etree.SubElement(author, "persName")
             forename = etree.SubElement(persName, "forename")
             forename.set("type","first")
-            forename.text = str(auth[1]) #.decode("utf-8")                #Build from data
+            forename.text = auth[1].decode("latin1")                #Build from data
             surname = etree.SubElement(persName, "surname")
-            surname.text = str(auth[0]) #.decode("utf-8")                    #Build from data
+            surname.text = auth[0].decode("latin1")                    #Build from data
             if len(auth[2]) > 1 :
-                if str(auth[0]) == name_user and id_hal_user is not "":
+                if auth[0].decode("latin1") == name_user and id_hal_user is not "":
                     idno =  etree.SubElement(author, "idno")
                     idno.set("type", "idhal")
                     idno.text = id_hal_user
@@ -329,21 +417,20 @@ def create_single_xml(listauthors, lang_title, title_publi, name_conf, nb_pages,
 
 
     # Unnecessary noteStmt
-    """
+    '''
     notesStmt = etree.SubElement(biblFull, "notesStmt")
     note = etree.SubElement(notesStmt, "note")
     note.set("type","commentary")
     note.text = comment_publi
-    """
+    '''
     # sourceDesc
     sourceDesc = etree.SubElement(biblFull, "sourceDesc")
     biblStruct = etree.SubElement(sourceDesc, "biblStruct")
     analytic = etree.SubElement(biblStruct, "analytic")
     title = etree.SubElement(analytic, "title")
     title.set("xml_lang",lang_title)          #Build from data             ### ATTENTION remplacement  xml_lang par xml:lang
-    title.text = str(title_publi) #.decode("utf-8")                   #Build from data
-    #print ("CREATE XML title "+str(type(title_publi)))
-
+    title.text = title_publi.decode("latin1")                   #Build from data
+    #print ("CREATE XML title "+type(title_publi)))
 
     for auth in listauthors :
         author = etree.SubElement(analytic, "author")
@@ -351,9 +438,9 @@ def create_single_xml(listauthors, lang_title, title_publi, name_conf, nb_pages,
         persName = etree.SubElement(author, "persName")
         forename = etree.SubElement(persName, "forename")
         forename.set("type","first")
-        forename.text = str(auth[1]) #.decode("utf-8")                #Build from data
+        forename.text = auth[1].decode("latin1")                #Build from data
         surname = etree.SubElement(persName, "surname")
-        surname.text = str(auth[0]) #.decode("utf-8")                    #Build from data
+        surname.text = auth[0].decode("latin1")                    #Build from data
         if len(auth[2]) > 1 :
             affiliation = etree.SubElement(author, "affiliation")
             labo_author = "#"+auth[2]
@@ -363,35 +450,32 @@ def create_single_xml(listauthors, lang_title, title_publi, name_conf, nb_pages,
                 idno_idhal.set("type", "idhal")
                 idno.text = id_hal_user
 
-
-
     monogr = etree.SubElement(biblStruct, "monogr")
     title = etree.SubElement(monogr, "title")
     if type_pub == "ART":
         title.set("level","j")
-        title.text = str(name_conf) #.decode("utf-8")                       #Build from data
+        title.text = name_conf.decode("latin1")                       #Build from data
     if type_pub == "COMM":
         title.set("level","m")
-        title.text = str(name_conf) #.decode("utf-8")                       #Build from data
+        title.text = name_conf.decode("latin1")                       #Build from data
     if type_pub == "POSTER":
         title.set("level","m")
-        title.text = str(name_conf) #.decode("utf-8")    
+        title.text = name_conf.decode("latin1")    
     # Pour les COUV on donne le titre du livre (ici noté name_conf)
     if type_pub == "COUV":
         title = etree.SubElement(monogr, "title")
         title.set("level","m")
-        title.text = str(name_conf)   # ici name_conf = titre livre                    #Build from data
+        title.text = name_conf.decode("latin1")   # ici name_conf = titre livre                    #Build from data
         if len(editor_book) > 0 :
             editor = etree.SubElement(monogr, "editor")
-            editor.text = str(editor_book)     #Build from data
+            editor.text = editor_book     #Build from data
 
-    
     if (type_pub == "COMM") or (type_pub == "POSTER") :
         if (pays.strip() is not ""):
     
             meeting = etree.SubElement(monogr, "meeting")
             title = etree.SubElement(meeting, "title")
-            title.text = str(name_conf)                      #Build from data
+            title.text = name_conf.decode("latin1")                      #Build from data
 
             date = etree.SubElement(meeting, "date")
             date.set("type","start")
@@ -400,18 +484,18 @@ def create_single_xml(listauthors, lang_title, title_publi, name_conf, nb_pages,
             settlement.text = str(ville)
             country = etree.SubElement(meeting, "country")
             country.set("key",pays_acr)
-            country.text = str(pays) ##.decode("utf-8")
+            country.text = str(pays) ##.decode("latin1")
     
     imprint = etree.SubElement(monogr, "imprint")
     
     if len(volume) > 0 :
         biblScope = etree.SubElement(imprint, "biblScope")
         biblScope.set("unit","volume")
-        biblScope.text = str(volume) ##.decode("utf-8")#.strip()
+        biblScope.text = str(volume) ##.decode("latin1")#.strip()
     if len(nb_pages) > 0 :
         biblScope = etree.SubElement(imprint, "biblScope")
         biblScope.set("unit","pp")
-        biblScope.text = str(nb_pages) ##.decode("utf-8")#.strip()
+        biblScope.text = str(nb_pages) ##.decode("latin1")#.strip()
     
     date = etree.SubElement(imprint, "date")
     date.set("type","datePub")
@@ -449,7 +533,6 @@ def create_single_xml(listauthors, lang_title, title_publi, name_conf, nb_pages,
     org.set("type","laboratory")
     org.set("xml_id",labo_auth_final)                                            ### ATTENTION remplacement  xml_id par xml:id
 
-
     docxml = etree.tostring(tei, pretty_print=True, encoding='unicode')
 
     file.write(docxml) 
@@ -471,6 +554,3 @@ def create_single_xml(listauthors, lang_title, title_publi, name_conf, nb_pages,
         file.write(docxml)
 
     return docxml
-
-
-
diff --git a/hal/forms.py b/hal/forms.py
index 4ab9fc8190e7cee6571bbb689e9eba86b62319c6..f2440b5ef4bfbbd3dbce911dde8057bef2c0e41b 100644
--- a/hal/forms.py
+++ b/hal/forms.py
@@ -14,7 +14,7 @@ class ConnexionForm(forms.Form):
 
 
 CHOICES_DEPOT= (
-('NODEPOT', 'Pas de dépôt'),
+#('NODEPOT', 'Pas de dépôt'),
 ('PREPROD', 'Dépôt préprod'),
 ('PRODHAL', 'Dépôt HAL'),
 )
@@ -106,27 +106,29 @@ CHOICES_DOMAINS2 = (
 )
 
 class Bibtex2halForm(forms.Form): 
-    bib_name_user = forms.CharField(required=True, max_length=40, label="Forme auteur Bibtex (*)")
     name_user = forms.CharField(required=True, max_length=40, label="Nom chercheur (*)")
     firstname_user = forms.CharField(required=True, max_length=40, label="Prénom chercheur (*)")
     labo_auth_final = forms.CharField(required=True, max_length=40, label="N° de structure (*) (Ex: 490706)", initial = 490706)   
+    bibtex_file = forms.CharField(required=True, label="contenu bibtex", widget=forms.Textarea(attrs={'rows':20, 'cols':90}),)
+
+
+class Bibformat2halForm(forms.Form):
+    name_user = forms.CharField(required=True, max_length=40, label="Nom chercheur (*)")
     id_hal_user = forms.CharField(required=True, max_length=40, label="IdHal chercheur (*)")
     login_user = forms.CharField(required=True, max_length=40, label="Login HAL chercheur (*)")
     #choice_source = forms.ChoiceField(widget=forms.RadioSelect, choices=CHOICES_SOURCE_BIBTEX, label="Choix de la source", initial='DBLP' )
+    labo_auth_final = forms.CharField(required=True, max_length=40, label="N° de structure (*) (Ex: 490706)", initial = 490706)
     login_depot = forms.CharField(required=True, max_length=40, label="Login HAL référent (*)")
     passwd_depot = forms.CharField(required=True, max_length=40, label=("Password HAL référent (*)"), widget=forms.PasswordInput())
     choice_depot = forms.ChoiceField(widget=forms.RadioSelect, choices=CHOICES_DEPOT, label="Choix du dépôt", initial='NODEPOT' )
     mail_reponse = forms.CharField(required=True, max_length=40, label="Adresse mail de retour résultats")
     domains = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, choices=CHOICES_DOMAINS, label="Domaines de recherche", initial='math',required=False)
     domains2 = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple, choices=CHOICES_DOMAINS2, label="Autres domaines", initial='info.info-gt',required=False)
-    """ domain1 = forms.CharField(required=True, max_length=20, label="Domaine 1 (*)")
-    domain2 = forms.CharField(required=False, max_length=20, label="Domaine 2")
-    domain3 = forms.CharField(required=False, max_length=20, label="Domaine 3")
-    domain4 = forms.CharField(required=False, max_length=20, label="Domaine 4")
-    domain5 = forms.CharField(required=False, max_length=20, label="Domaine 5") """
-
-    bibtex_file = forms.CharField(required=True, label="contenu bibtex", widget=forms.Textarea(attrs={'rows':20, 'cols':90}),)
 
+class VerifHalConfForm(forms.Form): 
+    name_user = forms.CharField(required=True, max_length=40, label="Nom chercheur (*)")
+    firstname_user = forms.CharField(required=True, max_length=40, label="Prénom chercheur (*)")
+    id_hal_user = forms.CharField(required=True, max_length=40, label="IdHal chercheur (*)")
 
 class BibtexXmlForm(forms.Form): 
     bib_name_user = forms.CharField(required=True, max_length=40, label="Forme auteur DBLP (*)")
@@ -146,19 +148,7 @@ class BibtexXmlForm(forms.Form):
 
     bibtex_file = forms.CharField(required=True, label="contenu bibtex", widget=forms.Textarea(attrs={'rows':20, 'cols':90}),)
 
-class UpdateHalBibtexForm(forms.Form): 
-    #bib_name_user = forms.CharField(required=True, max_length=40, label="Forme auteur Bibtex (*)")
-    name_user = forms.CharField(required=True, max_length=40, label="Nom chercheur (*)")
-    firstname_user = forms.CharField(required=True, max_length=40, label="Prénom chercheur (*)")
-    labo_auth_final = forms.CharField(required=True, max_length=40, label="N° de structure (*) (Ex: 490706)", initial = 490706)   
-    id_hal_user = forms.CharField(required=True, max_length=40, label="IdHal chercheur (*)")
-    #login_user = forms.CharField(required=True, max_length=40, label="Login HAL chercheur (*)")
-    #choice_source = forms.ChoiceField(widget=forms.RadioSelect, choices=CHOICES_SOURCE_BIBTEX, label="Choix de la source", initial='DBLP' )
-    login_depot = forms.CharField(required=True, max_length=40, label="Login HAL référent (*)")
-    passwd_depot = forms.CharField(required=True, max_length=40, label=("Password HAL référent (*)"), widget=forms.PasswordInput())
-    choice_depot = forms.ChoiceField(widget=forms.RadioSelect, choices=CHOICES_DEPOT, label="Choix du dépôt", initial='NODEPOT' )
- 
-    #bibtex_file = forms.CharField(required=True, label="contenu bibtex", widget=forms.Textarea(attrs={'rows':20, 'cols':90}),)
+
 
 
 class Csv2halForm(forms.Form):
diff --git a/hal/management/commands/create_csv_scimagocore.py b/hal/management/commands/create_csv_scimagocore.py
index f5c568b3b5771b59624949280f7fc5d22d2986b1..8ff44f81e452f19ab08a8f050da07904cbea69b6 100644
--- a/hal/management/commands/create_csv_scimagocore.py
+++ b/hal/management/commands/create_csv_scimagocore.py
@@ -18,75 +18,17 @@
 ####################################
 
 from django.core.management.base import BaseCommand, CommandError
-
+from haltools.settings  import BASE_DIR
+from hal.dict_scimago_core import dict_scimago, dict_core
 import requests
 import csv
 import os
-from haltools.settings  import BASE_DIR
 
 ###########
 # VARIABLES
 ###########
 
-# URLs SCIMAGO pour tous les les domaines informatique
-url_sci_2021 = 'https://www.scimagojr.com/journalrank.php?year=2021&type=j&out=xls'
-url_sci_2020 = 'https://www.scimagojr.com/journalrank.php?year=2020&type=j&out=xls'
-url_sci_2019 = 'https://www.scimagojr.com/journalrank.php?year=2019&type=j&out=xls'
-url_sci_2018 = 'https://www.scimagojr.com/journalrank.php?year=2018&type=j&out=xls'
-url_sci_2017 = 'https://www.scimagojr.com/journalrank.php?year=2017&type=j&out=xls'
-url_sci_2016 = 'https://www.scimagojr.com/journalrank.php?year=2016&type=j&out=xls'
-url_sci_2015 = 'https://www.scimagojr.com/journalrank.php?year=2015&type=j&out=xls'
-url_sci_2014 = 'https://www.scimagojr.com/journalrank.php?year=2014&type=j&out=xls'
-url_sci_2013 = 'https://www.scimagojr.com/journalrank.php?year=2013&type=j&out=xls'
-'''
-url_sci_comput_2017='https://www.scimagojr.com/journalrank.php?year=2017&area=1700&type=j&out=xls'
-url_sci_comput_2016='https://www.scimagojr.com/journalrank.php?year=2016&area=1700&type=j&out=xls'
-url_sci_comput_2015='https://www.scimagojr.com/journalrank.php?year=2015&area=1700&type=j&out=xls'
-url_sci_comput_2014='https://www.scimagojr.com/journalrank.php?year=2014&area=1700&type=j&out=xls'
-url_sci_comput_2013='https://www.scimagojr.com/journalrank.php?year=2013&area=1700&type=j&out=xls'
-
-url_sci_maths_2017='https://www.scimagojr.com/journalrank.php?year=2017&area=2200&type=j&out=xls'
-url_sci_maths_2016='https://www.scimagojr.com/journalrank.php?year=2016&area=2200&type=j&out=xls'
-url_sci_maths_2015='https://www.scimagojr.com/journalrank.php?year=2015&area=2200&type=j&out=xls'
-url_sci_maths_2014='https://www.scimagojr.com/journalrank.php?year=2014&area=2200&type=j&out=xls'
-url_sci_maths_2013='https://www.scimagojr.com/journalrank.php?year=2013&area=2200&type=j&out=xls'
-
-url_sci_engin_2017='https://www.scimagojr.com/journalrank.php?year=2017&area=2600&type=j&out=xls'
-url_sci_engin_2016='https://www.scimagojr.com/journalrank.php?year=2016&area=2600&type=j&out=xls'
-url_sci_engin_2015='https://www.scimagojr.com/journalrank.php?year=2015&area=2600&type=j&out=xls'
-url_sci_engin_2014='https://www.scimagojr.com/journalrank.php?year=2014&area=2600&type=j&out=xls'
-url_sci_engin_2013='https://www.scimagojr.com/journalrank.php?year=2013&area=2600&type=j&out=xls'
-'''
-
-# URLs CORE pour les conferences
-url_core_conf_2021="http://portal.core.edu.au/conf-ranks/?search=&by=all&source=CORE2021&sort=arank&page=1&do=Export"
-url_core_conf_2020="http://portal.core.edu.au/conf-ranks/?search=&by=all&source=CORE2020&sort=arank&page=1&do=Export"
-url_core_conf_2018="http://portal.core.edu.au/conf-ranks/?search=&by=all&source=CORE2018&sort=arank&page=1&do=Export"
-url_core_conf_2017="http://portal.core.edu.au/conf-ranks/?search=&by=all&source=CORE2017&sort=arank&page=1&do=Export"
-url_core_conf_2014="http://portal.core.edu.au/conf-ranks/?search=&by=all&source=CORE2014&sort=arank&page=1&do=Export"
-url_core_conf_2013="http://portal.core.edu.au/conf-ranks/?search=&by=all&source=CORE2013&sort=arank&page=1&do=Export"
-#url_core_jnl_all="http://portal.core.edu.au/jnl-ranks/?search=&by=all&source=all&sort=atitle&page=1&do=Export"
-
 path_csv = str(BASE_DIR+"/ranking/")
-# Fichiers CSV crees
-new_csv_sci_21="SCIMago-J-2021.csv"
-new_csv_sci_20="SCIMago-J-2020.csv"
-new_csv_sci_19="SCIMago-J-2019.csv"
-new_csv_sci_18="SCIMago-J-2018.csv"
-new_csv_sci_17="SCIMago-J-2017.csv"
-new_csv_sci_16="SCIMago-J-2016.csv"
-new_csv_sci_15="SCIMago-J-2015.csv"
-new_csv_sci_14="SCIMago-J-2014.csv"
-new_csv_sci_13="SCIMago-J-2013.csv"
-
-new_csv_core_c_21="CORE-C-2021.csv"
-new_csv_core_c_20="CORE-C-2020.csv"
-new_csv_core_c_18="CORE-C-2018.csv"
-new_csv_core_c_17="CORE-C-2017.csv"
-new_csv_core_c_14="CORE-C-2014.csv"
-new_csv_core_c_13="CORE-C-2013.csv"
-#new_csv_core_j_all="ranking/CORE-J-all.csv"
-
 # Compteurs
 cnt_scimago_jrn=0
 cnt_core_conf=0
@@ -111,10 +53,8 @@ def create_csv_scimago(csvsci, new_csv) :
     global cnt_scimago_jrn
     cnt_scimago_jrn+=1
     print ("begin create_csv_scimago")
-    #csv_sci_com = csv.reader(open(csvsci,"rb"), delimiter=str(';'), quotechar='|')
     csv_sci_com = csv.reader(csvsci.splitlines(), delimiter=str(';'), quotechar='|')
     list_sci_com = []
-    #for row in csv_sci_com :
     for row in list(csv_sci_com) :
         title = str(row[2])
         #print ("MY TITLE = ",title)
@@ -131,13 +71,11 @@ def create_csv_scimago(csvsci, new_csv) :
         for journal in list_sci_com :
             titre = journal[0]
             note = journal[1]
-            #line = (journal[0]+'|'+journal[0])
             try :
                 writefile.writerow([titre, note])
             except Exception as e :
                 print("Pb")
-            #myfile.writerow(line+'\n')
-            #myfile.write('\n')
+
 
 
 # Creation des fichiers CORE conferences contenant titre des conf, acronymes et notes
@@ -168,126 +106,32 @@ def create_csv_core_conf(csv_core_conf, new_csv) :
             titre = conf[0]
             acro = conf[1]
             note = conf[2]
-            #line = (conf[0]+'|'+conf[1]+'|'+conf[2])
             writefile.writerow([titre, acro, note])
-            #myfile.write(line)
-            #myfile.write('\n')
-
 
 
 
 class Command(BaseCommand):
-    help = "renew all Scimago and Core CSV files"
+    help = "renew all Scimago and Core CSV files from dictionaries in dict_scimago_core"
 
     def handle(self, *args, **options):
-        ###########
-        # PROGRAMME
-        ###########
-
-        # Download files from SCIMAGO and create 6 CSV
-        #file_sci_com_19 = wget.download(url_sci_2020)
-        file_sci_com_21 = requests.get(url_sci_2021)
-        create_csv_scimago(file_sci_com_21.content.decode("utf-8"), path_csv+new_csv_sci_21)
-        self.stdout.write(self.style.SUCCESS("create_csv_scimago {0}".format(new_csv_sci_21)))
-
-        file_sci_com_20 = requests.get(url_sci_2020)
-        create_csv_scimago(file_sci_com_20.content.decode("utf-8"), path_csv+new_csv_sci_20)
-        self.stdout.write(self.style.SUCCESS("create_csv_scimago {0}".format(new_csv_sci_20)))
-
-        #file_sci_com_19 = wget.download(url_sci_2019)
-        file_sci_com_19 = requests.get(url_sci_2019)
-        create_csv_scimago(file_sci_com_19.content.decode("utf-8"), path_csv+new_csv_sci_19)
-        self.stdout.write(self.style.SUCCESS("create_csv_scimago {0}".format(new_csv_sci_19)))
-
-        #file_sci_com_18 = wget.download(url_sci_2018)
-        file_sci_com_18 = requests.get(url_sci_2018)
-        create_csv_scimago(file_sci_com_18.content.decode("utf-8"), path_csv+new_csv_sci_18)
-        self.stdout.write(self.style.SUCCESS("create_csv_scimago {0}".format(new_csv_sci_18)))
-
-        #file_sci_com_17 = wget.download(url_sci_2017)
-        file_sci_com_17 = requests.get(url_sci_2017)
-        create_csv_scimago(file_sci_com_17.content.decode("utf-8"), path_csv+new_csv_sci_17)
-        self.stdout.write(self.style.SUCCESS("create_csv_scimago {0}".format(new_csv_sci_17)))
-
-        #file_sci_com_16 = wget.download(url_sci_2016)
-        file_sci_com_16 = requests.get(url_sci_2016)
-        create_csv_scimago(file_sci_com_16.content.decode("utf-8"), path_csv+new_csv_sci_16)
-        self.stdout.write(self.style.SUCCESS("create_csv_scimago {0}".format(new_csv_sci_16)))
-
-        #file_sci_com_15 = wget.download(url_sci_2015)
-        file_sci_com_15 = requests.get(url_sci_2015)
-        create_csv_scimago(file_sci_com_15.content.decode("utf-8"), path_csv+new_csv_sci_15)
-        self.stdout.write(self.style.SUCCESS("create_csv_scimago {0}".format(new_csv_sci_15)))
-
-        #file_sci_com_14 = wget.download(url_sci_2014)
-        file_sci_com_14 = requests.get(url_sci_2014)
-        create_csv_scimago(file_sci_com_14.content.decode("utf-8"), path_csv+new_csv_sci_14)
-        self.stdout.write(self.style.SUCCESS("create_csv_scimago {0}".format(new_csv_sci_14)))
-
-        #file_sci_com_13 = wget.download(url_sci_2013)
-        file_sci_com_13 = requests.get(url_sci_2013)
-        create_csv_scimago(file_sci_com_13.content.decode("utf-8"), path_csv+new_csv_sci_13)
-        self.stdout.write(self.style.SUCCESS("create_csv_scimago {0}".format(new_csv_sci_13)))
-
-        print("BEFORE DELETE ",file_sci_com_21.headers['content-disposition'], )
-
-        # Delete downloaded files SCIMAGO
-        """
-        delete_file(file_sci_com_19)
-        delete_file(file_sci_com_18)
-        delete_file(file_sci_com_17)
-        delete_file(file_sci_com_16)
-        delete_file(file_sci_com_15)
-        delete_file(file_sci_com_14)
-        delete_file(file_sci_com_13)
-        """
-
-        # Download files from CORE ,create CSV and delete file
-        #file_core_conf_21 = wget.download(url_core_conf_2021)
-        file_core_conf_21 = requests.get(url_core_conf_2021)
-        create_csv_core_conf(file_core_conf_21.content.decode("utf-8"),path_csv+new_csv_core_c_21)
-        self.stdout.write(self.style.SUCCESS("create_csv_core {0}".format(new_csv_core_c_21)))
-
-        #file_core_conf_20 = wget.download(url_core_conf_2020)
-        file_core_conf_20 = requests.get(url_core_conf_2020)
-        create_csv_core_conf(file_core_conf_20.content.decode("utf-8"),path_csv+new_csv_core_c_20)
-        self.stdout.write(self.style.SUCCESS("create_csv_core {0}".format(new_csv_core_c_20)))
-        #delete_file(file_core_conf_20)
-
-        #file_core_conf_18 = wget.download(url_core_conf_2018)
-        file_core_conf_18 = requests.get(url_core_conf_2018)
-        create_csv_core_conf(file_core_conf_18.content.decode("utf-8"),path_csv+new_csv_core_c_18)
-        self.stdout.write(self.style.SUCCESS("create_csv_core {0}".format(new_csv_core_c_18)))
-        #delete_file(file_core_conf_18)
-
-        #file_core_conf_17 = wget.download(url_core_conf_2017)
-        file_core_conf_17 = requests.get(url_core_conf_2017)
-        create_csv_core_conf(file_core_conf_17.content.decode("utf-8"),path_csv+new_csv_core_c_17)
-        self.stdout.write(self.style.SUCCESS("create_csv_core {0}".format(new_csv_core_c_17)))
-        #delete_file(file_core_conf_17)
-
-        #file_core_conf_14 = wget.download(url_core_conf_2014)
-        file_core_conf_14 = requests.get(url_core_conf_2014)
-        create_csv_core_conf(file_core_conf_14.content.decode("utf-8"),path_csv+new_csv_core_c_14)
-        self.stdout.write(self.style.SUCCESS("create_csv_core {0}".format(new_csv_core_c_14)))
-        #delete_file(file_core_conf_14)
 
-        #file_core_conf_13 = wget.download(url_core_conf_2013)
-        file_core_conf_13 = requests.get(url_core_conf_2013)
-        create_csv_core_conf(file_core_conf_13.content.decode("utf-8"),path_csv+new_csv_core_c_13)
-        self.stdout.write(self.style.SUCCESS("create_csv_core {0}".format(new_csv_core_c_13)))
-        #delete_file(file_core_conf_13)
+        # Download files from SCIMAGO and create CSV
+        for scimago_filename in dict_scimago.keys() :
+            url = dict_scimago[scimago_filename]
+            file_sci_com = requests.get(url)
+            create_csv_scimago(file_sci_com.content.decode("utf-8"), path_csv+scimago_filename)
+            self.stdout.write(self.style.SUCCESS("create_csv_scimago {0}".format(scimago_filename)))
+        
+        for core_filename in dict_core.keys() :
+            url = dict_core[core_filename]
+            file_core_conf = requests.get(url)
+            create_csv_core_conf(file_core_conf.content.decode("utf-8"),path_csv+core_filename)
+            self.stdout.write(self.style.SUCCESS("create_csv_core {0}".format(core_filename)))
 
-        '''
-        file_core_jrn_all = wget.download(url_core_jnl_all)
-        create_csv_core_jrn(file_core_jrn_all,new_csv_core_j_all)
-        delete_file(file_core_jrn_all)
-        '''
         print ("")
         print ("RESULTATS")
         print ("Fichiers CSV SCIMago : "+str(cnt_scimago_jrn))
         print ("Fichiers CSV CORE conf : "+str(cnt_core_conf))
-        #print ("Fichiers CSV CORE journaux : "+str(cnt_core_jrn))
         print ("problemes saut de lignes regles : "+str(cnt_problems_sautligne))
         print ("fin")
 
diff --git a/hal/script_update_hal_bibtex.py b/hal/script_update_hal_bibtex.py
deleted file mode 100644
index 7696e32d991236d25d5ec099b193412e6e38fd56..0000000000000000000000000000000000000000
--- a/hal/script_update_hal_bibtex.py
+++ /dev/null
@@ -1,202 +0,0 @@
-
-from .dict_countries import dict_countries
-import requests
-
-import difflib 
-import csv
-
-import bibtexparser
-from bibtexparser.bparser import BibTexParser
-#from bibtexparser.customization import homogenize_latex_encoding
-from bibtexparser.customization import convert_to_unicode
-
-def script_update_hal_bibtex(name_user, firstname_user, labo_auth_final, id_hal_user, login_depot, passwd_depot, bool_depot_preprod, bool_depot_prod):
-    response = None
-
-    resultat_journ_egal = ""
-    resultat_journ_diff = ""
-    resultat_conf_egal = ""
-    resultat_conf_diff = ""
-    problemes_doublon = ""
-    problemes_url = ""
-    pas_trouve = ""
-
-    cnt_depot_D = 0
-    cnt_depot_E = 0
-    cnt_depot_A = 0
-    cnt_depot_P = 0
-    cnt_depot_2 = 0
-
-    cnt_nb_publis = 0
-    cnt_article = 0
-    cnt_inproceeding = 0
-    cnt_book = 0
-    cnt_error_jrn = 0
-
-    cnt_error_booktitle = 0
-        
-    cnt_error_vol = 0 
-    cnt_error_pages = 0 
-    cnt_error_year_art = 0 
-    cnt_error_doi = 0 
-
-    fullname1 = "{0} {1}".format(firstname_user.lower(), name_user.lower())
-    fullname2 = "{0} {1}".format(name_user.lower(), firstname_user.lower())
-
-
-    reponse = []
-
-    # recup de toutes les publis par HalID
-    url_request = "https://api.archives-ouvertes.fr/search/?q=authIdHal_s:{0}&start=0&rows=1000&fl=uri_s,docType_s,halId_s,authFullName_s,authIdHal_s,title_s,journalTitle_s,conferenceTitle_s,producedDate_s,contributorFullName_s,contributorId_i,owners_i&wt=json".format(id_hal_user)
-
-    req = requests.get(url_request)       
-    json = ""
-    try :
-        json = req.json()
-    except ValueError as ve :
-        print ("PROBLEME VALUEERROR {0}".format(ve))
-    try : 
-        if json is not "" :
-            all_publis = json['response']['docs']
-
-            foundcontrib_id = False
-            contrib_id = ""
-
-            for pub in all_publis :
-                uri = pub["uri_s"]
-                title = pub["title_s"]
-                datep = pub["producedDate_s"]
-                datey = datep.split('-')
-                datey = int(datey[0])
-                journ = ""
-                conf = ""
-                contributor_name = pub["contributorFullName_s"]
-                contributor_id = str(pub["contributorId_i"])
-                owners = str(pub["owners_i"])
-                allowners =  owners# ','.join(owners)
-                
-                if foundcontrib_id == False :
-                    try :
-                        if (contributor_name.lower() == fullname1) or (contributor_name.lower() == fullname2) :
-                            print("find contrib_id = {0}".format(contrib_id))
-                            contrib_id = contributor_id
-                            foundcontrib_id = True
-                    except Exception as e :
-                        pass
-
-                ## on veut une reponse du type :
-                ## ART|"nom de ma publi"|DIFF|journal_publi|journalscimago|proprietaire(o/n)
-
-                if pub["docType_s"] == "ART" :
-                    try :
-                        journ = pub["journalTitle_s"]
-                    except Exception as e:
-                        pass
-                    print("ARTICLE : {0} -> {1} -- {2} -- {3}".format(title, uri, journ, datey))
-                    if datey <= 2013 :
-                        art_file = 'SCIMago-J-2013.csv'
-                    elif datey == 2014 :
-                        art_file = 'SCIMago-J-2014.csv'
-                    elif datey == 2015 :
-                        art_file = 'SCIMago-J-2015.csv'
-                    elif datey == 2016 :
-                        art_file = 'SCIMago-J-2016.csv'
-                    elif datey == 2017 :
-                        art_file = 'SCIMago-J-2017.csv'
-                    elif datey == 2018 :
-                        art_file = 'SCIMago-J-2018.csv'
-                    elif datey == 2019 :
-                        art_file = 'SCIMago-J-2019.csv'
-                    elif datey == 2020 :
-                        art_file = 'SCIMago-J-2020.csv'
-                    elif datey >= 2021 :
-                        art_file = 'SCIMago-J-2021.csv'
-                    else :
-                        print ("Problem in date {0}".format(datey))
-
-                    list_journals = []
-                    csvscimago = csv.reader(open('ranking/{0}'.format(art_file),"r"), delimiter=str('|'))
-                    for row in csvscimago :
-                        list_journals.append(row[0])
-
-                    try :
-                        result = difflib.get_close_matches(journ,list_journals)
-                        print("For journal '{0}'  results are '{1}'".format(journ, result))
-                        if journ != result[0] :
-                            print("DIFFERENCE between {0} and {1} --> UPDATE".format(journ,result[0]))
-                            reponse.append("ART|{0}|{1}|DIFF|{2}|{3}|{4}".format(title,datey, journ, result[0],allowners))
-                        else :
-                            reponse.append("ART|{0}|{1}|CORRECT|{2}||{3}".format(title,datey,journ, allowners))
-                    except Exception as e :
-                        print("Journal {0} NOT FOUND in list".format(journ))
-                        reponse.append("ART|{0}|{1}|NONE|{2}||{3}".format(title,datey, journ, allowners))
-                    print("")
-
-
-                if pub["docType_s"] == "COMM" :
-                    try :
-                        conf = pub["conferenceTitle_s"]
-                    except Exception as e:
-                        pass
-                    print("CONF : {0} -> {1} -- {2} -- {3}".format(title, uri, conf, datey))
-
-                    if datey <= 2013 :
-                        conf_file = 'CORE-C-2013.csv'
-                    elif datey == 2014 or datey == 2015 or datey == 2016:
-                        conf_file = 'CORE-C-2014.csv'
-                    elif datey == 2017 :
-                        conf_file = 'CORE-C-2017.csv'
-                    elif datey == 2018 or datey == 2019 :
-                        conf_file = 'CORE-C-2018.csv'
-                    elif datey == 2020 :
-                        conf_file = 'CORE-C-2020.csv'
-                    elif datey >= 2021 :
-                        conf_file = 'CORE-C-2021.csv'
-                    else :
-                        print ("Problem in date {0}".format(datey))
-
-                    list_confs = []
-                    list_confs_acr = []
-                    csvcore = csv.reader(open('ranking/{0}'.format(conf_file),"r"), delimiter=str('|'))
-                    for row in csvcore :
-                        list_confs.append(row[0])
-                        list_confs_acr.append(row[1])
-                    
-                    try :
-                        result = difflib.get_close_matches(conf,list_confs)
-                        if not result : # empty list
-                            result = difflib.get_close_matches(conf,list_confs_acr)
-
-                        print("For conf '{0}'  results are '{1}'".format(conf, result))
-
-                        if conf != result[0] :
-                            print("DIFFERENCE between {0} and {1} --> UPDATE".format(conf,result[0]))
-                            reponse.append("COMM|{0}|{1}|DIFF|{2}|{3}|{4}".format(title,datey,conf, result[0],allowners))
-                        else :
-                            reponse.append("COMM|{0}|{1}|CORRECT|{2}||{3}".format(title,datey,conf, allowners))
-                    except Exception as e :
-                        print("Conf {0} NOT FOUND in list".format(conf))
-                        reponse.append("COMM|{0}|{1}|NONE|{2}||{3}".format(title,datey,conf, allowners))
-                    print("")
-
-            #replace in reponse allowners by Y or N if user  can change publi (owner)
-            if contrib_id != "":
-                newresponse = []
-                for el in reponse :
-                    all_el = el.split('|')
-                    print("{0} -- {1}".format(contrib_id, all_el[6]))
-                    if contrib_id in all_el[6] :
-                        newresp = "{0}|{1}|{2}|{3}|{4}|{5}|Y".format(all_el[0],all_el[1],all_el[2],all_el[3],all_el[4],all_el[5])
-                    else :
-                        newresp = "{0}|{1}|{2}|{3}|{4}|{5}|N".format(all_el[0],all_el[1],all_el[2],all_el[3],all_el[4],all_el[5])
-                    newresponse.append(newresp)
-            else :
-                newresponse = []
-                for el in reponse :
-                    all_el = el.split('|')
-                    newresp = "{0}|{1}|{2}|{3}|{4}|{5}|N".format(all_el[0],all_el[1],all_el[2],all_el[3],all_el[4],all_el[5])
-                    newresponse.append(newresp)                
-
-    except KeyError as ke :
-        print(ke)
-    return newresponse
diff --git a/hal/scripts_bibtex.py b/hal/scripts_bibtex.py
index 379a59aa256e2ab2902460585d11062a181963bc..384456ba9b36b77f86b1585d04ed1f2d9fc86dcb 100644
--- a/hal/scripts_bibtex.py
+++ b/hal/scripts_bibtex.py
@@ -1,5 +1,5 @@
 #!/usr/bin/python
-#-*- coding: utf-8 -*-
+#-*- coding: latin1 -*-
 
 from __future__ import unicode_literals
 
@@ -31,10 +31,6 @@ problemes_doublon = ""
 a_deposer = ""
 problemes_depot = ""    
 depots = ""
-reponse_single_xml = ""
-
-# Fichier CSV en sortie
-file_publis_csv = "all_csv.csv"
 
 
 ########################################################################################################################################
@@ -43,7 +39,7 @@ file_publis_csv = "all_csv.csv"
 ########################################################################################################################################
 ########################################################################################################################################
 
-'''
+''' ## Plus utilise
 def get_info_from_proceeding(crossref, bib_database) :
     #global bib_database
     list_info = []
@@ -58,21 +54,19 @@ def get_info_from_proceeding(crossref, bib_database) :
 '''
 
 @shared_task
-def script_bibtex_2_hal (bibtex_file, bib_name_user, name_user, firstname_user, labo_auth_final, id_hal_user, login_user, listdomains, login_depot, passwd_depot, bool_depot_preprod, bool_depot_prod, single, mail_reponse):
+def script_bibtex_2_hal (bibtex_file, name_user, firstname_user, labo_auth_final, csvfile):
+    
     '''
     take bibtex file and some values in entry and parse the bibtex to get info upon publications
 
     if the bool 'single' == False -> bibtex file has many publications, call createXml_sendHal (create XML and deposit) return a lis of results    
     if the bool 'single' == True -> bibtex file has one publication, call create_single_xml (post single XML no deposit) return the XML in string
     '''
-    print ("script_bibtex_2_hal bool_depot_prod ",bool_depot_prod)
-    resultat = ""
+    print ("script_bibtex_2_hal")
+    existe = ""
     problemes_url = ""    
     problemes_doublon = ""
     a_deposer = ""
-    problemes_depot = ""    
-    depots = ""
-    reponse_single_xml = ""
 
     ###################################
     ###### COMPTEURS
@@ -119,7 +113,7 @@ def script_bibtex_2_hal (bibtex_file, bib_name_user, name_user, firstname_user,
     # on cherche crossref dans inproceeding, si on le trouve aller le chercher en bas, sinon chercher editor et publier directement dans inproceeding
     # car certains chercheurs peuvent creer leur bibtex comme ceci
 
-    #bibtex_file = bibtex_file.encode("utf-8")
+    #bibtex_file = bibtex_file.encode("latin1")
     #print (bibtex_file)
     
     parser = BibTexParser()
@@ -137,242 +131,200 @@ def script_bibtex_2_hal (bibtex_file, bib_name_user, name_user, firstname_user,
     # list_acronym_country -> nom du pays en anglais majuscule , acronyme du pays       
     list_acronym_country = []
 
-    for entry in bib_database.entries :
-        # initialize entries
-        type_publi =""
-        numero = ""
-        language = "en"
-        title = ""
-        conf=""
-        nb_pages=""
-        volume = ""
-        town=""
-        country=""
-        country_acr="XX"
-        year = 0
-        doi_value = ""
-        publisher_book = ""
-        editor_book = ""
-        pubmed = ""
-
-        # Recup type publi, numero, language
-        ## ENTRYTYPE peut être : article, inproceedings, book, phdthesis
-
-        if entry['ENTRYTYPE']=='article' : 
-            cnt_article +=1
-            type_publi = "ART"
-            numero = "RI"+str(cnt_article)
-            language = "fr"
-
-        elif entry['ENTRYTYPE']=='inproceedings' : 
-            cnt_inproceeding +=1
-            type_publi = "COMM"
-            numero = "CI"+str(cnt_inproceeding)
-            language = "en"
+    resultfile = "result_{0}.txt".format(csvfile)
+    with open('bibtex_csv_files/'+csvfile+".csv", 'w') as csvf:
+        # create the csv writer
+        csvwriter = csv.writer(csvf, delimiter=',')
 
-        elif entry['ENTRYTYPE']=='book' : 
-            cnt_book +=1
-            type_publi = "OUV"
-            numero = "O"+str(cnt_book)
+        for entry in bib_database.entries :
+            # initialize entries
+            type_publi =""
+            numero = ""
             language = "en"
-
-        # Recup title and format
-        title = entry['title']
-        title = title.replace("\n"," ")
-        title = title.replace("\\emph","")
-
-        # get authors according to source_bibtex
-        listauthors = []
-        try :
-            #print ("AUTHOR:"+entry['author'])
-            authors = entry['author']
-            list_authors_mix = authors.split("\n")
-            for auth in list_authors_mix :
-                lab_struct = ""
-                #print ("TEST name_user "+name_user+" - auth "+auth)
-
-                if name_user in auth :
-                    #print ("Script_bibtex Match form_author DBLP")
-                    auth = firstname_user+" "+name_user
-                    lab_struct = labo_auth_final
-                if auth[-4:] == " and" :
-                    auth = auth[:-4]
-                auth_full = auth.split(" ")
-                prenom = auth_full[0]
-                prenom = prenom.encode('utf-8')
-                nom = auth_full[-1]
-                nom = nom.encode('utf-8')
-                #print ("Script_dblp "+"author "+auth.encode('utf-8')+ " - prenom "+ prenom.encode('utf-8')+ " - nom "+nom.encode('utf-8')+ str(type(auth.encode('utf-8'))))
-                listauthors.append((nom,prenom,lab_struct))
-        except KeyError :
-            cnt_error_auth+=1          
-
-        """if source_bibtex == "ENDNOTE" :
+            title = ""
+            conf=""
+            nb_pages=""
+            volume = ""
+            town=""
+            country=""
+            country_acr="XX"
+            year = 0
+            doi_value = ""
+            publisher_book = ""
+            editor_book = ""
+            pubmed = ""
+
+            # Recup type publi, numero, language
+            ## ENTRYTYPE peut être : article, inproceedings, book, phdthesis
+
+            if entry['ENTRYTYPE']=='article' : 
+                cnt_article +=1
+                type_publi = "ART"
+                numero = "RI"+str(cnt_article)
+                language = "fr"
+
+            elif entry['ENTRYTYPE']=='inproceedings' : 
+                cnt_inproceeding +=1
+                type_publi = "COMM"
+                numero = "CI"+str(cnt_inproceeding)
+                language = "en"
+
+            elif entry['ENTRYTYPE']=='book' : 
+                cnt_book +=1
+                type_publi = "OUV"
+                numero = "O"+str(cnt_book)
+                language = "en"
+
+            # Recup title and format
+            title = entry['title']
+            title = title.replace("\n"," ")
+            title = title.replace("\\emph","")
+
+            # get authors according to source_bibtex
+            listauthors = []
             try :
                 #print ("AUTHOR:"+entry['author'])
                 authors = entry['author']
-                
-                list_authors_mix = authors.split("and")
+                list_authors_mix = authors.split("\n")
                 for auth in list_authors_mix :
                     lab_struct = ""
-                    #print ("TEST bib_name_user "+bib_name_user+" - auth "+auth)
+                    #print ("TEST name_user "+name_user+" - auth "+auth)
 
-                    if bib_name_user in auth :
-                        print ("Script_bibtex Match form_author EndNote")
-                        auth = name_user + ", " + firstname_user
+                    if name_user in auth :
+                        #print ("Script_bibtex Match form_author DBLP")
+                        auth = firstname_user+" "+name_user
                         lab_struct = labo_auth_final
-
-                    auth_full = auth.split(",")
-                    nom = auth_full[0]
-                    nom = nom.encode('utf-8') 
-                    nom = nom.strip()                   
-                    prenom = auth_full[-1]
-                    prenom = prenom.encode('utf-8')
-                    prenom = prenom.strip() 
-
-                    #print ("Script_dblp "+"author "+auth.encode('utf-8')+ " - prenom "+ prenom.encode('utf-8')+ " - nom "+nom.encode('utf-8')+ str(type(auth.encode('utf-8'))))
+                    if auth[-4:] == " and" :
+                        auth = auth[:-4]
+                    auth_full = auth.split(" ")
+                    prenom = auth_full[0]
+                    #prenom = prenom.encode('latin1')
+                    nom = auth_full[-1]
+                    #nom = nom.encode('latin1')
+                    #print ("Script_dblp "+"author "+auth.encode('latin1')+ " - prenom "+ prenom.encode('latin1')+ " - nom "+nom.encode('latin1')+ str(type(auth.encode('latin1'))))
                     listauthors.append((nom,prenom,lab_struct))
             except KeyError :
-                cnt_error_auth+=1     
-        # if source_bibtex == "..." : """
-
-        # Get journal for ARTICLES
-        if type_publi == "ART" :
-            try :
-                conf = entry['journal']
-                conf = conf.replace("\n"," ")
-            except KeyError :
-                cnt_error_jrn+=1        
-        
-        # Get conf for COMM, split entry with ',' , first occurence is conf name
-        # then search country from CSV in other occurences and if found, get previous occurence to get town (except USA previuous previous occurence)
-        if type_publi == "COMM" :
-            try :
-                booktitle = entry['booktitle']
-                conf_all = booktitle.split(",")
-                conf = conf_all[0]
-                conf = conf.replace("\n"," ")
-                conf = conf.replace("\\(^\\mboxth\\)","th")
-                conf = conf.replace("\\(^\\mboxe\\)","e")
-                prev_conf_elmt = ""
-                prev_prev_conf_elmt = ""
-                #print("TEST HERE conf_all {0}".format(conf_all))
-                for conf_elmt in conf_all :
-                    conf_elmt = conf_elmt.strip()
-                    conf_elmt = conf_elmt.upper()
-                    #print("TEST HERE conf_elmt {0}".format(conf_elmt))
-                    
-                    try :
-                        data_country = dict_countries[conf_elmt]
-                        print("MATCH country conf_elmt {0}".format(conf_elmt))
-                        if conf_elmt == "USA" or conf_elmt == "CANADA":
-                            prev_prev_conf_elmt = prev_prev_conf_elmt.replace("\n"," ")
-                            town = prev_prev_conf_elmt
-                            country_acr = data_country
-                            country = conf_elmt
-                        elif conf_elmt == "LUXEMBOURG" or conf_elmt == "SINGAPORE":
-                            country = conf_elmt
-                            country_acr = data_country
-                            town = country
-                        else :                        
-                            prev_conf_elmt = prev_conf_elmt.replace("\n"," ")
-                            town = prev_conf_elmt
-                            country_acr = data_country
-                            country = conf_elmt
-                             
-                    except Exception as e :
-                        #print("NO MATCH  conf_elmt {0}".format(conf_elmt))
-                        pass
-                 
+                cnt_error_auth+=1          
 
-                    
-                    ''' for csv_country in list_acronym_country :
-                        if conf_elmt.upper() == csv_country[0] :
-                            if csv_country[0] == "USA" :
+            # Get journal for ARTICLES
+            if type_publi == "ART" :
+                try :
+                    conf = entry['journal']
+                    conf = conf.replace("\n"," ")
+                except KeyError :
+                    cnt_error_jrn+=1        
+            
+            # Get conf for COMM, split entry with ',' , first occurence is conf name
+            # then search country from CSV in other occurences and if found, get previous occurence to get town (except USA previuous previous occurence)
+            if type_publi == "COMM" :
+                try :
+                    booktitle = entry['booktitle']
+                    conf_all = booktitle.split(",")
+                    conf = conf_all[0]
+                    conf = conf.replace("\n"," ")
+                    conf = conf.replace("\\(^\\mboxth\\)","th")
+                    conf = conf.replace("\\(^\\mboxe\\)","e")
+                    prev_conf_elmt = ""
+                    prev_prev_conf_elmt = ""
+                    #print("TEST HERE conf_all {0}".format(conf_all))
+                    for conf_elmt in conf_all :
+                        conf_elmt = conf_elmt.strip()
+                        conf_elmt = conf_elmt.upper()
+                        #print("TEST HERE conf_elmt {0}".format(conf_elmt))
+                        
+                        try :
+                            data_country = dict_countries[conf_elmt]
+                            print("MATCH country conf_elmt {0}".format(conf_elmt))
+                            if conf_elmt == "USA" or conf_elmt == "CANADA":
                                 prev_prev_conf_elmt = prev_prev_conf_elmt.replace("\n"," ")
                                 town = prev_prev_conf_elmt
-                                country_acr = csv_country[1]
-                                country = csv_country[0]
-
-                            else :
+                                country_acr = data_country
+                                country = conf_elmt
+                            elif conf_elmt == "LUXEMBOURG" or conf_elmt == "SINGAPORE":
+                                country = conf_elmt
+                                country_acr = data_country
+                                town = country
+                            else :                        
                                 prev_conf_elmt = prev_conf_elmt.replace("\n"," ")
                                 town = prev_conf_elmt
-                                country_acr = csv_country[1]
-                                country = csv_country[0] '''
-
-                    prev_prev_conf_elmt = prev_conf_elmt
-                    prev_conf_elmt = conf_elmt
-                
-                if country == "":
-                    print("Virtual event")
-                    #if 'Virtual Event' in conf_all :
-                    if any("Virtual Event" in s for s in conf_all):
-                        country='VIRTUAL EVENT'
-                        country_acr = 'XX'
+                                country_acr = data_country
+                                country = conf_elmt
+                                
+                        except Exception as e :
+                            #print("NO MATCH  conf_elmt {0}".format(conf_elmt))
+                            pass
                     
-                    #if 'Online Streaming' in conf_all :
-                    elif any("Online" in s for s in conf_all):
-                        country='ONLINE'
-                        country_acr = 'XX'
+                        prev_prev_conf_elmt = prev_conf_elmt
+                        prev_conf_elmt = conf_elmt
+                    
+                    if country == "":
+                        print("Virtual event")
+                        #if 'Virtual Event' in conf_all :
+                        if any("Virtual Event" in s for s in conf_all):
+                            country='VIRTUAL EVENT'
+                            country_acr = 'XX'
+                        
+                        #if 'Online Streaming' in conf_all :
+                        elif any("Online" in s for s in conf_all):
+                            country='ONLINE'
+                            country_acr = 'XX'
 
+                except KeyError :
+                    cnt_error_booktitle+=1
+            
+            # get volume
+            try :
+                volume = entry['volume']
+            except KeyError :
+                cnt_error_vol+=1
 
+            # get nb_pages
+            try :
+                nb_pages = entry['pages']
             except KeyError :
-                cnt_error_booktitle+=1
-        
-        # get volume
-        try :
-            volume = entry['volume']
-        except KeyError :
-            cnt_error_vol+=1
-
-        # get nb_pages
-        try :
-            nb_pages = entry['pages']
-        except KeyError :
-            cnt_error_pages+=1
-
-        # get Year
-        try :
-            year = entry['year']
-        except KeyError :
-            cnt_error_year_art+=1
-
-        # get DOI
-        try :
-            doi_value = entry['doi']
-        except KeyError :
-            cnt_error_doi+=1
-
-
-        if (type_publi == "COMM") or (type_publi == "BOOK") :
-            # get Publisher
+                cnt_error_pages+=1
+
+            # get Year
             try :
-                publisher_book = entry['publisher']
+                year = entry['year']
             except KeyError :
-                cnt_error_publisher+=1
+                cnt_error_year_art+=1
 
-            # get Editor
+            # get DOI
             try :
-                 editor_book = entry['editor']
+                doi_value = entry['doi']
             except KeyError :
-                cnt_error_editor+=1
+                cnt_error_doi+=1
+
+            if (type_publi == "COMM") or (type_publi == "OUV") :
+                # get Publisher
+                try :
+                    publisher_book = entry['publisher']
+                except KeyError :
+                    cnt_error_publisher+=1
+
+                # get Editor
+                try :
+                    editor_book = entry['editor']
+                except KeyError :
+                    cnt_error_editor+=1
+
 
+            #print("{0} {1} {2} {3} {4} {5} {6} {7}".format(numero, type_publi, title, listauthors, conf, year, town, country))
+            print("")
 
-        #print("{0} {1} {2} {3} {4} {5} {6} {7}".format(numero, type_publi, title, listauthors, conf, year, town, country))
-        print("")
+            # Test value "single" 
+            # if false -> call createXml_sendHal (create XML and deposit)
+            # if true -> call create_single_xml (build XML without creation, no deposit)
+            if (type_publi == "ART") or (type_publi == "COMM") or (type_publi == "OUV") :
 
-        # Test value "single" 
-        # if false -> call createXml_sendHal (create XML and deposit)
-        # if true -> call create_single_xml (build XML without creation, no deposit)
-        if (type_publi == "ART") or (type_publi == "COMM") or (type_publi == "OUV") :
-            if single == False :
 
                 action_todo=""
 
                 # Verification que la publi n'existe pas deja dans HAL
                 # pour un meilleur matching, titre en minuscule et recherche par le champ title_t (sans casse ni accent)
                 #title_low = title.lower()
-                url_request = "https://api.archives-ouvertes.fr/search/?q=title_t:\"{0}\"&fl=uri_s,halId_s,authFullName_s,authIdHal_s,title_s&wt=json".format(title)
+                url_request = "https://api.archives-ouvertes.fr/search/?q=title_s:\"{0}\"&fl=uri_s,halId_s,authFullName_s,authIdHal_s,title_s&wt=json".format(title)
 
                 req = requests.get(url_request)       
                 json = ""
@@ -384,7 +336,7 @@ def script_bibtex_2_hal (bibtex_file, bib_name_user, name_user, firstname_user,
                     if json is not "" :
                         result = json['response']['docs']
 
-                        # si un resultat est trouve, recup authors et URI pour affichage dans 'resultat', action_todo = "E"
+                        # si un resultat est trouve, recup authors et URI pour affichage dans 'existe', action_todo = "E"
                         if (len(result) == 1 ) :
                             all_auth = ""
                             try :
@@ -393,7 +345,7 @@ def script_bibtex_2_hal (bibtex_file, bib_name_user, name_user, firstname_user,
                                     all_auth = all_auth + auth+"-"
                             except KeyError as ke :
                                 print ("error print authors existing publi keyerror {0}".format(ke))
-                            resultat = resultat + "num. "+numero+" - "+result[0]["uri_s"]+" - auteurs:"+all_auth+"<br/>"
+                            existe = existe + "num. "+numero+" - "+result[0]["uri_s"]+" - auteurs:"+all_auth+"<br/>"
                             action_todo = "E"
                             cnt_depot_E+=1
 
@@ -408,6 +360,7 @@ def script_bibtex_2_hal (bibtex_file, bib_name_user, name_user, firstname_user,
                             action_todo = "D"
                             result = False
                             accept_depot = True
+                            a_deposer += "num. {0} au titre {1} peut etre deposee dans HAL<br/>".format(numero, title)#.decode("latin1") )
 
                             # Si caracteres incoherents (issus de DBLP) dans le titre -> pas de depot -> problemes_depot
                             if ("\\(^\\mbox" in title) :
@@ -415,37 +368,37 @@ def script_bibtex_2_hal (bibtex_file, bib_name_user, name_user, firstname_user,
                                 accept_depot = False
                                 result = False
 
-                            title = title.encode("utf-8")
-                            conf = conf.encode("utf-8")
-                            town = town.encode("utf-8")
-                            editor_book = editor_book.encode("utf-8")
+                            #title = title.encode("latin1")
+                            #conf = conf.encode("latin1")
+                            #town = town.encode("latin1")
+                            #editor_book = editor_book.encode("latin1")
 
-                            if bool_depot_preprod==False and bool_depot_prod==False :
+                            """ if bool_depot_preprod==False and bool_depot_prod==False :
                                 if accept_depot == True :
-                                    a_deposer += "num. {0} au titre {1} peut etre deposee dans HAL<br/>".format(numero, title)
+                                    a_deposer += "num. {0} au titre {1} peut etre deposee dans HAL<br/>".format(numero, title.decode("latin1") )
                                     cnt_depot_A+=1
                                 elif accept_depot == False :
-                                    problemes_depot += "num. {0} au titre {1} -> pb ds le bibtex<br/>".format(numero,title)
+                                    problemes_depot += "num. {0} au titre {1} -> pb ds le bibtex<br/>".format(numero,title.decode("latin1") )
                                     cnt_depot_P+=1
 
                             elif bool_depot_preprod==True or bool_depot_prod==True :
                                 print ("bool_depot_prod ",bool_depot_prod )
                                 if accept_depot == True :
                                     result = createXml_sendHal(numero, listauthors, language, title, conf, nb_pages, year, listdomains, type_publi, town, country, country_acr,doi_value, editor_book, volume, pubmed, name_user, labo_auth_final, id_hal_user, login_user, login_depot, passwd_depot, bool_depot_preprod, bool_depot_prod)
-
+                                    print("RESULT REQUEST : http:{0} - text:{1}".format(result[0], result[1]))
                                     # methode createXml_sendHal renvoie true -> depot HAL ou preprod OK
-                                    if result == True :
+                                    if (str(result[0]) == "200") or (str(result[0]) == "202") :
                                         #depots = depots + "num. "+numero+" au titre "+title+" deposee dans HAL<br/>"
-                                        depots += "num. {0} au titre {1} deposee dans HAL<br/>".format(numero, title)
+                                        depots += "num. {0} au titre {1} deposee dans HAL<br/>".format(numero, title.decode("latin1") )
                                         cnt_depot_D+=1
                                     # methode createXml_sendHal renvoie true -> pb depot HAL ou preprod ou pas de depot demande    
-                                    if result == False :
+                                    else :
                                         #problemes_depot = problemes_depot + "num. "+numero+" au titre "+title+" a un probleme de depot<br/>"
-                                        problemes_depot += "num. {0} au titre {1} a un probleme de depot<br/>".format(numero,title)
+                                        problemes_depot += "num. {0} au titre {1} a un probleme de depot -> http:{2} - error:{3}<br/>".format(numero,title.decode("latin1") ,str(result[0], result[1]))
                                         cnt_depot_P+=1
                                 elif accept_depot == False :
-                                    problemes_depot += "num. {0} au titre {1} -> pb ds le bibtex<br/>".format(numero,title)
-                                    cnt_depot_P+=1
+                                    problemes_depot += "num. {0} au titre {1} -> pb ds le bibtex<br/>".format(numero,title.decode("latin1") )
+                                    cnt_depot_P+=1 """
                     else :
                         # pb de lecture json, pas depot -> problemes_url
                         action_todo = "P"
@@ -459,16 +412,21 @@ def script_bibtex_2_hal (bibtex_file, bib_name_user, name_user, firstname_user,
 
                 # Creation du CSV qui sera renvoye et affiche
                 authors = authors.replace(" and",", ")
+                authors = authors.replace("\r","")
+                authors = authors.replace("\n","")
                 list_pub_csv.append((numero,authors,title,conf,nb_pages, volume,year, type_publi, action_todo, town, country, country_acr, language))
-
-
-            elif single == True :
-                title = title.encode("utf-8")
-                conf = conf.encode("utf-8")
-                town = town.encode("utf-8")
-                editor_book = editor_book.encode("utf-8")                
+            
+            row = [numero,authors,title,conf,nb_pages, volume,year, type_publi, action_todo, town, country, country_acr, doi_value, editor_book, language]
+            print(row)
+            csvwriter.writerow(row)
+
+            """ elif single == True :
+                title = title.encode("latin1")
+                conf = conf.encode("latin1")
+                town = town.encode("latin1")
+                editor_book = editor_book.encode("latin1")   
                 login_user = login_depot
-                reponse_single_xml = create_single_xml(listauthors, language, title, conf, nb_pages, year, listdomains, type_publi, town, country, country_acr, doi_value, editor_book, volume, pubmed, name_user, labo_auth_final, id_hal_user, login_user)
+                reponse_single_xml = create_single_xml(listauthors, language, title, conf, nb_pages, year, listdomains, type_publi, town, country, country_acr, doi_value, editor_book, volume, pubmed, name_user, labo_auth_final, id_hal_user, login_user) """
 
         # ------------------END LOOP -----------------
         cnt_total+=1
@@ -477,176 +435,89 @@ def script_bibtex_2_hal (bibtex_file, bib_name_user, name_user, firstname_user,
     ####### ECRITURE RESULTATS  -> list_resultats
     print ("list_pub_csv length :",cnt_total)
     
-    list_resultats=[]
+    """ list_resultats=[]
     for pub in list_pub_csv :
         allauth = pub[1]
         allauth = allauth.replace("\n","")
-        title = pub[2]#.decode("utf-8") 
-        conf = pub[3]#.decode("utf-8") 
-        ville = pub[9]#.decode("utf-8")
-
-        list_resultats.append((str(pub[0]),str(allauth),str(title),str(conf),str(pub[4]),str(pub[5]),str(pub[6]),str(pub[7]),str(pub[8]),ville,str(pub[10]),str(pub[11]),str(pub[12])))
+        title = pub[2]#.decode("latin1") 
+        conf = pub[3]#.decode("latin1") 
+        ville = pub[9]#.decode("latin1")
 
+        list_resultats.append((str(pub[0]),str(allauth),str(title),str(conf),str(pub[4]),str(pub[5]),str(pub[6]),str(pub[7]),str(pub[8]),ville,str(pub[10]),str(pub[11]),str(pub[12]))) """
+    with open('bibtex_csv_files/'+resultfile, 'w') as resfile :
+        #resfile.write = ""
+        
+        resfile.write("# RESULTS<br/>")
+        resfile.write("## RESULTS PARSING BIBTEX<br/>")
+        resfile.write("- cnt_article : {0}<br/>".format(cnt_article))
+        resfile.write("- cnt_inproceeding : {0}<br/>".format(cnt_inproceeding))
+        resfile.write("- cnt_proceeding : {0}<br/>".format(cnt_proceeding))
+        resfile.write("- cnt_incollection : {0}<br/>".format(cnt_incollection))
+        resfile.write("- cnt_book : {0}<br/>".format(cnt_book))
+        resfile.write("- cnt_phdthesis : {0}<br/>".format(cnt_phdthesis))
+        resfile.write("- cnt_total : {0}<br/>".format(cnt_total))
+        resfile.write("<br/>")
+        resfile.write("## RESULTS XML + DEPOSITS<br/>")
+        resfile.write("**Existing deposits**<br/>")
+        resfile.write(existe)
+        resfile.write("<br/>")
+        resfile.write("------------------<br/>")
+        resfile.write("**To deposit**<br/>")
+        resfile.write(a_deposer)
+        resfile.write("<br/>")
+        resfile.write("------------------<br/>")
+        resfile.write("**Problems duplicates**<br/>")
+        resfile.write(problemes_doublon)
+        resfile.write("<br/>")
+        resfile.write("------------------<br/>")
+        resfile.write("**Problems URL**<br/>")
+        resfile.write(problemes_url)
+        resfile.write("<br/>")
+        resfile.write("------------------<br/>")
 
-    mail_msg = ""
-    
-    mail_msg+="# RESULTATS\n"
-    mail_msg+="## RESULTATS PARSING BIBTEX\n"
-    mail_msg+="- cnt_article : {0}\n".format(cnt_article)
-    mail_msg+="- cnt_inproceeding : {0}\n".format(cnt_inproceeding)
-    mail_msg+="- cnt_proceeding : {0}\n".format(cnt_proceeding)
-    mail_msg+="- cnt_incollection : {0}\n".format(cnt_incollection)
-    mail_msg+="- cnt_book : {0}\n".format(cnt_book)
-    mail_msg+="- cnt_phdthesis : {0}\n".format(cnt_phdthesis)
-    mail_msg+="- cnt_total : {0}\n".format(cnt_total)
-    mail_msg+="\n"
-    mail_msg+="## RESULTATS XML + DEPOTS\n"
-    mail_msg+="**Dépôts existants**\n\n"
-    mail_msg+=resultat
-    mail_msg+="\n\n"
-    mail_msg+="------------------\n\n"
-    mail_msg+="**Dépôts effectues**\n\n"
-    mail_msg+=depots
-    mail_msg+="\n\n"
-    mail_msg+="------------------\n\n"
-    mail_msg+="**A déposer**\n\n"
-    mail_msg+=a_deposer
-    mail_msg+="\n\n"
-    mail_msg+="------------------\n\n"
-    mail_msg+="**Problèmes dépôts**\n\n"
-    mail_msg+=problemes_depot
-    mail_msg+="\n\n"
-    mail_msg+="------------------\n\n"
-    mail_msg+="**Problèmes doublons**\n"
-    mail_msg+=problemes_doublon
-    mail_msg+="\n\n"
-    mail_msg+="------------------\n\n"
-    mail_msg+="**Problèmes URL**\n\n"
-    mail_msg+=problemes_url
-    mail_msg+="\n\n"
-    mail_msg+="------------------\n\n"
-
-    ## Creation tableau
-    mail_msg+="## Visualisation\n"
-    mail_msg+="\n"
-    mail_msg+="|n°|Auteurs|Titre|Conf|pp|vol|date|type|todo|Ville|pays|\n"
-    mail_msg+="|--|--|--|--|--|--|--|--|--|--|--|\n"
-    for res in list_resultats :
-        mail_msg+="|{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|\n".format(res[0],res[1],res[2],res[3],res[4],res[5],res[6],res[7],res[8],res[9],res[10])
-
-    mail_msg+="\n"
-    mail_msg+="## ERRORS\n"
-    mail_msg+="- ERROR Author : {0}\n".format(cnt_error_auth)
-    mail_msg+="- ERROR Title : {0}\n".format(cnt_error_title)
-    mail_msg+="\n"
-    mail_msg+="**ERRORS ARTICLE**\n\n"
-    mail_msg+="- cnt_error_jrn : {0}\n".format(cnt_error_jrn)
-    mail_msg+="- cnt_error_vol : {0}\n".format(cnt_error_vol)
-    mail_msg+="- cnt_error_numb : {0}\n".format(cnt_error_numb)
-    mail_msg+="- cnt_error_pages : {0}\n".format(cnt_error_pages)
-    mail_msg+="- cnt_error_year_art : {0}\n".format(cnt_error_year_art)
-    mail_msg+="- cnt_error_doi : {0}\n".format(cnt_error_doi)
-    mail_msg+="\n"
-    mail_msg+="**ERRORS INPROCEEDINGS**\n\n"
-    mail_msg+="- cnt_error_booktitle : {0}\n".format(cnt_error_booktitle)
-    mail_msg+="- cnt_error_pages : {0}\n".format(cnt_error_pages)
-    mail_msg+="- cnt_error_year_inp : {0}\n".format(cnt_error_year_inp)
-    mail_msg+="- cnt_error_crossref : {0}\n".format(cnt_error_crossref)
-    mail_msg+="- cnt_error_publisher : {0}\n".format(cnt_error_publisher)
-    mail_msg+="- cnt_error_editor : {0}\n".format(cnt_error_editor)
-    mail_msg+="\n"
-    mail_msg+="**ERRORS PROCEEDINGS**\n\n"
-    mail_msg+="- cnt_error_idcrossref : {0}\n".format(cnt_error_idcrossref)
-    mail_msg+="\n"
-
-    mail_subject = "[HALTOOLS] résultats"
+        ## Creation tableau
+        #mail_msg+="## Visualisation\n"
+        #mail_msg+="\n"
+        #mail_msg+="|num|Authors|Title|Journal-Conf|pp|vol|date|type|todo|Town|Country|\n"
+        #for res in list_resultats :
+        #    mail_msg+="|{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|\n".format(res[0],res[1],res[2],res[3],res[4],res[5],res[6],res[7],res[8],res[9],res[10])
+
+        resfile.write("<br/>")
+        resfile.write("## ERRORS<br/>")
+        resfile.write("- ERROR Author : {0}<br/>".format(cnt_error_auth))
+        resfile.write("- ERROR Title : {0}<br/>".format(cnt_error_title))
+        resfile.write("<br/>")
+        resfile.write("**ERRORS ARTICLE**<br/>")
+        resfile.write("- cnt_error_jrn : {0}<br/>".format(cnt_error_jrn))
+        resfile.write("- cnt_error_vol : {0}<br/>".format(cnt_error_vol))
+        resfile.write("- cnt_error_numb : {0}<br/>".format(cnt_error_numb))
+        resfile.write("- cnt_error_pages : {0}<br/>".format(cnt_error_pages))
+        resfile.write("- cnt_error_year_art : {0}<br/>".format(cnt_error_year_art))
+        resfile.write("- cnt_error_doi : {0}<br/>".format(cnt_error_doi))
+        resfile.write("<br/>")
+        resfile.write("**ERRORS INPROCEEDINGS**<br/>")
+        resfile.write("- cnt_error_booktitle : {0}<br/>".format(cnt_error_booktitle))
+        resfile.write("- cnt_error_pages : {0}<br/>".format(cnt_error_pages))
+        resfile.write("- cnt_error_year_inp : {0}<br/>".format(cnt_error_year_inp))
+        resfile.write("- cnt_error_crossref : {0}<br/>".format(cnt_error_crossref))
+        resfile.write("- cnt_error_publisher : {0}<br/>".format(cnt_error_publisher))
+        resfile.write("- cnt_error_editor : {0}<br/>".format(cnt_error_editor))
+        resfile.write("<br/>")
+        resfile.write("**ERRORS PROCEEDINGS**<br/>")
+        resfile.write("- cnt_error_idcrossref : {0}<br/>".format(cnt_error_idcrossref))
+        resfile.write("<br/>")
+
+    """ mail_subject = "[HALTOOLS] results"
     if bool_depot_prod == True :
-        mail_subject+=" dépôts PROD"
+        mail_subject+=" deposits PROD"
     elif bool_depot_preprod == True :
-        mail_subject+=" dépôts PREPROD"
+        mail_subject+=" deposits PREPROD"
     else :
-        mail_subject+=" dépôts TEST"
+        mail_subject+=" deposits TEST"
 
-    mails.sendonemail(mail_subject,mail_msg, mail_reponse)
+    mails.sendonemail(mail_subject,mail_msg, mail_reponse) """
 
     '''
-    ## Creation d'un fichier Mkdocs
-    with open (MEDIA_ROOT+"temp_results/"+namenewfile, "w") as mdfile:
-        mdfile.write("# Résultats fichier :'{0}'\n".format(namenewfile))
-
-        mdfile.write("## RESULTATS PARSING BIBTEX\n")
-        mdfile.write("- cnt_article : {0}\n".format(cnt_article))
-        mdfile.write("- cnt_inproceeding : {0}\n".format(cnt_inproceeding))
-        mdfile.write("- cnt_proceeding : {0}\n".format(cnt_proceeding))
-        mdfile.write("- cnt_incollection : {0}\n".format(cnt_incollection))
-        mdfile.write("- cnt_book : {0}\n".format(cnt_book))
-        mdfile.write("- cnt_phdthesis : {0}\n".format(cnt_phdthesis))
-        mdfile.write("- cnt_total : {0}\n".format(cnt_total))
-        mdfile.write("\n")
-        mdfile.write("## RESULTATS XML + DEPOTS\n")
-        mdfile.write("**Dépôts existants**\n\n")
-        mdfile.write(resultat)#.encode("utf-8"))
-        mdfile.write("\n\n")
-        mdfile.write("------------------\n\n")
-        mdfile.write("**Dépôts effectues**\n\n")
-        mdfile.write(depots)#.encode("utf-8"))
-        mdfile.write("\n\n")
-        mdfile.write("------------------\n\n")
-        mdfile.write("**A déposer**\n\n")
-        mdfile.write(a_deposer)#.encode("utf-8"))
-        mdfile.write("\n\n")
-        mdfile.write("------------------\n\n")
-        mdfile.write("**Problèmes dépôts**\n\n")
-        mdfile.write(problemes_depot)#.encode("utf-8"))
-        mdfile.write("\n\n")
-        mdfile.write("------------------\n\n")
-        mdfile.write("**Problèmes doublons**\n")
-        mdfile.write(problemes_doublon)#.encode("utf-8"))
-        mdfile.write("\n\n")
-        mdfile.write("------------------\n\n")
-        mdfile.write("**Problèmes URL**\n\n")
-        mdfile.write(problemes_url)#.encode("utf-8"))
-        mdfile.write("\n\n")
-        mdfile.write("------------------\n\n")
-
-        ## Creation tableau
-        mdfile.write("## Visualisation\n")
-        mdfile.write("\n")
-        mdfile.write("|n°|Auteurs|Titre|Conf|pp|vol|date|type|todo|Ville|pays|\n")
-        mdfile.write("|--|--|--|--|--|--|--|--|--|--|--|\n")
-
-        for res in list_resultats :
-            mdfile.write("|{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|\n".format(res[0],res[1],res[2],res[3],res[4],res[5],res[6],res[7],res[8],res[9],res[10]))
-
-        mdfile.write("\n")
-        mdfile.write("## ERRORS\n")
-        mdfile.write("- ERROR Author : {0}\n".format(cnt_error_auth))
-        mdfile.write("- ERROR Title : {0}\n".format(cnt_error_title))
-        mdfile.write("\n")
-        mdfile.write("**ERRORS ARTICLE**\n\n")
-        mdfile.write("- cnt_error_jrn : {0}\n".format(cnt_error_jrn))
-        mdfile.write("- cnt_error_vol : {0}\n".format(cnt_error_vol))
-        mdfile.write("- cnt_error_numb : {0}\n".format(cnt_error_numb))
-        mdfile.write("- cnt_error_pages : {0}\n".format(cnt_error_pages))
-        mdfile.write("- cnt_error_year_art : {0}\n".format(cnt_error_year_art))
-        mdfile.write("- cnt_error_doi : {0}\n".format(cnt_error_doi))
-        mdfile.write("\n")
-        mdfile.write("**ERRORS INPROCEEDINGS**\n\n")
-        mdfile.write("- cnt_error_booktitle : {0}\n".format(cnt_error_booktitle))
-        mdfile.write("- cnt_error_pages : {0}\n".format(cnt_error_pages))
-        mdfile.write("- cnt_error_year_inp : {0}\n".format(cnt_error_year_inp))
-        mdfile.write("- cnt_error_crossref : {0}\n".format(cnt_error_crossref))
-        mdfile.write("- cnt_error_publisher : {0}\n".format(cnt_error_publisher))
-        mdfile.write("- cnt_error_editor : {0}\n".format(cnt_error_editor))
-        mdfile.write("\n")
-        mdfile.write("**ERRORS PROCEEDINGS**\n\n")
-        mdfile.write("- cnt_error_idcrossref : {0}\n".format(cnt_error_idcrossref))
-        mdfile.write("\n")
-
-
-    
-    cnt_nb_publis = cnt_article + cnt_inproceeding + cnt_book + cnt_incollection + cnt_phdthesis
-
     list_resultats.append(("RESULTATS","nombre de publis",str(cnt_nb_publis),"","","","","","","","","","")) 
     list_resultats.append(("RESULTATS","{0} publis deja presentes dans HAL".format(cnt_depot_E),resultat,"","","","","","","","","",""))
     list_resultats.append(("RESULTATS","{0} depots de publis".format(cnt_depot_D),depots,"","","","","","","","","","")) 
@@ -691,24 +562,21 @@ def script_bibtex_2_hal (bibtex_file, bib_name_user, name_user, firstname_user,
 
     print ("######## RESULTATS XML + DEPOTS ##########")
     print ("RESULTATS existants")
-    print (resultat.encode("utf-8"))
-    print ("------------------")
-    print ("DEPOTS effectues")
-    print (depots.encode("utf-8"))
+    print (existe)#.encode("latin1"))
     print ("------------------")
-    print ("PROBLEMES DEPOTS")
-    print (problemes_depot.encode("utf-8"))
+    print ("A DEPOSER")
+    print (a_deposer)#.encode("latin1"))
     print ("------------------")
     print ("PROBLEMES DOUBLONS")
-    print (problemes_doublon.encode("utf-8"))
+    print (problemes_doublon)#.encode("latin1"))
     print ("------------------")
     print ("PROBLEMES URL")
-    print (problemes_url.encode("utf-8"))
+    print (problemes_url)#.encode("latin1"))
     
-
-    if single == False :
+    return None
+    """ if single == False :
         print("SINGLE FALSE")
         return None
     if single == True :
         print("SINGLE TRUE")
-        return reponse_single_xml
+        return reponse_single_xml """
diff --git a/hal/scriptupdatehalranking.py b/hal/scriptupdatehalranking.py
new file mode 100644
index 0000000000000000000000000000000000000000..a52f9ca83bba32461d12d5be334a088c25c3bd4b
--- /dev/null
+++ b/hal/scriptupdatehalranking.py
@@ -0,0 +1,302 @@
+
+import requests
+from celery import shared_task
+import difflib 
+import csv
+import re
+
+from haltools.settings import BASE_DIR
+from .dict_scimago_core import dict_scimago, dict_core
+from .dict_countries import dict_countries
+
+import bibtexparser
+from bibtexparser.bparser import BibTexParser
+#from bibtexparser.customization import homogenize_latex_encoding
+from bibtexparser.customization import convert_to_unicode
+
+def get_conf_acronym(conf):
+    print("TRY ACRONYM for {0}".format(conf))
+    acronym = None
+    if ('(' in conf) and (')' in conf) :
+        try : 
+            firstparent = conf.index('(')
+            secondparent = conf.index(')')
+            string = conf[firstparent+1:secondparent]
+            acronym = re.sub('\d+', '', string)
+            acronym = acronym.strip()
+            print("TEST ACRONYM  : Conf {0} , string {1} , acronym {2}".format(conf, string, acronym))
+        except Exception as ex :
+            print("ERROR get_conf_acronym {0}".format(ex))
+    return acronym
+
+
+@shared_task
+def script_verify_hal_ranking(name_user, firstname_user, id_hal_user, name_file):
+    # les listes suivantes correspondent aux annees pour lesquelles on a 
+    #list_years_scimago =[2013,2014,2015,2016,2017,2018,2019,2020,2021,2022,2023,2024,2025,2026]
+    # list_years_core =[2013,2014,2017,2018,2020,2021,2022,2023,2024,2025,2026]
+
+    fullname1 = "{0} {1}".format(firstname_user.lower(), name_user.lower())
+    fullname2 = "{0} {1}".format(name_user.lower(), firstname_user.lower())
+
+    name_csv_tmpfile = "{0}_tmp.csv".format(name_file)
+    name_csv_file = "{0}.csv".format(name_file)
+
+    # recup de toutes les publis par HalID
+    url_request = "https://api.archives-ouvertes.fr/search/?q=authIdHal_s:{0}&start=0&rows=1000&fl=uri_s,docType_s,halId_s,authFullName_s,authIdHal_s,title_s,journalTitle_s,conferenceTitle_s,producedDate_s,contributorFullName_s,contributorId_i,owners_i&wt=json".format(id_hal_user)
+
+    req = requests.get(url_request)       
+    json = ""
+    try :
+        json = req.json()
+    except ValueError as ve :
+        print ("PROBLEME VALUEERROR {0}".format(ve))
+    try : 
+        if json is not "" :
+            all_publis = json['response']['docs']
+
+            foundcontrib_id = False
+            contrib_id = ""
+
+            # open the file in the write mode
+            with open('ranking_csv_files/'+name_csv_tmpfile, 'w') as csvf:
+                # create the csv writer
+                csvwriter = csv.writer(csvf, delimiter=',')
+                cnt_publis = 0
+                for pub in all_publis :
+                    cnt_publis+=1
+                    print("------------ publi {0}".format(cnt_publis))
+
+                    uri = pub["uri_s"]
+                    title = pub["title_s"]
+                    datep = pub["producedDate_s"]
+                    datey = datep.split('-')
+                    datey = int(datey[0])
+                    journ = ""
+                    conf = ""
+                    contributor_name = pub["contributorFullName_s"]
+                    contributor_id = str(pub["contributorId_i"])
+                    owners = str(pub["owners_i"])
+                    allowners =  owners# ','.join(owners)
+                    
+                    if foundcontrib_id == False :
+                        try :
+                            if (contributor_name.lower() == fullname1) or (contributor_name.lower() == fullname2) :
+                                print("find contrib_id = {0}".format(contrib_id))
+                                contrib_id = contributor_id
+                                foundcontrib_id = True
+                        except Exception as e :
+                            pass
+
+                    row=[]
+                    ## on veut une reponse du type :
+                    ## ART|"nom de ma publi"|DIFF|journal_publi|journalscimago|proprietaire(o/n)
+                    print("publi num {0} au titre {1}".format(cnt_publis, title))
+
+                    if pub["docType_s"] == "ART" :
+                        try :
+                            journ = pub["journalTitle_s"]
+                        except Exception as e:
+                            pass
+                        print("ARTICLE : {0} -> {1} -- {2} -- {3}".format(title, uri, journ, datey))
+                        
+                        art_file = None
+
+                        list_scimago_files = dict_scimago.keys()
+                        for file in list_scimago_files :
+                            year = "20"+file[-6:-4]
+                            #print("year {0} of file : {1} and date_pub={2}".format(year,file,datey))
+                            if datey >= int(year) :
+                                #print("elif match date_pub={0} year ={1}".format(datey,year))
+                                art_file=file
+                                break
+                            else :
+                                continue
+                        print('artfile after loop {0}'.format(art_file))
+
+                        """ if datey <= 2013 :
+                            art_file = 'SCIMago-J-2013.csv'
+                        elif datey == 2014 :
+                            art_file = 'SCIMago-J-2014.csv'
+                        elif datey == 2015 :
+                            art_file = 'SCIMago-J-2015.csv'
+                        elif datey == 2016 :
+                            art_file = 'SCIMago-J-2016.csv'
+                        elif datey == 2017 :
+                            art_file = 'SCIMago-J-2017.csv'
+                        elif datey == 2018 :
+                            art_file = 'SCIMago-J-2018.csv'
+                        elif datey == 2019 :
+                            art_file = 'SCIMago-J-2019.csv'
+                        elif datey == 2020 :
+                            art_file = 'SCIMago-J-2020.csv'
+                        elif datey >= 2021 :
+                            art_file = 'SCIMago-J-2021.csv'
+                        else :
+                            print ("Problem in date {0}".format(datey)) """
+
+                        if art_file != None :
+                            list_journals = []
+                            csvscimago = csv.reader(open('ranking/{0}'.format(art_file),"r"), delimiter=str('|'))
+                            for row in csvscimago :
+                                list_journals.append(row[0])
+
+                            newjourn = ""
+                            try :
+                                result = difflib.get_close_matches(journ,list_journals)
+                                print("For journal '{0}'  results are '{1}'".format(journ, result))
+                                if journ != result[0] :
+                                    newjourn = result[0]
+                                    print("DIFFERENCE between {0} and {1} --> UPDATE".format(journ,result[0]))
+                                    #reponse.append("ART|{0}|{1}|DIFF|{2}|{3}|{4}".format(title,datey, journ, result[0],allowners))
+                                    res = "DIFF"
+                                    #row = ["ART",title,datey,"DIFF",journ,result[0],allowners]
+                                else :
+                                    #reponse.append("ART|{0}|{1}|CORRECT|{2}||{3}".format(title,datey,journ, allowners))
+                                    res = "CORRECT"
+                                    #row = ["ART",title,datey,"DIFF",journ,result[0],allowners]
+                            except Exception as e :
+                                print("Journal {0} NOT FOUND in list".format(journ))
+                                #reponse.append("ART|{0}|{1}|NONE|{2}||{3}".format(title,datey, journ, allowners))
+                                res = "NONE"
+                            print("")
+                            row = ["ART",title,uri,datey,res,journ,newjourn,allowners]
+                        else :
+                            print("Pas de correspondance de fichier")
+                            res = "TOO OLD"
+                            row = ["ART",title,uri,datey,res,journ,'',allowners]
+
+                    elif pub["docType_s"] == "COMM" :
+                        try :
+                            conf = pub["conferenceTitle_s"]
+                        except Exception as e:
+                            pass
+                        print("CONF : {0} -> {1} -- {2} -- {3}".format(title, uri, conf, datey))
+
+
+                        conf_file = None
+
+                        list_core_files = dict_core.keys()
+                        for file in list_core_files :
+                            year = "20"+file[-6:-4]
+                            #print("year {0} of file : {1} and datey={2}".format(year,file,datey))
+                            if datey >= int(year) :
+                                #print("elif match datey={0} year ={1}".format(datey,year))
+                                conf_file=file
+                                break
+                            else :
+                                continue
+                        print('conf_file after loop {0}'.format(conf_file))
+
+                        """ if datey <= 2013 :
+                            conf_file = 'CORE-C-2013.csv'
+                        elif datey == 2014 or datey == 2015 or datey == 2016:
+                            conf_file = 'CORE-C-2014.csv'
+                        elif datey == 2017 :
+                            conf_file = 'CORE-C-2017.csv'
+                        elif datey == 2018 or datey == 2019 :
+                            conf_file = 'CORE-C-2018.csv'
+                        elif datey == 2020 :
+                            conf_file = 'CORE-C-2020.csv'
+                        elif datey >= 2021 :
+                            conf_file = 'CORE-C-2021.csv'
+                        else :
+                            print ("Problem in date {0}".format(datey)) """
+
+                        if conf_file != None :
+                            list_confs = []
+                            list_confs_acr = []
+                            csvcore = csv.reader(open('ranking/{0}'.format(conf_file),"r"), delimiter=str('|'))
+                            for row in csvcore :
+                                list_confs.append(row[0])
+                                list_confs_acr.append(row[1])
+                            
+                            newconf = ""
+
+
+                            try :
+                                matchconf = False
+                                if conf in list_confs :
+                                    res = "CORRECT"
+                                    matchconf = True
+
+                                else :
+                                    acro_conf = get_conf_acronym(conf)
+                                    if acro_conf :
+                                        if acro_conf in list_confs_acr :
+                                            res = "CORRECT ACR"
+                                            matchconf = True
+                                    if not matchconf :
+                                        result = difflib.get_close_matches(conf,list_confs)
+                                        if conf == result[0] :
+                                            res = "CORRECT BIZZARE"
+                                            matchconf = True
+                                        if conf != result[0] :
+                                            newconf = result[0]
+                                            print("DIFFERENCE between {0} and {1} --> UPDATE".format(conf,result[0]))
+                                            res = "DIFF"
+                                            matchconf = True
+
+                            
+                            except Exception as e :
+                                print("Conf {0} NOT FOUND in list - ERROR {1}".format(conf, e))
+                                #reponse.append("COMM|{0}|{1}|NONE|{2}||{3}".format(title,datey,conf, allowners))
+                                res = "NONE"
+
+                            """ try :
+                                result = difflib.get_close_matches(conf,list_confs)                                    
+                                if not result : # empty list
+                                    result = difflib.get_close_matches(conf,list_confs_acr)
+                                    if not result : # empty list
+                                        # on essaie d'isoler l'acronyme de la conf
+                                        acronym_conf = get_conf_acronym(conf)
+                                        result = difflib.get_close_matches(acronym_conf,list_confs_acr)
+
+                                print("For conf '{0}'  results are '{1}'".format(conf, result))
+
+                                if conf != result[0] :
+
+                                    newconf = result[0]
+                                    print("DIFFERENCE between {0} and {1} --> UPDATE".format(conf,result[0]))
+                                    #reponse.append("COMM|{0}|{1}|DIFF|{2}|{3}|{4}".format(title,datey,conf, result[0],allowners))
+                                    res = "DIFF"
+                                else :
+                                    #reponse.append("COMM|{0}|{1}|CORRECT|{2}||{3}".format(title,datey,conf, allowners))
+                                    res = "CORRECT"
+                            except Exception as e :
+                                print("Conf {0} NOT FOUND in list".format(conf))
+                                #reponse.append("COMM|{0}|{1}|NONE|{2}||{3}".format(title,datey,conf, allowners))
+                                res = "NONE" """
+                            print("")
+                            row = ["COMM",title,uri,datey,res,conf,newconf,allowners]
+                        else :
+                            print("Pas de correspondance de fichier")
+                            res = "TOO OLD"
+                            row = ["COMM",title,uri,datey,res,conf,'',allowners]
+                    
+                    else : #other types of publis
+                        row = [pub["docType_s"],title,'','','','','','']
+                    
+                    csvwriter.writerow(row)
+
+            #replace in reponse allowners by Y or N if user  can change publi (owner)
+            with open('ranking_csv_files/'+name_csv_tmpfile, 'r', newline='') as source, open('ranking_csv_files/'+name_csv_file, 'w', newline='') as result:
+                csvreader = csv.reader(source)
+                csvwriter = csv.writer(result)
+
+                # Process data rows
+                for row in csvreader:
+                    
+                    if contrib_id != "":
+                        if contrib_id in row[7] :
+                            row[7] = "Y"
+                        else :
+                            row[7] = "N"
+                    else :
+                        row[7] = "N"
+                    
+                    csvwriter.writerow(row)    
+
+    except KeyError as ke :
+        print(ke)
+    return None
diff --git a/hal/templates/base.html b/hal/templates/base.html
index c7e7feec4e2d5842d9f2f48853a172d080d9fd92..f01caba4e1a04e17163f51e35b4406929551eed2 100644
--- a/hal/templates/base.html
+++ b/hal/templates/base.html
@@ -9,7 +9,7 @@
 <head>
     <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
     <link rel="shortcut icon" href="{%  static 'imgsite/favicon.ico' %}">
-    <title>ImportHal</title>  
+    <title>Haltools</title>  
 </head>
  {% endblock %}
 <!-- <body> -->
@@ -40,23 +40,24 @@
 
      {% if user.is_authenticated %}
 
-      <li class="nav-item dropdown">
-        <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Bibtex</a>
-         <div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 39px, 0px);">
-          <a class="dropdown-item" href="{% url "bibtex2hal" %}">Bibtex_2_Hal</a>
-          <a class="dropdown-item" href="{% url "bibtexxml" %}">Create XML</a>
-          <a class="dropdown-item" href="{% url "updatehalbibtex" %}">Update HAL</a>
-         </div>
-      </li>
+     <li class="nav-item">
+      <a class="nav-link" href="{% url "bibtex2hal" %}">Bibtex_2_Hal</a>
+    </li>
 
-      <li class="nav-item dropdown">
-        <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">CSV</a>
-         <div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 39px, 0px);">
-          <a class="dropdown-item" href="{% url "csv2hal" %}">CSV_2_Hal</a>
-         </div>
-      </li>
+    <li class="nav-item">
+      <a class="nav-link" href="{% url "csv2hal" %}">CSV_2_Hal</a>
+    </li>
+
+    <li class="nav-item">
+      <a class="nav-link" href="{% url "verifhalconf_ranking" %}">Fix_Hal_Ranking</a>
+    </li>
 
-{% comment %}       <li class="nav-item dropdown">
+    <li class="nav-item">
+      <a class="nav-link" href="{% url "aide" %}">Aide</a>
+    </li>
+    
+      {% comment %}
+       <li class="nav-item dropdown">
         <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">TEXT</a>
          <div class="dropdown-menu" x-placement="bottom-start" style="position: absolute; will-change: transform; top: 0px; left: 0px; transform: translate3d(0px, 39px, 0px);">
           <a class="dropdown-item" href="{% url "text2hal" %}">Text_2_Hal</a>
@@ -65,9 +66,6 @@
           <a class="dropdown-item" href="{% url "text_format" %}">Format text</a>
          </div>
       </li> {% endcomment %}
-      <li class="nav-item">
-        <a class="nav-link" href="{% url "aide" %}">Aide</a>
-      </li>
       {% endif %}
 
     </ul>
@@ -79,7 +77,7 @@
 
 
           <h1 class="site-heading text-center text-white d-none d-lg-block">
-          <span class="site-heading-upper text-primary mb-3">Import'HAL</span>
+          <span class="site-heading-upper text-primary mb-3">HALTOOLS</span>
           </h1>
 
 
@@ -102,9 +100,7 @@
  	
     <footer class="footer text-faded text-center py-5">
       <div class="container">
-        <p class="m-0 small">Administrateur : Jessica Leyrit - jessica.leyrit@uca.fr 
-		</p>
-		<p class="m-0 small">Concepteur : Bastien Doreau - bdoreau@isima.fr 
+		<p class="m-0 small">Conception : Bastien Doreau - <a href="mailto:bastien.doreau@limos.fr">bastien.doreau@limos.fr</a> - LIMOS UMR 6158
 		</p>
       </div>
     </footer>
diff --git a/hal/templates/hal/aide.html b/hal/templates/hal/aide.html
index 1ba30658567e67f0a9d1588de5643583a26cb9f5..e423aac906d50b8d314f96f2428b28555e1108d1 100644
--- a/hal/templates/hal/aide.html
+++ b/hal/templates/hal/aide.html
@@ -28,16 +28,15 @@
 <a href="#imports">Imports dans HAL et en préprod</a> <br/>
 <br/>
 <a href="#bibtex_2_hal">Bibtex_2_Hal</a> <br/>
-<a href="#create_xml">Create XML</a> <br/>
-<a href="#text_2_hal">Text_2_Hal</a> <br/>
-<a href="#modif_text">Modify Text</a> <br/>
-
+<a href="#csv_2_hal">CSV_2_Hal</a> <br/>
+<a href="#fix_hal_ranking">Fix_Hal_Ranking</a> <br/>
+<br/>
 <a href="#list_domains">Liste des domaines</a> <br/>
 
 </h4>
 
 <p align="left"><b><u><a id="recup_data"></a>Récupération des données</u></b></p>
-Les données sur les publications peuvent être transmises au format bibtex ou au format texte<br/>
+Les données sur les publications peuvent être transmises au format bibtex ou au format CSV<br/>
 <br/>
 
 
@@ -57,6 +56,7 @@ Les données sur les publications peuvent être transmises au format bibtex ou a
           <li>volume</li>
           <li>date</li> 
           <li>doi</li> 
+          <li>editeur</li> 
         </ul>
 
       </div>
@@ -78,13 +78,13 @@ Les données sur les publications peuvent être transmises au format bibtex ou a
 
 
 Cependant, selon les sources du Bibtex, les auteurs sont formatés de façon différentes.
-Il est nécessaire de spécifier une source pour différencier les auteurs, récupérer les 
-villes et pays des conférences (nécessaires pour HAL)
 <br/>
 Pour l'instant, la seule source est DBLP
 <br/>
 <br/>
-<u>Au format Texte</u><br/>
+<u>Au format CSV</u><br/>
+...
+<!-- <u>Au format Texte</u><br/>
 Les données sont très peu structurées. Mais le format standard 
 d'une publication se présente ainsi :
 <ul>
@@ -121,29 +121,27 @@ La numérotation avant le tiret sert à indiquer le type de publi <br/>
 - CO : chapitres d'ouvrages<br/>
 - P : posters<br/>
 </p>
-<br/>
+<br/> -->
 
 <p align="left"><b><u><a id="fix_data"></a>Correction des données</u></b></p>
 <br/>
-Quelle que soit la source, il est intéressant de simuler un dépôt et de 
+<p>Quelle que soit la source, il est intéressant de simuler un dépôt et de 
 contrôler et corriger les résultats avant de faire un vrai dépôt. <br/>
-Le résultat indique tout d'abord quelles sont les publis déja présentes dans HAL et lesquelles
-sont susceptibles d'être déposées. <br/>
-<br/>
-Dans la première partie des résultats sont indiqués le nombre de publications recensées dans la source,
-puis les publications déja existantes dans HAL (une requête est lancée avec le titre) puis les dépôts 
-et les tentatives de dépôts s'étant soldées par un echec (problèmes de dépôts).<br/>
-A noter qu'en mode simulation, aucun dépôt n'est fait et tous les potentiels dépôts se retrouvent 
-dans la catégorie "problèmes de dépôts". 
+Le résultat indique tout d'abord quelles sont les publis déja présentes dans HAL (une requête est lancée avec le titre) et lesquelles
+sont susceptibles d'être déposées (indiqués par la lettre <b>D</b>). <br/>
+<br/>
+Vous pouvez ainsi voir les informations qui seront déposées et les champs manquants.<br/>
 </p>
 
 <p align="center">
-<img src="{% static 'img/aide_res_corr1.png' %}" > </p>
+<img src="{% static 'img/aide_corr1.png' %}" > </p>
 <br/>
 <p align="justify">
-Dans la seconde partie des résultats sont indiqués sous forme de tableaux les données telles qu'elles
-ont été récupérées.<br/>
-Il est alors possible de vérifier la justesse des données récupérées. <br/>
+Plus bas, une synthèse est présentée et reprend ces informations (publis déjà existantes et puiblis à déposer) 
+ainsi que les potentiels duplicats.<br/>
+Puis une liste des erreurs est indiquée, une erreur correspond à un champ attendu qui n'est pas trouvé.<br/>
+Seules les erreurs sur le titre ou les auteurs sont rééllement bloquantes.<br/>
+
 Si un nombre de pages ou un volume n'apparait pas alors qu'il devrait être présent, 
 il manque sans doute une virgule avant ou après la donnée. <br/>
 <br/>
@@ -153,16 +151,10 @@ types de publis, la valeur par défaut est un champ vide ou la valeur "inconnue"
 Le champ "TODO" indique quelle sera l'action effectuée : <br/>
 - E : une publi existe déjà avec le même titre dans HAL et aucun dépôt ne sera fait.<br/>
 - D : la publi peut être déposée <br/>
-- 2 : la publi existe déjà avec le même titre dans HAL en plusieurs exemplaires et aucun dépôt ne sera fait. <br/>
-
-</p>
-<p align="center">
-    <img src="{% static 'img/aide_res_corr2.png' %}" > </p>
-    <br/>
-    <p align="justify">
-
 <br/>
+Si besoin, corriger manuellement la source avant de recommencer l'opération.<br/>
 
+</p>
 
 
 <p align="left"><b><u><a id="imports"></a>Imports dans HAL et en préprod</u></b></p>
@@ -191,7 +183,7 @@ Ensuite seulement, faire des dépôts.
 <br/><br/>
 En cas d'erreur, il est toujours possible de supprimer des dépôts dont on est propriétaire mais il faut les sélectionner 
 un par un ce qui peut être un peu long pour un import d'une centaine de publications.<br/>
-La base de préproduction peut être intéressante pour présenter au chercheur les résultats tels qu'ils apparaitront sur HAL en lui fournissant ses identifiants sur la base de préproduction.
+La base de préproduction peut être intéressante pour présenter les résultats tels qu'ils apparaitront sur HAL.
 </p>
 <br/>
 
@@ -202,21 +194,26 @@ La base de préproduction peut être intéressante pour présenter au chercheur
 Cet outil permet d'importer un contenu au format Bibtex d'une source <a href="https://dblp.uni-trier.de/" target="_blank">DBLP</a>  dans la base HAL ou dans la base de préproduction de HAL.
 <br/>
 <br/>
+L'import se passe en deux étapes :<br/>
+- Indication des données et nom/prénom du chercheur -> une vérification est faite sur l'existence ou non de la publi dans HAL.
+Les données sont récupérées et mises en forme.<br/>
+- Sélection des publications à déposer et informations nécéssaires au dépôt.<br/>
 Renseignez les différents champs (ceux avec une étoile sont obligatoires)
 <br/><br/>
-La <b>forme auteur</b> correspond à la dénomination littérale de l'auteur dans le fichier bibtex.
-<br> 
+<!-- La <b>forme auteur</b> correspond à la dénomination littérale de l'auteur dans le fichier bibtex.
+<br>  
 Cette forme peut être simple : <i>Jean Mailfert</i> ou plus complexe en cas d'accent ou de tiret : <i>S{\'{e}}bastien Cipi{\`{e}}re}</i>
-</br><br/>
-Le <b>nom</b> et <b>prénom</b> du chercheur correspondent à ce que vous souhaitez voir apparaître dans HAL
+</br><br/>-->
+Le <b>nom</b> du chercheur, son <b>login Hal</b>, son <b>idHal</b> ainsi qu'une adresse mail pour recevoir les résultats par mail.
 <br/><br/>
-Le <b>login Hal</b> et l<b>'idHal</b> du chercheur doivent vous être fournis par l'auteur lui-même dans le cas d'un dépôt sur la base HAL.
+Le <b>login Hal</b> et le<b>mot de passe</b> du référent (ou déposant)
 <br/><br/>
-Le <b>numéro de structure</b> correspond à son identifiant (id). Rentrez le nom de la structure sur la base AuréHAL pour l'obtenir et rentrez le tel quel (Ex : 490706)
+Le <b>numéro de structure</b> correspond à son identifiant (id) dans HAL. Rentrez le nom de la structure sur la base 
+<a href="https://aurehal.archives-ouvertes.fr/structure" target="_blank">AuréHAL</a> pour l'obtenir et rentrez le tel quel (Ex : 490706 pour le LIMOS)
 <br/><br/>
-Les <b>domaines</b> sont généralement fournis par le chercheur et s'appliquent à toutes les publications.
+Les <b>domaines</b> s'appliqueront à toutes les publications séléctionnées pour le dépôt.
 <br/>
-Cliquez <a href="#trav_equip">ici</a> pour en avoir la liste.
+Cliquez <a href="#list_domains">ici</a> pour en avoir la liste.
 <br/>
 Au moins un domaine est nécessaire pour un import dans la base (Hal ou préprod)
 <br/>
@@ -237,9 +234,37 @@ Copiez-collez le contenu de ce fichier dans l'emplacement prévu nommé <b>conte
 <br/>
 <br/>
 </p>
+
+<p align="left"><b><u><a id="csv_2_hal"></a>CSV_2_Hal</u></b></p>
+<p align="justify">
+<i>TODO</i>
+</p>
+
 <br/>
 <br/>
+<p align="left"><b><u><a id="fix_hal_ranking"></a>Fix_Hal_Ranking</u></b></p>
+<p align="justify">
+Cet outil permet de vérifier la justesse des noms des journaux et conférences indiqués dans les dépôts de publications dans HAL.<br/>
+A partir du nom/prénom d'un chercheur ainsi que de son idHal, les publications sont récupérées sur l'API de HAL, les noms des conférences et journaux repris 
+et comparés avec ceux que proposent les organismes de ranking, <a href="https://www.scimagojr.com/" target="_blank">Scimago</a> pour les noms des journaux et 
+<a href="http://portal.core.edu.au/conf-ranks/" target="_blank">Core ranking</a> pour les noms des conférences ebn fonction des années de publication.<br/>
+Les données de Scimago et Core sont régulièrement mises à jour.<br/>
+<br/>
+L'outil indique  comment comprendre le résultat. <br/>
+Si la colonne <b>Résultat</b> indique :
+<ul>
+  <li>CORRECT : correspondance exacte entre le nom dans HAL et dans Scimago/Core</li>
+  <li>CORRECT ACR : pour les conférences, c'est l'acronyme de la conférence qui fait l'objet d'une correspondance</li>
+  <li>TOO OLD : la publication est trop ancienne pour matcher avec un fichier de Scimago/Core</li>
+  <li>NONE : Pas de correspondance possible et aucun nom de fichier approchant</li>
+  <li>DIFF : Un nom approchant a été rtouvé, il est proposé comme solution de remplacement</li>
+</ul>
+Si le résultat est <b>DIFF</b> un lien vers la publication vous est proposé dans le cas où vous êtes prropriétaire du dépôt.
 
+</p>
+<p align="center">
+  <img src="{% static 'img/aide_verifhal1.png' %}" > </p>
+<!-- 
 <p align="left"><b><u><a id="dblp_2_xml"></a>Create XML (from DBLP)</u></b></p>
 <p align="justify">
 Cet outil permet de générer un fichier XML au format TEI, donc importable dans HAL, mais sans faire d'import.
@@ -263,7 +288,7 @@ Le <b>numéro de structure</b> correspond à son identifiant (id). Rentrez le no
 <br/>
 Les <b>domaines</b> sont généralement fournis par le chercheur et s'appliquent à toutes les publications.
 <br/>
-Cliquez <a href="#trav_equip">ici</a> pour en avoir la liste.
+Cliquez <a href="#list_domains">ici</a> pour en avoir la liste.
 <br/><br/>
 
 Ouvrir le client web avec vos identifiants HAL à l'URL suivante <a href="https://api.archives-ouvertes.fr/sword/upload/">
@@ -294,7 +319,7 @@ TODO
 TODO
 </p>
 <br/>
-
+ -->
 
 <p align="left"><b><u><a id="list_domains"></a>Liste des domaines</u></b></p>
 <p align="justify">
diff --git a/hal/templates/hal/bibtex2hal.html b/hal/templates/hal/bibtex2hal.html
index 6a405df0204486acc8470448b165229c300db8fd..f524f8248309bd14af2266efbfddedc7576e9962 100644
--- a/hal/templates/hal/bibtex2hal.html
+++ b/hal/templates/hal/bibtex2hal.html
@@ -13,7 +13,7 @@
 {% endblock %}
 
 {% block content %}
-<h3>Bibtex to HAL</h3>
+<h3>Bibtex to HAL : Sources</h3>
   <br/>
   	{% if user.is_authenticated %}
 
@@ -22,16 +22,30 @@
 		{% for message in messages %}
 		<div style="color:red"><b>{{ message }} </b></div>
 		{% endfor %}
+		<br/>
+	{% endif %}
+	{% if csvfile != '' %}
+	<b>Résultat :</b>  <a href="{% url 'bibformat_2hal' csvfile %}" target="_blank">{{ csvfile }}</a>
+	<br/><br/>
 	{% endif %}
 
 
-  	<p align="left">Remplissez les données demandées ci-dessous
-  	<br/>
-  	Tous les champs sont requis
-  	<br/>
-  	Dans un premier temps, simulez le dépôt en laissant les champs "dépôt préprod" et "dépôt prod" décochés
-  	<br/>
-  	Copiez-collez le contenu de votre fichier bibtex dans la zone prévue</p>
+  	<p align="left">
+		Cet outil permet de déposer dans HAL des publications à partir d'une source Bibtex, à retirer sur DBLP.
+		<br/>
+		Cette opération se fait en deux étapes.
+		<ul>
+			<li><b>1e étape</b> : Analyse du fichier bibtex et comparaison avec les données de Hal pour savoir quelles sont les publis à déposer</li>
+			<li><b>2e étape</b> : Vérification des données et séléction des publis à déposer</li>
+		</ul>
+
+		<h4>1e étape</h4>
+		Indiquer le nom et prénom du chercheur
+		<br/>
+		Récupérer le <a href="{% url 'aide' %}">contenu du fichier bibtex</a> à partir de DBLP et coller le dans le cadre nommé "contenu bibtex"
+		<br/>
+		En soumettant, un lien est proposé. Il ne sera accessible qu'après quelques minutes (le temps de traitelment est en fonction du nombre de publis dans la source bibtex)
+	</p>
 
 	<div class="well bs-component">
     <form action="{% url "bibtex2hal" %}" method="post">
@@ -44,16 +58,7 @@
 			<h3>Auteur</h3>
 			</div>           
           </div>
-
            <!--  1e ligne -->         
-          <div class="col-lg-4">         
-			<div class="fieldWrapper">
-		    {{ form.bib_name_user.errors }}
-		    {{ form.bib_name_user.label_tag }}<br/>
-		    {{ form.bib_name_user }}
-			</div>           
-          </div>
-          
           <div class="col-lg-4">
 			<div class="fieldWrapper">
 		    {{ form.name_user.errors }}
@@ -69,154 +74,17 @@
 		    {{ form.firstname_user }}
 			</div>                   
           </div>        
-          <!--  2e ligne -->
-          
-          <div class="col-lg-4">
-			<div class="fieldWrapper">
-		    {{ form.login_user.errors }}
-		    {{ form.login_user.label_tag }}<br/>
-		    {{ form.login_user }}
-			</div>           
-          </div>
-
-          <div class="col-lg-4">         
-			<div class="fieldWrapper">
-		    {{ form.id_hal_user.errors }}
-		    {{ form.id_hal_user.label_tag }}<br/>
-		    {{ form.id_hal_user }}
-			</div>           
-          </div>
 
 		  <div class="col-lg-4">
 			<div class="fieldWrapper">
-		    {{ form.mail_reponse.errors }}
-		    {{ form.mail_reponse.label_tag }}<br/>
-		    {{ form.mail_reponse }}
-			</div>        
-			<br/>
-          </div> 
-
-          <div class="col-lg-12">
-			<div class="fieldWrapper">
 		    {{ form.labo_auth_final.errors }}
 		    {{ form.labo_auth_final.label_tag }}<br/>
 		    {{ form.labo_auth_final }}
 			</div>        
-			<br/>
           </div> 
-
-
-
-		  <div class="col-lg-7">         
-			<div class="fieldWrapper">
-				{{ form.domains.errors }}
-				{{ form.domains.label_tag }}<br/>
-				{{ form.domains }}
-			</div>           
-	  	  </div>
-		  <div class="col-lg-5">         
-				<div class="fieldWrapper">
-					{{ form.domains2.errors }}
-					{{ form.domains2.label_tag }}<br/>
-					{{ form.domains2 }}
-				</div>           
-		  </div>
-          <!--  
-          <div class="col-lg-4">         
-			<div class="fieldWrapper">
-		    {{ form.domain1.errors }}
-		    {{ form.domain1.label_tag }}<br/>
-		    {{ form.domain1 }}
-			</div>           
-          </div>
-          
-          <div class="col-lg-4">
-			<div class="fieldWrapper">
-		    {{ form.domain2.errors }}
-		    {{ form.domain2.label_tag }}<br/>
-		    {{ form.domain2 }}
-			</div>      
-          </div>  
-
-          <div class="col-lg-4">
-			<div class="fieldWrapper">
-		    {{ form.domain3.errors }}
-		    {{ form.domain3.label_tag }}<br/>
-		    {{ form.domain3 }}
-			</div>      
-          </div>  3e ligne -->
-
-          <!--  
-          <div class="col-lg-4">         
-			<div class="fieldWrapper">
-		    {{ form.domain4.errors }}
-		    {{ form.domain4.label_tag }}<br/>
-		    {{ form.domain4 }}
-			</div>           
-          </div>
-          
-          <div class="col-lg-4">
-			<div class="fieldWrapper">
-		    {{ form.domain5.errors }}
-		    {{ form.domain5.label_tag }}<br/>
-		    {{ form.domain5 }}
-			</div>      
-          </div>  
-
-          <div class="col-lg-4">
-			<div class="fieldWrapper">
-			</div>      
-		  </div> 4e ligne -->
-		       		  
-		  <!-- <div class="col-lg-12">         
-				<div class="fieldWrapper">
-				<h3>Source</h3>
-				</div>           
-		  </div>
-
-		  <div class="col-lg-12">         
-				<div class="fieldWrapper">
-				{{ form.choice_source.errors }}
-				{{ form.choice_source.label_tag }}<br/>
-				{{ form.choice_source }}
-				</div>           
-		  </div> -->
-
-          <div class="col-lg-12">         
-			<div class="fieldWrapper">
-			<h3>Déposant</h3>
-			</div>           
-          </div>
- 
-          <!--  5e ligne -->
-          <div class="col-lg-4">         
-			<div class="fieldWrapper">
-		    {{ form.login_depot.errors }}
-		    {{ form.login_depot.label_tag }}<br/>
-		    {{ form.login_depot }}
-			</div>           
-          </div>
+          <!--  2e ligne -->
           
-          <div class="col-lg-4">
-			<div class="fieldWrapper">
-		    {{ form.passwd_depot.errors }}
-		    {{ form.passwd_depot.label_tag }}<br/>
-		    {{ form.passwd_depot }}
-			</div>      
-          </div>  
-
-          <div class="col-lg-4">
-			<div class="fieldWrapper">
-			{{ form.choice_depot.errors }}
-			{{ form.choice_depot.label_tag }}<br/>
-			{{ form.choice_depot }}					
-			</div>      
-          </div>  
-
-               
-          <!--  6e ligne -->
           <div class="col-lg-12">      
- 			<br/>
 			<hr>   	            
 			<div class="fieldWrapper">
 		    {{ form.bibtex_file.errors }}
@@ -230,61 +98,8 @@
         <input type="submit" class="btn btn-primary" value="Submit" />
     </form>
 	</div>
-	
-	<div class="well bs-component">
-	<div class="row">
-	<div class="col-lg-12"> 
-	<br/>
-<!-- 	<b><u>Résultats :</u></b>	
-	{% autoescape off %}
-	<br/>
-	<p align="left">
-	{{ reponse_to_post }}
-	</p>
-	<br/>
-	{% endautoescape %}
-	<br/>
-	</div>
-	</div>
-	</div>
-	
-	{% if list_to_post|length > 0%}
-	<table class="table table-striped table-hover ">
-		<tr>
-			<th>n°</th>
-			<th>Auteurs </th>
-      		<th>Titre</th>
-      		<th>Conf</th>
-			<th>pp </th>
-      		<th>vol</th>
-      		<th>date</th>
-			<th>type </th>
-      		<th>todo</th>
-      		<th>Ville</th> 
-			<th>pays </th>
-      		<th>acr</th>
-      		<th>lang</th>      		   		
-		</tr>
 
-			{% for pub in list_to_post %}
-        <tr>
-		    <td>{{ pub.num }}</td>
-		    <td>{{ pub.authors }}</td>
-		    <td>{{ pub.title }}</td>
-		    <td>{{ pub.conf }}</td>
-		    <td>{{ pub.page }}</td>
-		    <td>{{ pub.vol }}</td>
-		    <td>{{ pub.date }}</td>		 
-		    <td>{{ pub.type }}</td>		    	    
-		    <td>{{ pub.todo }}</td>
-		    <td>{{ pub.ville }}</td>
-		    <td>{{ pub.pays }}</td>		 
-		    <td>{{ pub.acr }}</td>		    
-		    <td>{{ pub.lang }}</td>	
-		 </tr>
-      {% endfor %}
-	  </table>
-	  {% endif %} -->
+
 	  
 	{% else %}
 	<h5>Pour faire une demande d'identifiants, envoyer un mail à jessica.leyrit@uca.fr</h5>
diff --git a/hal/templates/hal/index.html b/hal/templates/hal/index.html
index 385ae8070adc44265b8b89c8e1077a2f5c54cc17..610419fdd8f880ed3a94ebbff2b918d730eeda5e 100644
--- a/hal/templates/hal/index.html
+++ b/hal/templates/hal/index.html
@@ -7,7 +7,7 @@
 <head>
     <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
     <link rel="shortcut icon" href="{%  static 'imgsite/favicon.ico' %}">
-    <title>ImportHAL</title>
+    <title>Haltools</title>
     
 </head>
 {% endblock %}
@@ -16,32 +16,48 @@
 
 
           <h4 align="justify">
-          Ce site permet aux référents HAL d'utiliser des outils d'imports de publications dans HAL
-          <br/> <br/>       
+          Ce site permet à des enseignants chercheurs d'utiliser des outils d'imports massifs de publications dans HAL
+          <br/> <br/>
+          
+          <div class="alert alert-dismissible alert-danger">
+            
+            <strong>Attention !</strong> Les outils d'imports permettent uniquement de déposer des notices, càd des dépôts sans PDFs.<br/>
+            Dans la logique de sciences ouvertes pensée dans HAL, les dépôts devraient s'accompagner du document.<br/>
+            Le DOI peut être renseigné dans la notice.
+          </div>
+
           Ces outils reposent sur l'API <a href="https://api.archives-ouvertes.fr/docs/sword" target="_blank">SWORD</a> de HAL.
           <br/><br/> 
-          Le principe de ces outils est de lire des listes de publications au format bibtex ou texte et de générer des fichiers XML (format TEI) qui seront envoyés sur l'API pour être importés dans la base de HAL.
+          Le principe de ces outils est de lire des listes de publications au format bibtex ou CSV et de générer des fichiers XML (format TEI) qui seront envoyés sur l'API pour être importés dans la base de HAL.
           <br/>
           <br/>
           Un rendu sous forme de tableau permet de visualiser les résultats et le choix est donné de déposer sur la base HAL ou sur une <a href="https://hal.halpreprod.archives-ouvertes.fr/" target="_blank">base de préproduction</a>.
           <br/>
           <br/>
-          <b>Bibtex_2_Hal</b> permet de faire des imports massifs dans HAL à partir de fichiers au format bibtex provenant de différentes sources.
+          <b>Bibtex_2_Hal</b> permet de faire des imports massifs dans HAL à partir de fichiers au format bibtex provenant de :
           <br/>
           - <a href="https://dblp.uni-trier.de/" target="_blank">DBLP</a>.
-          <br/>
-          - <a href="https://endnote.com/" target="_blank">ENDNOTE</a>.
+          <!-- <br/>
+          - <a href="https://endnote.com/" target="_blank">ENDNOTE</a>. -->
           <br/><br/> 
-          <b>CSV_2_Hal</b> permet de faire des imports massifs dans HAL à partir de fichiers au format CSV provenant de différentes sources.
+          <b>CSV_2_Hal</b> permet de faire des imports massifs dans HAL à partir de fichiers au format CSV provenant de :
           <br/>
           - <a href="https://www.ncbi.nlm.nih.gov/pubmed/" target="_blank">PUBMED</a>.
-          <!-- <br/>
-          - <a href="https://www.scopus.com/home.uri" target="_blank">SCOPUS</a>.-->
-          <br/><br/>           
-          <b>Text_2_Hal</b> permet de faire des imports massifs dans HAL à partir d'une liste texte, de formater une liste texte ou de formater du texte issu de différentes sources telles que :
+          <br/><br/> 
+          <b>Fix_Hal_Ranking</b> permet de vérifier si les noms des journaux et conférences indiqués dans les publis déposées dans HAL correspondent aux entrées de Scimago et Core :
           <br/>
-          - <a href="https://www.researchgate.net/" target="_blank">Research Gate</a>
+          - <a href="https://www.scimagojr.com/" target="_blank">Scimago</a> pour les noms des journaux, <a href="http://portal.core.edu.au/conf-ranks/" target="_blank">Core ranking</a> pour les noms des conférences
+          <br/><br/>
+
+
+          <div class="alert alert-dismissible alert-primary">
+            Vous devez avoir des identifiants pour vous connecter sur HAL ainsi qu'un <a href="https://doc.archives-ouvertes.fr/identifiant-auteur-idhal-cv/" target="_blank"><b>idHal</b></a> pour utiliser ces outils.
+          </div>
+
+
+          <!-- - <a href="https://www.scopus.com/home.uri" target="_blank">SCOPUS</a>.
           <br/>
+          <br/>-->
           </h4>
 
 
@@ -49,12 +65,12 @@
           
           <div class="col-lg-6 text-center">          
           <br/>
-          <img src="{% static 'img/logo_limos.png' %}" width="100" align="center"> 
+          <a href="https://limos.fr" target="_blank"><img src="{% static 'img/logo_limos.png' %}" width="100" align="center"></a> 
           <br/>
           </div>
           <div class="col-lg-6 text-center">
           <br/>
-          <img src="{% static 'img/logo_hal.png' %}" width="100"  align="center"> 
+          <a href="https://hal.science/" target="_blank"><img src="{% static 'img/logo_hal.png' %}" width="100"  align="center"></a> 
           <br/>
 
           </div>
diff --git a/hal/templates/hal/updatehalbibtex.html b/hal/templates/hal/updatehalbibtex.html
deleted file mode 100644
index 5b4268ecbca4403a61520df1652444754645ed78..0000000000000000000000000000000000000000
--- a/hal/templates/hal/updatehalbibtex.html
+++ /dev/null
@@ -1,166 +0,0 @@
-{% extends "base.html" %}
-{% load static %}
-{% load bootstrap3 %}
-{% load bootstrap_themes %}
-
-{% block head %}
-<head>
-    <link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
-    <link rel="shortcut icon" href="{%  static 'imgsite/favicon.ico' %}">
-    <title>ImportHAL</title>
-    
-</head>
-{% endblock %}
-
-{% block content %}
-<h3>Update HAL from Bibtex</h3>
-  <br/>
-  	{% if user.is_authenticated %}
-  	<p align="left">Remplissez les données demandées ci-dessous
-  	<br/>
-  	Tous les champs sont requis
-  	<br/>
-  	Dans un premier temps, simulez le dépôt en laissant les champs "dépôt préprod" et "dépôt prod" décochés
-  	<br/>
-  	Copiez-collez le contenu de votre fichier bibtex dans la zone prévue</p>
-
-	<div class="well bs-component">
-    <form action="{% url "updatehalbibtex" %}" method="post">
-        {% csrf_token %}
-
-        <div class="row">
-
-          <div class="col-lg-12">         
-			<div class="fieldWrapper">
-			<h3>Auteur</h3>
-			</div>           
-          </div>
-
-           <!--  1e ligne -->         
-          
-          <div class="col-lg-3">
-			<div class="fieldWrapper">
-		    {{ form.name_user.errors }}
-		    {{ form.name_user.label_tag }}<br/>
-		    {{ form.name_user }}
-			</div>           
-          </div>
-          
-          <div class="col-lg-3">
-			<div class="fieldWrapper">
-		    {{ form.firstname_user.errors }}
-		    {{ form.firstname_user.label_tag }}<br/>
-		    {{ form.firstname_user }}
-			</div>                   
-          </div>        
-          
-		  
-		  
-          <div class="col-lg-3">         
-			<div class="fieldWrapper">
-				{{ form.id_hal_user.errors }}
-				{{ form.id_hal_user.label_tag }}<br/>
-		   		{{ form.id_hal_user }}
-			</div> 
-		</div>           
-
-	
-		<div class="col-lg-3">
-			<div class="fieldWrapper">
-				{{ form.labo_auth_final.errors }}
-				{{ form.labo_auth_final.label_tag }}<br/>
-				{{ form.labo_auth_final }}
-			</div>        
-	
-		</div> 
-		
-		<!--  2e ligne -->
-
-
-          <div class="col-lg-12">         
-			<div class="fieldWrapper">
-			<h3>Déposant</h3>
-			</div>           
-          </div>
- 
-          <!--  5e ligne -->
-          <div class="col-lg-4">         
-			<div class="fieldWrapper">
-		    {{ form.login_depot.errors }}
-		    {{ form.login_depot.label_tag }}<br/>
-		    {{ form.login_depot }}
-			</div>           
-          </div>
-          
-          <div class="col-lg-4">
-			<div class="fieldWrapper">
-		    {{ form.passwd_depot.errors }}
-		    {{ form.passwd_depot.label_tag }}<br/>
-		    {{ form.passwd_depot }}
-			</div>      
-          </div>  
-
-          <div class="col-lg-4">
-			<div class="fieldWrapper">
-			{{ form.choice_depot.errors }}
-			{{ form.choice_depot.label_tag }}<br/>
-			{{ form.choice_depot }}					
-			</div>      
-          </div>                   
-        </div>
-
-	
-        <input type="submit" class="btn btn-primary" value="Submit" />
-    </form>
-	</div>
-	
-	<!-- 	<div class="well bs-component">
-	<div class="row">
-	<div class="col-lg-12"> 
-	<br/>
-	<b><u>Résultats :</u></b>	
-	{% autoescape off %}
-	<br/>
-	<p align="left">
-	{{ reponse_to_post }}
-	</p>
-	<br/>
-	{% endautoescape %}
-	<br/>
-	</div>
-	</div>
-	</div> -->
-	
-	{% if list_to_post|length > 0%}
-	<table class="table table-striped table-hover ">
-		<tr>
-			<th>Type</th>
-      		<th>Titre</th>
-			<th>Date</th>
-      		<th>Resultat</th>
-      		<th>Journ/Conf HAL</th>
-			<th>Journ/Conf Rank</th>
-      		<th>Propriété</th>    		   		
-		</tr>
-
-			{% for pub in list_to_post %}
-        <tr>
-		    <td>{{ pub.type }}</td>
-		    <td>{{ pub.title }}</td>
-		    <td>{{ pub.date }}</td>		 
-		    <td>{{ pub.change }}</td>
-		    <td>{{ pub.conf }}</td>
-		    <td>{{ pub.conf2 }}</td>
-		    <td>{{ pub.owner }}</td>		    	    
-		 </tr>
-      {% endfor %}
-	  </table>
-	  {% endif %}
-	  
-	{% else %}
-	<h5>Pour faire une demande d'identifiants, envoyer un mail à jessica.leyrit@uca.fr</h5>
-	<br/>
-
-	{% endif %}
-
-{% endblock %}
diff --git a/hal/urls.py b/hal/urls.py
index 094ec11e233dd5d23b5e12cadb729bc63f519653..9c775ef36491c61474fc5bffe6b4d90cb137c70e 100644
--- a/hal/urls.py
+++ b/hal/urls.py
@@ -9,9 +9,16 @@ urlpatterns = [
     url(r'^deconnexion$', views.deconnexion, name='deconnexion'),
     url(r'^blog$', views.article_blog, name='blog'),
     url(r'^bibtex2hal$', views.bibtex2hal, name='bibtex2hal'),
-    url(r'^updatehalbibtex$', views.updatehalbibtex, name='updatehalbibtex'),
-    url(r'^bibtexxml$', views.bibtexxml, name='bibtexxml'),
+    url(r'^bibformat_2hal/(?P<csvfile>[\w\-]+)$', views.bibformat_2hal, name='bibformat_2hal'),
+    url(r'^validatepost2hal$', views.validatepost2hal, name='validatepost2hal'),
+
+    url(r'^verifhalconf_ranking$', views.verifhalconf_ranking, name='verifhalconf_ranking'),
+    url(r'^verifhal_byuser/(?P<csvfile>[\w\-]+)$', views.verifhal_byuser, name='verifhal_byuser'),
+    
+    #url(r'^bibtexxml$', views.bibtexxml, name='bibtexxml'),
     url(r'^csv2hal$', views.csv2hal, name='csv2hal'),
+    url(r'^valid_post_hal$', views.valid_post_hal, name='valid_post_hal'),
+    
     #url(r'^text2hal$', views.text2hal, name='text2hal'),
     #url(r'^textxml$', views.textxml, name='textxml'),
     #url(r'^textmodif$', views.textmodif, name='textmodif'),
diff --git a/hal/views.py b/hal/views.py
index 95b065803c6a882f7a5c7b4f43e1aceeafb8a9fb..5966263cc9fc2b7c9d11d7f7739ba13a9c5e87a7 100644
--- a/hal/views.py
+++ b/hal/views.py
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals
 
-from django.shortcuts import render
+from django.shortcuts import render,redirect
 
 from django.contrib.auth.backends import ModelBackend
 from django.contrib.auth import authenticate, login, logout
@@ -9,7 +9,7 @@ from django.contrib.auth import authenticate, login, logout
 from django.contrib import messages
 from django.core.checks.messages import Error
 
-from .forms import ConnexionForm, Bibtex2halForm, BibtexXmlForm, Csv2halForm, UpdateHalBibtexForm, \
+from .forms import ConnexionForm, Bibtex2halForm, BibtexXmlForm, Csv2halForm, VerifHalConfForm, Bibformat2halForm ,\
     TextXmlForm, ModifTextForm,TextFromRG, Text2halForm
 
 from haltools.settings import MEDIA_ROOT
@@ -17,7 +17,11 @@ from haltools.settings import MEDIA_ROOT
 from .scripts_bibtex import script_bibtex_2_hal
 #from .scripts_text import script_text_2_hal
 from .scripts_csv import script_csv_2_hal
-from .script_update_hal_bibtex import script_update_hal_bibtex
+from .scriptupdatehalranking import script_verify_hal_ranking #, script_verif_hal_ranking
+from  .create_xml2hal import sendselect_2hal
+
+from slugify import slugify
+from datetime import datetime
 
 import random
 import string
@@ -85,6 +89,8 @@ class PubliDescribe():
         self.ville = "" 
         self.pays = ""
         self.acr = ""
+        self.doi = ""
+        self.editor = ""
         self.lang = ""
 
 
@@ -95,6 +101,7 @@ class PubliChange():
     def __init__(self):
         self.type = ""
         self.title = ""
+        self.uri = ""
         self.date = ""
         self.change = ""
         self.conf = ""
@@ -110,80 +117,117 @@ def bibtex2hal(request):
         treats a bibtex file and some variables
         give a table of data (parsed bibtex file) and results of HAL depot
     '''   
+    print("method views.bibtex2hal")
     reponse = ""
+    csvfile = ""
     form = Bibtex2halForm(request.POST or None)
     
     if form.is_valid():
-        # get data from form
-        bib_name_user = form.cleaned_data['bib_name_user']
         name_user = form.cleaned_data['name_user']
         firstname_user = form.cleaned_data['firstname_user']
         labo_auth_final = form.cleaned_data['labo_auth_final']
-        id_hal_user = form.cleaned_data['id_hal_user']
-        login_user = form.cleaned_data['login_user']
-        domains = form.cleaned_data['domains']
-        domains2 = form.cleaned_data['domains2']
-        mail_reponse = form.cleaned_data['mail_reponse']
-        """ domain1 = form.cleaned_data['domain1']
-        domain2 = form.cleaned_data['domain2']
-        domain3 = form.cleaned_data['domain3']
-        domain4 = form.cleaned_data['domain4']
-        domain5 = form.cleaned_data['domain5'] """
-        listdomains = domains + domains2
-        print("listdomains {0}".format(listdomains))
+        bibtex_file = form.cleaned_data['bibtex_file']       
 
-        #choice_source = form.cleaned_data['choice_source']
-    
-        login_depot = form.cleaned_data['login_depot']
-        passwd_depot = form.cleaned_data['passwd_depot']
-        #bool_depot_preprod = form.cleaned_data['bool_depot_preprod']
-        #bool_depot_prod = form.cleaned_data['bool_depot_prod']
-        choice_depot = form.cleaned_data['choice_depot']
-        bibtex_file = form.cleaned_data['bibtex_file']
+        labo_auth_final = "struct-"+labo_auth_final
 
-        bool_depot_preprod = False
-        bool_depot_prod = False
-        
-        # recup du type de depot
-        if choice_depot == 'PREPROD' :
-            print ("Views.py depot preprod")
-            bool_depot_preprod = True
-        if choice_depot == 'PRODHAL' :
-            print ("Views.py depot prod")
-            bool_depot_prod = True
-        
-        #print ("choice_source ",choice_source)
+
+        print ("begin script")
+
+        today = datetime.today()
+        randomnumbers = ''.join(random.choices(string.digits, k=6))
+        csvfile = "{0}_{1}-{2}_{3}".format(slugify(name_user),today.day, today.month,randomnumbers)
+
+        msg_to_announce = "Attendre quelques minutes avant d'aller voir le résultat"
+        reponse = script_bibtex_2_hal.delay(bibtex_file, name_user, firstname_user, labo_auth_final, csvfile)
+        messages.add_message(request, messages.WARNING, msg_to_announce)
         
-        # single = False -> ask to deposit many publications 
-        single = False
+    return render(request, 'hal/bibtex2hal.html', locals())
 
-        labo_auth_final = "struct-"+labo_auth_final
 
-        # manage domains  1st domain required, not the others
+def bibformat_2hal(request, csvfile):
+    print("method views.bibformat_2hal")
+    form = Bibformat2halForm(request.POST or None)
+    try :
+
+        with open('bibtex_csv_files/'+csvfile+'.csv', 'r', newline='') as csv_file :
+            csvr = csv.reader(csv_file, delimiter =',')
+
+            list_to_post = []
+            for row in csvr :
+                print(row)
+                p = PubliDescribe() #PubliChange()
+
+                p.num = row[0]
+                p.authors =row[1]
+                p.title = row[2]
+                p.conf = row[3]
+                p.page = row[4]
+                p.vol = row[5]
+                p.date = row[6]
+                p.type = row[7]
+                p.todo = row[8]
+                p.ville = row[9] 
+                p.pays = row[10]
+                p.acr = row[11]
+                p.doi = row[12]
+                p.editor = row[13]
+                p.lang = row[14]
 
-        print ("views.py bool_depot_prod ", bool_depot_prod)
-        print ("begin script")
+                list_to_post.append(p)
 
-        URLnameuser = name_user.replace(" ","-")
-        URLnameuser = URLnameuser.replace("'","-")
+        with open('bibtex_csv_files/result_'+csvfile+'.txt', 'r') as resultxt :
+            result = resultxt.readlines()
+
+        if form.is_valid():
+            print("method views.bibformat_2hal FORM VALID")
+            name_user = form.cleaned_data['name_user']
+            login_user = form.cleaned_data['login_user']
+            id_hal_user = form.cleaned_data['id_hal_user']
+            mail_reponse = form.cleaned_data['mail_reponse']
+            labo_auth_final = form.cleaned_data['labo_auth_final']
+            domains = form.cleaned_data['domains']
+            domains2 = form.cleaned_data['domains2']
+            login_depot = form.cleaned_data['login_depot']
+            passwd_depot = form.cleaned_data['passwd_depot']
+            choice_depot = form.cleaned_data['choice_depot']
+
+            list_publis_to_update = request.POST.getlist('chkbox')
+
+            labo_auth_final = "struct-"+labo_auth_final
+            listdomains = domains + domains2  
+            for pub_upd in list_publis_to_update :
+                print(pub_upd)
+            
+            msg_to_announce = "Après l'opération, les résultats seront envoyés à l'adresse : {0}".format(mail_reponse)
+            messages.add_message(request, messages.WARNING, msg_to_announce)
 
-        ''' randomURL = ''.join(random.choices(string.ascii_uppercase + string.digits, k=6))
-        namenewfile = '{0}_{1}.md'.format(URLnameuser,randomURL) '''
+            reponse = sendselect_2hal.delay(name_user,login_user,id_hal_user,mail_reponse,labo_auth_final,listdomains,login_depot,passwd_depot,choice_depot,list_publis_to_update,csvfile)
+            
 
-        msg_to_announce = "Le résultat vous sera envoyé par mail à {0}".format(mail_reponse)
+        return  render(request, 'hal/bibformat_2hal.html', locals())
+    except Exception as e :
+        print (e)
+        return redirect('https://http.cat/425')
 
-        reponse = script_bibtex_2_hal.delay(bibtex_file, bib_name_user, name_user, firstname_user, labo_auth_final, id_hal_user, login_user, listdomains, login_depot, passwd_depot, bool_depot_preprod, bool_depot_prod, single, mail_reponse)
-        
-        messages.add_message(request, messages.WARNING, msg_to_announce)
 
-        
-    return render(request, 'hal/bibtex2hal.html', locals())
+## A enlever
+def validatepost2hal(request):
+    print("method views.validatepost2hal")
+
+    if request.method == 'POST' :
+        print("method post")
+        list_publis_to_update = request.POST.getlist('chkbox')
+        #print(list_publis_to_update)
+        for pub_upd in list_publis_to_update :
+            print(pub_upd)
+
+    return redirect('https://http.cat/425')
 
 ##################################################################################################################################
 ## bibtexXML  ######################################################################################################################
 ##################################################################################################################################
 
-def bibtexxml(request):
+""" def bibtexxml(request):
     reponse = ""
     form = BibtexXmlForm(request.POST or None)
 
@@ -227,11 +271,7 @@ def bibtexxml(request):
         reponse_to_post = script_bibtex_2_hal(bibtex_file, bib_name_user, name_user, firstname_user, labo_auth_final, id_hal_user, login_user, listdomains, login_depot, passwd_depot, bool_depot_preprod, bool_depot_prod, single, choice_source)
 
         #print (reponse_to_post)
-    return render(request, 'hal/bibtexxml.html', locals())
-
-
-
-
+    return render(request, 'hal/bibtexxml.html', locals()) """
 
 
 
@@ -239,67 +279,79 @@ def bibtexxml(request):
 ## UPDATE_HAL  ######################################################################################################################
 ##################################################################################################################################
       
-def updatehalbibtex(request):
+def verifhalconf_ranking(request):
     '''
         update HAL from Bitex DBLP -> change name conf
     '''   
+    print("method views.verifhalconf_ranking")
     reponse = ""
-    form = UpdateHalBibtexForm(request.POST or None)
+    url_result = ""
+    form = VerifHalConfForm(request.POST or None)
+
+    csvfile = ""
     
     if form.is_valid():
         # get data from form
-        #bib_name_user = form.cleaned_data['bib_name_user']
+
         name_user = form.cleaned_data['name_user']
         firstname_user = form.cleaned_data['firstname_user']
-        labo_auth_final = form.cleaned_data['labo_auth_final']
         id_hal_user = form.cleaned_data['id_hal_user']
-        #login_user = form.cleaned_data['login_user']
-    
-        login_depot = form.cleaned_data['login_depot']
-        passwd_depot = form.cleaned_data['passwd_depot']
-
-        choice_depot = form.cleaned_data['choice_depot']
-        #bibtex_file = form.cleaned_data['bibtex_file']
-
-        bool_depot_preprod = False
-        bool_depot_prod = False
         
-        # recup du type de depot
-        if choice_depot == 'PREPROD' :
-            print ("Views.py depot preprod")
-            bool_depot_preprod = True
-        if choice_depot == 'PRODHAL' :
-            print ("Views.py depot prod")
-            bool_depot_prod = True
-        
-        labo_auth_final = "struct-"+labo_auth_final
-
-        print ("views.py bool_depot_prod ", bool_depot_prod)
         print ("begin script")
-        reponse = script_update_hal_bibtex(name_user, firstname_user, labo_auth_final, id_hal_user, login_depot, passwd_depot, bool_depot_preprod, bool_depot_prod)        
-        # in reponse, there's a table of data coming from bibtex file and some results (with "RESULTATS" in first column)
-        list_to_post = []
-        for all_res in reponse :
-            result=all_res.split("|") 
-            p = PubliChange()
-            p.type = result[0]
-            p.title = result[1]
-            p.date = result[2]
-            p.change = result[3]
-            p.conf = result[4]
-            p.conf2 = result[5]
-            p.owner = result[6]
-            
-            list_to_post.append(p)
-                #list_to_post.append((result[0],result[1],result[2],result[3],result[4],result[5],\
-                #result[6],result[7],result[8],result[9],result[10],result[11],result[12],))
-        #reponse=("reponse HAL")
+
+        today = datetime.today()
+        randomnumbers = ''.join(random.choices(string.digits, k=6))
+        csvfile = "{0}_{1}-{2}_{3}".format(slugify(name_user),today.day, today.month,randomnumbers)
+
+        msg_to_announce = "Attendre quelques minutes avant d'aller voir le résultat"
+        messages.add_message(request, messages.WARNING, msg_to_announce)
+        reponse = script_verify_hal_ranking.delay(name_user, firstname_user, id_hal_user, csvfile)        
         
-    return render(request, 'hal/updatehalbibtex.html', locals())
+    return render(request, 'hal/verifhalconf_ranking.html', locals())
+
+
+def verifhal_byuser(request, csvfile):
+    print("method views.verifhal_byuser")
+    try :
+
+        with open('ranking_csv_files/'+csvfile+'.csv', 'r', newline='') as csv_file :
+            csvr = csv.reader(csv_file, delimiter =',')
+
+            list_to_post = []
+            for row in csvr :
+                print(row)
+                p = PubliChange()
+                p.type = row[0]
+                p.title = row[1]
+                p.uri = row[2]
+                p.date = row[3]
+                p.change = row[4]
+                p.conf = row[5]
+                p.conf2 = row[6]
+                p.owner = row[7]
+                
+                list_to_post.append(p)
 
+        return  render(request, 'hal/verifhal_byuser.html', locals())
+    except Exception as e :
+        print (e)
+        return redirect('https://http.cat/425')
 
 
 
+def valid_post_hal(request):
+    print("method views.valid_update_hal")
+    print(request)
+    if request.method == 'POST' :
+        print("method post")
+        list_publis_to_update = request.POST.getlist('chkbox')
+        #print(list_publis_to_update)
+        for pub_upd in list_publis_to_update :
+            print(pub_upd)
+        
+        #reponse = script_update_hal_ranking.delay(list_publis_to_update)
+        
+    return render(request,'hal/updatehal_byuser.html', locals() )
 
 
 
diff --git a/requirements.txt b/requirements.txt
index 9202b8753d5e9918706f263e9dfba8ff647f0e1f..90834b936b44dc5934e0da63d6474b9a143facb1 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,6 +5,7 @@ django-bootstrap-themes==3.3.6
 django-bootstrap3==21.1
 lxml==4.9.0
 mysqlclient==2.1.0
+python-slugify==8.0.1
 requests==2.26.0