Dolibarr is a powerful and flexible free and open source ERP & CRM application. It has all the fuctionalities of a classic ERP & CRM application and is easy to install, use, customize and upgrade. It has a modular structure, all the functionalities being implemented by separate modules which can be enabled or disabled when needed. Dolibarr is the best free and open source ERP and CRM application to date. Unfortunately, companies realize this only after they have spent months or even years trying to use Odoo. Odoo generates numerous problems when you try to upgrade it: modules that worked perfectly with the previous Odoo version have to be rewritten because in general, new Odoo versions, released yearly, are not compatible with old modules. Odoo remains slow even after implementing all the speed optimization measures. Let alone the fact that Odoo uses the ‘open core’ model that proves no real respect for user freedom.
17.1. Preliminary steps
Create a directory for Dolibarr like this:
mkdir /var/www/doli.example.com
where example.com is the main domain hosted on your server. You can use a different domain for serving Dolibarr, but it’s recommended to use your main domain, since all the other applications (Roundcube, Nextcloud, Matomo, Friendica, phpList, etc.) will use the same domain.
Download the last version of Dolibarr from the Github repository. Navigate to https://github.com/Dolibarr/dolibarr , click on ‘Releases’, on the right panel, then right-click on the zip archive (Source code (zip)) of the most recent version of Dolibarr, choose ‘Copy link location’ to copy the link to the clipboard.
Next navigate to the newly created directory:
cd /var/www/doli.example.com
Download the archive and extract it (in this example the archive is 12.0.1.zip and the download link copied to clipboard is: https://github.com/Dolibarr/dolibarr/archive/12.0.1.zip):
wget https://github.com/Dolibarr/dolibarr/archive/12.0.1.zip
unzip 12.0.1.zip
rm 12.0.1.zip
Next move all the content of the dolibarr-12.0.1 directory to the root directory of Dolibarr:
cd /var/www/doli.example.com/dolibarr-12.0.1
mv * /var/www/doli.example.com
Then move all the content of the htdocs directory to the root directory of Dolibarr (/var/www/doli.example.com):
cd /var/www/doli.example.com/htdocs
mv * /var/www/doli.example.com
This will overwrite the robots.txt file from the root directory, with the robots.txt file from the htdocs directory, which is what we want.
Then you can delete the dolibarr-12.0.1 directory:
cd /var/www/doli.example.com
rm -r dolibarr-12.0.1
Next, change ownership and permissions for /var/www/doli.example.com
and its content:
chown -R www-data:www-data /var/www/doli.example.com
find /var/www/doli.example.com -type d -exec chmod 750 {} +
find /var/www/doli.example.com -type f -exec chmod 640 {} +
Create the A and AAAA DNS records for doli.example.com. They should be identical to the records for mail.example.com, with the difference that instead of mail you will enter doli.
17.2. Create a new database and user
To create a new database and database user for Dolibarr, log in to phpMyAdmin, click ‘Databases’ on the upper bar, then enter dolibarr as the name for the new database in the ‘Database name’ text box, leave the format as ‘utf8mb4_general_ci’, then click ‘Create’ and the new database will be created.
To create a new user click on the Home icon on the left panel, then click ‘User accounts’ on the upper bar, then click ‘Add user account’. Then in the ‘User name’ text fields enter Use text field and doliuser as the name of the new user; in the ‘Host name’ text fields enter Local and localhost, in the ‘Password’ text fields enter Use text field and a strong password made up of a mixture of lower case and upper case letters, numbers and symbols; in the ‘Re-type’ field enter the same strong password, then write down the new username and password, because you will need them later during the installation process, then leave everything as it is, scroll down to the bottom of the page and click ‘Go’.
Next give doliuser all the rights over the dolibarr database, except GRANT, which is not necessary: click on ‘User accounts’ on the upper bar, click on ‘Edit privileges’ on the doliuser row, click on the ‘Database’ tab, then in the ‘Add privileges on the following database(s)’ text area click on dolibarr to select it, click on ‘Go’, then next to ‘Database-specific privileges’ check the ‘Check all’ checkbox, then, to exclude the GRANT privilege, uncheck its checkbox under ‘Administration’, then click on the ‘Go’ button.
17.3. Get a Let’s Encrypt SSL certificate for doli.example.com
Open the /etc/nginx/sites-enabled/0-conf file for editing:
nano /etc/nginx/sites-enabled/0-conf
Add the following temporary block at the bottom of the file:
server {
listen 80;
listen [::]:80;
server_name doli.example.com;
location /.well-known/acme-challenge {
root /var/www;
}
}
Replace example.com with your own domain.
Reload Nginx:
systemctl reload nginx
Get the SSL certificate:
certbot certonly –agree-tos –webroot -w /var/www/ -d doli.example.com
17.4. Configure Nginx for Dolibarr
After you have obtained the Let’s Encrypt SSL certificate, you can replace the temporary server block mentioned above, with the following blocks:
server {
listen 80;
listen [::]:80;
server_name doli.example.com;
return 301 https://doli.example.com$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name doli.example.com;
root /var/www/doli.example.com;
index index.php;
ssl_certificate /etc/letsencrypt/live/doli.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/doli.example.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/doli.example.com/chain.pem;
ssl_dhparam /etc/nginx/ssl/dhparam.pem;
ssl_session_timeout 4h;
ssl_session_cache shared:SSL:40m;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_stapling on;
ssl_stapling_verify on;
add_header Strict-Transport-Security “max-age=63072000” always;
add_header X-Frame-Options SAMEORIGIN;
add_header X-Content-Type-Options nosniff;
add_header X-Robots-Tag “noindex, nofollow, nosnippet, noarchive”;
location /.well-known/acme-challenge {
root /var/www;
}
location = /robots.txt {
allow all;
}
location / {
auth_basic ‘Restricted’;
auth_basic_user_file /etc/nginx/htpass/doli.example.com;
try_files $uri $uri/ /index.php;
}
# Allow uploads up to 20MB in size
client_max_body_size 20m;
client_body_buffer_size 128k;
# Cache static files
location ~ \.(js|css|png|jpg|jpeg|gif|ico)$ {
expires 30d;
log_not_found off;
}
# Pretty REST API URL
location ~ ^/api/(?!(index\.php))(.*) {
try_files $uri /api/index.php/$2?$query_string;
}
location ~ [^/]\.php(/|$) {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param HTTPS on;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
# Dolibarr Rest API path support
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_script_name;
}
# Prevent serving hidden files
location ~ /\.(?!well-known).* {
deny all;
access_log off;
log_not_found off;
}
access_log /var/log/sites/doli.example.com/access.log;
error_log /var/log/nginx/doli.example.com.error.log notice;
}
Replace example.com with your actual domain.
Create the access log directory:
mkdir /var/log/sites/doli.example.com
Create the /etc/nginx/htpass/doli.example.com password file containing the hashed password to be used for basic HTTP authentication by the user(s) with access to the Dolibarr login page. If the user is robert, the command will be:
htpasswd -c /etc/nginx/htpass/doli.example.com robert
To add a new user marcus to the same password file, so that he can have access to the log in page, run:
htpasswd /etc/nginx/htpass/doli.example.com marcus
Enter the password twice. Change ownership and permissions for the new password file:
chown www-data:www-data /etc/nginx/htpass/doli.example.com
chmod 400 /etc/nginx/htpass/doli.example.com
The username and password used for HTTP authentication should be different from the username and password used to log in to Dolibarr.
Open the /var/www/doli.example.com/robots.txt:
nano /var/www/doli.example.com/robots.txt
By default, this file has the following content:
User-agent: *
Allow: /public/agenda/agendaexport.php
Allow: /public/demo/
Allow: /index.php
Disallow: /
If you want to allow the search engine bots to index your login page, the public demo page and the public agenda in your Dolibarr installation, you can leave the content of the robots.txt file as it is and also disable basic HTTP authentication by changing the location / block to make it look like the following:
location / {
# auth_basic ‘Restricted’;
# auth_basic_user_file /etc/nginx/htpass/doli.example.com;
try_files $uri $uri/ /index.php;
}
On the contrary, if you want to discourage search engines from indexing any pages of your Dolibarr installation, change the content of the robots.txt file to make it look like this:
User-agent: *
Disallow: /
The implementation of basic HTTP authentication will prevent search engines to access and index any Dolibarr page, but in case you suspend it temporarily for testing purposes or for other reasons, the robots.txt file having the content shown above, will tell search engines not to index Dolibarr pages.
Reload Nginx:
systemctl reload nginx
17.5. Install Dolibarr using the web interface
Begin the installation by accessing:
You will see the following screen:
Choose the default language from the drop-down list, then click ‘Next step’. The installer will choose ‘Fresh install’ as setup mode, like below:
Just click ‘Start’.
On the next screen fill in the listed fields as shown below:
‘Directory where web pages are stored’ > /var/www/doli.example.com
‘Directory to store uploaded and generated documents‘ > /var/www/doli.example.com/documents
‘URL Root‘ > https://doli.example.com
‘Force secure connections (https)‘ leave unchecked because https is enforced in the web server’s settings.
‘Database name‘ > dolibarr
‘Driver type‘ > mysqli (MySQL or MariaDB >= 5.0.3)
‘Database server‘ > localhost
‘Port‘ leave the default 3306 as it is
‘Database table prefix‘ > llx_
‘Create database‘ > leave unchecked
‘Login‘ > doliuser (the user set up when creating the ‘dolibarr’ database)
‘Password‘ > enter the password set up when creating the user of the ‘dolibarr’ database
‘Create user account or grant user account permission on the Dolibarr database‘ > leave unchecked
Click ‘Next step’ then again ‘Next step’ and wait until Dolibarr creates all the necessary database tables.
If an error appears, telling you to go back and check the name of the database because the connection to the database server failed, just go back and enter again the database name, database user, its password, leave the database server port as chosen by the installer, then click again ‘Next step’.
After the successful installation of the database, the screen will look like this:
After you click ‘Next step’, you will be prompted to enter a username and a password for the master account:
Next you will be informed that the installation is complete and that you should add a file called install.lock in the ‘documents’ directory of Dolibarr to prevent the malicious use of the installation tools. So run the following:
cd /var/www/doli.example.com/documents
touch install.lock
Since the /var/www/doli.
example.com
/
conf/conf.php
file
is
writable
by
the
www-data
user
, you will see a prominent warning at the bottom of the Home screen each time you log
in.
To make it disappear
,
make the configuration file read-only by running
:
cd
/var/www/doli.
example.com
/
conf
chmod 4
0
0 conf.php
Reload Nginx:
systemctl reload nginx
Next log in with the master account user and password at https://doli.example.com . You will be prompted to enter your company/organization’s data and to enable the modules that you will be using:
First click on ‘Setup > Company/Organization’ on the left panel, and enter your Company/Organization’s data in the ‘Company/Organization’ section, on the ‘Company’ tab. Click Save.
Then click on ‘Setup > Modules/Applications’ on the left panel to go to the ‘Modules/Applications Setup’ section. There click on ‘List view’ on the right side of the screen to view all the available modules as a list:
Enable (using the switch) the following modules:
– Third Parties
– Proposals
– Sales Orders
– Shipments
– Contracts/Subscriptions
– Tickets
– Vendors
– Vendor Commercial Proposals
– Incoterms
– Invoices
– Taxes & Special Expenses
– Banks & Cash
– Payments by Direct Debit
– Margins
– Accounting (double entry)
– Products
– Services
– Stocks
– Product Lots
– Product Variants
– Projects or Leads
– Events/Agenda
– Resources
– DMS/ECM
– Tags/Categories
– WYSIWYG editor
– Multicurrency
– Barcodes
– Workflow
– Data imports
– Data exports
– Module and Application Builder
– Poll, Survey or Vote
– Notifications on business event
– API/Web services (REST server)
– API/Web services (SOAP server)
– Paypal
– Stripe
– Direct Printing
– Scheduled jobs
– Unalterable Archives
Of course, you can enable the ‘Accounting (simplified)’ instead of the ‘Accounting (double entry)’ module, if it’s applicable to your specific situation. You can also enable additional modules if you believe you will need them.
You will also need to enable the ‘Sync Dolibarr with WooCommerce’ module after you install it, as explained further down below.
In order to be able to see confortably all the columns in the list view of products/orders/invoices, etc. it’s recommended to disable the unnecessary columns, by clicking on the small list icon at the right end of the upper bar, in every list screen, and unchecking the names of the columns that you want to remove from the list view.
It’s recommended to change the default number of items listed by default on a list page: go to Home > Setup > Display > scroll down to the ‘Miscellaneous’ section and change the ‘Default max length for lists’ from 25 to 100 or more, then click ‘Save’.
In the “Installthe ‘Sync WooCommerce with Dolibarr‘plugin” chapter we mentioned a few configuration settings that you have to make in Dolibarr in order to properly synchronize it with WooCommerce. We’ll repeat them below:
– You should set the decimal precision to 2 both in WooCommerce and Dolibarr. In Dolibarr, go to Home > Setup > Limits and accuracy and set 8 in ‘Max. decimals for unit prices’, 2 in ‘Max. decimals for total prices’ and 2 in ‘Max. decimals for prices shown on screen’.
– In Dolibarr, to hide product description on order and invoice lines, go to Home > Setup > PDF > scroll down to the ‘Other’ section, then next to ‘Hide products description’ select ‘Yes’, then click ‘Save’. If you don’t hide product description on order and invoice lines, all the text from the product’s description from WooCommerce will be added on the order/invoice line, next to the product name, which will make the order or invoice almost unreadable.
– If you live in a country where by default, only one type of sales tax is applicable, you will have only the first tax enabled by default in Dolibarr (Home > Setup > Company/Organization > ‘Type of sales tax’). In this situation, if you receive orders with two or three types of taxes, in order to have them properly converted into invoices, you’ll have to explicitly enable the second and the third tax in Dolibarr > Home > Setup > Company/Organization > scroll down to ‘Type of sales tax’ and check ‘Use second tax’ and if a third tax appears on the orders, also check ‘Use third tax’. All the taxes included in the WooCommerce orders are automatically transferred to Dolibarr along with the orders, so you don’t have to enter the taxes manually in Dolibarr, but as explained, the second and the third tax have to be enabled by hand, if you receive orders containing a second and a third tax. You only need to enable them once.
– The same currency needs to be set up in WooCommerce and in Dolibarr. That currency will be the one used by default in all the orders, invoices, etc. If on occasion, you need to issue invoices or other documents in other currency, first you will have to enable that currency in Dolibarr in Home > Setup > Modules/Applications > Multicurrency > click on the settings wheel > under ‘Currencies used’ select a new currency, enter the exchange rate in the ‘Rate’ field, then click on ‘ADD’. Then you’ll be able to choose the new currency for the occasional documents that you want to issue, while keeping the default currency as default and using it for all ordinary documents.
17.6. Activate the USA Chart of Accounts and the Canada English Chart of Accounts
If you want to use a basic USA chart of accounts, you have to overwrite the original sql file from Dolibarr, which contains a misconfiguration. This file is:
/var/www/doli.example.com/install/mysql/data/llx_accounting_account_us.sql
You have to replace it with the file with the same name located inside the assets directory of the ‘Sync Dolibarr with WooCommerce’ module. So, run:
cp /var/www/doli.example.com/custom/syncdolibarrwithwoocommerce/assets/charts_of_accounts/USA/llx_accounting_account_us.sql /var/www/doli.example.com/install/mysql/data
Next, while logged in to Dolibarr, click on ‘Accounting’ on the upper bar, then in the upper right corner of the screen click on ‘Show Tutorial’, then click on ‘STEP 2 … Setup – Chart of accounts models’.
To add a new chart of accounts for US: in the ‘Chart of accounts models’ field enter US-BASE, in the ‘Label’ field enter USA basic chart of accounts and in the ‘Country’ field choose ‘United States (US)’. Then click ‘ADD’.
To add an English chart of accounts for Canada, in the ‘Chart of accounts models’ field enter CA-ENG-BASE, in the ‘Label’ field enter Canadian basic chart of accounts – English and in the ‘Country’ field choose ‘Canada (CA)’. Then click ‘ADD’.
Then, to enable one of the newly added charts of accounts click again on ‘Accounting’ on the upper bar, click on ‘Show Tutorial’ in the upper right corner of the screen, then click on ‘STEP 3 … Setup – Chart of accounts’. In the new screen, in the ‘Select active chart of accounts’ drop-down list, select the newly added chart of accounts ‘US-BASE – USA basic chart of accounts – (US)’ or ‘CA-ENG-BASE – Canadian basic chart of accounts – English – (CA)’, then click the ‘CHANGE AND LOAD’ button to load the new chart of accounts.
Please note that you can modify or delete any account line in the loaded chart of accounts by clicking on the ‘Modify’/’Delete’ icon on the row of that respective account. Also, you can add a new account line to the chart of accounts that is loaded, by clicking on the ‘+’ icon in the upper right corner of the screen.
17.7. Add a chart of accounts for a new country to Dolibarr
If you look in the /var/www/doli.example.com/install/mysql/data directory and you don’t find an sql file (of the form llx_accounting_account_xx.sql, where xx is the two letter country code for a country) for one country that you are interested in, you can create a chart of accounts for that country by following the steps from below.
To add a new, customized chart of accounts for a new country to Dolibarr, first copy an existing chart of accounts sql file from /var/www/doli.example.com/install/mysql/data and give it the name that is appropriate for the new country. For example, if you want to add a chart of accounts for Argentina, copy llx_accounting_account_es.sql under the name llx_accounting_account_ar.sql . Then open the file with a text editor and edit it to customize all the entries according to the accounting rules generally accepted in the country to which the chart of accounts will belong. You can create an extended chart of accounts with a large number of accounts, or a simpler chart of accounts, including just a reduced number of accounts that you know you will be using. In general, in a chart of accounts, all the accounts are grouped in 7 large parent accounts:
ASSETS
LIABILITIES
EQUITY
INCOME
COGS (Cost of Goods Sold)
EXPENSE
OTHER_REVENUE
OTHER_EXPENSES
These parent accounts may be called differently, according to the generally accepted rules of the country. In some cases they will be fewer, like 5 parent accounts. You can find online sample chart of accounts for almost any country.
While editing your chart of accounts, you should change the content of the fk_pcg_version column to a short descriptive abbreviation. For example, for Argentina, you could call it ‘AR-BASE’. After you finish editing the file, save it and change ownership and permissions:
chown www-data:www-data /var/www/doli.example.com/install/mysql/data/llx_accounting_account_ar.sql
chmod 640 /var/www/doli.example.com/install/mysql/data/llx_accounting_account_ar.sql
Next, click on ‘Accounting’ on the upper bar, then click on ‘Show Tutorial’ in the upper right corner of the screen, then click on ‘STEP 2 … Setup – Chart of accounts models’, and add the new chart of accounts to the list of enabled charts of account. In the ‘Chart of accounts models’ field enter the code that you entered in the fk_pcg_version column of the sql file edited earlier, in the ‘Label’ field enter a short description, like ‘Argentina basic chart of accounts’, in the ‘Country’ field select the appropriate country, then click ‘ADD’.
Next, click again on ‘Accounting’ on the upper bar, click on ‘Show Tutorial’ in the upper right corner of the screen, click on ‘STEP 3 … Setup – Chart of accounts’, then in the ‘Select active chart of accounts’ drop-down list, select the name of the newly added chart of accounts and click ‘Change and Load’ to load the selected chart of accounts.
17.8. Configure logrotate to rotate Dolibarr access logs
Add a block for the Dolibarr access log in the /etc/logrotate.d/nginx file, in order to allow logrotate to properly rotate the access log.
nano /etc/logrotate.d/nginx
Add the following block at the bottom of the file:
/var/log/sites/doli.example.com/access.log {
missingok
rotate 10
compress
delaycompress
notifempty
create 0640 www-data adm
size 2M
sharedscripts
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
postrotate
[ ! -f /var/run/nginx.pid ] || kill -USR1 `cat /var/run/nginx.pid`
endscript
}
Replace example.com with your domain.
17.9. Configure Fail2ban to protect Dolibarr against brute-force attacks
As with any other application with a login page that is publicly accessible, you should configure Fail2ban to protect Dolibarr’s login page against brute-force attacks. Navigate to /etc/fail2ban/filter.d:
cd /etc/fail2ban/filter.d
Create a new custom filter for Dolibarr:
nano dolibarr.conf
Enter the following content inside this file:
[Definition]
failregex = ^<HOST> .* \”POST /index.php\?mainmenu=home HTTP/2.0\” 200 236.*$
^<HOST> .* \”GET / HTTP/2.0\” 401 195 .*$
ignoreregex =
Please note that there are two lines in the ‘failregex’ section: the first is to identify the failed log in attempts against the Dolibarr login page, and the second is to identify the failed log in attempts against the HTTP authentication login window, which is displayed right before loading the Dolibarr login page and can be also subject to brute-force attacks. Next, open the /etc/fail2ban/jail.local file for editing:
nano /etc/fail2ban/jail.local
Right above the [phpmyadmin] block, add the following block:
[dolibarr]
enabled = true
filter = dolibarr
logpath = /var/log/sites/doli.example.com/access.log
port = 80,443
findtime = 3600
maxretry = 4
bantime = 604800
Replace example.com with your domain.
Reload Fail2ban:
systemctl reload fail2ban
17.10. Move the configuration file outside the web root
To increase the security of this installation, first copy the configuration file outside the web root directory, to /srv/scripts:
cp /var/www/doli.example.com/conf/conf.php /srv/scripts/dolibarr.php
Then delete all the content of the /var/www/doli.example.com/conf/conf.php file:
cat /dev/null > /var/www/doli.example.com/conf/conf.php
Then open it:
nano /var/www/doli.example.com/conf/conf.php
Add the following line inside it:
<?php include(‘/srv/scripts/dolibarr.php’); ?>
Change ownership and permissions for the dolibarr.php file:
chown www-data:www-data /srv/scripts/dolibarr.php
chmod 400 /srv/scripts/dolibarr.php
17.11. Install the ‘Sync Dolibarr with WooCommerce’ module
This module allows Dolibarr to connect to one or multiple WooCommerce websites and to synchronize product stock and order status with WooCommerce. When the stock of a product decreases or increases in Dolibarr, the corresponding product stock in WooCommerce will be automatically updated. Also, when an order that has been transferred from WooCommerce to Dolibarr is invoiced in Dolibarr, the status of that WooCommerce order will be automatically changed to ‘Invoiced’. When the products listed on such an order are shipped to the customer and the shipment is validated in Dolibarr, the status of the corresponding WooCommerce order will be changed to ‘Shipped/Completed/Pending payment’. This module also contains many customized PDF templates for orders, invoices and shipments, that can be used instead of the default PDF templates when viewing or printing such documents. It also adds some custom fields to products (such as ‘Site of origin’, ‘Downloadable’), to orders (such as ‘Delivery address’, ‘Customer note’) and to invoices (‘Delivery address’).
First download ‘Sync Dolibarr with WooCommerce’ from Dolistore (https://www.dolistore.com/en/), then upload the archived module to /var/www/doli.example.com/custom through FTP. Extract the archive and change ownership and permissions for the new directory and its content:
cd /var/www/doli.example.com/custom
chown -R www-data:www-data syncdolibarrwithwoocommerce
find /var/www/doli.example.com/custom/syncdolibarrwithwoocommerce -type d -exec chmod 750 {} +
find /var/www/doli.example.com/custom/syncdolibarrwithwoocommerce -type f -exec chmod 640 {} +
Next log in to Dolibarr, go to Home > Setup > Modules/Applications, scroll down and in the ‘Other’ section find the newly added module: ‘Sync Dolibarr with WooCommerce’. Enable it by using the switch.
To be able to connect Dolibarr with a WooCommerce website you have to create a ‘backend’. Click on ‘Sync Dolibarr with WooCommerce’ icon on the upper bar, then click on ‘New backend’ in the left panel.
– in the ‘Ref.’ field enter Backend_1, if it’s the first backend.
– in the ‘Backend Name’ field add a suggestive name for the new backend, like the domain of the WooCommerce website, eg.: example.com .
– in the ‘WooCommerce Site URL’ field enter the full URL of the WooCommerce website, eg. https://www.example.com .
– in the ‘WooCommerce Key’ field enter the Consumer Key set up in the WooCommerce site (WooCommerce > Settings > Advanced > REST API).
– in the ‘WooCommerce Secret’ field enter the Consumer Secret set up in the WooCommerce site.
– in the ‘WooCommerce Order Status’ choose the status that will be assigned to a WooCommerce order when the shipment associated to the corresponding Dolibarr order will be validated. You can choose from: ‘Shipped’, ‘Completed’ and ‘Pending payment’.
Click ‘Create’. Please keep in mind that in the future, if you modify any of the fields that you have just filled out, you will have to enter the WooCommerce Key and Secret again in their respective fields, otherwise the plugin won’t work.
‘Sync Dolibarr with WooCommerce’ allows Dolibarr to connect to one or multiple WooCommerce websites and to synchronize product stock and order status with WooCommerce. When the stock of a product decreases or increases in Dolibarr, the corresponding product stock in WooCommerce will be automatically updated. Also, when an order that has been transferred from WooCommerce to Dolibarr is invoiced in Dolibarr, the status of that WooCommerce order will be automatically changed to ‘Invoiced’. When the products listed on such an order are shipped to the customer and the shipment is validated in Dolibarr, the status of the corresponding WooCommerce order will be changed to ‘Shipped/Completed/Pending payment’. This module also contains many customized PDF templates for orders and invoices, that can be used instead of the default PDF templates when viewing or printing such documents. It also adds some custom fields to products (such as ‘Site of origin’, ‘Downloadable’), to orders (such as ‘Delivery address’, ‘Customer note’) and to invoices (‘Delivery address’).
This module is designed to be used in conjunction with the ‘Sync WooCommerce with Dolibarr’ WooCommerce plugin. It’s meant to be used for a Dolibarr installation that resides on the same machine as the WordPress installation.
It’s recommended that you make a copy of all the invoice/order/shipment pdf templates located in /var/www/doli.example.com/custom/syncdolibarrwithwoocommerce/assets/invoice_pdf_templates, /var/www/doli.example.com/custom/syncdolibarrwithwoocommerce/assets/order_pdf_templates, /var/www/doli.example.com/custom/syncdolibarrwithwoocommerce/assets/shipment_pdf_templates and place them in /var/www/doli.example.com/core/modules/facture/doc, /var/www/doli.example.com/core/modules/commande/doc, /var/www/doli.example.com/core/modules/expedition/doc, respectively. Then make the user of the web server, www-data, the owner of all the templates. Next, enable the new templates: go to Home > Setup > Modules/Applications > Invoices/Sales Orders/Shipments, click on the Setup wheel and change their status to ‘Enable’. Then you can use them when you want to print any invoice, order or shipment, by selecting their name from the ‘Doc template’ dropdown list on the card of any invoice/order/shipment. In addition to some aesthetic improvements, some of these templates contain two additional columns: one with the custom units of measure transferred from WooCommerce, and one with the taxes amount for every invoice/order line.
17.12. Upgrading the ‘Sync Dolibarr with WooCommerce’ module
When a new version of the module is available on Dolistore, you can upgrade your installed ‘Sync Dolibarr with WooCommerce’ module as follows: first disable the module, then download the new version, then upload it to the /var/www/doli.example.com/custom directory and overwrite the old files with the new ones, then change ownership and permissions as when installing the module for the first time, then enable the module again.
17.13. Upgrading Dolibarr
Before upgrading Dolibarr to a new version, it’s recommended to verify if the new version has been tested and confirmed to function well within the suite of applications described in this guide. Once we test an application and confirm that it works well, we include it on this page.
Every few months you can check if a new version of Dolibarr has been released by going to ‘Home’ > ‘Admin Tools’ > ‘About Dolibarr’ and by clicking on ‘Check’ next to ‘Dolibarr current version (Programs)’. After a few seconds, the number of the newest Dolibarr version will be displayed. You don’t need to upgrade Dolibarr to every minor version, if you don’t have any problems with your current version, but if a major version is realeased, it’s recommended to perform the upgrade.
To upgrade Dolibarr to the latest version, follow the steps from below:
1. Archive the old Dolibarr folder and include the date in the name of the archive:
cd /var/bm_archives
tar czf doli.example.com-2020-5-21.tar.gz /var/www/doli.example.com
Store the archive in a safe place as backup.
2. Export the Dolibarr database using phpMyAdmin. Once logged in to phpMyAdmin click on the name of the Dolibarr database on the left panel, then click on ‘Export’ on the upper bar, then click on ‘Go’. After you save the sql file on your computer, rename it to include the date in its name, then place it in a safe location, along with the archive of the Dolibarr folder. Use a FTP client like FileZilla to download the archive of the Dolibarr folder on your local computer and to upload the database backup to the remote server.
3. Download the latest version of Dolibarr from the Github repository. Navigate to https://github.com/Dolibarr/dolibarr , click on ‘Releases’, on the right panel, then right-click on the zip archive of the most recent version of Dolibarr, choose ‘Copy link location’ to copy the link to the clipboard. In this example, the newest version is 12.0.2 and the download link copied to the clipboard is https://github.com/Dolibarr/dolibarr/archive/12.0.2.zip
Navigate to the /tmp directory:
cd /tmp
Download the archive and extract it:
wget https://github.com/Dolibarr/dolibarr/archive/12.0.2.zip
unzip 12.0.2.zip
rm 12.0.2.zip
Move all the content of the htdocs directory to the parent folder:
cd /tmp/dolibarr-12.0.2/htdocs
mv * ../
Copy all the content of the dolibarr-12.0.2 folder to the root Dolibarr folder, which is /var/www/doli.example.com :
cd /tmp/dolibarr-12.0.2
cp -r /tmp/dolibarr-12.0.2/* /var/www/doli.example.com
This will overwrite all the old files with the new ones without affecting the conf.php file or the additional modules from the custom directory.
Then you can delete the dolibarr-12.0.2 folder:
cd /tmp
rm -r dolibarr-12.0.2
Next set the necessary ownership for the Dolibarr root folder:
cd /var/www
chown -R www-data:www-data doli.example.com
4. To be able to upgrade the Dolibarr installation, remove the install.lock file from the documens directory:
cd /var/www/doli.example.com/documents
rm install.lock
Then open your browser and access:
It should automatically redirect you to:
The screen should look like below:
As you can see, the install choice suggested by the installer is ‘Upgrade’. So, click on Start next to the suggested upgrade. After the database upgrade finishes click on ‘Next step’, then again ‘Next step’. In the next screen you will be informed that Dolibarr has been upgraded successfully and that you should create again the install.lock
file in the documents
directory, so as to prevent mallicious use of the installer. So, run:
cd /var/www/doli.
example.com
/documents
touch install.lock
Since the /var/www/doli.
example.com
/
conf/conf.php
file
is
writable
by
the
www-data
user
, you will see a prominent warning at the bottom of the Home screen each time you log
in.
To make it disappear
,
make the configuration file read-only by running
:
cd
/var/www/doli.
example.com
/
conf
chmod 4
0
0 conf.php
Please note that the upgrade process can be done multiple times by calling the /install/index.php
page in a browser.
That’s it. You can now access the new Dolibarr version at: