Editing Dolibarr

Hello
I am trying to customize my Dolibarr installation at my company’s needs.
I have currently two questions.

  1. Is there a way in Dolibarr to create code overrides, to avoid editing core files and doing updates easily?
  2. I can’t manage to find parts of code of the tabs in modules like fichinder, commande, societe. For example in fichinder/card.php can’t find the code above <div class="refidno">, like pagination, tabbar, statusref. Obviously they’re in other file, but I 'm missing it, although I 'm reading the wiki

Thanks in advance

Regarding 1.:

Depending on what you need to customize, it is advisable to do this by building a custom module like it is described here:

https://wiki.dolibarr.org/index.php?title=Module_development

In many cases, if you need to perform additional actions after certain events happen (e.g. a bill gets marked as paid), there are triggers available. In this case, the trigger BILL_PAYED can be used within a custom module to perform additional actions.

To modify/extend functionality performed by Dolibarr, you can use hooks.

The Wiki provides a good step by step explanation of how an own module can be created and a module builder is part of Dolibarr, which helps you with the required steps. But depending on your experience level, there is still some learning curve.

However, if you absolutely need to make changes in the core files, it might help to use git and also make future updates based on git to help with merge conflicts and avoid overrides.

2 Likes

Thank you. This is the wiki for anyone else looking for it: Hooks system - Dolibarr ERP CRM Wiki

hello ,
i would like to ask if there is a way to overwrite an index file like for exemple compta\facture\index.php
it doesn’t containe any hooks , also its possible if i did a copy directly inside custom like so
custom\compta\facture\index.php
but if i replace it under my custome module like so
custom\my_module\compta\facture\index.php
it doesn’t work , is there is a way to make my modifications on index.php using my_module ?

Hello,

I don’t think that’s possible.

1 Like

idk, but i sitll want to try, i belive there is a way hhhh

Hello, all dolibarr files include main.inc.php
Maybe you should try to use the hook printMainArea :wink:
I never did it but it might be a good idea.
You have to test the $_SERVER[‘ineverknowwhichentry’] to match the compta/facture/index.php and then print your content and exit; it should do the job.
please tell me if it works.

1 Like

UPDATE : i’ve just made it work :slight_smile:
In your actions_yourmodule.class.php, you just have to create a new function :

	function printMainArea($parameters) {
        global $langs;

        if ($_SERVER['SCRIPT_FILENAME'] == DOL_DOCUMENT_ROOT . '/compta/facture/index.php') {
			print load_fiche_titre($langs->trans("CustomersInvoicesArea"), '', 'bill');
			print 'it works';
			exit;
		}
	}

image

4 Likes

it worked for me too, thank you

Hello,

I just came to know that there is an external module that allows page overwritting : Dolibarr extension / dolibarr_module_pagessubstitution · GitLab

Hello ksar, this module was not updated since 3 years… i dont know if it still works

Hello @altatof,

I will just quote Alexandre :

The best soups are made in the oldest pans :upside_down_face: