Mass imports - Migrate my Data To Dolibarr: Difference between revisions

Jump to navigation Jump to search
m
Tag: 2017 source edit
Line 34: Line 34:
For example, you can use '''LibreOffice''', which is able to insert the contents of a table into a database such as Mysql Dolibarr. Here is a tutorial on this method: [[Import data with OpenOffice]].
For example, you can use '''LibreOffice''', which is able to insert the contents of a table into a database such as Mysql Dolibarr. Here is a tutorial on this method: [[Import data with OpenOffice]].


Some automation tool specialized in synchronizing data may also be able to do the job.
Some automation tools specialized in synchronizing data may also be able to do the job.


=[[File:Outils.png]] Developing yourself your own import script=
=[[File:Outils.png]] Developing yourself your own import script=
Line 41: Line 41:


You can develop custom scripts to read your source information. Depending on your source system, you can make:
You can develop custom scripts to read your source information. Depending on your source system, you can make:
* Direct database access to read the data
 
* Using the API of your source system to read its data.
*Direct database access to read the data
* If the source system is another Dolibarr, you can also use CRUD objects of Dolibarr (the PHP Class to manipulate Data objects, so you can call the method fetch() and fetchAll() to get the data). This need to have PHP development knowledge.
*Using the API of your source system to read its data.
*If the source system is another Dolibarr, you can also use CRUD objects of Dolibarr (the PHP Class to manipulate Data objects, so you can call the method fetch() and fetchAll() to get the data). This need to have PHP development knowledge.


This scripts can then write the data read into your target Dolibarr using also the 3 methods.  
This scripts can then write the data read into your target Dolibarr using also the 3 methods.  
* Using the API is the more secured method (most of the business control are included).  
 
* Using the CRUD class objects to call the method (so you can call the method fetch() to check if object already exists in the target, call the method create() or update() to insert of update the record). This need to have PHP development knowledge. You may find examples of script to load data from CSV files into the database using the second method (Dolibarr CRUD objects) into this directory: https://github.com/Dolibarr/dolibarr/tree/develop/dev/initdata
*Using the API is the more secured method (most of the business control are included).
* You can also make direct database write by a direct access to the database (This method is not recommended because it bypass all business rules implemented into CRUD class or into APIs, however, it is the more performant). This need to understand the database structure. This is not so difficult because each data is saved once and only once into the Dolibarr database structure.
*Using the CRUD class objects to call the method (so you can call the method fetch() to check if object already exists in the target, call the method create() or update() to insert of update the record). This need to have PHP development knowledge. You may find examples of script to load data from CSV files into the database using the second method (Dolibarr CRUD objects) into this directory: https://github.com/Dolibarr/dolibarr/tree/develop/dev/initdata
*You can also make direct database write by a direct access to the database (This method is not recommended because it bypass all business rules implemented into CRUD class or into APIs, however, it is the more performant). This need to understand the database structure. This is not so difficult because each data is saved once and only once into the Dolibarr database structure.




Line 76: Line 78:
Special Notes for certain import fields when you are importing Excel files (CSV or XLSX)
Special Notes for certain import fields when you are importing Excel files (CSV or XLSX)


* Field Type '''Date'''  The default formatting abilities in the US Excel can be used (i.e. 2022/01/19 or 2022-01-19).  You must highlight the column in Excel and with <CRTL><1> you get to the formatting menu.  From there click "Date" and choose format "2022-01-19".  Afterwards click "Custom" and you will see the format information "yyyy-mm-dd,-@".  Delete the dashes and the character after dd. Now everything will show in the Excel column as needed for Import.
*Field Type '''Date'''  The default formatting abilities in the US Excel can be used (i.e. 2022/01/19 or 2022-01-19).  You must highlight the column in Excel and with <CRTL><1> you get to the formatting menu.  From there click "Date" and choose format "2022-01-19".  Afterwards click "Custom" and you will see the format information "yyyy-mm-dd,-@".  Delete the dashes and the character after dd. Now everything will show in the Excel column as needed for Import.
* Field Type '''Country'''  Although Dolibarr displays fully spelled out name such as "United States", Dolibarr only imports the two-digit Country code.  A complete list of the countries in the world can be found here:  [https://laendercode.net/en/2-letter-list.html '''Country Codes''']
*Field Type '''Country'''  Although Dolibarr displays fully spelled out name such as "United States", Dolibarr only imports the two-digit Country code.  A complete list of the countries in the world can be found here:  [https://laendercode.net/en/2-letter-list.html '''Country Codes''']
* Field Type '''State/Province'''  Similar to Country Code (in particular US states) which are displayed for example as "MA - Massachusetts", Dolibarr only wants the two-digit State Code.  A list of US State codes can be found here:  '''[https://www.faa.gov/air_traffic/publications/atpubs/cnt_html/appendix_a.html United States].  | [https://www.ncbi.nlm.nih.gov/books/NBK7254/ Canada] | [https://kb.bullseyelocations.com/article/42-australia-state-codes Australia] | [https://brazil-help.com/brazilian_states.htm Brazil]  | [https://kb.bullseyelocations.com/article/67-mexico-state-codes Mexico]'''  and France is a 3 digit code '''[https://kb.bullseyelocations.com/article/57-france-state-codes France]'''
*Field Type '''State/Province'''  Similar to Country Code (in particular US states) which are displayed for example as "MA - Massachusetts", Dolibarr only wants the two-digit State Code.  A list of US State codes can be found here:  '''[https://www.faa.gov/air_traffic/publications/atpubs/cnt_html/appendix_a.html United States].  | [https://www.ncbi.nlm.nih.gov/books/NBK7254/ Canada] | [https://kb.bullseyelocations.com/article/42-australia-state-codes Australia] | [https://brazil-help.com/brazilian_states.htm Brazil]  | [https://kb.bullseyelocations.com/article/67-mexico-state-codes Mexico]'''  and France is a 3 digit code '''[https://kb.bullseyelocations.com/article/57-france-state-codes France]'''


==Import invoices==
==Import invoices==
Line 98: Line 100:




= Asking a freelance =
=Asking a freelance=
You can also ask an expert that will choose the best method and will make the actions for you.
You can also ask an expert that will choose the best method and will make the actions for you.


Navigation menu