I want to add a couple of lines of code in two files:
dolibarr\htdocs\core\tpl\objectline_title.tpl.php
and
dolibarr\htdocs\core\tpl\objectline_view.tpl.php
I do not want to make changes directly in the files, because when I upgrade my dolibarr, these changes will be gone.
In these two files there are no hooks.
Is there a way to override these two files with new files, which will include my additional code?
What if you introduced hooks in those files and made a pull request? and then - if the pull request are accepted could safely add your own files that does what you want?
It’s quite easy if you know what to do.
Make necessary changes in your object class file
Create inside your module folder a new folder with name tpl.
Copy in there the objectline tpl files from core and modify them.
I am a new dolibarr user and unfortunately I still do not know what to do.
This part is done.
Can you give me the path of the object class file and guide me what kind of changes I have to make?
Is the object class file the Descriptor file of module - mytestmodule/core/modules/modMytestmodule.class.php ?
Please describe what are you trying to achieve here.
If you want to modify an existing Dolibarr object you should go with hooks as @jonbendtsen suggested
But I do not want to add these changes directly in these two files, because after the next upgrade these changes will be lost.
In some cms system there is tool which tool can search a certain phrase in a certain file and then an additional code can be added before or after that phrase. Or replace that phrase with new one.
But in dolibarr there is no such option, that’s why I am begging for help how can I achieve this.
Normaly, if you create your module with modulbuilder
Put 'tpl' => 1,to tell dolibarr that you are replacing template
and put the template with the same name incustom/mymodule/core/tpl/
It should be replaced
I have one more question.
In file dolibarr\htdocs\mrp\mo_production.php mo_production.php (61.6 KB)
I want to insert a couple of lines of code at two places.
Can can you take a look the attached file in my previous post and tell me how to use the hook from this file and then I will add the code to actions_mymodule.class.php?
As far as I can see, in your code you want to add some fields on the card.
The best way I think is to use the Tab management system : Tabs system - Dolibarr ERP CRM Wiki
You can replace a tab screen with your module tab