开发文档: Difference between revisions

From Dolibarr ERP CRM Wiki
Jump to navigation Jump to search
(Created page with "<keywords content="developer, development, documentation, guide, doc, tutorial, usage, help, api, coding, standard, rules" /> This page is main index of documents relating to dev...")
 
mNo edit summary
Tag: 2017 source edit
 
(67 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<keywords content="developer, development, documentation, guide, doc, tutorial, usage, help, api, coding, standard, rules" />
<!-- BEGIN interlang links -->
This page is main index of documents relating to developer documentation. For user documentation, [[User documentation|see here]].
<!-- Do NOT edit this section
    Links below are automatically managed by PolyglotBot
    You can edit links on the English source page : Developer_documentation -->
[[en:Developer_documentation]]
[[fr:Documentation_Développeur]]
[[es:Documentación_Desarrolladores]]
[[de:Entwickler_Dokumentation]]
<!-- END interlang links -->
{{#metamaster:keywords|developer, development, documentation, guide, doc, tutorial, usage, help, api, coding, standard, rules}}
页是与开发者文档相关的文章索引。有关使用者文档,请参阅 [[用户手册|用户手册]]
{{Template用户手册}}
{{TemplateMainPageZh}}




=组织和开发工具=
本章包含在开始任何Dolibarr开发行动之前需要阅读的一般信息。


= Development organization and tools =
#[[Dolibarr项目|项目组织]]
This chapter contains global information that must be read before starting any development on Dolibarr.
#[[开发须知|在开始开发之前要了解的信息]]
# [[Dolibarr Project|Organization of project]]
#[[开发环境与工具|环境和开发工具]]
# [[To known before to start|To be known before starting to develop]]
#[[依赖项与外部库|外部库和依赖项]]
# [[Environment and development tools]]
#[[常见问题-获取与更新项目的GIT源代码|获取、更新版本的源代码]]
# [[Dependencies and external libraries]]
# [[FAQ_Get,update_project_sources|Get or update sources of a development version]]


= Coding rules and best practices =
=编码规则和最佳实践=
# [[Prerequisite|Prerequisites]]
# [[Language and development rules|Language and development rules (PHP, SQL, HTML)]]
# [[:Category:Table SQL|List of tables]]
# Tree structure of files and classes are available in the [http://doxygen.dolibarr.org/ doxygen generated documentation]


= List of modules =
#[[安装前提条件|前提条件]]
Technical documentation on standard business modules is available in each module's developer documentation pages. Choose the appropriate page you are interested in:
#[[语言和开发规则|开发语言和编码规范(PHP, SQL, HTML)]]
#[[:Category:Table SQL|数据库表清单]]
#核心文件和类树结构请参阅: [http://doxygen.dolibarr.org/ doxygen生成的文档] 。


* [[:Category:List of Modules (developer)‎|List of standard modules]]
=模块清单=
* [[:Category:Complementary modules|List of complementary modules]]
特定于Dolibarr标准功能模块的技术文档在每个模块的开发文档页上定义。请选择要访问的页面:


= To develop a new module/addon for GUI =
*标准模块清单请参阅:[[:Category:List of Modules (developer)‎|List of standard modules]]
This section describes how to develop a new module changing the Dolibarr user interface. This can be screens, themes, data, its own CSS stylesheet, source code or all of this.
*扩展模块清单请参阅:[[:Category:Complementary modules|List of complementary modules]]


Script development is not included in this section (this is described in the next chapter).
=为 GUI 开发新的模块/扩展=
本章介绍如何开发影响 Dolibarr 用户界面的新模块。可以是屏幕、外观(主题)、代码(CSS样式表)或数据。


To develop your own module, check the [[Module development]] tutorial.
脚本开发不在此范围内,将在下一章中进行描述。


= To develop a batch or command line script =
要开发自己的Dolibarr扩展模块,请前往教程:[[模块开发]]
This chapter describes how to develop command line scripts to execute tasks in Dolibarr (read, update data...).
Making modifications to the graphical user interface (GUI) is not included in this chapter. See the previous chapter for this.


To develop a script, like a cron script or a command line import tool to import data from an external source, you can have a look at the [[Script development]] page.
=开发命令行或批处理脚本=
本章描述了开发自己的批处理脚本以在Dolibarr中执行任务处理(读、写等)的过程。


= Technical components of Dolibarr =
对图形用户界面(GUI)进行变更不属于此范围。请参阅上一章。
== Tree structure ==
The path hierarchy of the current version files is available from the [http://doxygen.dolibarr.org/ doxygen generated documentation] (similar to generated "javadoc" documentation).


Paths to use to add new files by a new module are defined in the documentation to develop a new module (see [[Module development]]).
要开发脚本,如 cron 处理脚本或从其他系统导入数据的脚本,请参阅:[[脚本开发]]


== Setup storage ==
=Dolibarr的技术组件=
There are 3 places for Dolibarr setup parameters.
==文件树==
* Dolibarr technical setup parameters (authentication mode, database logins and storage area for files) are defined in only one setup file, conf/conf.php. See [[Configuration file]] for more information.
当前版本的文件层次结构请参阅:源代码的 [http://doxygen.dolibarr.org/ doxygen generated documentation] (生成文档的样式为“javadoc”)。
* Global features parameters are stored in [[Table llx_const]]. See the [[Constants]] page for more information.
* Feature parameters specific to a user are stored in [[Table llx_user_param]]. See the [[Constants]] page for more information.


== Business objects ==
创建新模块时用于添加文件的路径在新模块开发文档中描述(请参阅 [[模块开发]])。
See page [[Business Objects]]


== Menus system ==
===配置文件===
See [[Menus system]].


== Tabs system ==
*/main.inc.php 定义Dolibarr GUI 环境(脚本不需要引用)
See [[Tabs system]].
*/master.inc.php  定义Dolibarr所有进程的环境,不管是页面还是脚本。文件记取conf文件,初始化 $lang, [[$db]]和空的$user
*/filefunc.inc.php  引用 conf.php 文件和其他通用库文件,比如: functions.lib.php
*/core/lib/function.inc.php 函数库,包括了引用数据库的函数。
*/core/class/html.formother.class.php 其他HTML部件的预先配置文件


== Skins system ==
==配置Dolibarr系统==
See [[Skins]].
Dolibarr中有3个级别的配置。


== Box system ==
*Dolibarr的技术配置(应用程序身份验证模式、数据库验证信息和文件存储位置)仅在 conf/conf.php 配置文件中定义。相关的更多信息,请参阅 [[Configuration file]] 。
See [[Box system]].
*功能配置存储在 [[Table llx_const|表llx_const]] 中。相关的更多信息,请参阅 [[Constants]] 。
*特定于用户的配置存储在 [[Table llx_user_param|表llx_user_param]] 中。相关的更多信息,请参阅 [[Constants]] 。


== Authentication system ==
==业务对象==
See [[Authentication]].
请参阅 [[业务对象]]


== Permission system ==
==菜单系统==
See [[Permissions En|Permissions]].
请参阅 [[菜单]].


== Translation system ==
==选项卡系统==
See [[Translation system]].
请参阅 [[选项卡]].


== Error management ==
==主题系统==
See [[Error reporting|Error reporting]].
请参阅 [[主题]].


== Canvas system ==
==消息框/widget小组件系统==
Canvas is a developer feature to replace screens to create, update or view a record (products, thirdparties, contacts, ...). For example, you can replace the input form used to create a new third party, or its editing form, or replace its viewing template.
请参阅 [[信息框|消息框/widget小组件]].
See [[Canvas development]].


== Triggers system ==
==身份认证系统==
Triggers are a development feature to execute personalized code during a Dolibarr "business event" (creation of an invoice, deleting a user, update of third party, etc...), and only for a business event. To personalize code for other contexts, see the '''Hooks system''' chapter instead.
请参阅 [[认证]].


For triggers usage, see [[Interfaces Dolibarr toward foreign systems|this page]].
==权限系统==
请参阅 [[用户权限]].


== Hooks system ==
==翻译系统==
See [[Hooks system]].
请参阅 [[翻译]].


== Variable substitution system ==
==错误处理==
See [[Variable substitution system]].
请参阅 [[错误处理]] 。


== Web services ==
==画布系统(屏幕重载)==
Dolibarr can be setup to provide some services.
'''画布'''是一种开发功能,用于替换创建、更新或查看/展示表单(产品、合作方、联系人等)的屏幕显示。例如,您可以将合作方输入表单替换为您自己的输入表单、编辑表单或查看/展示表单。


See [[Module Web Services]].
请参阅 [[画布]].


== Files/Documents storage management ==
==触发器系统==
See [[Generated documents]].
触发器是一种开发功能,用于在Dolibarr“业务操作”(创建发票、删除用户、更新合作方等)执行期间运行自定义代码,仅适用于业务事件。要在其他场景中自定义代码,请参阅  [[钩子系统]]。


== Numbering modules ==
请参阅 [[触发系统|触发器系统]] 。
For each entity created in the application, Dolibarr assigns a reference. In order to adapt the reference to any use, Dolibarr use modules to define the reference generation rule. Several standard modules are supplied. Some are generic and are used to define the numbering mask (number on x characters, with or without prefix, including the date or not, etc.), which can meet most needs. However, there are still cases where the modules provided don't meet the needs. In this case it is necessary to develop a custom numbering module.


For more information, see [[Create numeration module|Create numbering module]].
==钩子系统==
请参阅 [[钩子系统]] 。


== Document templates and documents generation ==
==变量替换系统==
请参阅 [[变量替换系统]]。


More documentation about document generation from templates is available to [[Create a PDF document template]] or [[Create an ODT document template]].
==Web服务==
可以配置 Dolibarr 为外部系统提供可访问的服务。


== Extrafields ==
请参阅 [[提供REST API的Web服务模块(开发者)]]
See [[Extrafields]].


== Other internal function ==
注意:[[Module Web Services API SOAP (developer)|提供SOAP API的Web服务模块(开发者)]]已弃用。
There are many internal libraries your code can use.
You may find a lot of generic functions in the functions.lib.php, functions2.lib.php or admin.lib.php. Any function found in htdocs/core/lib/*.lib files can be used.


'''To specify a requirement based on Dolibarr version number'''
==文件/文档的存储管理==
请参阅 [[生成的文件]] 。


For example, to make a condition based on requiring Dolibarr version > 3.5, you can use versioncompare and versiondolibarrarray found in admin.lib.php:
==编号模块==
对于在应用程序中创建的每个实体,Dolibarr 都会为其分配一个引用。
 
为了使此引用适应任何用途,Dolibarr 使用模块来定义生成此引用的规则。
 
系统提供了多个标准模块,其中有些是通用的,用于定义编号掩码(字符的个数,带或不带前缀,是否包括日期等),从而满足大多数需求。
 
然而,在某些情况下,提供的标准模块不能满足需求。在这种情况下,有必要开发自己的编号模块。
 
请参阅 [[自动编号模块|自动编号模块]].
 
==文档模板和文档生成==
 
有关从模板生成文档的更多信息,请参阅 [[创建PDF模板]] 或 [[Create an ODT document template]].
 
==附加字段==
请参阅 [[附加字段]].
 
==在线支付系统==
请参阅 [[在线支付系统]] 。
 
==其他内部函数==
您的代码可以使用许多内部库。
 
您可以在 functions.lib.php、functions2.lib.php 或 admin.lib.php 中找到大量的通用函数。
 
也可以使用在 htdocs/core/lib/*.lib 文件中找到的任何函数。
 
'''基于 Dolibarr 版本的判断条件'''
 
例如,要判断当前Dolibarr版本是否大于3.5,可以使用 admin.lib.php中的 versioncompare和 versiondolibarrarray:


<source lang="php">
<source lang="php">
Line 127: Line 163:
</source>
</source>


= Mass exports/imports =
=批量导入/导出=
# [[Mass imports]]
 
# [[Module Exports En|Mass exports]]
#[[批量导入]]
#[[导出模块]]
 
=与其他应用程序的接口和链接=
 
#[[Dolibarr到外部系统的接口]] 或 Dolibarr到Dolibarr的接口(Dolibarr触发器或钩子)
#[[外部系统到Dolibarr的接口]]
#[[Module Web Services|Web Services]]
 
==将 Dolibarr 集成到自动化平台==


= Interfaces and links with other applications =
*[[Integration of Dolibarr to the Zapier automation platform]]
# [[Interfaces Dolibarr toward foreign systems]] or toward Dolibarr (Dolibarr Triggers)
*[[Integration of Dolibarr to the n8n automation platform]]
# [[Interfaces from foreign systems toward Dolibarr]]
*[[Integration of Dolibarr to the Make automation platform]]
# [[Module Web Services|Web Services]]


= FAQ =
=FAQ=
All FAQs are available through the FAQ index page [[:Category:FAQ EN|FAQ EN]]
所有常见问题(FAQs)解答均可通过 FAQ 索引页面 [[:Category:FAQ EN|FAQ EN]] 获取。

Latest revision as of 01:26, 31 August 2025


页是与开发者文档相关的文章索引。有关使用者文档,请参阅 用户手册


组织和开发工具

本章包含在开始任何Dolibarr开发行动之前需要阅读的一般信息。

  1. 项目组织
  2. 在开始开发之前要了解的信息
  3. 环境和开发工具
  4. 外部库和依赖项
  5. 获取、更新版本的源代码

编码规则和最佳实践

  1. 前提条件
  2. 开发语言和编码规范(PHP, SQL, HTML)
  3. 数据库表清单
  4. 核心文件和类树结构请参阅: doxygen生成的文档 。

模块清单

特定于Dolibarr标准功能模块的技术文档在每个模块的开发文档页上定义。请选择要访问的页面:

为 GUI 开发新的模块/扩展

本章介绍如何开发影响 Dolibarr 用户界面的新模块。可以是屏幕、外观(主题)、代码(CSS样式表)或数据。

脚本开发不在此范围内,将在下一章中进行描述。

要开发自己的Dolibarr扩展模块,请前往教程:模块开发

开发命令行或批处理脚本

本章描述了开发自己的批处理脚本以在Dolibarr中执行任务处理(读、写等)的过程。

对图形用户界面(GUI)进行变更不属于此范围。请参阅上一章。

要开发脚本,如 cron 处理脚本或从其他系统导入数据的脚本,请参阅:脚本开发

Dolibarr的技术组件

文件树

当前版本的文件层次结构请参阅:源代码的 doxygen generated documentation (生成文档的样式为“javadoc”)。

创建新模块时用于添加文件的路径在新模块开发文档中描述(请参阅 模块开发)。

配置文件

  • /main.inc.php 定义Dolibarr GUI 环境(脚本不需要引用)
  • /master.inc.php 定义Dolibarr所有进程的环境,不管是页面还是脚本。文件记取conf文件,初始化 $lang, $db和空的$user
  • /filefunc.inc.php 引用 conf.php 文件和其他通用库文件,比如: functions.lib.php
  • /core/lib/function.inc.php 函数库,包括了引用数据库的函数。
  • /core/class/html.formother.class.php 其他HTML部件的预先配置文件

配置Dolibarr系统

Dolibarr中有3个级别的配置。

  • Dolibarr的技术配置(应用程序身份验证模式、数据库验证信息和文件存储位置)仅在 conf/conf.php 配置文件中定义。相关的更多信息,请参阅 Configuration file 。
  • 功能配置存储在 表llx_const 中。相关的更多信息,请参阅 Constants 。
  • 特定于用户的配置存储在 表llx_user_param 中。相关的更多信息,请参阅 Constants 。

业务对象

请参阅 业务对象

菜单系统

请参阅 菜单.

选项卡系统

请参阅 选项卡.

主题系统

请参阅 主题.

消息框/widget小组件系统

请参阅 消息框/widget小组件.

身份认证系统

请参阅 认证.

权限系统

请参阅 用户权限.

翻译系统

请参阅 翻译.

错误处理

请参阅 错误处理 。

画布系统(屏幕重载)

画布是一种开发功能,用于替换创建、更新或查看/展示表单(产品、合作方、联系人等)的屏幕显示。例如,您可以将合作方输入表单替换为您自己的输入表单、编辑表单或查看/展示表单。

请参阅 画布.

触发器系统

触发器是一种开发功能,用于在Dolibarr“业务操作”(创建发票、删除用户、更新合作方等)执行期间运行自定义代码,仅适用于业务事件。要在其他场景中自定义代码,请参阅 钩子系统。

请参阅 触发器系统 。

钩子系统

请参阅 钩子系统 。

变量替换系统

请参阅 变量替换系统。

Web服务

可以配置 Dolibarr 为外部系统提供可访问的服务。

请参阅 提供REST API的Web服务模块(开发者)

注意:提供SOAP API的Web服务模块(开发者)已弃用。

文件/文档的存储管理

请参阅 生成的文件 。

编号模块

对于在应用程序中创建的每个实体,Dolibarr 都会为其分配一个引用。

为了使此引用适应任何用途,Dolibarr 使用模块来定义生成此引用的规则。

系统提供了多个标准模块,其中有些是通用的,用于定义编号掩码(字符的个数,带或不带前缀,是否包括日期等),从而满足大多数需求。

然而,在某些情况下,提供的标准模块不能满足需求。在这种情况下,有必要开发自己的编号模块。

请参阅 自动编号模块.

文档模板和文档生成

有关从模板生成文档的更多信息,请参阅 创建PDF模板 或 Create an ODT document template.

附加字段

请参阅 附加字段.

在线支付系统

请参阅 在线支付系统 。

其他内部函数

您的代码可以使用许多内部库。

您可以在 functions.lib.php、functions2.lib.php 或 admin.lib.php 中找到大量的通用函数。

也可以使用在 htdocs/core/lib/*.lib 文件中找到的任何函数。

基于 Dolibarr 版本的判断条件

例如,要判断当前Dolibarr版本是否大于3.5,可以使用 admin.lib.php中的 versioncompare和 versiondolibarrarray:

if (versioncompare(versiondolibarrarray(), array(3,5,0)) > 0)
{
 ...
}

批量导入/导出

  1. 批量导入
  2. 导出模块

与其他应用程序的接口和链接

  1. Dolibarr到外部系统的接口 或 Dolibarr到Dolibarr的接口(Dolibarr触发器或钩子)
  2. 外部系统到Dolibarr的接口
  3. Web Services

将 Dolibarr 集成到自动化平台

FAQ

所有常见问题(FAQs)解答均可通过 FAQ 索引页面 FAQ EN 获取。