83
edits
Tag: 2017 source edit |
|||
| Line 65: | Line 65: | ||
=Create a new template= | =Create a new template= | ||
==For an existing module== | ==For an existing core module== | ||
Do not directly modify an existing template. | Do not directly modify an existing template. | ||
Although it is possible to copy the file of the template used as example into a new name in same directory and edit it to change content it is strongly recommended not to modify any core file or structure(If you want to fix something use the project Github page to propose your changes). | |||
*Copy and paste file pdf_cyan.modules.php | Instead use the the Module Builder [[Module development]] available from v12.0 to create your own module even for just a new template. | ||
For this example, we will call our new module 'mymodule' and our template 'mycompanyblue', based on the existing template 'cyan': | |||
*Copy and paste file pdf_cyan.modules.php into custom/mymodule/core/modules/propale/doc | |||
*Rename the copy as pdf_mycompanyblue.modules.php | *Rename the copy as pdf_mycompanyblue.modules.php | ||
*Edit and make the following changes in the code: | *Edit the file and make the following changes in the code: | ||
# | #'Class pdf_cyan' to 'Class pdf_mycompanyblue' | ||
# | #'$this->name = "cyan";' to '$this->name = "mycompanyblue";'. | ||
#Save file. Now the template will be available in the list of models in Dolibarr. | #'$this->description = $langs->trans('DocModelCyanDescription');' to '$this->description = $langs->trans('DocModelCyanDescription');'. | ||
#Save file. | |||
Now the template will be available in the list of models in Dolibarr. | |||
Test this model (see previous section) before going further. | Test this model (see previous section) before going further. | ||
edits