モジュール 開発: Difference between revisions

Jump to navigation Jump to search
見出し翻訳
(初期翻訳: Enから複製)
Tag: 2017 source edit
 
(見出し翻訳)
Line 13: Line 13:
Dolibarr向け新規 モジュール/アドオン を作成するには, 複数のステップがある. このチュートリアルで説明するのは、Dolibarrの特質拡張用モジュールを作るステップのそれぞれである, 以下の1つとか、複数の組み合わせとかのように :
Dolibarr向け新規 モジュール/アドオン を作成するには, 複数のステップがある. このチュートリアルで説明するのは、Dolibarrの特質拡張用モジュールを作るステップのそれぞれである, 以下の1つとか、複数の組み合わせとかのように :


*Add new tables in database.
*データベースに新規テーブルを追加.
*Add your own menu entries.
*自前メニュー項目を追加.
*Add new screens to edit new tables.
*新規テーブル編集用の新規画面を追加.
*Add or remove tabs on object view (invoice, product, order, event, ...).
*オブジェクトビュー (請求,製品,注文,イベント, ...) に関わるタブの追加または削除.
*Add predefined exports for the internal export tool.
*内部エキスポートツール向けの事前定義済のエクスポートを追加.
*Add new information widget in the home page.
*ホームページに新規情報ウィジェットを追加.
*Add new substitutions variables.
*新規置換変数を追加.
*Define new permissions.
*新規許認可を定義.
*Execute code automatically triggered by a particular Dolibarr action.
*特定の Dolibarr アクションにより自動トリガされるコードを実行.
*Insert your code inside Dolibarr hooks positions.
*Dolibarr フックポジション内に自分のコードを挿入.
*Add your numbering rule to generate the reference of objects
*オブジェクト参照を生成するための自前の番号付けルールを追加
*Add a new document template.
*新規文書テンプレートを追加.
*Add a new skin.
*新規スキンを追加.


etc...
etc...


Following chapters presents how to do all of this manually with an easy way.
以下の章では、これらすべてを手作業で簡単に行う方法を示す.


=Module creation with the module builder=
=モジュールビルダ によるモジュールの生成=
From Dolibarr 9.0 it is possible to create the main pages of your module with the Module Builder. To activate it:
Dolibarr 9.0 から、モジュールビルダにより、自前モジュールのメインページ作成が可能. 起動方法は:


*Go into the list of module and enable the module "Module Builder",
*モジュールリストにて、"モジュールビルダ(Module Builder)"を有効化する,


[[File:Mod_builder_2.png|400px]]
[[File:Mod_builder_2.png|400px]]


*Then click on the "bug" image in the top right of screen.
*その後 "バグ(bug)" 画像をクリック、場所は画面右上.


[[File:Mod_builder_3.png|400px]]
[[File:Mod_builder_3.png|400px]]


