Line 16:
Line 16:
* view tab of products, contracts and third parties. In most cases, it's only the first tab when you open the card of an object. But you can have a look at the documentation about creating a new module to know how to disable other tabs or add others if you want to change other tabs too.
* view tab of products, contracts and third parties. In most cases, it's only the first tab when you open the card of an object. But you can have a look at the documentation about creating a new module to know how to disable other tabs or add others if you want to change other tabs too.
−
= Replace a create form with your own canvas page =
+
= Replace a creation form with your own template =
+
First thing to do is to find the URL of standard creation form you want to replace and add the parameter '''canvas=mymodule@mycanvas'''. To find url, you can go on page and get URL found at top of your browser.
+
+
For example, imagine you want to replace the creation form of third parties with your own form. The url is something like
+
'''http://mydomain/societe/soc.php?action=create&leftmenu=customers
+
'''
+
After adding the canvas parameter, URL will look like
+
'''http://mydomain/societe/soc.php?action=create&leftmenu=customers&canvas=mymodule@mycanvas
+
'''
+
When you add a parameter canvas=mymodule@mycanvas on a create page, Dolibarr will use the template file into htdocs called
+
'''/''mymodule''/canvas/''mycanvas''/tpl/''tabname''_create.tpl'''
+
where
+
* '''mymodule''' directory is value mymodule found into canvas parameter (you choose this value and create directory with same value. use lower case values).
+
* '''mycanvas''' is value mycanvas found into canvas parameter (you choose this value and create directory with same value. use lower case value).
+
* '''tabname''' is name of tab or page where initial form was stored. In most cases it is value "card".
+
+
For example, we will use value "'''societe@companies'''" for canvas parameter. This is a value of an already coded demo canvas template for third parties, not used in a standard usage of Dolibarr. So URL to create a third party using this alternative template is now:
+
+
'''http://mydomain/societe/soc.php?action=create&leftmenu=customers&canvas=societe@companies'''
+
+
This means the form to create the third party will be found into template file:
+
+
'''/societe/canvas/companies/tpl/card_create.tpl'''
+
+
So to use you own template, just choose a value for mymodule, mycanvas, copy and paste a demo template found into Dolibarr directories with new directory and file name and then edit the template like you want. You can remove or add your own fields but you must always keep mandatory fields in your form to avoid errors when you will submit the page. Fields removed will be filled with null into database. New fields for the moment are ignored. We will see later how we can add code to save them.
+
+
= Replace an edit form with your own template =
+
{{ToComplete}}
+
+
= Replace a view form with your own template =
+
{{ToComplete}}
+
+
= Add code to manage new fields =
{{ToComplete}}
{{ToComplete}}