31,029
edits
Tag: 2017 source edit |
Tag: 2017 source edit |
||
| Line 29: | Line 29: | ||
=[[File:Outils.png]] Developing your own import script= | =[[File:Outils.png]] Developing your own import script= | ||
You can decide to develop custom scripts to load data into Dolibarr database. | |||
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. | |||
* 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. | |||
* 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 | |||
* 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. | |||
This is examples of some use cases: | |||
==Import third parties and contacts== | ==Import third parties and contacts== | ||