=Example of Template External Module=
=テンプレート外部モジュールの例=
A good model to start development of external module can be found here : [https://github.com/Dolibarr/dolibarr/tree/develop/htdocs/modulebuilder/template GitHub Dolibarr Module Modèle]
A good model to start development of external module can be found here : [https://github.com/Dolibarr/dolibarr/tree/develop/htdocs/modulebuilder/template GitHub Dolibarr Module Modèle]


=Create your module=
=自前モジュールを作る=
==Create a Module descriptor for your Module (required)==
==自前モジュールに関するモジュール説明(Module descriptor)を作る (必須)==
'''When it is required''': Required as soon as an addon is developed, whatever its goal is (except for adding a skin).
'''When it is required''': Required as soon as an addon is developed, whatever its goal is (except for adding a skin).


Line 69: Line 69:
If you set the property version in the module description you should see a new line with your new module and the possibility to activate it or not. If you set the property version to "develop" or "experiental", to see your module, you must first go into '''Setup-Others''' and set MAIN_FEATURES_LEVEL to 1 to see "experimental" modules or 2 to see "development" modules.
If you set the property version in the module description you should see a new line with your new module and the possibility to activate it or not. If you set the property version to "develop" or "experiental", to see your module, you must first go into '''Setup-Others''' and set MAIN_FEATURES_LEVEL to 1 to see "experimental" modules or 2 to see "development" modules.


==Tree of path for new module files (required)==
==新規モジュールファイルに関するパスツリー (必須)==
This is how your files must be organized when building a new module (the zip file must also match this rule).
This is how your files must be organized when building a new module (the zip file must also match this rule).
Note: Only the second line is mandatory.
Note: Only the second line is mandatory.
Line 75: Line 75:
{{TemplateModuleTreeSimple}}
{{TemplateModuleTreeSimple}}


==Create your SQL tables and the PHP DAO class (optional)==
==自前 SQL テーブル と PHP DAO クラス (任意)==
'''When''': If your module needs to manage data of its own
'''When''': If your module needs to manage data of its own


Line 115: Line 115:
In this class, there are already operational CRUD (Create/Read/Update/Delete) methods to perform an insert, a fetch (select), an update, a delete of a table row. Edit the file to use the correct module name, tables and place this file in the class subdirectory of the module. The Module Builder allows you to do this with just a few mouse clicks.
In this class, there are already operational CRUD (Create/Read/Update/Delete) methods to perform an insert, a fetch (select), an update, a delete of a table row. Edit the file to use the correct module name, tables and place this file in the class subdirectory of the module. The Module Builder allows you to do this with just a few mouse clicks.


==The tab management (optional)==
==タブ管理 (任意)==


===Add or remove your own tabs on object sheets===
===Add or remove your own tabs on object sheets===
Line 217: Line 217:
This function will show required tabs and open an html element ''< div class="" >'' that correspond to the area under the tabs. To close area of a tab, just use ''< /div >'' into your PHP page.
This function will show required tabs and open an html element ''< div class="" >'' that correspond to the area under the tabs. To close area of a tab, just use ''< /div >'' into your PHP page.


==Create or modify PHP screens (optional)==
==PHP 画面の作成や更新 (任意)==
'''When''': If the purpose of your module is to add features that require new or modified screens.
'''When''': If the purpose of your module is to add features that require new or modified screens.


Line 359: Line 359:
as soon as the module is activate, the tpl will be overwrited
as soon as the module is activate, the tpl will be overwrited


==Add your own setup page (optional)==
==自前の準備ページを追加 (任意)==
'''When''': If your module needs parameters, which are to be provided by the user, for proper setting up of the module.
'''When''': If your module needs parameters, which are to be provided by the user, for proper setting up of the module.


Line 382: Line 382:
Go into page '''Home->Setup->Modules''', you should see a picture at the end of the line of your module to reach your setup page. Click on it, you should be able to view/edit parameters from your page.
Go into page '''Home->Setup->Modules''', you should see a picture at the end of the line of your module to reach your setup page. Click on it, you should be able to view/edit parameters from your page.


==Define your entries in menu (optional)==
==メニューに自前項目を定義 (任意)==
'''When''': If you have created PHP pages, it is necessary that those pages can be reached from menu entries in Dolibarr menu.
'''When''': If you have created PHP pages, it is necessary that those pages can be reached from menu entries in Dolibarr menu.


Line 433: Line 433:
Disable and re-enable your module under the Dolibarr module setup page, menus entries must appear (if property 'enabled' is declaration array is ok).
Disable and re-enable your module under the Dolibarr module setup page, menus entries must appear (if property 'enabled' is declaration array is ok).


==Add your own permissions (optional)==
==自前の許認可を追加 (任意)==
'''When''': If you want to add new permissions.
'''When''': If you want to add new permissions.


Line 465: Line 465:
</syntaxhighlight>
</syntaxhighlight>


==Define your own box (optional)==
==自前の box を定義 (任意)==
'''When''': If your module needs to provide one or several new boxes to show on home page.
'''When''': If your module needs to provide one or several new boxes to show on home page.


Line 490: Line 490:
Your boxes must appear in the list of boxes you can activate. Activate the box and go on the home page to see if the box is showing correctly.
Your boxes must appear in the list of boxes you can activate. Activate the box and go on the home page to see if the box is showing correctly.


==Define your own export (optional)==
==自前のエキスポートを定義 (任意)==
'''When''': If your module provides new predefined database export profiles (for its own tables or for already existing tables of another module).
'''When''': If your module provides new predefined database export profiles (for its own tables or for already existing tables of another module).


Line 501: Line 501:
Choose on field and try to build an export file. If ok, try again with all fields.
Choose on field and try to build an export file. If ok, try again with all fields.


==Define your CSS styles (optional)==
==自前の CSS スタイルを定義 (任意)==
'''When''': If in your PHP pages, you use class styles that are not defined inside Dolibarr themes CSS (not recommanded).
'''When''': If in your PHP pages, you use class styles that are not defined inside Dolibarr themes CSS (not recommanded).


Line 522: Line 522:
You should see into the HTML header, a line that declares your style sheet.
You should see into the HTML header, a line that declares your style sheet.


==Add your Javascript functions (optional)==
==自前の Javascript 関数を追加 (任意)==
'''When''': If in your PHP pages, you use javascript functions not available in Dolibarr (in file lib_head.js)
'''When''': If in your PHP pages, you use javascript functions not available in Dolibarr (in file lib_head.js)


Line 534: Line 534:
</syntaxhighlight>
</syntaxhighlight>


==Run your own code on any Dolibarr event (optional)==
==いずれかの Dolibarr イベントで自前コードを実行する (任意)==
'''When''': If you want to execute your own code once a common Dolibarr event has occurred (example: I want to update a table in my module when an invoice is created into Dolibarr), you must create a '''triggers'''.
'''When''': If you want to execute your own code once a common Dolibarr event has occurred (example: I want to update a table in my module when an invoice is created into Dolibarr), you must create a '''triggers'''.


Line 540: Line 540:
and [[Interfaces_from_foreign_systems_toward_Dolibarr]]
and [[Interfaces_from_foreign_systems_toward_Dolibarr]]


==Insert your code inside Dolibarr hooks positions (optional)==
==Dolibarr フックポジションの内部に、自前コードを挿入 (任意)==
'''When''': When you want to add code or replace Dolibarr code into another situation than a business event (See the previous chapter for adding code during a business event).
'''When''': When you want to add code or replace Dolibarr code into another situation than a business event (See the previous chapter for adding code during a business event).


Line 546: Line 546:




==Add your own numbering rules==
==自前の番号付けルールを追加==
'''When''': When you need a new rule for generated ref of elements that are not covered by existing rules.
'''When''': When you need a new rule for generated ref of elements that are not covered by existing rules.


See page [[Create numbering module]].
See page [[Create numbering module]].


==Add your document template (optional)==
==自前の文書テンプレートを追加 (任意)==
'''When''': When you want to personalized your own generated PDF or ODT documents.
'''When''': When you want to personalized your own generated PDF or ODT documents.


Line 558: Line 558:
Documentation to add your own template is available on page [[Create_a_PDF_document_template]] or [[Create_an_ODT_document_template]].
Documentation to add your own template is available on page [[Create_a_PDF_document_template]] or [[Create_an_ODT_document_template]].


==Add your skin (optional)==
==自前のスキンを追加 (任意)==
'''When''': When you want to personalized your colors/fonts/images.
'''When''': When you want to personalized your colors/fonts/images.


Line 565: Line 565:
To add your own skin, read page [[Skins]].
To add your own skin, read page [[Skins]].


=Some coding rules and predefined functions=
=コーディングルールおよび定義済み関数=
The coding rules to be followed are defined in the [[Developer documentation]], under section "General Information - Language and standards development".
The coding rules to be followed are defined in the [[Developer documentation]], under section "General Information - Language and standards development".


A lot of predefined features for developers are also available and described into page [[Developer documentation]] under section "Technical components of Dolibarr".
A lot of predefined features for developers are also available and described into page [[Developer documentation]] under section "Technical components of Dolibarr".


=Create a package to distribute and install your module=
=自前モジュールを配布し導入するためのパッケージを作成=
This process must be used to generate a package to submit it on the http://www.dolistore.com marketplace.
This process must be used to generate a package to submit it on the http://www.dolistore.com marketplace.
But you can use it to have a package easy to distribute on your own network.
But you can use it to have a package easy to distribute on your own network.
Line 595: Line 595:
**If quality is enough and license permits it, the code might be added inside main Dolibarr sources (except if you disagree for that).
**If quality is enough and license permits it, the code might be added inside main Dolibarr sources (except if you disagree for that).


=Enabling/activation condition of external module on DoliStore=
=DoliStore での外部モジュール 有効化/活性化 条件=


See [[Module_Dolistore_Validation_Rules|Validation Rules]]
See [[Module_Dolistore_Validation_Rules|Validation Rules]]
[[Category:Development]]
[[Category:Development]]
56

edits

Navigation menu