Work on modulebuilder template
@@ -1,2 +1,4 @@
|
|||||||
# Dolibarr language file - Source file is en_US - loan
|
# Dolibarr language file - Source file is en_US - loan
|
||||||
ModuleBuilderDesc=This tools give you utilites to build your own module. Your modules will be generated into the first alternative directory: <strong>%s</strong>.
|
ModuleBuilderDesc=This tools give you utilites to build your own module.
|
||||||
|
ModuleBuilderDesc2=Path were modules are generated (first alternative directory defined into %s): <strong>%s</strong>.
|
||||||
|
They are detected when the file %s exists in root of module directory.
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2005-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -29,9 +29,43 @@ $langs->load("admin");
|
|||||||
$langs->load("modulebuilder");
|
$langs->load("modulebuilder");
|
||||||
$langs->load("other");
|
$langs->load("other");
|
||||||
|
|
||||||
|
$action=GETPOST('action','alpha');
|
||||||
|
$confirm=GETPOST('confirm','alpha');
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (! $user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) accessforbidden('ModuleBuilderNotAllowed');
|
if (! $user->admin && empty($conf->global->MODULEBUILDER_FOREVERYONE)) accessforbidden('ModuleBuilderNotAllowed');
|
||||||
|
|
||||||
|
$modulename=dol_sanitizeFileName(GETPOST('modulename','alpha'));
|
||||||
|
|
||||||
|
// Dir for custom dirs
|
||||||
|
$tmp=explode(',', $dolibarr_main_document_root_alt);
|
||||||
|
$dircustom = $tmp[0];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($dircustom && $action == 'initmodule' && $modulename)
|
||||||
|
{
|
||||||
|
$srcfile = DOL_DOCUMENT_ROOT.'/modulebuilder/skeletons';
|
||||||
|
$destfile = $dircustom.'/'.$modulename;
|
||||||
|
//$result = dolCopyDir($srcfile, $destfile, 0, 0);
|
||||||
|
|
||||||
|
dol_mkdir($destfile);
|
||||||
|
|
||||||
|
fopen($destfile, $mode)
|
||||||
|
|
||||||
|
if ($result > 0)
|
||||||
|
{
|
||||||
|
setEventMessages('ModuleInitialized', null);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setEventMessages($langs->trans("ErrorFailedToCopyDir"), null, 'errors');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -48,14 +82,24 @@ $text=$langs->trans("ModuleBuilder");
|
|||||||
|
|
||||||
print load_fiche_titre($text, '', 'title_setup');
|
print load_fiche_titre($text, '', 'title_setup');
|
||||||
|
|
||||||
$tmp=explode(',', $dolibarr_main_document_root_alt);
|
|
||||||
$dircustom = $tmp[0];
|
|
||||||
|
|
||||||
// Show description of content
|
// Show description of content
|
||||||
print $langs->trans("ModuleBuilderDesc", $dircustom).'<br><br>';
|
print $langs->trans("ModuleBuilderDesc").'<br>';
|
||||||
|
print $langs->trans("ModuleBuilderDesc2", 'conf/conf.php', $dircustom).'<br>';
|
||||||
|
print '<br>';
|
||||||
|
|
||||||
|
|
||||||
|
// New module
|
||||||
|
print '<div class="modulebuilderbox">';
|
||||||
|
print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
|
print '<input type="hidden" name="action" value="initmodule">';
|
||||||
|
print '<input type="text" name="modulename" value="" placeholder="'.dol_escape_htmltag($langs->trans("ModuleName")).'">';
|
||||||
|
print '<input type="submit" class="button" name="create" value="'.dol_escape_htmltag($langs->trans("CreateNewModule")).'">';
|
||||||
|
print '</form>';
|
||||||
|
print '<div>';
|
||||||
|
|
||||||
|
|
||||||
|
$listofmodules=array();
|
||||||
/*
|
/*
|
||||||
if (!empty($conf->modulebuilder->enabled) && $mainmenu == 'modulebuilder') // Entry for Module builder
|
if (!empty($conf->modulebuilder->enabled) && $mainmenu == 'modulebuilder') // Entry for Module builder
|
||||||
{
|
{
|
||||||
@@ -73,7 +117,7 @@ if (!empty($conf->modulebuilder->enabled) && $mainmenu == 'modulebuilder') // En
|
|||||||
$fullname = $dircustom['fullname'];
|
$fullname = $dircustom['fullname'];
|
||||||
if (dol_is_file($fullname.'/modulebuilder.txt'))
|
if (dol_is_file($fullname.'/modulebuilder.txt'))
|
||||||
{
|
{
|
||||||
print '<div class="boxstats">'.$module.'</div>';
|
$listofmodules[$module]=$fullname;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -84,7 +128,11 @@ if (!empty($conf->modulebuilder->enabled) && $mainmenu == 'modulebuilder') // En
|
|||||||
$newmenu->add('', 'NoGeneratedModuleFound', 0, 0);
|
$newmenu->add('', 'NoGeneratedModuleFound', 0, 0);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
foreach($listofmodules as $modules => $fullname)
|
||||||
|
{
|
||||||
|
print '<div class="modulebuilderbox>'.$module.'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
llxFooter();
|
llxFooter();
|
||||||
|
|
||||||
|
|||||||
19
htdocs/modulebuilder/template/.editorconfig
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# EditorConfig is awesome: http://EditorConfig.org
|
||||||
|
|
||||||
|
# top-most EditorConfig file
|
||||||
|
root = true
|
||||||
|
# Unix-style newlines with a newline ending every file
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
[*.php]
|
||||||
|
indent_style = tab
|
||||||
|
[*.js]
|
||||||
|
indent_style = tab
|
||||||
|
[*.css]
|
||||||
|
indent_style = tab
|
||||||
|
[*.xml]
|
||||||
|
indent_style = tab
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
23
htdocs/modulebuilder/template/.gitattributes
vendored
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# Set default behaviour, in case users don't have core.autocrlf set.
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
|
||||||
|
# Explicitly declare text files we want to always be normalized and converted
|
||||||
|
# to native line endings on checkout.
|
||||||
|
*.php text eol=lf
|
||||||
|
*.sql text eol=lf
|
||||||
|
*.htm text eol=lf
|
||||||
|
*.html text eol=lf
|
||||||
|
*.js text eol=lf
|
||||||
|
*.css text eol=lf
|
||||||
|
*.lang text eol=lf
|
||||||
|
*.txt text eol=lf
|
||||||
|
*.md text eol=lf
|
||||||
|
*.bat text eol=crlf
|
||||||
|
|
||||||
|
# Denote all files that are truly binary and should not be modified.
|
||||||
|
*.ico binary
|
||||||
|
*.png binary
|
||||||
|
*.jpg binary
|
||||||
|
*.odt binary
|
||||||
|
*.odf binary
|
||||||
16
htdocs/modulebuilder/template/.gitignore
vendored
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# Generated binaries
|
||||||
|
/build/*.zip
|
||||||
|
# Doxygen generated documentation
|
||||||
|
/build/doxygen/doxygen_warnings.log
|
||||||
|
/doc/code/doxygen
|
||||||
|
# Composer managed dependencies
|
||||||
|
/vendor
|
||||||
|
/dev/bin
|
||||||
|
# PHPdocumentor generated files
|
||||||
|
/build/phpdoc
|
||||||
|
/doc/code/phpdoc
|
||||||
|
# Sphinx generated files
|
||||||
|
/doc/user/build
|
||||||
|
/.settings/
|
||||||
|
/.buildpath
|
||||||
|
/.project
|
||||||
9
htdocs/modulebuilder/template/.tx/config
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
[main]
|
||||||
|
host = https://www.transifex.com
|
||||||
|
lang_map = uz: uz_UZ
|
||||||
|
|
||||||
|
[mymodule.mymodule]
|
||||||
|
file_filter = langs/<lang>/mymodule.lang
|
||||||
|
source_file = langs/en_US/mymodule.lang
|
||||||
|
source_lang = en_US
|
||||||
|
type = MOZILLAPROPERTIES
|
||||||
621
htdocs/modulebuilder/template/COPYING
Normal file
@@ -0,0 +1,621 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
221
htdocs/modulebuilder/template/README.md
Normal file
@@ -0,0 +1,221 @@
|
|||||||
|
Dolibarr Module Template (aka My Module)
|
||||||
|
========================================
|
||||||
|
|
||||||
|
This is a full featured module template for Dolibarr.
|
||||||
|
It's a tool for module developers to kickstart their project and give an hands-on sample of which features Dolibarr has to offer for module development.
|
||||||
|
|
||||||
|
If you're not a module developer you have no use for this.
|
||||||
|
|
||||||
|
Documentation
|
||||||
|
-------------
|
||||||
|
|
||||||
|
[Module tutorial](http://wiki.dolibarr.org/index.php/Module_development)
|
||||||
|
|
||||||
|
[Dolibarr development](http://wiki.dolibarr.org/index.php/Developer_documentation)
|
||||||
|
|
||||||
|
### Translations
|
||||||
|
|
||||||
|
Dolibarr uses [Transifex](http://transifex.com) to manage it's translations.
|
||||||
|
|
||||||
|
This template also contains a sample configuration for Transifex managed translations under the hidden [.tx](.tx) directory.
|
||||||
|
|
||||||
|
For more informations, see the [translator's documentation](http://wiki.dolibarr.org/index.php/Translator_documentation).
|
||||||
|
|
||||||
|
There is a [Transifex project](http://transifex.com/projects/p/dolibarr-module-template) for this module.
|
||||||
|
|
||||||
|
Install
|
||||||
|
-------
|
||||||
|
|
||||||
|
### Manually
|
||||||
|
|
||||||
|
- Make sure Dolibarr (>= 3.3.x) is already installed and configured on your workstation or development server.
|
||||||
|
|
||||||
|
- In your Dolibarr installation directory, edit the ```htdocs/conf/conf.php``` file
|
||||||
|
|
||||||
|
- Find the following lines:
|
||||||
|
```php
|
||||||
|
//$dolibarr_main_url_root_alt ...
|
||||||
|
//$dolibarr_main_document_root_alt ...
|
||||||
|
```
|
||||||
|
|
||||||
|
- Uncomment these lines (delete the leading ```//```) and assign a sensible value according to your Dolibarr installation
|
||||||
|
|
||||||
|
For example :
|
||||||
|
|
||||||
|
- UNIX:
|
||||||
|
```php
|
||||||
|
$dolibarr_main_url_root = 'http://localhost/Dolibarr/htdocs';
|
||||||
|
$dolibarr_main_document_root = '/var/www/Dolibarr/htdocs';
|
||||||
|
$dolibarr_main_url_root_alt = '/custom';
|
||||||
|
$dolibarr_main_document_root_alt = '/var/www/Dolibarr/htdocs/custom';
|
||||||
|
```
|
||||||
|
|
||||||
|
- Windows:
|
||||||
|
```php
|
||||||
|
$dolibarr_main_url_root = 'http://localhost/Dolibarr/htdocs';
|
||||||
|
$dolibarr_main_document_root = 'C:/My Web Sites/Dolibarr/htdocs';
|
||||||
|
$dolibarr_main_url_root_alt = '/custom';
|
||||||
|
$dolibarr_main_document_root_alt = 'C:/My Web Sites/Dolibarr/htdocs/custom';
|
||||||
|
```
|
||||||
|
|
||||||
|
For more information about the ```conf.php``` file take a look at the conf.php.example file.
|
||||||
|
|
||||||
|
*Note that for Dolibarr versions before 3.5, the ```$dolibarr_main_url_root_alt``` has to be an absolute path*
|
||||||
|
|
||||||
|
- Clone the repository in ```$dolibarr_main_document_root_alt/mymodule```
|
||||||
|
|
||||||
|
*(You may have to create the ```htdocs/custom``` directory first if it doesn't exist yet.)*
|
||||||
|
```sh
|
||||||
|
git clone git@github.com:Dolibarr/dolibarr-module-template.git mymodule
|
||||||
|
```
|
||||||
|
|
||||||
|
- Install [Composer](https://getcomposer.org) dependencies:
|
||||||
|
```sh
|
||||||
|
composer install
|
||||||
|
```
|
||||||
|
|
||||||
|
Follow the [final steps](#final_steps).
|
||||||
|
|
||||||
|
### Using [Composer](https://getcomposer.org)
|
||||||
|
Require this repository from Dolibarr's composer:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"repositories": [
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://github.com/dolibarr/dolibarr-module-template"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"require": {
|
||||||
|
"dolibarr/mymodule": "dev-master"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Run
|
||||||
|
```sh
|
||||||
|
composer update
|
||||||
|
```
|
||||||
|
|
||||||
|
Follow the [final steps](#final_steps).
|
||||||
|
|
||||||
|
### <a name="final_steps"></a>Final steps
|
||||||
|
|
||||||
|
From your browser:
|
||||||
|
|
||||||
|
- Log into Dolibarr as a super-administrator
|
||||||
|
- Under "Setup" -> "Other setup", set ```MAIN_FEATURES_LEVEL``` to ```2```
|
||||||
|
- Go to "Setup" -> "Modules"
|
||||||
|
- The module is under one of the tabs
|
||||||
|
- You should now be able to enable the new module and start coding ;)
|
||||||
|
|
||||||
|
Provided tools
|
||||||
|
--------------
|
||||||
|
|
||||||
|
### Starting a new module
|
||||||
|
|
||||||
|
A [script](dev/newmodule.sh) allows you to rename most of the code to your own module name.
|
||||||
|
It requires ```find```, ```sed``` and ```rename``` commands on your system.
|
||||||
|
Just make sure you provide a CamelCase name.
|
||||||
|
```sh
|
||||||
|
./dev/newmodule.sh [NewName]
|
||||||
|
```
|
||||||
|
|
||||||
|
Some work still has to be done manually:
|
||||||
|
- Rename the directory holding the code
|
||||||
|
- Maybe rename some other bits (Search for 'my' in filenames and code)
|
||||||
|
- Update your module ID in the module descriptor
|
||||||
|
- Update your language files
|
||||||
|
- Keywords based on the module ID
|
||||||
|
- String referencing the template
|
||||||
|
- Remove the features you don't plan to use
|
||||||
|
- Fill the copyright notices at the top of each file
|
||||||
|
- Add your logo: see [images README](dev/img/README.md) for specifications
|
||||||
|
- Start a new GIT history
|
||||||
|
```
|
||||||
|
git checkout --orphan [new_branch_name]
|
||||||
|
```
|
||||||
|
- Build an awesome module ;)
|
||||||
|
|
||||||
|
### Composer scripts
|
||||||
|
|
||||||
|
Only the main commands are listed here.
|
||||||
|
See the [composer comments](composer-comments.md) or the [composer.json](composer.json) itself for more informations.
|
||||||
|
|
||||||
|
#### Check
|
||||||
|
|
||||||
|
Run a linter, a PHP compatibility version checker and checks coding style.
|
||||||
|
```sh
|
||||||
|
composer check
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Test
|
||||||
|
|
||||||
|
Run unit and functional tests.
|
||||||
|
```sh
|
||||||
|
composer test
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Doc
|
||||||
|
Build code and user documentation.
|
||||||
|
|
||||||
|
#### Release
|
||||||
|
|
||||||
|
Run the checks and tests then build a distribution ZIP.
|
||||||
|
```sh
|
||||||
|
composer release
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Git hooks
|
||||||
|
|
||||||
|
Optional [GIT hooks](https://git-scm.com/book/it/v2/Customizing-Git-Git-Hooks) are provided.
|
||||||
|
These are just wrappers calling composer scripts.
|
||||||
|
They ensure best practices are followed during module development.
|
||||||
|
|
||||||
|
Install:
|
||||||
|
```sh
|
||||||
|
composer git_hooks_install
|
||||||
|
```
|
||||||
|
|
||||||
|
Remove:
|
||||||
|
```sh
|
||||||
|
composer git_hooks_remove
|
||||||
|
```
|
||||||
|
|
||||||
|
## Publishing the module
|
||||||
|
The de-facto standard for publishing and marketing modules for Dolibarr is the [Dolistore](https://www.dolistore.com).
|
||||||
|
Templates for required images and texts are [provided](dev/dolistore).
|
||||||
|
Check the dedicated [README](dev/dolistore/README.md) for more informations.
|
||||||
|
|
||||||
|
Contributions
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Feel free to contribute and report defects on our [issue tracker](http://github.com/Dolibarr/dolibarr-module-template/issues).
|
||||||
|
|
||||||
|
Licenses
|
||||||
|
--------
|
||||||
|
|
||||||
|
### Main code
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
GPLv3 or (at your option) any later version.
|
||||||
|
|
||||||
|
See [COPYING](COPYING) for more information.
|
||||||
|
|
||||||
|
### Other Licenses
|
||||||
|
|
||||||
|
#### [Parsedown](http://parsedown.org/)
|
||||||
|
|
||||||
|
Used to display this README in the module's about page.
|
||||||
|
Licensed under MIT.
|
||||||
|
|
||||||
|
#### [GNU Licenses logos](https://www.gnu.org/graphics/license-logos.html)
|
||||||
|
|
||||||
|
Public domain
|
||||||
|
|
||||||
|
#### Documentation
|
||||||
|
|
||||||
|
All texts and readmes.
|
||||||
|
|
||||||
|

|
||||||
94
htdocs/modulebuilder/template/admin/about.php
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file admin/about.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief About page of module MyModule.
|
||||||
|
*
|
||||||
|
* MyModuleDescription.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Load Dolibarr environment
|
||||||
|
if (false === (@include '../../main.inc.php')) { // From htdocs directory
|
||||||
|
require '../../../main.inc.php'; // From "custom" directory
|
||||||
|
}
|
||||||
|
|
||||||
|
// Libraries
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
require_once '../lib/mymodule.lib.php';
|
||||||
|
|
||||||
|
// Translations
|
||||||
|
$langs->load("errors");
|
||||||
|
$langs->load("admin");
|
||||||
|
$langs->load("mymodule@mymodule");
|
||||||
|
|
||||||
|
// Access control
|
||||||
|
if (! $user->admin) {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parameters
|
||||||
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
// None
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
$page_name = "MyModuleAbout";
|
||||||
|
llxHeader('', $langs->trans($page_name));
|
||||||
|
|
||||||
|
// Subheader
|
||||||
|
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
|
||||||
|
. $langs->trans("BackToModuleList") . '</a>';
|
||||||
|
print load_fiche_titre($langs->trans($page_name), $linkback);
|
||||||
|
|
||||||
|
// Configuration header
|
||||||
|
$head = mymoduleAdminPrepareHead();
|
||||||
|
dol_fiche_head(
|
||||||
|
$head,
|
||||||
|
'about',
|
||||||
|
$langs->trans("MyModuleName"),
|
||||||
|
0,
|
||||||
|
'mymodule@mymodule'
|
||||||
|
);
|
||||||
|
|
||||||
|
// About page goes here
|
||||||
|
echo $langs->trans("MyModuleAboutPage");
|
||||||
|
|
||||||
|
echo '<br>';
|
||||||
|
|
||||||
|
require_once '../core/modulebuilder/mymodule/core/modules/modMyModule.class.php';
|
||||||
|
$tmpmodule = new MyModule($db);
|
||||||
|
print $tmpmodule->getDescLong();
|
||||||
|
|
||||||
|
// Page end
|
||||||
|
dol_fiche_end();
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
79
htdocs/modulebuilder/template/admin/setup.php
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file admin/setup.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example module setup page.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Load Dolibarr environment
|
||||||
|
if (false === (@include '../../main.inc.php')) { // From htdocs directory
|
||||||
|
require '../../../main.inc.php'; // From "custom" directory
|
||||||
|
}
|
||||||
|
|
||||||
|
global $langs, $user;
|
||||||
|
|
||||||
|
// Libraries
|
||||||
|
require_once DOL_DOCUMENT_ROOT . "/core/lib/admin.lib.php";
|
||||||
|
require_once '../lib/mymodule.lib.php';
|
||||||
|
//require_once "../class/myclass.class.php";
|
||||||
|
// Translations
|
||||||
|
$langs->load("mymodule@mymodule");
|
||||||
|
|
||||||
|
// Access control
|
||||||
|
if (! $user->admin) {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parameters
|
||||||
|
$action = GETPOST('action', 'alpha');
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
$page_name = "MyModuleSetup";
|
||||||
|
llxHeader('', $langs->trans($page_name));
|
||||||
|
|
||||||
|
// Subheader
|
||||||
|
$linkback = '<a href="' . DOL_URL_ROOT . '/admin/modules.php">'
|
||||||
|
. $langs->trans("BackToModuleList") . '</a>';
|
||||||
|
print load_fiche_titre($langs->trans($page_name), $linkback);
|
||||||
|
|
||||||
|
// Configuration header
|
||||||
|
$head = mymoduleAdminPrepareHead();
|
||||||
|
dol_fiche_head(
|
||||||
|
$head,
|
||||||
|
'settings',
|
||||||
|
$langs->trans("Module500000Name"),
|
||||||
|
0,
|
||||||
|
"mymodule@mymodule"
|
||||||
|
);
|
||||||
|
|
||||||
|
// Setup page goes here
|
||||||
|
echo $langs->trans("MyModuleSetupPage");
|
||||||
|
|
||||||
|
// Page end
|
||||||
|
dol_fiche_end();
|
||||||
|
llxFooter();
|
||||||
2419
htdocs/modulebuilder/template/build/doxygen/mymodule.doxyfile
Normal file
388
htdocs/modulebuilder/template/build/makepack-dolibarrmodule.pl
Normal file
@@ -0,0 +1,388 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
# \file build/makepack-dolibarrmodule.pl
|
||||||
|
# \brief Package builder (tgz, zip, rpm, deb, exe)
|
||||||
|
# \author (c)2005-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
# (c)2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
|
#----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
use Cwd;
|
||||||
|
|
||||||
|
|
||||||
|
@LISTETARGET=("TGZ"); # Possible packages
|
||||||
|
%REQUIREMENTTARGET=( # Tool requirement for each package
|
||||||
|
"TGZ"=>"tar",
|
||||||
|
"ZIP"=>"7z"
|
||||||
|
);
|
||||||
|
%ALTERNATEPATH=(
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
use vars qw/ $REVISION $VERSION /;
|
||||||
|
$REVISION='1.20';
|
||||||
|
$VERSION="1.0 (build $REVISION)";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
# MAIN
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
($DIR=$0) =~ s/([^\/\\]+)$//; ($PROG=$1) =~ s/\.([^\.]*)$//; $Extension=$1;
|
||||||
|
$DIR||='.'; $DIR =~ s/([^\/\\])[\\\/]+$/$1/;
|
||||||
|
|
||||||
|
# Detect OS type
|
||||||
|
# --------------
|
||||||
|
if ("$^O" =~ /linux/i || (-d "/etc" && -d "/var" && "$^O" !~ /cygwin/i)) { $OS='linux'; $CR=''; }
|
||||||
|
elsif (-d "/etc" && -d "/Users") { $OS='macosx'; $CR=''; }
|
||||||
|
elsif ("$^O" =~ /cygwin/i || "$^O" =~ /win32/i) { $OS='windows'; $CR="\r"; }
|
||||||
|
if (! $OS) {
|
||||||
|
print "makepack-dolbarrmodule.pl was not able to detect your OS.\n";
|
||||||
|
print "Can't continue.\n";
|
||||||
|
print "makepack-dolibarrmodule.pl aborted.\n";
|
||||||
|
sleep 2;
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Define buildroot
|
||||||
|
# ----------------
|
||||||
|
if ($OS =~ /linux/) {
|
||||||
|
$TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp";
|
||||||
|
}
|
||||||
|
if ($OS =~ /macos/) {
|
||||||
|
$TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"/tmp";
|
||||||
|
}
|
||||||
|
if ($OS =~ /windows/) {
|
||||||
|
$TEMP=$ENV{"TEMP"}||$ENV{"TMP"}||"c:/temp";
|
||||||
|
$PROGPATH=$ENV{"ProgramFiles"};
|
||||||
|
}
|
||||||
|
if (! $TEMP || ! -d $TEMP) {
|
||||||
|
print "Error: A temporary directory can not be find.\n";
|
||||||
|
print "Check that TEMP or TMP environment variable is set correctly.\n";
|
||||||
|
print "makepack-dolibarrmodule.pl aborted.\n";
|
||||||
|
sleep 2;
|
||||||
|
exit 2;
|
||||||
|
}
|
||||||
|
$BUILDROOT="$TEMP/dolibarr-buildroot";
|
||||||
|
|
||||||
|
|
||||||
|
my $copyalreadydone=0;
|
||||||
|
my $batch=0;
|
||||||
|
|
||||||
|
for (0..@ARGV-1) {
|
||||||
|
if ($ARGV[$_] =~ /^-*target=(\w+)/i) { $target=$1; $batch=1; }
|
||||||
|
if ($ARGV[$_] =~ /^-*desti=(.+)/i) { $DESTI=$1; }
|
||||||
|
if ($ARGV[$_] =~ /^-*prefix=(.+)/i) {
|
||||||
|
$PREFIX=$1;
|
||||||
|
$FILENAMESNAPSHOT.="-".$PREFIX;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$SOURCE="$DIR/..";
|
||||||
|
$DESTI="$SOURCE/build";
|
||||||
|
if ($ENV{"DESTIMODULES"}) { $DESTI = $ENV{"DESTIMODULES"}; } # Force output dir if env DESTIMODULES is defined
|
||||||
|
$NEWDESTI=$DESTI;
|
||||||
|
|
||||||
|
|
||||||
|
print "Makepack for modules version $VERSION\n";
|
||||||
|
print "Source directory: $SOURCE\n";
|
||||||
|
print "Target directory: $NEWDESTI\n";
|
||||||
|
|
||||||
|
# Autodetect version and module name
|
||||||
|
$mod_dir = "../core/modules/";
|
||||||
|
opendir(DIR, $mod_dir);
|
||||||
|
@mod_files=grep { /^mod\w*\.class.php$/ } readdir(DIR);
|
||||||
|
foreach $file (@mod_files) {
|
||||||
|
$PROJECTINPUT=lc $1 if $file =~ /^mod(\w*)\.class.php$/;
|
||||||
|
$file = $mod_dir . $file;
|
||||||
|
open FILE, $file or die $!;
|
||||||
|
@file_content = <FILE>;
|
||||||
|
close FILE;
|
||||||
|
foreach $line (@file_content) {
|
||||||
|
# Extracts version number
|
||||||
|
$PROJVERSION=$1 if $line =~ /(?<=version\s=\s')(\d+(\.\d+){1,2})/;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ask and set version $MAJOR, $MINOR and $BUILD
|
||||||
|
if ($PROJVERSION eq '')
|
||||||
|
{
|
||||||
|
print "Enter value for version: ";
|
||||||
|
$PROJVERSION=<STDIN>;
|
||||||
|
}
|
||||||
|
chomp($PROJVERSION);
|
||||||
|
($MAJOR,$MINOR,$BUILD)=split(/\./,$PROJVERSION,3);
|
||||||
|
if ($MINOR eq '')
|
||||||
|
{
|
||||||
|
print "Enter value for minor version: ";
|
||||||
|
$MINOR=<STDIN>;
|
||||||
|
chomp($MINOR);
|
||||||
|
}
|
||||||
|
|
||||||
|
# Ask module
|
||||||
|
if ($PROJECTINPUT eq '')
|
||||||
|
{
|
||||||
|
print "Enter name for your module (mymodule, mywonderfulmondule, ... or 'all') : ";
|
||||||
|
$PROJECTINPUT=<STDIN>;
|
||||||
|
}
|
||||||
|
chomp($PROJECTINPUT);
|
||||||
|
print "Move to ".$DIR." directory.\n";
|
||||||
|
chdir($DIR);
|
||||||
|
|
||||||
|
|
||||||
|
my @PROJECTLIST=();
|
||||||
|
if ($PROJECTINPUT eq "all")
|
||||||
|
{
|
||||||
|
opendir(DIR, $DIR) || return;
|
||||||
|
local @rv = grep { /^makepack\-(.*)\.conf$/ } sort readdir(DIR);
|
||||||
|
closedir(DIR);
|
||||||
|
foreach my $xxx (0..@rv-1) {
|
||||||
|
if ($rv[$xxx] =~ /^makepack\-(.*)\.conf$/)
|
||||||
|
{
|
||||||
|
@PROJECTLIST[$xxx]=$1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
@PROJECTLIST=($PROJECTINPUT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Loop on each projects
|
||||||
|
foreach my $PROJECT (@PROJECTLIST) {
|
||||||
|
|
||||||
|
if (! -f "makepack-".$PROJECT.".conf")
|
||||||
|
{
|
||||||
|
print "Error: can't open conf file makepack-".$PROJECT.".conf\n";
|
||||||
|
print "\n";
|
||||||
|
print "For help on building a module package, see web page\n";
|
||||||
|
print
|
||||||
|
"http://wiki.dolibarr.org/cindex.php/Module_development#Create_a_package_to_distribute_and_install_your_module\n";
|
||||||
|
print "makepack-dolibarrmodule.pl aborted.\n";
|
||||||
|
sleep 2;
|
||||||
|
exit 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
$FILENAME="$PROJECT";
|
||||||
|
$FILENAMETGZ="module_$PROJECT-$MAJOR.$MINOR".($BUILD ne ''?".$BUILD":"");
|
||||||
|
$FILENAMEZIP="module_$PROJECT-$MAJOR.$MINOR".($BUILD ne ''?".$BUILD":"");
|
||||||
|
if (-d "/usr/src/redhat") {
|
||||||
|
# redhat
|
||||||
|
$RPMDIR="/usr/src/redhat";
|
||||||
|
}
|
||||||
|
if (-d "/usr/src/RPM") {
|
||||||
|
# mandrake
|
||||||
|
$RPMDIR="/usr/src/RPM";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
# Choose package targets
|
||||||
|
#-----------------------
|
||||||
|
$target="ZIP"; # Dolibarr modules are this format
|
||||||
|
$CHOOSEDTARGET{uc($target)}=1;
|
||||||
|
|
||||||
|
|
||||||
|
# Test if requirement is ok
|
||||||
|
#--------------------------
|
||||||
|
foreach my $target (keys %CHOOSEDTARGET) {
|
||||||
|
foreach my $req (split(/[,\s]/,$REQUIREMENTTARGET{$target})) {
|
||||||
|
# Test
|
||||||
|
print "Test requirement for target $target: Search '$req'... ";
|
||||||
|
$ret=`"$req" 2>&1`;
|
||||||
|
$coderetour=$?; $coderetour2=$coderetour>>8;
|
||||||
|
if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/)) && $PROGPATH) {
|
||||||
|
# Not found error, we try in PROGPATH
|
||||||
|
$ret=`"$PROGPATH/$ALTERNATEPATH{$req}/$req\" 2>&1`;
|
||||||
|
$coderetour=$?; $coderetour2=$coderetour>>8;
|
||||||
|
$REQUIREMENTTARGET{$target}="$PROGPATH/$ALTERNATEPATH{$req}/$req";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($coderetour != 0 && (($coderetour2 == 1 && $OS =~ /windows/ && $ret !~ /Usage/i) || ($coderetour2 == 127 && $OS !~ /windows/))) {
|
||||||
|
# Not found error
|
||||||
|
print "Not found\nCan't build target $target. Requirement '$req' not found in PATH\n";
|
||||||
|
$CHOOSEDTARGET{$target}=-1;
|
||||||
|
last;
|
||||||
|
} else {
|
||||||
|
# Pas erreur ou erreur autre que programme absent
|
||||||
|
print " Found ".$REQUIREMENTTARGET{$target}."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n";
|
||||||
|
|
||||||
|
# Check if there is at least on target to build
|
||||||
|
#----------------------------------------------
|
||||||
|
$nboftargetok=0;
|
||||||
|
$nboftargetneedbuildroot=0;
|
||||||
|
$nboftargetneedcvs=0;
|
||||||
|
foreach my $target (keys %CHOOSEDTARGET) {
|
||||||
|
if ($CHOOSEDTARGET{$target} < 0) { next; }
|
||||||
|
if ($target ne 'EXE' && $target ne 'EXEDOLIWAMP')
|
||||||
|
{
|
||||||
|
$nboftargetneedbuildroot++;
|
||||||
|
}
|
||||||
|
if ($target eq 'SNAPSHOT')
|
||||||
|
{
|
||||||
|
$nboftargetneedcvs++;
|
||||||
|
}
|
||||||
|
$nboftargetok++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($nboftargetok) {
|
||||||
|
|
||||||
|
# Update CVS if required
|
||||||
|
#-----------------------
|
||||||
|
if ($nboftargetneedcvs)
|
||||||
|
{
|
||||||
|
print "Go to directory $SOURCE\n";
|
||||||
|
$olddir=getcwd();
|
||||||
|
chdir("$SOURCE");
|
||||||
|
print "Run cvs update -P -d\n";
|
||||||
|
$ret=`cvs update -P -d 2>&1`;
|
||||||
|
chdir("$olddir");
|
||||||
|
}
|
||||||
|
|
||||||
|
# Update buildroot if required
|
||||||
|
#-----------------------------
|
||||||
|
if ($nboftargetneedbuildroot)
|
||||||
|
{
|
||||||
|
if (! $copyalreadydone) {
|
||||||
|
print "Delete directory $BUILDROOT\n";
|
||||||
|
$ret=`rm -fr "$BUILDROOT"`;
|
||||||
|
|
||||||
|
mkdir "$BUILDROOT";
|
||||||
|
mkdir "$BUILDROOT/$PROJECT";
|
||||||
|
|
||||||
|
$result=open(IN,"<makepack-".$PROJECT.".conf");
|
||||||
|
if (! $result) { die "Error: Can't open conf file makepack-".$PROJECT.".conf for reading.\n"; }
|
||||||
|
while(<IN>)
|
||||||
|
{
|
||||||
|
if ($_ =~ /^#/) { next; } # Do not process comments
|
||||||
|
|
||||||
|
$_ =~ s/\n//;
|
||||||
|
$_ =~ /^(.*)\/[^\/]+/;
|
||||||
|
print "Create directory $BUILDROOT/$PROJECT/$1\n";
|
||||||
|
$ret=`mkdir -p "$BUILDROOT/$PROJECT/$1"`;
|
||||||
|
if ($_ !~ /version\-/)
|
||||||
|
{
|
||||||
|
print "Copy $SOURCE/$_ into $BUILDROOT/$PROJECT/$_\n";
|
||||||
|
$ret=`cp -pr "$SOURCE/$_" "$BUILDROOT/$PROJECT/$_"`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close IN;
|
||||||
|
|
||||||
|
@timearray=localtime(time());
|
||||||
|
$fulldate=($timearray[5]+1900).'-'.($timearray[4]+1).'-'.$timearray[3].' '.$timearray[2].':'.$timearray[1];
|
||||||
|
# open(VF,">$BUILDROOT/$PROJECT/build/version-".$PROJECT.".txt");
|
||||||
|
#
|
||||||
|
# print "Create version file $BUILDROOT/$PROJECT/build/version-".$PROJECT.".txt with date ".$fulldate."\n";
|
||||||
|
# $ret=`mkdir -p "$BUILDROOT/$PROJECT/build"`;
|
||||||
|
# print VF "Version: ".$MAJOR.".".$MINOR.($BUILD ne ''?".$BUILD":"")."\n";
|
||||||
|
# print VF "Build : ".$fulldate."\n";
|
||||||
|
# close VF;
|
||||||
|
}
|
||||||
|
print "Clean $BUILDROOT\n";
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/.cache`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/.project`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/.settings`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/build/html`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/documents`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/document`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.mysql`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.old`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf.php.postgres`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/conf/conf*sav*`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/custom2`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/htdocs/theme/bureau2crea`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/test`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/Thumbs.db $BUILDROOT/$PROJECT/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/Thumbs.db $BUILDROOT/$PROJECT/*/*/*/*/Thumbs.db`;
|
||||||
|
$ret=`rm -fr $BUILDROOT/$PROJECT/CVS* $BUILDROOT/$PROJECT/*/CVS* $BUILDROOT/$PROJECT/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/CVS* $BUILDROOT/$PROJECT/*/*/*/*/*/CVS*`;
|
||||||
|
}
|
||||||
|
|
||||||
|
# Build package for each target
|
||||||
|
#------------------------------
|
||||||
|
foreach my $target (keys %CHOOSEDTARGET) {
|
||||||
|
if ($CHOOSEDTARGET{$target} < 0) { next; }
|
||||||
|
|
||||||
|
print "\nBuild package for target $target\n";
|
||||||
|
|
||||||
|
if ($target eq 'TGZ') {
|
||||||
|
$NEWDESTI=$DESTI;
|
||||||
|
if (-d $DESTI.'/../modules') { $NEWDESTI=$DESTI.'/../modules'; }
|
||||||
|
|
||||||
|
print "Remove target $FILENAMETGZ.tgz...\n";
|
||||||
|
unlink("$NEWDESTI/$FILENAMETGZ.tgz");
|
||||||
|
print "Compress $BUILDROOT/* into $FILENAMETGZ.tgz...\n";
|
||||||
|
$cmd="tar --exclude-vcs --exclude *.tgz --directory \"$BUILDROOT\" --mode=go-w --group=500 --owner=500 -czvf \"$FILENAMETGZ.tgz\" .";
|
||||||
|
$ret=`$cmd`;
|
||||||
|
if ($OS =~ /windows/i) {
|
||||||
|
print "Move $FILENAMETGZ.tgz to $NEWDESTI/$FILENAMETGZ.tgz\n";
|
||||||
|
$ret=`mv "$FILENAMETGZ.tgz" "$NEWDESTI/$FILENAMETGZ.tgz"`;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ret=`mv "$FILENAMETGZ.tgz" "$NEWDESTI/$FILENAMETGZ.tgz"`;
|
||||||
|
}
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($target eq 'ZIP') {
|
||||||
|
$NEWDESTI=$DESTI;
|
||||||
|
if (-d $DESTI.'/../modules') { $NEWDESTI=$DESTI.'/../modules'; }
|
||||||
|
|
||||||
|
print "Remove target $FILENAMEZIP.zip...\n";
|
||||||
|
unlink "$NEWDESTI/$FILENAMEZIP.zip";
|
||||||
|
print "Compress $FILENAMEZIP into $FILENAMEZIP.zip...\n";
|
||||||
|
|
||||||
|
print "Go to directory $BUILDROOT\n";
|
||||||
|
$olddir=getcwd();
|
||||||
|
chdir("$BUILDROOT");
|
||||||
|
$cmd= "7z a -r -tzip -mx $BUILDROOT/$FILENAMEZIP.zip *";
|
||||||
|
print $cmd."\n";
|
||||||
|
$ret= `$cmd`;
|
||||||
|
chdir("$olddir");
|
||||||
|
|
||||||
|
print "Move $FILENAMEZIP.zip to $NEWDESTI/$FILENAMEZIP.zip\n";
|
||||||
|
$ret=`mv "$BUILDROOT/$FILENAMEZIP.zip" "$NEWDESTI/$FILENAMEZIP.zip"`;
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($target eq 'EXE') {
|
||||||
|
$NEWDESTI=$DESTI;
|
||||||
|
if (-d $DESTI.'/../modules') { $NEWDESTI=$DESTI.'/../modules'; }
|
||||||
|
|
||||||
|
print "Remove target $FILENAMEEXE.exe...\n";
|
||||||
|
unlink "$NEWDESTI/$FILENAMEEXE.exe";
|
||||||
|
print "Compress into $FILENAMEEXE.exe by $FILENAMEEXE.nsi...\n";
|
||||||
|
$command="\"$REQUIREMENTTARGET{$target}\" /DMUI_VERSION_DOT=$MAJOR.$MINOR.$BUILD /X\"SetCompressor bzip2\" \"$SOURCE\\build\\exe\\$FILENAME.nsi\"";
|
||||||
|
print "$command\n";
|
||||||
|
$ret=`$command`;
|
||||||
|
print "Move $FILENAMEEXE.exe to $NEWDESTI\n";
|
||||||
|
rename("$SOURCE\\build\\exe\\$FILENAMEEXE.exe","$NEWDESTI/$FILENAMEEXE.exe");
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n----- Summary -----\n";
|
||||||
|
foreach my $target (keys %CHOOSEDTARGET) {
|
||||||
|
if ($CHOOSEDTARGET{$target} < 0) {
|
||||||
|
print "Package $target not built (bad requirement).\n";
|
||||||
|
} else {
|
||||||
|
print "Package $target built successfully in $NEWDESTI\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (! $batch) {
|
||||||
|
print "\nPress key to finish...";
|
||||||
|
my $WAITKEY=<STDIN>;
|
||||||
|
}
|
||||||
|
|
||||||
|
0;
|
||||||
26
htdocs/modulebuilder/template/build/makepack-mymodule.conf
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
# Your module name here
|
||||||
|
#
|
||||||
|
# Goal: Goal of module
|
||||||
|
# Version: <version>
|
||||||
|
# Author: Copyright <year> - <name of author>
|
||||||
|
# License: GPLv3
|
||||||
|
# Install: Just unpack content of module package in Dolibarr directory.
|
||||||
|
# Setup: Go on Dolibarr setup - modules to enable module.
|
||||||
|
#
|
||||||
|
# Files in module
|
||||||
|
index.php
|
||||||
|
mypage.php
|
||||||
|
admin/
|
||||||
|
class/
|
||||||
|
COPYING
|
||||||
|
core/
|
||||||
|
css/
|
||||||
|
doc/
|
||||||
|
img/
|
||||||
|
js/
|
||||||
|
langs/
|
||||||
|
lib/
|
||||||
|
scripts/
|
||||||
|
sql/
|
||||||
|
vendor/
|
||||||
|
README.md
|
||||||
51
htdocs/modulebuilder/template/class/MyTrigger.php
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file class/MyTrigger.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Compatibility class for triggers in Dolibarr < 3.7.
|
||||||
|
*
|
||||||
|
* Hack for compatibility with Dolibarr versions < 3.7.
|
||||||
|
* Remove this and extend DolibarrTriggers directly from interface_99_modMyModule_MyTrigger.class.php
|
||||||
|
* if you don't intend to support these versions.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// We ignore the PSR1.Classes.ClassDeclaration.MultipleClasses rule.
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
|
$dolibarr_version = versiondolibarrarray();
|
||||||
|
if ($dolibarr_version[0] < 3 || ($dolibarr_version[0] == 3 && $dolibarr_version[1] < 7)) { // DOL_VERSION < 3.7
|
||||||
|
/**
|
||||||
|
* Class MyTrigger
|
||||||
|
*
|
||||||
|
* For Dolibarr < 3.7.
|
||||||
|
*/
|
||||||
|
abstract class MyTrigger
|
||||||
|
{
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/**
|
||||||
|
* Class MyTrigger
|
||||||
|
*
|
||||||
|
* For Dolibarr >= 3.7
|
||||||
|
*/
|
||||||
|
abstract class MyTrigger extends DolibarrTriggers
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
48
htdocs/modulebuilder/template/class/ParsedownDolibarr.php
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file class/ParsedownDolibarr.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Custom Parsedown class to display inline images from the README.md in the about page
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Includes */
|
||||||
|
require __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ParsedownDolibarr
|
||||||
|
*/
|
||||||
|
class ParsedownDolibarr extends Parsedown
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Resolve inline images relative URLs to the module's path
|
||||||
|
*
|
||||||
|
* @param $Excerpt
|
||||||
|
* @return array|void
|
||||||
|
*/
|
||||||
|
protected function inlineImage($Excerpt)
|
||||||
|
{
|
||||||
|
$image = parent::inlineImage($Excerpt);
|
||||||
|
$path = new \Enrise\Uri($image['element']['attributes']['src']);
|
||||||
|
if ($path->isRelative()) {
|
||||||
|
$image['element']['attributes']['src'] = dol_buildpath('/mymodule/' . $path, 1);
|
||||||
|
}
|
||||||
|
return $image;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file class/actions_mymodule.class.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example hook overload.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class ActionsMyModule
|
||||||
|
*/
|
||||||
|
class ActionsMyModule
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var array Hook results. Propagated to $hookmanager->resArray for later reuse
|
||||||
|
*/
|
||||||
|
public $results = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string String displayed by executeHook() immediately after return
|
||||||
|
*/
|
||||||
|
public $resprints;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Errors
|
||||||
|
*/
|
||||||
|
public $errors = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Overloading the doActions function : replacing the parent's function with the one below
|
||||||
|
*
|
||||||
|
* @param array() $parameters Hook metadatas (context, etc...)
|
||||||
|
* @param CommonObject &$object The object to process (an invoice if you are in invoice module, a propale in propale's module, etc...)
|
||||||
|
* @param string &$action Current action (if set). Generally create or edit or null
|
||||||
|
* @param HookManager $hookmanager Hook manager propagated to allow calling another hook
|
||||||
|
* @return int < 0 on error, 0 on success, 1 to replace standard code
|
||||||
|
*/
|
||||||
|
public function doActions($parameters, &$object, &$action, $hookmanager)
|
||||||
|
{
|
||||||
|
$error = 0; // Error counter
|
||||||
|
$myvalue = 'test'; // A result value
|
||||||
|
|
||||||
|
print_r($parameters);
|
||||||
|
echo "action: " . $action;
|
||||||
|
print_r($object);
|
||||||
|
|
||||||
|
if (in_array('somecontext', explode(':', $parameters['context']))) {
|
||||||
|
// do something only for the context 'somecontext'
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error) {
|
||||||
|
$this->results = array('myreturn' => $myvalue);
|
||||||
|
$this->resprints = 'A text to show';
|
||||||
|
return 0; // or return 1 to replace standard code
|
||||||
|
} else {
|
||||||
|
$this->errors[] = 'Error message';
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
361
htdocs/modulebuilder/template/class/myclass.class.php
Normal file
@@ -0,0 +1,361 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file class/myclass.class.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example CRUD (Create/Read/Update/Delete) class.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Includes */
|
||||||
|
//require_once DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php";
|
||||||
|
//require_once DOL_DOCUMENT_ROOT."/societe/class/societe.class.php";
|
||||||
|
//require_once DOL_DOCUMENT_ROOT."/product/class/product.class.php";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Put your class' description here
|
||||||
|
*/
|
||||||
|
class MyClass // extends CommonObject
|
||||||
|
{
|
||||||
|
|
||||||
|
/** @var DoliDb Database handler */
|
||||||
|
private $db;
|
||||||
|
/** @var string Error code or message */
|
||||||
|
public $error;
|
||||||
|
/** @var array Several error codes or messages */
|
||||||
|
public $errors = array();
|
||||||
|
/** @var string Id to identify managed object */
|
||||||
|
//public $element='myelement';
|
||||||
|
/** @var string Name of table without prefix where object is stored */
|
||||||
|
//public $table_element='mytable';
|
||||||
|
/** @var int An example ID */
|
||||||
|
public $id;
|
||||||
|
/** @var mixed An example property */
|
||||||
|
public $prop1;
|
||||||
|
/** @var mixed An example property */
|
||||||
|
public $prop2;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDb $db Database handler
|
||||||
|
*/
|
||||||
|
public function __construct($db)
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create object into database
|
||||||
|
*
|
||||||
|
* @param User $user User that create
|
||||||
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* @return int <0 if KO, Id of created object if OK
|
||||||
|
*/
|
||||||
|
public function create($user, $notrigger = 0)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
if (isset($this->prop1)) {
|
||||||
|
$this->prop1 = trim($this->prop1);
|
||||||
|
}
|
||||||
|
if (isset($this->prop2)) {
|
||||||
|
$this->prop2 = trim($this->prop2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
// Put here code to add control on parameters values
|
||||||
|
// Insert request
|
||||||
|
$sql = "INSERT INTO " . MAIN_DB_PREFIX . "mytable(";
|
||||||
|
$sql.= " field1,";
|
||||||
|
$sql.= " field2";
|
||||||
|
|
||||||
|
$sql.= ") VALUES (";
|
||||||
|
$sql.= " '" . $this->prop1 . "',";
|
||||||
|
$sql.= " '" . $this->prop2 . "'";
|
||||||
|
|
||||||
|
$sql.= ")";
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) {
|
||||||
|
$error ++;
|
||||||
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error) {
|
||||||
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "mytable");
|
||||||
|
|
||||||
|
if (! $notrigger) {
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action call a trigger.
|
||||||
|
//// Call triggers
|
||||||
|
//include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
|
||||||
|
//$interface=new Interfaces($this->db);
|
||||||
|
//$result=$interface->run_triggers('MYOBJECT_CREATE',$this,$user,$langs,$conf);
|
||||||
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
foreach ($this->errors as $errmsg) {
|
||||||
|
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error ? ', ' . $errmsg : $errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
|
||||||
|
return -1 * $error;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
|
return $this->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load object in memory from database
|
||||||
|
*
|
||||||
|
* @param int $id Id object
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function fetch($id)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$sql = "SELECT";
|
||||||
|
$sql.= " t.rowid,";
|
||||||
|
$sql.= " t.field1,";
|
||||||
|
$sql.= " t.field2";
|
||||||
|
//...
|
||||||
|
$sql.= " FROM " . MAIN_DB_PREFIX . "mytable as t";
|
||||||
|
$sql.= " WHERE t.rowid = " . $id;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
if ($this->db->num_rows($resql)) {
|
||||||
|
$obj = $this->db->fetch_object($resql);
|
||||||
|
|
||||||
|
$this->id = $obj->rowid;
|
||||||
|
$this->prop1 = $obj->field1;
|
||||||
|
$this->prop2 = $obj->field2;
|
||||||
|
//...
|
||||||
|
}
|
||||||
|
$this->db->free($resql);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
$this->error = "Error " . $this->db->lasterror();
|
||||||
|
dol_syslog(__METHOD__ . " " . $this->error, LOG_ERR);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update object into database
|
||||||
|
*
|
||||||
|
* @param User $user User that modify
|
||||||
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function update($user = 0, $notrigger = 0)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
// Clean parameters
|
||||||
|
if (isset($this->prop1)) {
|
||||||
|
$this->prop1 = trim($this->prop1);
|
||||||
|
}
|
||||||
|
if (isset($this->prop2)) {
|
||||||
|
$this->prop2 = trim($this->prop2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check parameters
|
||||||
|
// Put here code to add control on parameters values
|
||||||
|
// Update request
|
||||||
|
$sql = "UPDATE " . MAIN_DB_PREFIX . "mytable SET";
|
||||||
|
$sql.= " field1=" . (isset($this->field1) ? "'" . $this->db->escape($this->field1) . "'" : "null") . ",";
|
||||||
|
$sql.= " field2=" . (isset($this->field2) ? "'" . $this->db->escape($this->field2) . "'" : "null") . "";
|
||||||
|
|
||||||
|
$sql.= " WHERE rowid=" . $this->id;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__ . " sql=" . $sql, LOG_DEBUG);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) {
|
||||||
|
$error ++;
|
||||||
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error) {
|
||||||
|
if (! $notrigger) {
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action call a trigger.
|
||||||
|
//// Call triggers
|
||||||
|
//include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
|
||||||
|
//$interface=new Interfaces($this->db);
|
||||||
|
//$result=$interface->run_triggers('MYOBJECT_MODIFY',$this,$user,$langs,$conf);
|
||||||
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
foreach ($this->errors as $errmsg) {
|
||||||
|
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error ? ', ' . $errmsg : $errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
|
||||||
|
return -1 * $error;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete object in database
|
||||||
|
*
|
||||||
|
* @param User $user User that delete
|
||||||
|
* @param int $notrigger 0=launch triggers after, 1=disable triggers
|
||||||
|
* @return int <0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
public function delete($user, $notrigger = 0)
|
||||||
|
{
|
||||||
|
global $conf, $langs;
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
if (! $error) {
|
||||||
|
if (! $notrigger) {
|
||||||
|
// Uncomment this and change MYOBJECT to your own tag if you
|
||||||
|
// want this action call a trigger.
|
||||||
|
//// Call triggers
|
||||||
|
//include_once DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php";
|
||||||
|
//$interface=new Interfaces($this->db);
|
||||||
|
//$result=$interface->run_triggers('MYOBJECT_DELETE',$this,$user,$langs,$conf);
|
||||||
|
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||||
|
//// End call triggers
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error) {
|
||||||
|
$sql = "DELETE FROM " . MAIN_DB_PREFIX . "mytable";
|
||||||
|
$sql.= " WHERE rowid=" . $this->id;
|
||||||
|
|
||||||
|
dol_syslog(__METHOD__ . " sql=" . $sql);
|
||||||
|
$resql = $this->db->query($sql);
|
||||||
|
if (! $resql) {
|
||||||
|
$error ++;
|
||||||
|
$this->errors[] = "Error " . $this->db->lasterror();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Commit or rollback
|
||||||
|
if ($error) {
|
||||||
|
foreach ($this->errors as $errmsg) {
|
||||||
|
dol_syslog(__METHOD__ . " " . $errmsg, LOG_ERR);
|
||||||
|
$this->error.=($this->error ? ', ' . $errmsg : $errmsg);
|
||||||
|
}
|
||||||
|
$this->db->rollback();
|
||||||
|
|
||||||
|
return -1 * $error;
|
||||||
|
} else {
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load an object from its id and create a new one in database
|
||||||
|
*
|
||||||
|
* @param int $fromid Id of object to clone
|
||||||
|
* @return int New id of clone
|
||||||
|
*/
|
||||||
|
public function createFromClone($fromid)
|
||||||
|
{
|
||||||
|
global $user, $langs;
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
$object = new SkeletonClass($this->db);
|
||||||
|
|
||||||
|
$this->db->begin();
|
||||||
|
|
||||||
|
// Load source object
|
||||||
|
$object->fetch($fromid);
|
||||||
|
$object->id = 0;
|
||||||
|
$object->statut = 0;
|
||||||
|
|
||||||
|
// Clear fields
|
||||||
|
// ...
|
||||||
|
// Create clone
|
||||||
|
$result = $object->create($user);
|
||||||
|
|
||||||
|
// Other options
|
||||||
|
if ($result < 0) {
|
||||||
|
$this->error = $object->error;
|
||||||
|
$error ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $error) {
|
||||||
|
// Do something
|
||||||
|
}
|
||||||
|
|
||||||
|
// End
|
||||||
|
if (! $error) {
|
||||||
|
$this->db->commit();
|
||||||
|
|
||||||
|
return $object->id;
|
||||||
|
} else {
|
||||||
|
$this->db->rollback();
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise object with example values
|
||||||
|
* Id must be 0 if object instance is a specimen
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function initAsSpecimen()
|
||||||
|
{
|
||||||
|
$this->id = 0;
|
||||||
|
$this->prop1 = 'prop1';
|
||||||
|
$this->prop2 = 'prop2';
|
||||||
|
}
|
||||||
|
}
|
||||||
195
htdocs/modulebuilder/template/core/boxes/mybox.php
Normal file
@@ -0,0 +1,195 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file core/boxes/mybox.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example box definition.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Includes */
|
||||||
|
include_once DOL_DOCUMENT_ROOT . "/core/boxes/modules_boxes.php";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to manage the box
|
||||||
|
*
|
||||||
|
* Warning: for the box to be detected correctly by dolibarr,
|
||||||
|
* the filename should be the lowercase classname
|
||||||
|
*/
|
||||||
|
class MyBox extends ModeleBoxes
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string Alphanumeric ID. Populated by the constructor.
|
||||||
|
*/
|
||||||
|
public $boxcode = "mybox";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Box icon (in configuration page)
|
||||||
|
* Automatically calls the icon named with the corresponding "object_" prefix
|
||||||
|
*/
|
||||||
|
public $boximg = "mymodule@mymodule";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Box label (in configuration page)
|
||||||
|
*/
|
||||||
|
public $boxlabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string[] Module dependencies
|
||||||
|
*/
|
||||||
|
public $depends = array('mymodule');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var DoliDb Database handler
|
||||||
|
*/
|
||||||
|
public $db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var mixed More parameters
|
||||||
|
*/
|
||||||
|
public $param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Header informations. Usually created at runtime by loadBox().
|
||||||
|
*/
|
||||||
|
public $info_box_head = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Contents informations. Usually created at runtime by loadBox().
|
||||||
|
*/
|
||||||
|
public $info_box_contents = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
* @param string $param More parameters
|
||||||
|
*/
|
||||||
|
public function __construct(DoliDB $db, $param = '')
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("boxes");
|
||||||
|
$langs->load('mymodule@mymodule');
|
||||||
|
|
||||||
|
parent::__construct($db, $param);
|
||||||
|
|
||||||
|
$this->boxlabel = $langs->transnoentitiesnoconv("MyBox");
|
||||||
|
|
||||||
|
$this->param = $param;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load data into info_box_contents array to show array later. Called by Dolibarr before displaying the box.
|
||||||
|
*
|
||||||
|
* @param int $max Maximum number of records to load
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function loadBox($max = 5)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
// Use configuration value for max lines count
|
||||||
|
$this->max = $max;
|
||||||
|
|
||||||
|
//include_once DOL_DOCUMENT_ROOT . "/mymodule/class/mymodule.class.php";
|
||||||
|
|
||||||
|
// Populate the head at runtime
|
||||||
|
$text = $langs->trans("MyBoxDescription", $max);
|
||||||
|
$this->info_box_head = array(
|
||||||
|
// Title text
|
||||||
|
'text' => $text,
|
||||||
|
// Add a link
|
||||||
|
'sublink' => 'http://example.com',
|
||||||
|
// Sublink icon placed after the text
|
||||||
|
'subpicto' => 'object_mymodule@mymodule',
|
||||||
|
// Sublink icon HTML alt text
|
||||||
|
'subtext' => '',
|
||||||
|
// Sublink HTML target
|
||||||
|
'target' => '',
|
||||||
|
// HTML class attached to the picto and link
|
||||||
|
'subclass' => 'center',
|
||||||
|
// Limit and truncate with "…" the displayed text lenght, 0 = disabled
|
||||||
|
'limit' => 0,
|
||||||
|
// Adds translated " (Graph)" to a hidden form value's input (?)
|
||||||
|
'graph' => false
|
||||||
|
);
|
||||||
|
|
||||||
|
// Populate the contents at runtime
|
||||||
|
$this->info_box_contents = array(
|
||||||
|
0 => array( // First line
|
||||||
|
0 => array( // First Column
|
||||||
|
// HTML properties of the TR element. Only available on the first column.
|
||||||
|
'tr' => 'align="left"',
|
||||||
|
// HTML properties of the TD element
|
||||||
|
'td' => '',
|
||||||
|
// Fist line logo
|
||||||
|
'logo' => 'mymodule@mymodule',
|
||||||
|
// Main text
|
||||||
|
'text' => 'My text',
|
||||||
|
// Secondary text
|
||||||
|
'text2' => '<p><strong>Another text</strong></p>',
|
||||||
|
// Unformatted text, usefull to load javascript elements
|
||||||
|
'textnoformat' => '',
|
||||||
|
// Link on 'text' and 'logo' elements
|
||||||
|
'url' => 'http://example.com',
|
||||||
|
// Link's target HTML property
|
||||||
|
'target' => '_blank',
|
||||||
|
// Truncates 'text' element to the specified character length, 0 = disabled
|
||||||
|
'maxlength' => 0,
|
||||||
|
// Prevents HTML cleaning (and truncation)
|
||||||
|
'asis' => false,
|
||||||
|
// Same for 'text2'
|
||||||
|
'asis2' => true
|
||||||
|
),
|
||||||
|
1 => array( // Another column
|
||||||
|
// No TR for n≠0
|
||||||
|
'td' => '',
|
||||||
|
'text' => 'Another cell',
|
||||||
|
)
|
||||||
|
),
|
||||||
|
1 => array( // Another line
|
||||||
|
0 => array( // TR
|
||||||
|
'tr' => 'align="left"',
|
||||||
|
'text' => 'Another line'
|
||||||
|
)
|
||||||
|
),
|
||||||
|
2 => array( // Another line
|
||||||
|
0 => array( // TR
|
||||||
|
'tr' => 'align="left"',
|
||||||
|
'text' => 'Yet another line'
|
||||||
|
)
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to show box. Called by Dolibarr eatch time it wants to display the box.
|
||||||
|
*
|
||||||
|
* @param array $head Array with properties of box title
|
||||||
|
* @param array $contents Array with properties of box lines
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function showBox($head = null, $contents = null)
|
||||||
|
{
|
||||||
|
// You may make your own code here…
|
||||||
|
// … or use the parent's class function using the provided head and contents templates
|
||||||
|
parent::showBox($this->info_box_head, $this->info_box_contents);
|
||||||
|
}
|
||||||
|
}
|
||||||
719
htdocs/modulebuilder/template/core/modules/modMyModule.class.php
Normal file
@@ -0,0 +1,719 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \defgroup mymodule MyModule module
|
||||||
|
* \brief MyModule module descriptor.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file core/modules/modMyModule.class.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example module description and activation file.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
include_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php";
|
||||||
|
|
||||||
|
// The class name should start with a lower case mod for Dolibarr to pick it up
|
||||||
|
// so we ignore the Squiz.Classes.ValidClassName.NotCamelCaps rule.
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
|
/**
|
||||||
|
* Description and activation class for module MyModule
|
||||||
|
*/
|
||||||
|
class modMyModule extends DolibarrModules
|
||||||
|
{
|
||||||
|
/** @var DoliDB Database handler */
|
||||||
|
public $db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int numero Module unique ID
|
||||||
|
* @see http://wiki.dolibarr.org/index.php/List_of_modules_id Available ranges
|
||||||
|
*/
|
||||||
|
public $numero = 500000;
|
||||||
|
|
||||||
|
/** @var string Text key to reference module (for permissions, menus, etc.) */
|
||||||
|
public $rights_class = 'mymodule';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Module family.
|
||||||
|
* Used to group modules in module setup page.
|
||||||
|
* Can be one of 'crm', 'financial', 'hr', 'projects', 'products', 'ecm', 'technic', 'other'
|
||||||
|
*/
|
||||||
|
public $family = 'other';
|
||||||
|
|
||||||
|
/** @var int Module position in the family */
|
||||||
|
public $module_position = 500;
|
||||||
|
|
||||||
|
/** @var array Provide a custom family and options */
|
||||||
|
public $familyinfo = array(
|
||||||
|
// 'myownfamily' => array(
|
||||||
|
// 'position' => '001',
|
||||||
|
// 'label' => 'MyOwnFamily'
|
||||||
|
// )
|
||||||
|
);
|
||||||
|
|
||||||
|
/** @var string Module name */
|
||||||
|
public $name = "My Module";
|
||||||
|
|
||||||
|
/** @var string Module short description */
|
||||||
|
public $description = "Description of module MyModule";
|
||||||
|
|
||||||
|
/** @var string Module long description */
|
||||||
|
public $descriptionlong = "A very long description. Can be a full HTML content";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Module editor name
|
||||||
|
* @since 4.0
|
||||||
|
*/
|
||||||
|
public $editor_name = "My Company";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Module editor website
|
||||||
|
* @since 4.0
|
||||||
|
*/
|
||||||
|
public $editor_url = "http://www.example.com";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Module version string
|
||||||
|
* Special values to hide the module behind MAIN_FEATURES_LEVEL: development, experimental
|
||||||
|
* @see https://semver.org
|
||||||
|
*/
|
||||||
|
public $version = 'development';
|
||||||
|
|
||||||
|
/** @var string Key used in llx_const table to save module status enabled/disabled */
|
||||||
|
public $const_name = 'MAIN_MODULE_MYMODULE';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string Module logo
|
||||||
|
* Should be named object_mymodule.png and store under mymodule/img
|
||||||
|
*/
|
||||||
|
public $picto = 'mymodule@mymodule';
|
||||||
|
|
||||||
|
/** @var array Define module parts */
|
||||||
|
public $module_parts = array(
|
||||||
|
/** @var bool Module ships triggers in mymodule/core/triggers */
|
||||||
|
'triggers' => true,
|
||||||
|
/**
|
||||||
|
* @var bool Module ships login in mymodule/core/login
|
||||||
|
* @todo: example
|
||||||
|
*/
|
||||||
|
'login' => false,
|
||||||
|
/**
|
||||||
|
* @var bool Module ships substitution functions
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
'substitutions' => false,
|
||||||
|
/**
|
||||||
|
* @var bool Module ships menu handlers
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
'menus' => false,
|
||||||
|
/**
|
||||||
|
* @var bool Module ships theme in mymodule/theme
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
'theme' => false,
|
||||||
|
/**
|
||||||
|
* @var bool Module shipped templates in mymodule/core/tpl overload core ones
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
'tpl' => false,
|
||||||
|
/**
|
||||||
|
* @var bool Module ships barcode functions
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
'barcode' => false,
|
||||||
|
/**
|
||||||
|
* @var bool Module ships models
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
'models' => false,
|
||||||
|
/** @var string[] List of module shipped custom CSS relative file paths */
|
||||||
|
'css' => array(
|
||||||
|
'mymodule/css/mycss.css.php'
|
||||||
|
),
|
||||||
|
/** @var string[] List of module shipped custom JavaScript relative file paths */
|
||||||
|
'js' => array(
|
||||||
|
'mymodule/js/myjs.js.php'
|
||||||
|
),
|
||||||
|
/**
|
||||||
|
* @var string[] List of hook contexts managed by the module
|
||||||
|
* @ todo example
|
||||||
|
*/
|
||||||
|
'hooks' => array(),
|
||||||
|
/**
|
||||||
|
* @var array List of default directory names to force
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
'dir' => array(),
|
||||||
|
/**
|
||||||
|
* @var array List of workflow contexts managed by the module
|
||||||
|
*/
|
||||||
|
'workflow' => array(),
|
||||||
|
);
|
||||||
|
|
||||||
|
/** @var string Data directories to create when module is enabled */
|
||||||
|
public $dirs = array(
|
||||||
|
'/mymodule/temp'
|
||||||
|
);
|
||||||
|
|
||||||
|
/** @var array Configuration page declaration */
|
||||||
|
public $config_page_url = 'setup.php@mymodule';
|
||||||
|
|
||||||
|
/** @var bool Control module visibility */
|
||||||
|
public $hidden = false;
|
||||||
|
|
||||||
|
/** @var string[] List of class names of modules to enable when this one is enabled */
|
||||||
|
public $depends = array();
|
||||||
|
|
||||||
|
/** @var string[] List of class names of modules to disable when this one is disabled */
|
||||||
|
public $requiredby = array();
|
||||||
|
|
||||||
|
/** @var string List of class names of modules this module conflicts with */
|
||||||
|
public $conflictwith = array();
|
||||||
|
|
||||||
|
/** @var int[] Minimum PHP version required by this module */
|
||||||
|
public $phpmin = array(5, 3);
|
||||||
|
|
||||||
|
/** @var int[] Minimum Dolibarr version required by this module */
|
||||||
|
public $need_dolibarr_version = array(3, 2);
|
||||||
|
|
||||||
|
/** @var string[] List of language files */
|
||||||
|
public $langfiles = array('mymodule@mymodule');
|
||||||
|
|
||||||
|
/** @var array Indexed list of constants options */
|
||||||
|
public $const = array(
|
||||||
|
0 => array(
|
||||||
|
/** @var string Constant name */
|
||||||
|
'MYMODULE_MYNEWCONST1',
|
||||||
|
/**
|
||||||
|
* @var string Constant type
|
||||||
|
* @todo Are there other types than 'chaine'?
|
||||||
|
*/
|
||||||
|
'chaine',
|
||||||
|
/** @var string Constant initial value */
|
||||||
|
'myvalue',
|
||||||
|
/** @var string Constant description */
|
||||||
|
'This is a configuration constant',
|
||||||
|
/** @var bool Constant visibility */
|
||||||
|
true,
|
||||||
|
/**
|
||||||
|
* @var string Multi-company entities
|
||||||
|
* 'current' or 'allentities'
|
||||||
|
*/
|
||||||
|
'current',
|
||||||
|
/** @var bool Delete constant when module is disabled */
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string List of pages to add as tab in a specific view
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
public $tabs = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Dictionaries declared by the module
|
||||||
|
*@todo example
|
||||||
|
*/
|
||||||
|
public $dictionaries = array();
|
||||||
|
|
||||||
|
/** @var array Indexed list of boxes options */
|
||||||
|
public $boxes = array(
|
||||||
|
0 => array(
|
||||||
|
'file' => 'mybox@mymodule',
|
||||||
|
'note' => '',
|
||||||
|
'enabledbydefaulton' => 'Home'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Indexed list of cronjobs options
|
||||||
|
* @todo: example
|
||||||
|
*/
|
||||||
|
public $cronjobs = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Indexed list of permissions options
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
public $rights = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Indexed list of menu options
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
public $menu = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Indexed list of export IDs
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
public $export_code = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Indexed list of export names
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
public $export_label = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Indexed list of export enabling conditions
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
public $export_enabled = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Indexed list of export required permissions
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
public $export_permission = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Indexed list of export fields
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
public $export_fields_array = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Indexed list of export entities
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
public $export_entities_array = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Indexed list of export SQL queries start
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
public $export_sql_start = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Indexed list of export SQL queries end
|
||||||
|
* @todo example
|
||||||
|
*/
|
||||||
|
public $export_sql_end = array();
|
||||||
|
|
||||||
|
/** @var bool Module only enabled / disabled in main company when multi-company is in use */
|
||||||
|
public $core_enabled = false;
|
||||||
|
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
|
/**
|
||||||
|
* Constructor. Define names, constants, directories, boxes, permissions
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
public function __construct($db)
|
||||||
|
{
|
||||||
|
global $langs, $conf;
|
||||||
|
|
||||||
|
// DolibarrModules is abstract in Dolibarr < 3.8
|
||||||
|
if (is_callable('parent::__construct')) {
|
||||||
|
parent::__construct($db);
|
||||||
|
} else {
|
||||||
|
global $db;
|
||||||
|
$this->db = $db;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Declare custom family with translated label
|
||||||
|
//$this->familyinfo = array(
|
||||||
|
// 'myownfamily' => array(
|
||||||
|
// 'position' => '001',
|
||||||
|
// 'label' => $langs->trans("MyOwnFamily")
|
||||||
|
// )
|
||||||
|
//);
|
||||||
|
|
||||||
|
// Lazy automatic module naming from class names
|
||||||
|
//$this->name = preg_replace('/^mod/i', '', get_class($this));
|
||||||
|
|
||||||
|
// Lazy automatic constant naming from module name
|
||||||
|
//$this->const_name = 'MAIN_MODULE_' . strtoupper($this->name);
|
||||||
|
|
||||||
|
// Examples for complex types
|
||||||
|
//$this->module_parts = array(
|
||||||
|
// Set here all hooks context managed by module
|
||||||
|
// 'hooks' => array('hookcontext1','hookcontext2'),
|
||||||
|
// To force the default directories names
|
||||||
|
// 'dir' => array('output' => 'othermodulename'),
|
||||||
|
// Set here all workflow context managed by module
|
||||||
|
// Don't forget to depend on modWorkflow!
|
||||||
|
// The description translation key will be descWORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2
|
||||||
|
// You will be able to check if it is enabled with the $conf->global->WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2 constant
|
||||||
|
// Implementation is up to you and is usually done in a trigger.
|
||||||
|
// 'workflow' => array(
|
||||||
|
// 'WORKFLOW_MODULE1_YOURACTIONTYPE_MODULE2' => array(
|
||||||
|
// 'enabled' => '! empty($conf->module1->enabled) && ! empty($conf->module2->enabled)',
|
||||||
|
// 'picto' => 'yourpicto@mymodule',
|
||||||
|
// 'warning' => 'WarningTextTranslationKey',
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
//);
|
||||||
|
|
||||||
|
|
||||||
|
// Array to add new pages in new tabs
|
||||||
|
// Example:
|
||||||
|
//$this->tabs = array(
|
||||||
|
// // To add a new tab identified by code tabname1
|
||||||
|
// 'objecttype:+tabname1:Title1:langfile@mymodule:$user->rights->mymodule->read:/mymodule/mynewtab1.php?id=__ID__',
|
||||||
|
// // To add another new tab identified by code tabname2
|
||||||
|
// 'objecttype:+tabname2:Title2:langfile@mymodule:$user->rights->othermodule->read:/mymodule/mynewtab2.php?id=__ID__',
|
||||||
|
// // To remove an existing tab identified by code tabname
|
||||||
|
// 'objecttype:-tabname'
|
||||||
|
//);
|
||||||
|
// 'categories_x' to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
|
||||||
|
// 'contact' to add a tab in contact view
|
||||||
|
// 'contract' to add a tab in contract view
|
||||||
|
// 'group' to add a tab in group view
|
||||||
|
// 'intervention' to add a tab in intervention view
|
||||||
|
// 'invoice' to add a tab in customer invoice view
|
||||||
|
// 'invoice_supplier' to add a tab in supplier invoice view
|
||||||
|
// 'member' to add a tab in fundation member view
|
||||||
|
// 'opensurveypoll' to add a tab in opensurvey poll view
|
||||||
|
// 'order' to add a tab in customer order view
|
||||||
|
// 'order_supplier' to add a tab in supplier order view
|
||||||
|
// 'payment' to add a tab in payment view
|
||||||
|
// 'payment_supplier' to add a tab in supplier payment view
|
||||||
|
// 'product' to add a tab in product view
|
||||||
|
// 'propal' to add a tab in propal view
|
||||||
|
// 'project' to add a tab in project view
|
||||||
|
// 'stock' to add a tab in stock view
|
||||||
|
// 'thirdparty' to add a tab in third party view
|
||||||
|
// 'user' to add a tab in user view
|
||||||
|
|
||||||
|
// Dictionaries
|
||||||
|
if (! isset($conf->mymodule->enabled)) {
|
||||||
|
$conf->mymodule=new stdClass();
|
||||||
|
$conf->mymodule->enabled = 0;
|
||||||
|
}
|
||||||
|
//$this->dictionaries = array();
|
||||||
|
/* Example:
|
||||||
|
$this->dictionaries=array(
|
||||||
|
'langs'=>'mymodule@mymodule',
|
||||||
|
// List of tables we want to see into dictonary editor
|
||||||
|
'tabname'=>array(
|
||||||
|
MAIN_DB_PREFIX."table1",
|
||||||
|
MAIN_DB_PREFIX."table2",
|
||||||
|
MAIN_DB_PREFIX."table3"
|
||||||
|
),
|
||||||
|
// Label of tables
|
||||||
|
'tablib'=>array("Table1","Table2","Table3"),
|
||||||
|
// Query to select fields
|
||||||
|
'tabsql'=>array(
|
||||||
|
'SELECT f.rowid as rowid, f.code, f.label, f.active'
|
||||||
|
. ' FROM ' . MAIN_DB_PREFIX . 'table1 as f',
|
||||||
|
'SELECT f.rowid as rowid, f.code, f.label, f.active'
|
||||||
|
. ' FROM ' . MAIN_DB_PREFIX . 'table2 as f',
|
||||||
|
'SELECT f.rowid as rowid, f.code, f.label, f.active'
|
||||||
|
. ' FROM ' . MAIN_DB_PREFIX . 'table3 as f'
|
||||||
|
),
|
||||||
|
// Sort order
|
||||||
|
'tabsqlsort'=>array("label ASC","label ASC","label ASC"),
|
||||||
|
// List of fields (result of select to show dictionary)
|
||||||
|
'tabfield'=>array("code,label","code,label","code,label"),
|
||||||
|
// List of fields (list of fields to edit a record)
|
||||||
|
'tabfieldvalue'=>array("code,label","code,label","code,label"),
|
||||||
|
// List of fields (list of fields for insert)
|
||||||
|
'tabfieldinsert'=>array("code,label","code,label","code,label"),
|
||||||
|
// Name of columns with primary key (try to always name it 'rowid')
|
||||||
|
'tabrowid'=>array("rowid","rowid","rowid"),
|
||||||
|
// Condition to show each dictionary
|
||||||
|
'tabcond'=>array(
|
||||||
|
$conf->mymodule->enabled,
|
||||||
|
$conf->mymodule->enabled,
|
||||||
|
$conf->mymodule->enabled
|
||||||
|
)
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Cronjobs
|
||||||
|
// List of cron jobs entries to add
|
||||||
|
//$this->cronjobs = array();
|
||||||
|
// Example:
|
||||||
|
// $this->cronjobs = array(
|
||||||
|
// 0 => array(
|
||||||
|
// 'label' => 'My label',
|
||||||
|
// 'jobtype' => 'method',
|
||||||
|
// 'class' => '/dir/class/file.class.php',
|
||||||
|
// 'objectname' => 'MyClass',
|
||||||
|
// 'method' => 'myMethod',
|
||||||
|
// 'parameters' => '',
|
||||||
|
// 'comment' => 'Comment',
|
||||||
|
// 'frequency' => 2,
|
||||||
|
// 'unitfrequency' => 3600,
|
||||||
|
// 'test' => true
|
||||||
|
// ),
|
||||||
|
// 1 => array(
|
||||||
|
// 'label' => 'My label',
|
||||||
|
// 'jobtype' => 'command',
|
||||||
|
// 'command' => '',
|
||||||
|
// 'parameters' => '',
|
||||||
|
// 'comment' => 'Comment',
|
||||||
|
// 'frequency' => 1,
|
||||||
|
// 'unitfrequency' => 3600 * 24,
|
||||||
|
// 'test' => true
|
||||||
|
// )
|
||||||
|
// );
|
||||||
|
|
||||||
|
// Permissions
|
||||||
|
//$r = 0;
|
||||||
|
// Add here list of permission defined by
|
||||||
|
// an id, a label, a boolean and two constant strings.
|
||||||
|
// Example:
|
||||||
|
//// Permission id (must not be already used)
|
||||||
|
//$this->rights[$r][0] = 2000;
|
||||||
|
//// Permission label
|
||||||
|
//$this->rights[$r][1] = 'Permision label';
|
||||||
|
//// Permission by default for new user (0/1)
|
||||||
|
//$this->rights[$r][3] = 1;
|
||||||
|
//// In php code, permission will be checked by test
|
||||||
|
//// if ($user->rights->permkey->level1->level2)
|
||||||
|
//$this->rights[$r][4] = 'level1';
|
||||||
|
//// In php code, permission will be checked by test
|
||||||
|
//// if ($user->rights->permkey->level1->level2)
|
||||||
|
//$this->rights[$r][5] = 'level2';
|
||||||
|
//$r++;
|
||||||
|
// Main menu entries
|
||||||
|
|
||||||
|
// Menu entries
|
||||||
|
// Example to declare a new Top Menu entry and its Left menu entry:
|
||||||
|
//$this->menu[]=array(
|
||||||
|
// // Put 0 if this is a top menu
|
||||||
|
// 'fk_menu'=>0,
|
||||||
|
// // This is a Top menu entry
|
||||||
|
// 'type'=>'top',
|
||||||
|
// Menu's title. FIXME: use a translation key
|
||||||
|
// 'titre'=>'MyModule top menu',
|
||||||
|
// This menu's mainmenu ID
|
||||||
|
// 'mainmenu'=>'mymodule',
|
||||||
|
// This menu's leftmenu ID
|
||||||
|
// 'leftmenu'=>'mymodule',
|
||||||
|
// 'url'=>'/mymodule/pagetop.php',
|
||||||
|
// // Lang file to use (without .lang) by module.
|
||||||
|
// // File must be in langs/code_CODE/ directory.
|
||||||
|
// 'langs'=>'mylangfile',
|
||||||
|
// 'position'=>100,
|
||||||
|
// // Define condition to show or hide menu entry.
|
||||||
|
// // Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||||
|
// 'enabled'=>'$conf->mymodule->enabled',
|
||||||
|
// // Use 'perms'=>'$user->rights->mymodule->level1->level2'
|
||||||
|
// // if you want your menu with a permission rules
|
||||||
|
// 'perms'=>'1',
|
||||||
|
// 'target'=>'',
|
||||||
|
// // 0=Menu for internal users, 1=external users, 2=both
|
||||||
|
// 'user'=>2
|
||||||
|
//);
|
||||||
|
//$this->menu[]=array(
|
||||||
|
// // Use r=value where r is index key used for the parent menu entry
|
||||||
|
// // (higher parent must be a top menu entry)
|
||||||
|
// 'fk_menu'=>'r=0',
|
||||||
|
// // This is a Left menu entry
|
||||||
|
// 'type'=>'left',
|
||||||
|
// Menu's title. FIXME: use a translation key
|
||||||
|
// 'titre'=>'MyModule left menu',
|
||||||
|
// This menu's mainmenu ID
|
||||||
|
// 'mainmenu'=>'mymodule',
|
||||||
|
// This menu's leftmenu ID
|
||||||
|
// 'leftmenu'=>'mymodule',
|
||||||
|
// 'url'=>'/mymodule/pagelevel1.php',
|
||||||
|
// // Lang file to use (without .lang) by module.
|
||||||
|
// // File must be in langs/code_CODE/ directory.
|
||||||
|
// 'langs'=>'mylangfile',
|
||||||
|
// 'position'=>100,
|
||||||
|
// // Define condition to show or hide menu entry.
|
||||||
|
// // Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||||
|
// 'enabled'=>'$conf->mymodule->enabled',
|
||||||
|
// // Use 'perms'=>'$user->rights->mymodule->level1->level2'
|
||||||
|
// // if you want your menu with a permission rules
|
||||||
|
// 'perms'=>'1',
|
||||||
|
// 'target'=>'',
|
||||||
|
// // 0=Menu for internal users, 1=external users, 2=both
|
||||||
|
// 'user'=>2
|
||||||
|
//);
|
||||||
|
//
|
||||||
|
// Example to declare a Left Menu entry into an existing Top menu entry:
|
||||||
|
//$this->menu[]=array(
|
||||||
|
// // Use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy'
|
||||||
|
// 'fk_menu'=>'fk_mainmenu=mainmenucode',
|
||||||
|
// // This is a Left menu entry
|
||||||
|
// 'type'=>'left',
|
||||||
|
// Menu's title. FIXME: use a translation key
|
||||||
|
// 'titre'=>'MyModule left menu',
|
||||||
|
// This menu's mainmenu ID
|
||||||
|
// 'mainmenu'=>'mainmenucode',
|
||||||
|
// This menu's leftmenu ID
|
||||||
|
// 'leftmenu'=>'mymodule',
|
||||||
|
// 'url'=>'/mymodule/pagelevel2.php',
|
||||||
|
// // Lang file to use (without .lang) by module.
|
||||||
|
// // File must be in langs/code_CODE/ directory.
|
||||||
|
// 'langs'=>'mylangfile',
|
||||||
|
// 'position'=>100,
|
||||||
|
// // Define condition to show or hide menu entry.
|
||||||
|
// // Use '$conf->mymodule->enabled' if entry must be visible if module is enabled.
|
||||||
|
// // Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
|
||||||
|
// 'enabled'=>'$conf->mymodule->enabled',
|
||||||
|
// // Use 'perms'=>'$user->rights->mymodule->level1->level2'
|
||||||
|
// // if you want your menu with a permission rules
|
||||||
|
// 'perms'=>'1',
|
||||||
|
// 'target'=>'',
|
||||||
|
// // 0=Menu for internal users, 1=external users, 2=both
|
||||||
|
// 'user'=>2
|
||||||
|
//);
|
||||||
|
|
||||||
|
// Exports
|
||||||
|
//$r = 0;
|
||||||
|
// Example:
|
||||||
|
//$this->export_code[$r]=$this->rights_class.'_'.$r;
|
||||||
|
//// Translation key (used only if key ExportDataset_xxx_z not found)
|
||||||
|
//$this->export_label[$r]='CustomersInvoicesAndInvoiceLines';
|
||||||
|
//// Condition to show export in list (ie: '$user->id==3').
|
||||||
|
//// Set to 1 to always show when module is enabled.
|
||||||
|
//$this->export_enabled[$r]='1';
|
||||||
|
//$this->export_permission[$r]=array(array("facture","facture","export"));
|
||||||
|
//$this->export_fields_array[$r]=array(
|
||||||
|
// 's.rowid'=>"IdCompany",
|
||||||
|
// 's.nom'=>'CompanyName',
|
||||||
|
// 's.address'=>'Address',
|
||||||
|
// 's.cp'=>'Zip',
|
||||||
|
// 's.ville'=>'Town',
|
||||||
|
// 's.fk_pays'=>'Country',
|
||||||
|
// 's.tel'=>'Phone',
|
||||||
|
// 's.siren'=>'ProfId1',
|
||||||
|
// 's.siret'=>'ProfId2',
|
||||||
|
// 's.ape'=>'ProfId3',
|
||||||
|
// 's.idprof4'=>'ProfId4',
|
||||||
|
// 's.code_compta'=>'CustomerAccountancyCode',
|
||||||
|
// 's.code_compta_fournisseur'=>'SupplierAccountancyCode',
|
||||||
|
// 'f.rowid'=>"InvoiceId",
|
||||||
|
// 'f.facnumber'=>"InvoiceRef",
|
||||||
|
// 'f.datec'=>"InvoiceDateCreation",
|
||||||
|
// 'f.datef'=>"DateInvoice",
|
||||||
|
// 'f.total'=>"TotalHT",
|
||||||
|
// 'f.total_ttc'=>"TotalTTC",
|
||||||
|
// 'f.tva'=>"TotalVAT",
|
||||||
|
// 'f.paye'=>"InvoicePaid",
|
||||||
|
// 'f.fk_statut'=>'InvoiceStatus',
|
||||||
|
// 'f.note'=>"InvoiceNote",
|
||||||
|
// 'fd.rowid'=>'LineId',
|
||||||
|
// 'fd.description'=>"LineDescription",
|
||||||
|
// 'fd.price'=>"LineUnitPrice",
|
||||||
|
// 'fd.tva_tx'=>"LineVATRate",
|
||||||
|
// 'fd.qty'=>"LineQty",
|
||||||
|
// 'fd.total_ht'=>"LineTotalHT",
|
||||||
|
// 'fd.total_tva'=>"LineTotalTVA",
|
||||||
|
// 'fd.total_ttc'=>"LineTotalTTC",
|
||||||
|
// 'fd.date_start'=>"DateStart",
|
||||||
|
// 'fd.date_end'=>"DateEnd",
|
||||||
|
// 'fd.fk_product'=>'ProductId',
|
||||||
|
// 'p.ref'=>'ProductRef'
|
||||||
|
//);
|
||||||
|
//$this->export_entities_array[$r]=array('s.rowid'=>"company",
|
||||||
|
// 's.nom'=>'company',
|
||||||
|
// 's.address'=>'company',
|
||||||
|
// 's.cp'=>'company',
|
||||||
|
// 's.ville'=>'company',
|
||||||
|
// 's.fk_pays'=>'company',
|
||||||
|
// 's.tel'=>'company',
|
||||||
|
// 's.siren'=>'company',
|
||||||
|
// 's.siret'=>'company',
|
||||||
|
// 's.ape'=>'company',
|
||||||
|
// 's.idprof4'=>'company',
|
||||||
|
// 's.code_compta'=>'company',
|
||||||
|
// 's.code_compta_fournisseur'=>'company',
|
||||||
|
// 'f.rowid'=>"invoice",
|
||||||
|
// 'f.facnumber'=>"invoice",
|
||||||
|
// 'f.datec'=>"invoice",
|
||||||
|
// 'f.datef'=>"invoice",
|
||||||
|
// 'f.total'=>"invoice",
|
||||||
|
// 'f.total_ttc'=>"invoice",
|
||||||
|
// 'f.tva'=>"invoice",
|
||||||
|
// 'f.paye'=>"invoice",
|
||||||
|
// 'f.fk_statut'=>'invoice',
|
||||||
|
// 'f.note'=>"invoice",
|
||||||
|
// 'fd.rowid'=>'invoice_line',
|
||||||
|
// 'fd.description'=>"invoice_line",
|
||||||
|
// 'fd.price'=>"invoice_line",
|
||||||
|
// 'fd.total_ht'=>"invoice_line",
|
||||||
|
// 'fd.total_tva'=>"invoice_line",
|
||||||
|
// 'fd.total_ttc'=>"invoice_line",
|
||||||
|
// 'fd.tva_tx'=>"invoice_line",
|
||||||
|
// 'fd.qty'=>"invoice_line",
|
||||||
|
// 'fd.date_start'=>"invoice_line",
|
||||||
|
// 'fd.date_end'=>"invoice_line",
|
||||||
|
// 'fd.fk_product'=>'product',
|
||||||
|
// 'p.ref'=>'product'
|
||||||
|
//);
|
||||||
|
//$this->export_sql_start[$r] = 'SELECT DISTINCT ';
|
||||||
|
//$this->export_sql_end[$r] = ' FROM (' . MAIN_DB_PREFIX . 'facture as f, '
|
||||||
|
// . MAIN_DB_PREFIX . 'facturedet as fd, ' . MAIN_DB_PREFIX . 'societe as s)';
|
||||||
|
//$this->export_sql_end[$r] .= ' LEFT JOIN ' . MAIN_DB_PREFIX
|
||||||
|
// . 'product as p on (fd.fk_product = p.rowid)';
|
||||||
|
//$this->export_sql_end[$r] .= ' WHERE f.fk_soc = s.rowid '
|
||||||
|
// . 'AND f.rowid = fd.fk_facture';
|
||||||
|
//$r++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called when module is enabled.
|
||||||
|
* The init function add constants, boxes, permissions and menus
|
||||||
|
* (defined in constructor) into Dolibarr database.
|
||||||
|
* It also creates data directories
|
||||||
|
*
|
||||||
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
|
* @return int 1 if OK, 0 if KO
|
||||||
|
*/
|
||||||
|
public function init($options = '')
|
||||||
|
{
|
||||||
|
$sql = array();
|
||||||
|
|
||||||
|
$result = $this->loadTables();
|
||||||
|
|
||||||
|
return $this->_init($sql, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create tables, keys and data required by module
|
||||||
|
* Files llx_table1.sql, llx_table1.key.sql llx_data.sql with create table, create keys
|
||||||
|
* and create data commands must be stored in directory /mymodule/sql/
|
||||||
|
* This function is called by this->init
|
||||||
|
*
|
||||||
|
* @return int <=0 if KO, >0 if OK
|
||||||
|
*/
|
||||||
|
private function loadTables()
|
||||||
|
{
|
||||||
|
return $this->_load_tables('/mymodule/sql/');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called when module is disabled.
|
||||||
|
* Remove from database constants, boxes and permissions from Dolibarr database.
|
||||||
|
* Data directories are not deleted
|
||||||
|
*
|
||||||
|
* @param string $options Options when enabling module ('', 'noboxes')
|
||||||
|
* @return int 1 if OK, 0 if KO
|
||||||
|
*/
|
||||||
|
public function remove($options = '')
|
||||||
|
{
|
||||||
|
$sql = array();
|
||||||
|
|
||||||
|
return $this->_remove($sql, $options);
|
||||||
|
}
|
||||||
|
}
|
||||||
28
htdocs/modulebuilder/template/core/tpl/mytemplate.tpl.php
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file core/tpl/mytemplate.tpl.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example template.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Your code here. */
|
||||||
|
echo "Hello world!";
|
||||||
@@ -0,0 +1,580 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file core/triggers/interface_99_modMyModule_MyTrigger.class.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example trigger.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*
|
||||||
|
* \remarks You can create other triggers by copying this one.
|
||||||
|
* - File name should be either:
|
||||||
|
* - interface_99_modMyModule_MyTrigger.class.php
|
||||||
|
* - interface_99_all_MyTrigger.class.php
|
||||||
|
* - The file must stay in core/triggers
|
||||||
|
* - The class name must be InterfaceMytrigger
|
||||||
|
* - The constructor method must be named InterfaceMytrigger
|
||||||
|
* - The name property name must be Mytrigger
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Includes */
|
||||||
|
require_once DOL_DOCUMENT_ROOT . '/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT . dol_buildpath('/mymodule/class/MyTrigger.php', 1);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class InterfaceMytrigger
|
||||||
|
*/
|
||||||
|
class InterfaceMytrigger extends MyTrigger
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var DoliDB Database handler
|
||||||
|
*/
|
||||||
|
protected $db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param DoliDB $db Database handler
|
||||||
|
*/
|
||||||
|
public function __construct($db)
|
||||||
|
{
|
||||||
|
$this->db = $db;
|
||||||
|
|
||||||
|
$this->name = preg_replace('/^Interface/i', '', get_class($this));
|
||||||
|
$this->family = "demo";
|
||||||
|
$this->description = "Triggers of this module are empty functions."
|
||||||
|
. "They have no effect."
|
||||||
|
. "They are provided for tutorial purpose only.";
|
||||||
|
// 'development', 'experimental', 'dolibarr' or version
|
||||||
|
$this->version = 'development';
|
||||||
|
$this->picto = 'mymodule@mymodule';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger name
|
||||||
|
*
|
||||||
|
* @return string Name of trigger file
|
||||||
|
*/
|
||||||
|
public function getName()
|
||||||
|
{
|
||||||
|
return $this->name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger description
|
||||||
|
*
|
||||||
|
* @return string Description of trigger file
|
||||||
|
*/
|
||||||
|
public function getDesc()
|
||||||
|
{
|
||||||
|
return $this->description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Trigger version
|
||||||
|
*
|
||||||
|
* @return string Version of trigger file
|
||||||
|
*/
|
||||||
|
public function getVersion()
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
$langs->load("admin");
|
||||||
|
|
||||||
|
if ($this->version == 'development') {
|
||||||
|
return $langs->trans("Development");
|
||||||
|
} elseif ($this->version == 'experimental') {
|
||||||
|
return $langs->trans("Experimental");
|
||||||
|
} elseif ($this->version == 'dolibarr') {
|
||||||
|
return DOL_VERSION;
|
||||||
|
} elseif ($this->version) {
|
||||||
|
return $this->version;
|
||||||
|
} else {
|
||||||
|
return $langs->trans("Unknown");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// @codingStandardsIgnoreStart
|
||||||
|
/**
|
||||||
|
* Compatibility trigger function for Dolibarr < 3.7
|
||||||
|
*
|
||||||
|
* @param int $action Trigger action
|
||||||
|
* @param CommonObject $object Object trigged from
|
||||||
|
* @param User $user User that trigged
|
||||||
|
* @param Translate $langs Translations handler
|
||||||
|
* @param Conf $conf Configuration
|
||||||
|
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
|
||||||
|
* @deprecated Replaced by DolibarrTriggers::runTrigger()
|
||||||
|
*/
|
||||||
|
public function run_trigger($action, $object, $user, $langs, $conf)
|
||||||
|
{
|
||||||
|
return $this->runTrigger($action, $object, $user, $langs, $conf);
|
||||||
|
}
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function called when a Dolibarrr business event is done.
|
||||||
|
* All functions "runTrigger" are triggered if file
|
||||||
|
* is inside directory core/triggers
|
||||||
|
*
|
||||||
|
* @param string $action Event action code
|
||||||
|
* @param CommonObject $object Object
|
||||||
|
* @param User $user Object user
|
||||||
|
* @param Translate $langs Object langs
|
||||||
|
* @param Conf $conf Object conf
|
||||||
|
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
|
||||||
|
*/
|
||||||
|
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
|
||||||
|
{
|
||||||
|
// Put here code you want to execute when a Dolibarr business events occurs.
|
||||||
|
// Data and type of action are stored into $object and $action
|
||||||
|
|
||||||
|
/** Users */
|
||||||
|
if ($action == 'USER_LOGIN') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'USER_UPDATE_SESSION') {
|
||||||
|
// Warning: To increase performances, this action is triggered only if
|
||||||
|
// constant MAIN_ACTIVATE_UPDATESESSIONTRIGGER is set to 1.
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'USER_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'USER_CREATE_FROM_CONTACT') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'USER_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'USER_NEW_PASSWORD') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'USER_ENABLEDISABLE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'USER_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'USER_LOGOUT') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'USER_SETINGROUP') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'USER_REMOVEFROMGROUP') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Groups */
|
||||||
|
} elseif ($action == 'GROUP_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'GROUP_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'GROUP_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Companies */
|
||||||
|
} elseif ($action == 'COMPANY_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'COMPANY_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'COMPANY_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Contacts */
|
||||||
|
} elseif ($action == 'CONTACT_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'CONTACT_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'CONTACT_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
// Products
|
||||||
|
} elseif ($action == 'PRODUCT_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PRODUCT_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PRODUCT_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Customer orders */
|
||||||
|
} elseif ($action == 'ORDER_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'ORDER_CLONE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'ORDER_VALIDATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'ORDER_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'ORDER_BUILDDOC') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'ORDER_SENTBYMAIL') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'LINEORDER_INSERT') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'LINEORDER_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Supplier orders */
|
||||||
|
} elseif ($action == 'ORDER_SUPPLIER_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'ORDER_SUPPLIER_VALIDATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'ORDER_SUPPLIER_SENTBYMAIL') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'SUPPLIER_ORDER_BUILDDOC') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Proposals */
|
||||||
|
} elseif ($action == 'PROPAL_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PROPAL_CLONE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PROPAL_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PROPAL_VALIDATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PROPAL_BUILDDOC') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PROPAL_SENTBYMAIL') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PROPAL_CLOSE_SIGNED') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PROPAL_CLOSE_REFUSED') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PROPAL_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'LINEPROPAL_INSERT') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'LINEPROPAL_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'LINEPROPAL_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Contracts */
|
||||||
|
} elseif ($action == 'CONTRACT_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'CONTRACT_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'CONTRACT_ACTIVATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'CONTRACT_CANCEL') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'CONTRACT_CLOSE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'CONTRACT_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Bills */
|
||||||
|
} elseif ($action == 'BILL_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'BILL_CLONE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'BILL_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'BILL_VALIDATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'BILL_BUILDDOC') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'BILL_SENTBYMAIL') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'BILL_CANCEL') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'BILL_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'LINEBILL_INSERT') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'LINEBILL_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Payments */
|
||||||
|
} elseif ($action == 'PAYMENT_CUSTOMER_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PAYMENT_SUPPLIER_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PAYMENT_ADD_TO_BANK') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PAYMENT_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Interventions */
|
||||||
|
} elseif ($action == 'FICHEINTER_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'FICHEINTER_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'FICHEINTER_VALIDATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'FICHEINTER_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Members */
|
||||||
|
} elseif ($action == 'MEMBER_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'MEMBER_VALIDATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'MEMBER_SUBSCRIPTION') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'MEMBER_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'MEMBER_NEW_PASSWORD') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'MEMBER_RESILIATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'MEMBER_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Categories */
|
||||||
|
} elseif ($action == 'CATEGORY_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'CATEGORY_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'CATEGORY_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Projects */
|
||||||
|
} elseif ($action == 'PROJECT_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PROJECT_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'PROJECT_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
/** Project tasks */
|
||||||
|
} elseif ($action == 'TASK_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'TASK_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'TASK_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Task time spent */
|
||||||
|
} elseif ($action == 'TASK_TIMESPENT_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'TASK_TIMESPENT_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'TASK_TIMESPENT_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** Shipping */
|
||||||
|
} elseif ($action == 'SHIPPING_CREATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'SHIPPING_MODIFY') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'SHIPPING_VALIDATE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'SHIPPING_SENTBYMAIL') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'SHIPPING_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'SHIPPING_BUILDDOC') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
|
||||||
|
/** File */
|
||||||
|
} elseif ($action == 'FILE_UPLOAD') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
} elseif ($action == 'FILE_DELETE') {
|
||||||
|
dol_syslog(
|
||||||
|
"Trigger '" . $this->name . "' for action '$action' launched by " . __FILE__ . ". id=" . $object->id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
27
htdocs/modulebuilder/template/css/mycss.css.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file css/mycss.css.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example CSS.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
header('Content-Type: text/css');
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<ruleset name="Dolibarr (PSR2)">
|
||||||
|
<description>The PSR2 standard with Dolibarr quirks.</description>
|
||||||
|
|
||||||
|
<!-- Include the whole PSR2 standard -->
|
||||||
|
<rule ref="PSR2">
|
||||||
|
<!-- Code can be indented with tabs -->
|
||||||
|
<exclude name="Generic.WhiteSpace.DisallowTabIndent" />
|
||||||
|
<!-- Dolibarr don't support namespacing (yet) -->
|
||||||
|
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
|
||||||
|
</rule>
|
||||||
|
</ruleset>
|
||||||
87
htdocs/modulebuilder/template/dev/dolistore/README.md
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
Dolistore
|
||||||
|
=========
|
||||||
|
|
||||||
|
[Dolistore](https://dolistore.com) is the marketplace for Dolibarr modules.
|
||||||
|
|
||||||
|
This directory contains templates assets that may be useful for publication.
|
||||||
|
|
||||||
|
Images
|
||||||
|
------
|
||||||
|
|
||||||
|
### Logo
|
||||||
|
|
||||||
|
See [img folder README](../img/README.md).
|
||||||
|
|
||||||
|
### Screenshots
|
||||||
|
|
||||||
|
Texts
|
||||||
|
-----
|
||||||
|
|
||||||
|
All texts needs 5 languages versions for:
|
||||||
|
- en (English)
|
||||||
|
- fr (Français)
|
||||||
|
- es (Español)
|
||||||
|
- it (Italiano)
|
||||||
|
- de (Deutsch)
|
||||||
|
|
||||||
|
### Name
|
||||||
|
|
||||||
|
The module's marketed name.
|
||||||
|
|
||||||
|
### Price
|
||||||
|
|
||||||
|
Expressed in Euro (€).
|
||||||
|
Keep in mind that Dolistore will keep a 20% markup.
|
||||||
|
|
||||||
|
### Categories
|
||||||
|
|
||||||
|
- [x] Modules/Plugins
|
||||||
|
- [ ] Skins and Templates
|
||||||
|
- [ ] Tools and documentation
|
||||||
|
- [ ] Skins
|
||||||
|
- [ ] Document templates
|
||||||
|
- [ ] System tools
|
||||||
|
- [ ] CRM
|
||||||
|
- [ ] ECM
|
||||||
|
- [ ] Human Relationship
|
||||||
|
- [ ] Products, Services or Stock
|
||||||
|
- [ ] Project or collaborative
|
||||||
|
- [ ] Interfaces
|
||||||
|
- [ ] Other
|
||||||
|
- [ ] Reporting or search
|
||||||
|
- [ ] User's interface
|
||||||
|
- [ ] 2Report sub-modules
|
||||||
|
- [ ] Accountancy
|
||||||
|
|
||||||
|
*The list may change. Check [Dolistore](https://dolistore.com) for up-to-date information.*
|
||||||
|
|
||||||
|
### Short description
|
||||||
|
|
||||||
|
A short description of the modules main features.
|
||||||
|
400 characters max.
|
||||||
|
|
||||||
|
### Keywords
|
||||||
|
|
||||||
|
Comma separated lists.
|
||||||
|
eg: ```template,dev,module```
|
||||||
|
|
||||||
|
### Long description
|
||||||
|
|
||||||
|
The long description of your module.
|
||||||
|
|
||||||
|
Suggested technical data:
|
||||||
|
|
||||||
|
Version: 1.0.0
|
||||||
|
Publisher: MyCompany
|
||||||
|
Licence: GPLv3+
|
||||||
|
User interface language(s): English
|
||||||
|
Help/Support: None / Forum www.dolibarr.org / Mail at contact@example.com
|
||||||
|
Prerequisites:
|
||||||
|
- Dolibarr min version: 3.8
|
||||||
|
- Dolibarr max version: 3.9.*
|
||||||
|
- PHP: ≥5.3
|
||||||
|
Install:
|
||||||
|
- Download the module's archive file (.zip file) from DoliStore.com.
|
||||||
|
- Put the file into the custom directory of Dolibarr.
|
||||||
|
- Uncompress the zip file, for example with ```unzip modulefile_version.zip``` command.
|
||||||
|
- Module is then available and can be activated.
|
||||||
1
htdocs/modulebuilder/template/dev/dolistore/name-de.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Mein modul
|
||||||
1
htdocs/modulebuilder/template/dev/dolistore/name-en.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
My module
|
||||||
1
htdocs/modulebuilder/template/dev/dolistore/name-es.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
My módulo
|
||||||
1
htdocs/modulebuilder/template/dev/dolistore/name-fr.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Mon module
|
||||||
1
htdocs/modulebuilder/template/dev/dolistore/name-it.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
Il mio modulo
|
||||||
2
htdocs/modulebuilder/template/dev/git-hooks/post-commit
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
composer git_post_commit
|
||||||
2
htdocs/modulebuilder/template/dev/git-hooks/pre-commit
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
composer git_pre_commit
|
||||||
2
htdocs/modulebuilder/template/dev/git-hooks/pre-push
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
composer git_pre_push
|
||||||
53
htdocs/modulebuilder/template/dev/img/README.md
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
Source images
|
||||||
|
=============
|
||||||
|
|
||||||
|
Used to generate icons and publication assets.
|
||||||
|
|
||||||
|
Icons
|
||||||
|
-----
|
||||||
|
|
||||||
|
### Dolibarr
|
||||||
|
|
||||||
|
These resides in the [/img](../../img) directory.
|
||||||
|
|
||||||
|
#### Small
|
||||||
|
|
||||||
|
Required.
|
||||||
|
Name must begin by ```object_```.
|
||||||
|
|
||||||
|
- Sample:  [object_mymodule.png](../../img/object_mymodule.png)
|
||||||
|
- Size: 14×14 pixels
|
||||||
|
- Type: PNG
|
||||||
|
|
||||||
|
#### Large
|
||||||
|
|
||||||
|
Optional.
|
||||||
|
|
||||||
|
- Sample:  [mymodule.png](../../img/mymodule.png)
|
||||||
|
- Size: 32×32 pixels
|
||||||
|
- Type: PNG
|
||||||
|
|
||||||
|
### Dolistore
|
||||||
|
|
||||||
|
Designed to fit a 512×512 icon + publisher branding.
|
||||||
|
|
||||||
|
- Size: 704×704
|
||||||
|
- Type: PNG
|
||||||
|
|
||||||
|
Export to 512×512
|
||||||
|
|
||||||
|
### Transifex
|
||||||
|
|
||||||
|
- Size: 96×96
|
||||||
|
- Type: PNG
|
||||||
|
|
||||||
|
### Others
|
||||||
|
|
||||||
|
To be on the safe side, you may also want to generate all popular sizes:
|
||||||
|
- 16×16
|
||||||
|
- 32×32
|
||||||
|
- 48×48
|
||||||
|
- 64×64
|
||||||
|
- 128×128
|
||||||
|
- 256×256
|
||||||
|
- 512×512
|
||||||
BIN
htdocs/modulebuilder/template/dev/img/gfdl-129x44.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
htdocs/modulebuilder/template/dev/img/gfdl-66x23.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
110
htdocs/modulebuilder/template/dev/img/gfdl-logo.svg
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="110.72372"
|
||||||
|
height="37.900333"
|
||||||
|
id="svg3330"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.48.0 r9654"
|
||||||
|
sodipodi:docname="New document 4">
|
||||||
|
<defs
|
||||||
|
id="defs3332" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="3.959798"
|
||||||
|
inkscape:cx="51.755214"
|
||||||
|
inkscape:cy="19.316583"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
fit-margin-top="0"
|
||||||
|
fit-margin-left="0"
|
||||||
|
fit-margin-right="0"
|
||||||
|
fit-margin-bottom="0"
|
||||||
|
inkscape:window-width="1680"
|
||||||
|
inkscape:window-height="950"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="27"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata3335">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-319.64995,-513.41138)">
|
||||||
|
<g
|
||||||
|
id="g5424"
|
||||||
|
transform="matrix(1.1204236,0,0,1.1204236,378.23897,-788.71491)">
|
||||||
|
<path
|
||||||
|
sodipodi:nodetypes="cccccc"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="rect6744"
|
||||||
|
d="m -51.39745,1163.0948 85,0 0,29.5252 -85,0 2,-14.7626 z"
|
||||||
|
style="fill:#f5efbc;fill-opacity:1;stroke:#000000;stroke-width:1.79999995;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dashoffset:0" />
|
||||||
|
<text
|
||||||
|
transform="scale(0.90245956,1.1080829)"
|
||||||
|
sodipodi:linespacing="125%"
|
||||||
|
id="text6752-6"
|
||||||
|
y="1071.2108"
|
||||||
|
x="-15.68348"
|
||||||
|
style="font-size:24.31293869px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:center;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Ubuntu;-inkscape-font-specification:Ubuntu Bold"
|
||||||
|
xml:space="preserve"><tspan
|
||||||
|
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-family:URW Palladio L;-inkscape-font-specification:URW Palladio L Bold"
|
||||||
|
y="1071.2108"
|
||||||
|
x="-15.68348"
|
||||||
|
id="tspan6754-4"
|
||||||
|
sodipodi:role="line">GFDL</tspan></text>
|
||||||
|
<path
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path7064-6"
|
||||||
|
d="m 19.61576,1166.8577 0,24 0.1875,0 c -0.12127,0.1989 -0.1875,0.4164 -0.1875,0.625 0,2.002 5.8203,3.625 13,3.625 7.1797,0 13,-1.623 13,-3.625 0,-0.2086 -0.0662,-0.4261 -0.1875,-0.625 l 0.1875,0 0,-24 -26,0 z"
|
||||||
|
style="color:#000000;fill:#f5efbc;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.79999995;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" />
|
||||||
|
<path
|
||||||
|
transform="translate(-321.63424,901.70446)"
|
||||||
|
d="m 367.25,264.98718 c 0,2.00203 -5.8203,3.625 -13,3.625 -7.1797,0 -13,-1.62297 -13,-3.625 0,-2.00203 5.8203,-3.625 13,-3.625 7.1797,0 13,1.62297 13,3.625 z"
|
||||||
|
sodipodi:ry="3.625"
|
||||||
|
sodipodi:rx="13"
|
||||||
|
sodipodi:cy="264.98718"
|
||||||
|
sodipodi:cx="354.25"
|
||||||
|
id="path7064"
|
||||||
|
style="color:#000000;fill:#f5efbc;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1.79999995;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||||
|
sodipodi:type="arc" />
|
||||||
|
<path
|
||||||
|
sodipodi:nodetypes="cccccc"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path7104"
|
||||||
|
d="m 45.06778,1167.3815 c -2.44864,5.5993 -9.9067,7.192 -21.52831,5.7955 l 5.7779,9.7599 -6.02275,7.2171 c 7.75095,3.1192 17.18643,1.5723 22.07112,-0.1842 z"
|
||||||
|
style="fill:#2e439b;fill-opacity:1;stroke:#000000;stroke-width:1.39999986;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||||
|
<path
|
||||||
|
sodipodi:nodetypes="ccscc"
|
||||||
|
inkscape:connector-curvature="0"
|
||||||
|
id="path7106"
|
||||||
|
d="m 34.45935,1165.7653 c -3.4695,-0.1017 -8.01646,0.018 -10.47747,0.7778 1.2102,0.9782 6.11198,1.5627 9.94714,1.2348 3.20297,-0.2738 6.08198,-0.1311 7.93857,-1.1503 -0.70667,-1.1077 -3.93837,-3.3774 -7.91865,-3.2613"
|
||||||
|
style="fill:none;stroke:#000000;stroke-width:1.39999998;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
|
||||||
|
</g>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 5.2 KiB |
389
htdocs/modulebuilder/template/dev/img/gpl-v3-logo.svg
Normal file
|
After Width: | Height: | Size: 80 KiB |
BIN
htdocs/modulebuilder/template/dev/img/gplv3-127x51.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
BIN
htdocs/modulebuilder/template/dev/img/gplv3-88x31.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
70
htdocs/modulebuilder/template/dev/img/mymodule.svg
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="14"
|
||||||
|
height="14"
|
||||||
|
id="svg2"
|
||||||
|
version="1.1"
|
||||||
|
inkscape:version="0.48.3.1 r9886"
|
||||||
|
sodipodi:docname="object_mymodule.svg"
|
||||||
|
inkscape:export-filename="/home/raph/Travail/src/zenfusion-modules/img/object_mymodule.png"
|
||||||
|
inkscape:export-xdpi="90"
|
||||||
|
inkscape:export-ydpi="90">
|
||||||
|
<defs
|
||||||
|
id="defs4" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="3.959798"
|
||||||
|
inkscape:cx="24.310822"
|
||||||
|
inkscape:cy="18.155032"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1021"
|
||||||
|
inkscape:window-x="1080"
|
||||||
|
inkscape:window-y="867"
|
||||||
|
inkscape:window-maximized="1" />
|
||||||
|
<metadata
|
||||||
|
id="metadata7">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="Calque 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(0,-1038.3622)">
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:12.99629784px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:DejaVu Serif;-inkscape-font-specification:DejaVu Serif"
|
||||||
|
x="0.35272363"
|
||||||
|
y="1050.0994"
|
||||||
|
id="text2985"
|
||||||
|
sodipodi:linespacing="125%"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan2987"
|
||||||
|
x="0.35272363"
|
||||||
|
y="1050.0994">M</tspan></text>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 2.2 KiB |
68
htdocs/modulebuilder/template/dev/newmodule.sh
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Copyright (C) 2014 Raphaël Doursenaud
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
VERSION=0.0.1
|
||||||
|
USAGE="Usage: newmodule.sh NewName"
|
||||||
|
|
||||||
|
# TODO: check depedencies presence (find, sed and rename)
|
||||||
|
# TODO: allow execution from build directory
|
||||||
|
# TODO: validate parameter
|
||||||
|
# TODO: use multiple word parameter, for example "My module is awesome" which should lead to "MyModuleIsAwesome" and "mymoduleisawesome" so we can also fix language strings
|
||||||
|
# TODO: add module ID management (language files…)
|
||||||
|
# TODO: add oneliner description management
|
||||||
|
# TODO: add copyright management
|
||||||
|
|
||||||
|
if [ $# == 0 ] ; then
|
||||||
|
echo ${USAGE}
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
ToLower () {
|
||||||
|
echo $(echo $1 | tr '[:upper:]' '[:lower:]')
|
||||||
|
}
|
||||||
|
ToUpper () {
|
||||||
|
echo $(echo $1 | tr '[:lower:]' '[:upper:]')
|
||||||
|
}
|
||||||
|
|
||||||
|
CAMELORIG="MyModule"
|
||||||
|
LOWERORIG=$(ToLower ${CAMELORIG})
|
||||||
|
UPPERORIG=$(ToUpper ${CAMELORIG})
|
||||||
|
cameltarget=$(echo $1)
|
||||||
|
lowertarget=$(ToLower $1)
|
||||||
|
uppertarget=$(ToUpper $1)
|
||||||
|
thisscript=`basename $0`
|
||||||
|
|
||||||
|
# Rewrite occurences
|
||||||
|
find . -not -iwholename '*.git*' -not -name "${thisscript}" -type f -print0 | xargs -0 sed -i'' -e"s/${CAMELORIG}/${cameltarget}/g"
|
||||||
|
find . -not -iwholename '*.git*' -not -name "${thisscript}" -type f -print0 | xargs -0 sed -i'' -e"s/${LOWERORIG}/${lowertarget}/g"
|
||||||
|
find . -not -iwholename '*.git*' -not -name "${thisscript}" -type f -print0 | xargs -0 sed -i'' -e"s/${UPPERORIG}/${uppertarget}/g"
|
||||||
|
|
||||||
|
# Rename files
|
||||||
|
for file in $(find . -not -iwholename '*.git*' -name "*${CAMELORIG}*" -type f)
|
||||||
|
do
|
||||||
|
rename ${CAMELORIG} ${cameltarget} ${file}
|
||||||
|
done
|
||||||
|
for file in $(find . -not -iwholename '*.git*' -name "*${LOWERORIG}*" -type f)
|
||||||
|
do
|
||||||
|
rename ${LOWERORIG} ${lowertarget} ${file}
|
||||||
|
done
|
||||||
|
for file in $(find . -not -iwholename '*.git*' -name "*${UPPERORIG}*" -type f)
|
||||||
|
do
|
||||||
|
rename ${UPPERORIG} ${uppertarget} ${file}
|
||||||
|
done
|
||||||
|
|
||||||
|
# TODO: add instructions about renaming vars (ack --php -i my)
|
||||||
|
# TODO: add instructions about renaming files (ls -R|grep -i my)
|
||||||
225
htdocs/modulebuilder/template/doc/user/Makefile
Normal file
@@ -0,0 +1,225 @@
|
|||||||
|
# Makefile for Sphinx documentation
|
||||||
|
#
|
||||||
|
|
||||||
|
# You can set these variables from the command line.
|
||||||
|
SPHINXOPTS =
|
||||||
|
SPHINXBUILD = sphinx-build
|
||||||
|
PAPER =
|
||||||
|
BUILDDIR = build
|
||||||
|
|
||||||
|
# Internal variables.
|
||||||
|
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||||
|
PAPEROPT_letter = -D latex_paper_size=letter
|
||||||
|
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||||
|
# the i18n builder cannot share the environment and doctrees with the others
|
||||||
|
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||||
|
|
||||||
|
.PHONY: help
|
||||||
|
help:
|
||||||
|
@echo "Please use \`make <target>' where <target> is one of"
|
||||||
|
@echo " html to make standalone HTML files"
|
||||||
|
@echo " dirhtml to make HTML files named index.html in directories"
|
||||||
|
@echo " singlehtml to make a single large HTML file"
|
||||||
|
@echo " pickle to make pickle files"
|
||||||
|
@echo " json to make JSON files"
|
||||||
|
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||||
|
@echo " qthelp to make HTML files and a qthelp project"
|
||||||
|
@echo " applehelp to make an Apple Help Book"
|
||||||
|
@echo " devhelp to make HTML files and a Devhelp project"
|
||||||
|
@echo " epub to make an epub"
|
||||||
|
@echo " epub3 to make an epub3"
|
||||||
|
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||||
|
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||||
|
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
||||||
|
@echo " text to make text files"
|
||||||
|
@echo " man to make manual pages"
|
||||||
|
@echo " texinfo to make Texinfo files"
|
||||||
|
@echo " info to make Texinfo files and run them through makeinfo"
|
||||||
|
@echo " gettext to make PO message catalogs"
|
||||||
|
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||||
|
@echo " xml to make Docutils-native XML files"
|
||||||
|
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
||||||
|
@echo " linkcheck to check all external links for integrity"
|
||||||
|
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||||
|
@echo " coverage to run coverage check of the documentation (if enabled)"
|
||||||
|
@echo " dummy to check syntax errors of document sources"
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf $(BUILDDIR)/*
|
||||||
|
|
||||||
|
.PHONY: html
|
||||||
|
html:
|
||||||
|
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||||
|
|
||||||
|
.PHONY: dirhtml
|
||||||
|
dirhtml:
|
||||||
|
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||||
|
|
||||||
|
.PHONY: singlehtml
|
||||||
|
singlehtml:
|
||||||
|
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||||
|
|
||||||
|
.PHONY: pickle
|
||||||
|
pickle:
|
||||||
|
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can process the pickle files."
|
||||||
|
|
||||||
|
.PHONY: json
|
||||||
|
json:
|
||||||
|
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can process the JSON files."
|
||||||
|
|
||||||
|
.PHONY: htmlhelp
|
||||||
|
htmlhelp:
|
||||||
|
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||||
|
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||||
|
|
||||||
|
.PHONY: qthelp
|
||||||
|
qthelp:
|
||||||
|
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||||
|
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||||
|
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Mymodule.qhcp"
|
||||||
|
@echo "To view the help file:"
|
||||||
|
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Mymodule.qhc"
|
||||||
|
|
||||||
|
.PHONY: applehelp
|
||||||
|
applehelp:
|
||||||
|
$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The help book is in $(BUILDDIR)/applehelp."
|
||||||
|
@echo "N.B. You won't be able to view it unless you put it in" \
|
||||||
|
"~/Library/Documentation/Help or install it in your application" \
|
||||||
|
"bundle."
|
||||||
|
|
||||||
|
.PHONY: devhelp
|
||||||
|
devhelp:
|
||||||
|
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||||
|
@echo
|
||||||
|
@echo "Build finished."
|
||||||
|
@echo "To view the help file:"
|
||||||
|
@echo "# mkdir -p $$HOME/.local/share/devhelp/Mymodule"
|
||||||
|
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Mymodule"
|
||||||
|
@echo "# devhelp"
|
||||||
|
|
||||||
|
.PHONY: epub
|
||||||
|
epub:
|
||||||
|
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||||
|
|
||||||
|
.PHONY: epub3
|
||||||
|
epub3:
|
||||||
|
$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3."
|
||||||
|
|
||||||
|
.PHONY: latex
|
||||||
|
latex:
|
||||||
|
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||||
|
@echo
|
||||||
|
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||||
|
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||||
|
"(use \`make latexpdf' here to do that automatically)."
|
||||||
|
|
||||||
|
.PHONY: latexpdf
|
||||||
|
latexpdf:
|
||||||
|
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||||
|
@echo "Running LaTeX files through pdflatex..."
|
||||||
|
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||||
|
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||||
|
|
||||||
|
.PHONY: latexpdfja
|
||||||
|
latexpdfja:
|
||||||
|
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||||
|
@echo "Running LaTeX files through platex and dvipdfmx..."
|
||||||
|
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
||||||
|
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||||
|
|
||||||
|
.PHONY: text
|
||||||
|
text:
|
||||||
|
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||||
|
|
||||||
|
.PHONY: man
|
||||||
|
man:
|
||||||
|
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||||
|
|
||||||
|
.PHONY: texinfo
|
||||||
|
texinfo:
|
||||||
|
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||||
|
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||||
|
"(use \`make info' here to do that automatically)."
|
||||||
|
|
||||||
|
.PHONY: info
|
||||||
|
info:
|
||||||
|
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||||
|
@echo "Running Texinfo files through makeinfo..."
|
||||||
|
make -C $(BUILDDIR)/texinfo info
|
||||||
|
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||||
|
|
||||||
|
.PHONY: gettext
|
||||||
|
gettext:
|
||||||
|
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||||
|
|
||||||
|
.PHONY: changes
|
||||||
|
changes:
|
||||||
|
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||||
|
@echo
|
||||||
|
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||||
|
|
||||||
|
.PHONY: linkcheck
|
||||||
|
linkcheck:
|
||||||
|
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||||
|
@echo
|
||||||
|
@echo "Link check complete; look for any errors in the above output " \
|
||||||
|
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||||
|
|
||||||
|
.PHONY: doctest
|
||||||
|
doctest:
|
||||||
|
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||||
|
@echo "Testing of doctests in the sources finished, look at the " \
|
||||||
|
"results in $(BUILDDIR)/doctest/output.txt."
|
||||||
|
|
||||||
|
.PHONY: coverage
|
||||||
|
coverage:
|
||||||
|
$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage
|
||||||
|
@echo "Testing of coverage in the sources finished, look at the " \
|
||||||
|
"results in $(BUILDDIR)/coverage/python.txt."
|
||||||
|
|
||||||
|
.PHONY: xml
|
||||||
|
xml:
|
||||||
|
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
||||||
|
|
||||||
|
.PHONY: pseudoxml
|
||||||
|
pseudoxml:
|
||||||
|
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
||||||
|
|
||||||
|
.PHONY: dummy
|
||||||
|
dummy:
|
||||||
|
$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy
|
||||||
|
@echo
|
||||||
|
@echo "Build finished. Dummy builder generates no files."
|
||||||
281
htdocs/modulebuilder/template/doc/user/make.bat
Normal file
@@ -0,0 +1,281 @@
|
|||||||
|
@ECHO OFF
|
||||||
|
|
||||||
|
REM Command file for Sphinx documentation
|
||||||
|
|
||||||
|
if "%SPHINXBUILD%" == "" (
|
||||||
|
set SPHINXBUILD=sphinx-build
|
||||||
|
)
|
||||||
|
set BUILDDIR=build
|
||||||
|
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
|
||||||
|
set I18NSPHINXOPTS=%SPHINXOPTS% source
|
||||||
|
if NOT "%PAPER%" == "" (
|
||||||
|
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
||||||
|
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "" goto help
|
||||||
|
|
||||||
|
if "%1" == "help" (
|
||||||
|
:help
|
||||||
|
echo.Please use `make ^<target^>` where ^<target^> is one of
|
||||||
|
echo. html to make standalone HTML files
|
||||||
|
echo. dirhtml to make HTML files named index.html in directories
|
||||||
|
echo. singlehtml to make a single large HTML file
|
||||||
|
echo. pickle to make pickle files
|
||||||
|
echo. json to make JSON files
|
||||||
|
echo. htmlhelp to make HTML files and a HTML help project
|
||||||
|
echo. qthelp to make HTML files and a qthelp project
|
||||||
|
echo. devhelp to make HTML files and a Devhelp project
|
||||||
|
echo. epub to make an epub
|
||||||
|
echo. epub3 to make an epub3
|
||||||
|
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
||||||
|
echo. text to make text files
|
||||||
|
echo. man to make manual pages
|
||||||
|
echo. texinfo to make Texinfo files
|
||||||
|
echo. gettext to make PO message catalogs
|
||||||
|
echo. changes to make an overview over all changed/added/deprecated items
|
||||||
|
echo. xml to make Docutils-native XML files
|
||||||
|
echo. pseudoxml to make pseudoxml-XML files for display purposes
|
||||||
|
echo. linkcheck to check all external links for integrity
|
||||||
|
echo. doctest to run all doctests embedded in the documentation if enabled
|
||||||
|
echo. coverage to run coverage check of the documentation if enabled
|
||||||
|
echo. dummy to check syntax errors of document sources
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "clean" (
|
||||||
|
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
||||||
|
del /q /s %BUILDDIR%\*
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
REM Check if sphinx-build is available and fallback to Python version if any
|
||||||
|
%SPHINXBUILD% 1>NUL 2>NUL
|
||||||
|
if errorlevel 9009 goto sphinx_python
|
||||||
|
goto sphinx_ok
|
||||||
|
|
||||||
|
:sphinx_python
|
||||||
|
|
||||||
|
set SPHINXBUILD=python -m sphinx.__init__
|
||||||
|
%SPHINXBUILD% 2> nul
|
||||||
|
if errorlevel 9009 (
|
||||||
|
echo.
|
||||||
|
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||||
|
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||||
|
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||||
|
echo.may add the Sphinx directory to PATH.
|
||||||
|
echo.
|
||||||
|
echo.If you don't have Sphinx installed, grab it from
|
||||||
|
echo.http://sphinx-doc.org/
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
:sphinx_ok
|
||||||
|
|
||||||
|
|
||||||
|
if "%1" == "html" (
|
||||||
|
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "dirhtml" (
|
||||||
|
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "singlehtml" (
|
||||||
|
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "pickle" (
|
||||||
|
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; now you can process the pickle files.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "json" (
|
||||||
|
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; now you can process the JSON files.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "htmlhelp" (
|
||||||
|
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; now you can run HTML Help Workshop with the ^
|
||||||
|
.hhp project file in %BUILDDIR%/htmlhelp.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "qthelp" (
|
||||||
|
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
||||||
|
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
||||||
|
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Mymodule.qhcp
|
||||||
|
echo.To view the help file:
|
||||||
|
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Mymodule.ghc
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "devhelp" (
|
||||||
|
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "epub" (
|
||||||
|
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "epub3" (
|
||||||
|
%SPHINXBUILD% -b epub3 %ALLSPHINXOPTS% %BUILDDIR%/epub3
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The epub3 file is in %BUILDDIR%/epub3.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "latex" (
|
||||||
|
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "latexpdf" (
|
||||||
|
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||||
|
cd %BUILDDIR%/latex
|
||||||
|
make all-pdf
|
||||||
|
cd %~dp0
|
||||||
|
echo.
|
||||||
|
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "latexpdfja" (
|
||||||
|
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||||
|
cd %BUILDDIR%/latex
|
||||||
|
make all-pdf-ja
|
||||||
|
cd %~dp0
|
||||||
|
echo.
|
||||||
|
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "text" (
|
||||||
|
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The text files are in %BUILDDIR%/text.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "man" (
|
||||||
|
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "texinfo" (
|
||||||
|
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "gettext" (
|
||||||
|
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "changes" (
|
||||||
|
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.The overview file is in %BUILDDIR%/changes.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "linkcheck" (
|
||||||
|
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Link check complete; look for any errors in the above output ^
|
||||||
|
or in %BUILDDIR%/linkcheck/output.txt.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "doctest" (
|
||||||
|
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Testing of doctests in the sources finished, look at the ^
|
||||||
|
results in %BUILDDIR%/doctest/output.txt.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "coverage" (
|
||||||
|
%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Testing of coverage in the sources finished, look at the ^
|
||||||
|
results in %BUILDDIR%/coverage/python.txt.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "xml" (
|
||||||
|
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The XML files are in %BUILDDIR%/xml.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "pseudoxml" (
|
||||||
|
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
if "%1" == "dummy" (
|
||||||
|
%SPHINXBUILD% -b dummy %ALLSPHINXOPTS% %BUILDDIR%/dummy
|
||||||
|
if errorlevel 1 exit /b 1
|
||||||
|
echo.
|
||||||
|
echo.Build finished. Dummy builder generates no files.
|
||||||
|
goto end
|
||||||
|
)
|
||||||
|
|
||||||
|
:end
|
||||||
428
htdocs/modulebuilder/template/doc/user/source/conf.py
Normal file
@@ -0,0 +1,428 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# My Module documentation build configuration file, created by
|
||||||
|
# sphinx-quickstart on Mon Sep 26 17:54:17 2016.
|
||||||
|
#
|
||||||
|
# This file is execfile()d with the current directory set to its
|
||||||
|
# containing dir.
|
||||||
|
#
|
||||||
|
# Note that not all possible configuration values are present in this
|
||||||
|
# autogenerated file.
|
||||||
|
#
|
||||||
|
# All configuration values have a default; values that are commented out
|
||||||
|
# serve to show the default.
|
||||||
|
|
||||||
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
|
#
|
||||||
|
# import os
|
||||||
|
# import sys
|
||||||
|
# sys.path.insert(0, os.path.abspath('.'))
|
||||||
|
|
||||||
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
|
# If your documentation needs a minimal Sphinx version, state it here.
|
||||||
|
#
|
||||||
|
# needs_sphinx = '1.0'
|
||||||
|
|
||||||
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
|
# ones.
|
||||||
|
extensions = [
|
||||||
|
'sphinx.ext.todo',
|
||||||
|
'sphinx.ext.imgmath',
|
||||||
|
'sphinx.ext.githubpages',
|
||||||
|
]
|
||||||
|
|
||||||
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
|
templates_path = ['_templates']
|
||||||
|
|
||||||
|
# The suffix(es) of source filenames.
|
||||||
|
# You can specify multiple suffix as a list of string:
|
||||||
|
#
|
||||||
|
# source_suffix = ['.rst', '.md']
|
||||||
|
source_suffix = '.rst'
|
||||||
|
|
||||||
|
# The encoding of source files.
|
||||||
|
#
|
||||||
|
# source_encoding = 'utf-8-sig'
|
||||||
|
|
||||||
|
# The master toctree document.
|
||||||
|
master_doc = 'index'
|
||||||
|
|
||||||
|
# General information about the project.
|
||||||
|
project = 'My Module'
|
||||||
|
copyright = '2016, Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>'
|
||||||
|
author = 'Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>'
|
||||||
|
|
||||||
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
|
# |version| and |release|, also used in various other places throughout the
|
||||||
|
# built documents.
|
||||||
|
#
|
||||||
|
# The short X.Y version.
|
||||||
|
version = 'development'
|
||||||
|
# The full version, including alpha/beta/rc tags.
|
||||||
|
release = 'development'
|
||||||
|
|
||||||
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
|
# for a list of supported languages.
|
||||||
|
#
|
||||||
|
# This is also used if you do content translation via gettext catalogs.
|
||||||
|
# Usually you set "language" from the command line for these cases.
|
||||||
|
language = None
|
||||||
|
|
||||||
|
# There are two options for replacing |today|: either, you set today to some
|
||||||
|
# non-false value, then it is used:
|
||||||
|
#
|
||||||
|
# today = ''
|
||||||
|
#
|
||||||
|
# Else, today_fmt is used as the format for a strftime call.
|
||||||
|
#
|
||||||
|
# today_fmt = '%B %d, %Y'
|
||||||
|
|
||||||
|
# List of patterns, relative to source directory, that match files and
|
||||||
|
# directories to ignore when looking for source files.
|
||||||
|
# This patterns also effect to html_static_path and html_extra_path
|
||||||
|
exclude_patterns = []
|
||||||
|
|
||||||
|
# The reST default role (used for this markup: `text`) to use for all
|
||||||
|
# documents.
|
||||||
|
#
|
||||||
|
# default_role = None
|
||||||
|
|
||||||
|
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||||
|
#
|
||||||
|
# add_function_parentheses = True
|
||||||
|
|
||||||
|
# If true, the current module name will be prepended to all description
|
||||||
|
# unit titles (such as .. function::).
|
||||||
|
#
|
||||||
|
# add_module_names = True
|
||||||
|
|
||||||
|
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||||
|
# output. They are ignored by default.
|
||||||
|
#
|
||||||
|
# show_authors = False
|
||||||
|
|
||||||
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
|
pygments_style = 'sphinx'
|
||||||
|
|
||||||
|
# A list of ignored prefixes for module index sorting.
|
||||||
|
# modindex_common_prefix = []
|
||||||
|
|
||||||
|
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||||
|
# keep_warnings = False
|
||||||
|
|
||||||
|
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||||
|
todo_include_todos = True
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for HTML output ----------------------------------------------
|
||||||
|
|
||||||
|
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||||
|
# a list of builtin themes.
|
||||||
|
#
|
||||||
|
html_theme = 'alabaster'
|
||||||
|
|
||||||
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
|
# further. For a list of options available for each theme, see the
|
||||||
|
# documentation.
|
||||||
|
#
|
||||||
|
# html_theme_options = {}
|
||||||
|
|
||||||
|
# Add any paths that contain custom themes here, relative to this directory.
|
||||||
|
# html_theme_path = []
|
||||||
|
|
||||||
|
# The name for this set of Sphinx documents.
|
||||||
|
# "<project> v<release> documentation" by default.
|
||||||
|
#
|
||||||
|
# html_title = 'My Module vdevelopment'
|
||||||
|
|
||||||
|
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||||
|
#
|
||||||
|
# html_short_title = None
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to place at the top
|
||||||
|
# of the sidebar.
|
||||||
|
#
|
||||||
|
# html_logo = None
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to use as a favicon of
|
||||||
|
# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||||
|
# pixels large.
|
||||||
|
#
|
||||||
|
# html_favicon = None
|
||||||
|
|
||||||
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
|
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||||
|
html_static_path = ['_static']
|
||||||
|
|
||||||
|
# Add any extra paths that contain custom files (such as robots.txt or
|
||||||
|
# .htaccess) here, relative to this directory. These files are copied
|
||||||
|
# directly to the root of the documentation.
|
||||||
|
#
|
||||||
|
# html_extra_path = []
|
||||||
|
|
||||||
|
# If not None, a 'Last updated on:' timestamp is inserted at every page
|
||||||
|
# bottom, using the given strftime format.
|
||||||
|
# The empty string is equivalent to '%b %d, %Y'.
|
||||||
|
#
|
||||||
|
# html_last_updated_fmt = None
|
||||||
|
|
||||||
|
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||||
|
# typographically correct entities.
|
||||||
|
#
|
||||||
|
# html_use_smartypants = True
|
||||||
|
|
||||||
|
# Custom sidebar templates, maps document names to template names.
|
||||||
|
#
|
||||||
|
# html_sidebars = {}
|
||||||
|
|
||||||
|
# Additional templates that should be rendered to pages, maps page names to
|
||||||
|
# template names.
|
||||||
|
#
|
||||||
|
# html_additional_pages = {}
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#
|
||||||
|
# html_domain_indices = True
|
||||||
|
|
||||||
|
# If false, no index is generated.
|
||||||
|
#
|
||||||
|
# html_use_index = True
|
||||||
|
|
||||||
|
# If true, the index is split into individual pages for each letter.
|
||||||
|
#
|
||||||
|
# html_split_index = False
|
||||||
|
|
||||||
|
# If true, links to the reST sources are added to the pages.
|
||||||
|
#
|
||||||
|
# html_show_sourcelink = True
|
||||||
|
|
||||||
|
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||||
|
#
|
||||||
|
# html_show_sphinx = True
|
||||||
|
|
||||||
|
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||||
|
#
|
||||||
|
# html_show_copyright = True
|
||||||
|
|
||||||
|
# If true, an OpenSearch description file will be output, and all pages will
|
||||||
|
# contain a <link> tag referring to it. The value of this option must be the
|
||||||
|
# base URL from which the finished HTML is served.
|
||||||
|
#
|
||||||
|
# html_use_opensearch = ''
|
||||||
|
|
||||||
|
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||||
|
# html_file_suffix = None
|
||||||
|
|
||||||
|
# Language to be used for generating the HTML full-text search index.
|
||||||
|
# Sphinx supports the following languages:
|
||||||
|
# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja'
|
||||||
|
# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh'
|
||||||
|
#
|
||||||
|
# html_search_language = 'en'
|
||||||
|
|
||||||
|
# A dictionary with options for the search language support, empty by default.
|
||||||
|
# 'ja' uses this config value.
|
||||||
|
# 'zh' user can custom change `jieba` dictionary path.
|
||||||
|
#
|
||||||
|
# html_search_options = {'type': 'default'}
|
||||||
|
|
||||||
|
# The name of a javascript file (relative to the configuration directory) that
|
||||||
|
# implements a search results scorer. If empty, the default will be used.
|
||||||
|
#
|
||||||
|
# html_search_scorer = 'scorer.js'
|
||||||
|
|
||||||
|
# Output file base name for HTML help builder.
|
||||||
|
htmlhelp_basename = 'Mymoduledoc'
|
||||||
|
|
||||||
|
# -- Options for LaTeX output ---------------------------------------------
|
||||||
|
|
||||||
|
latex_elements = {
|
||||||
|
# The paper size ('letterpaper' or 'a4paper').
|
||||||
|
#
|
||||||
|
# 'papersize': 'letterpaper',
|
||||||
|
|
||||||
|
# The font size ('10pt', '11pt' or '12pt').
|
||||||
|
#
|
||||||
|
# 'pointsize': '10pt',
|
||||||
|
|
||||||
|
# Additional stuff for the LaTeX preamble.
|
||||||
|
#
|
||||||
|
# 'preamble': '',
|
||||||
|
|
||||||
|
# Latex figure (float) alignment
|
||||||
|
#
|
||||||
|
# 'figure_align': 'htbp',
|
||||||
|
}
|
||||||
|
|
||||||
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
|
# (source start file, target name, title,
|
||||||
|
# author, documentclass [howto, manual, or own class]).
|
||||||
|
latex_documents = [
|
||||||
|
(master_doc, 'Mymodule.tex', 'My Module Documentation',
|
||||||
|
'Raphaël Doursenaud \\textless{}rdoursenaud@gpcsolutions.fr\\textgreater{}', 'manual'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
|
# the title page.
|
||||||
|
#
|
||||||
|
# latex_logo = None
|
||||||
|
|
||||||
|
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||||
|
# not chapters.
|
||||||
|
#
|
||||||
|
# latex_use_parts = False
|
||||||
|
|
||||||
|
# If true, show page references after internal links.
|
||||||
|
#
|
||||||
|
# latex_show_pagerefs = False
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
#
|
||||||
|
# latex_show_urls = False
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
#
|
||||||
|
# latex_appendices = []
|
||||||
|
|
||||||
|
# It false, will not define \strong, \code, itleref, \crossref ... but only
|
||||||
|
# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added
|
||||||
|
# packages.
|
||||||
|
#
|
||||||
|
# latex_keep_old_macro_names = True
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#
|
||||||
|
# latex_domain_indices = True
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for manual page output ---------------------------------------
|
||||||
|
|
||||||
|
# One entry per manual page. List of tuples
|
||||||
|
# (source start file, name, description, authors, manual section).
|
||||||
|
man_pages = [
|
||||||
|
(master_doc, 'mymodule', 'My Module Documentation',
|
||||||
|
[author], 1)
|
||||||
|
]
|
||||||
|
|
||||||
|
# If true, show URL addresses after external links.
|
||||||
|
#
|
||||||
|
# man_show_urls = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for Texinfo output -------------------------------------------
|
||||||
|
|
||||||
|
# Grouping the document tree into Texinfo files. List of tuples
|
||||||
|
# (source start file, target name, title, author,
|
||||||
|
# dir menu entry, description, category)
|
||||||
|
texinfo_documents = [
|
||||||
|
(master_doc, 'Mymodule', 'My Module Documentation',
|
||||||
|
author, 'Mymodule', 'One line description of project.',
|
||||||
|
'Miscellaneous'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Documents to append as an appendix to all manuals.
|
||||||
|
#
|
||||||
|
# texinfo_appendices = []
|
||||||
|
|
||||||
|
# If false, no module index is generated.
|
||||||
|
#
|
||||||
|
# texinfo_domain_indices = True
|
||||||
|
|
||||||
|
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||||
|
#
|
||||||
|
# texinfo_show_urls = 'footnote'
|
||||||
|
|
||||||
|
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||||
|
#
|
||||||
|
# texinfo_no_detailmenu = False
|
||||||
|
|
||||||
|
|
||||||
|
# -- Options for Epub output ----------------------------------------------
|
||||||
|
|
||||||
|
# Bibliographic Dublin Core info.
|
||||||
|
epub_title = project
|
||||||
|
epub_author = author
|
||||||
|
epub_publisher = author
|
||||||
|
epub_copyright = copyright
|
||||||
|
|
||||||
|
# The basename for the epub file. It defaults to the project name.
|
||||||
|
# epub_basename = project
|
||||||
|
|
||||||
|
# The HTML theme for the epub output. Since the default themes are not
|
||||||
|
# optimized for small screen space, using the same theme for HTML and epub
|
||||||
|
# output is usually not wise. This defaults to 'epub', a theme designed to save
|
||||||
|
# visual space.
|
||||||
|
#
|
||||||
|
# epub_theme = 'epub'
|
||||||
|
|
||||||
|
# The language of the text. It defaults to the language option
|
||||||
|
# or 'en' if the language is not set.
|
||||||
|
#
|
||||||
|
# epub_language = ''
|
||||||
|
|
||||||
|
# The scheme of the identifier. Typical schemes are ISBN or URL.
|
||||||
|
# epub_scheme = ''
|
||||||
|
|
||||||
|
# The unique identifier of the text. This can be a ISBN number
|
||||||
|
# or the project homepage.
|
||||||
|
#
|
||||||
|
# epub_identifier = ''
|
||||||
|
|
||||||
|
# A unique identification for the text.
|
||||||
|
#
|
||||||
|
# epub_uid = ''
|
||||||
|
|
||||||
|
# A tuple containing the cover image and cover page html template filenames.
|
||||||
|
#
|
||||||
|
# epub_cover = ()
|
||||||
|
|
||||||
|
# A sequence of (type, uri, title) tuples for the guide element of content.opf.
|
||||||
|
#
|
||||||
|
# epub_guide = ()
|
||||||
|
|
||||||
|
# HTML files that should be inserted before the pages created by sphinx.
|
||||||
|
# The format is a list of tuples containing the path and title.
|
||||||
|
#
|
||||||
|
# epub_pre_files = []
|
||||||
|
|
||||||
|
# HTML files that should be inserted after the pages created by sphinx.
|
||||||
|
# The format is a list of tuples containing the path and title.
|
||||||
|
#
|
||||||
|
# epub_post_files = []
|
||||||
|
|
||||||
|
# A list of files that should not be packed into the epub file.
|
||||||
|
epub_exclude_files = ['search.html']
|
||||||
|
|
||||||
|
# The depth of the table of contents in toc.ncx.
|
||||||
|
#
|
||||||
|
# epub_tocdepth = 3
|
||||||
|
|
||||||
|
# Allow duplicate toc entries.
|
||||||
|
#
|
||||||
|
# epub_tocdup = True
|
||||||
|
|
||||||
|
# Choose between 'default' and 'includehidden'.
|
||||||
|
#
|
||||||
|
# epub_tocscope = 'default'
|
||||||
|
|
||||||
|
# Fix unsupported image types using the Pillow.
|
||||||
|
#
|
||||||
|
# epub_fix_images = False
|
||||||
|
|
||||||
|
# Scale large images.
|
||||||
|
#
|
||||||
|
# epub_max_image_width = 0
|
||||||
|
|
||||||
|
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||||
|
#
|
||||||
|
# epub_show_urls = 'inline'
|
||||||
|
|
||||||
|
# If false, no index is generated.
|
||||||
|
#
|
||||||
|
# epub_use_index = True
|
||||||
22
htdocs/modulebuilder/template/doc/user/source/index.rst
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
.. My Module documentation master file, created by
|
||||||
|
sphinx-quickstart on Mon Sep 26 17:54:17 2016.
|
||||||
|
You can adapt this file completely to your liking, but it should at least
|
||||||
|
contain the root `toctree` directive.
|
||||||
|
|
||||||
|
Welcome to My Module's documentation!
|
||||||
|
=====================================
|
||||||
|
|
||||||
|
Contents:
|
||||||
|
|
||||||
|
.. toctree::
|
||||||
|
:maxdepth: 2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Indices and tables
|
||||||
|
==================
|
||||||
|
|
||||||
|
* :ref:`genindex`
|
||||||
|
* :ref:`modindex`
|
||||||
|
* :ref:`search`
|
||||||
|
|
||||||
BIN
htdocs/modulebuilder/template/img/gfdl.png
Normal file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
htdocs/modulebuilder/template/img/gplv3.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
htdocs/modulebuilder/template/img/mymodule.png
Normal file
|
After Width: | Height: | Size: 683 B |
BIN
htdocs/modulebuilder/template/img/object_mymodule.png
Normal file
|
After Width: | Height: | Size: 360 B |
27
htdocs/modulebuilder/template/js/myjs.js.php
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file js/myjs.js.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example JavaScript.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
header('Content-Type: application/javascript');
|
||||||
51
htdocs/modulebuilder/template/langs/en_US/mymodule.lang
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
# Copyright (C) <year> <name of author>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#
|
||||||
|
# Generic
|
||||||
|
#
|
||||||
|
|
||||||
|
# Module label 'ModuleXXXName'
|
||||||
|
# (where XXX is value of numeric property 'numero' of module)
|
||||||
|
Module500000Name = My module
|
||||||
|
# Module description 'ModuleXXXDesc'
|
||||||
|
# (where XXX is value of numeric property 'numero' of module)
|
||||||
|
Module500000Desc = My module description
|
||||||
|
|
||||||
|
#
|
||||||
|
# Admin page
|
||||||
|
#
|
||||||
|
MyModuleSetup = My module setup
|
||||||
|
Settings = Settings
|
||||||
|
MyModuleSetupPage = My module setup page
|
||||||
|
|
||||||
|
#
|
||||||
|
# About page
|
||||||
|
#
|
||||||
|
About = About
|
||||||
|
MyModuleAbout = About my module
|
||||||
|
MyModuleAboutPage = My module about page
|
||||||
|
|
||||||
|
#
|
||||||
|
# Sample page
|
||||||
|
#
|
||||||
|
MyPageName = My page name
|
||||||
|
|
||||||
|
#
|
||||||
|
# Sample box
|
||||||
|
#
|
||||||
|
MyBox = My box
|
||||||
|
MyBoxDescription = My box description
|
||||||
51
htdocs/modulebuilder/template/langs/fr_FR/mymodule.lang
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
# Copyright (C) <year> <name of author>
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#
|
||||||
|
# Générique
|
||||||
|
#
|
||||||
|
|
||||||
|
# Module label 'ModuleXXXName'
|
||||||
|
# (where XXX is value of numeric property 'numero' of module)
|
||||||
|
Module500000Name = Mon module
|
||||||
|
# Module description 'ModuleXXXDesc'
|
||||||
|
# (where XXX is value of numeric property 'numero' of module)
|
||||||
|
Module500000Desc = Description de mon module
|
||||||
|
|
||||||
|
#
|
||||||
|
# Page d'administration
|
||||||
|
#
|
||||||
|
MyModuleSetup = Configuration du module mon module
|
||||||
|
Settings = Réglages
|
||||||
|
MyModuleSetupPage = Page de réglage de mon module
|
||||||
|
|
||||||
|
#
|
||||||
|
# Page À propos
|
||||||
|
#
|
||||||
|
About = À propos
|
||||||
|
MyModuleAbout = À propos de mon module
|
||||||
|
MyModuleAboutPage = Page à propos de mon module
|
||||||
|
|
||||||
|
#
|
||||||
|
# Page d'exemple
|
||||||
|
#
|
||||||
|
MyPageName = Nom de ma page
|
||||||
|
|
||||||
|
#
|
||||||
|
# Box d'exemple
|
||||||
|
#
|
||||||
|
MyBox = Ma boîte
|
||||||
|
MyBoxDescription = Description de ma boîte
|
||||||
61
htdocs/modulebuilder/template/lib/mymodule.lib.php
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file lib/mymodule.lib.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example module library.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare admin pages header
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function mymoduleAdminPrepareHead()
|
||||||
|
{
|
||||||
|
global $langs, $conf;
|
||||||
|
|
||||||
|
$langs->load("mymodule@mymodule");
|
||||||
|
|
||||||
|
$h = 0;
|
||||||
|
$head = array();
|
||||||
|
|
||||||
|
$head[$h][0] = dol_buildpath("/mymodule/admin/setup.php", 1);
|
||||||
|
$head[$h][1] = $langs->trans("Settings");
|
||||||
|
$head[$h][2] = 'settings';
|
||||||
|
$h++;
|
||||||
|
$head[$h][0] = dol_buildpath("/mymodule/admin/about.php", 1);
|
||||||
|
$head[$h][1] = $langs->trans("About");
|
||||||
|
$head[$h][2] = 'about';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
// Show more tabs from modules
|
||||||
|
// Entries must be declared in modules descriptor with line
|
||||||
|
//$this->tabs = array(
|
||||||
|
// 'entity:+tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'
|
||||||
|
//); // to add new tab
|
||||||
|
//$this->tabs = array(
|
||||||
|
// 'entity:-tabname:Title:@mymodule:/mymodule/mypage.php?id=__ID__'
|
||||||
|
//); // to remove a tab
|
||||||
|
complete_head_from_modules($conf, $langs, $object, $head, $h, 'mymodule');
|
||||||
|
|
||||||
|
return $head;
|
||||||
|
}
|
||||||
135
htdocs/modulebuilder/template/mypage.php
Normal file
@@ -0,0 +1,135 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file mypage.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example PHP page.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1');
|
||||||
|
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1');
|
||||||
|
//if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
|
||||||
|
//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1');
|
||||||
|
// Do not check anti CSRF attack test
|
||||||
|
//if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK','1');
|
||||||
|
// Do not check style html tag into posted data
|
||||||
|
//if (! defined('NOSTYLECHECK')) define('NOSTYLECHECK','1');
|
||||||
|
// Do not check anti POST attack test
|
||||||
|
//if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL','1');
|
||||||
|
// If there is no need to load and show top and left menu
|
||||||
|
//if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU','1');
|
||||||
|
// If we don't need to load the html.form.class.php
|
||||||
|
//if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML','1');
|
||||||
|
//if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1');
|
||||||
|
// If this page is public (can be called outside logged session)
|
||||||
|
//if (! defined("NOLOGIN")) define("NOLOGIN",'1');
|
||||||
|
// Change the following lines to use the correct relative path
|
||||||
|
// (../, ../../, etc)
|
||||||
|
|
||||||
|
// Load Dolibarr environment
|
||||||
|
if (false === (@include '../../main.inc.php')) { // From htdocs directory
|
||||||
|
require '../../../main.inc.php'; // From "custom" directory
|
||||||
|
}
|
||||||
|
|
||||||
|
global $db, $langs, $user;
|
||||||
|
|
||||||
|
dol_include_once('/mymodule/class/myclass.class.php');
|
||||||
|
|
||||||
|
// Load translation files required by the page
|
||||||
|
$langs->load("mymodule@mymodule");
|
||||||
|
|
||||||
|
// Get parameters
|
||||||
|
$id = GETPOST('id', 'int');
|
||||||
|
$action = GETPOST('action', 'alpha');
|
||||||
|
$myparam = GETPOST('myparam', 'alpha');
|
||||||
|
|
||||||
|
// Access control
|
||||||
|
if ($user->socid > 0) {
|
||||||
|
// External user
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default action
|
||||||
|
if (empty($action) && empty($id) && empty($ref)) {
|
||||||
|
$action='create';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load object if id or ref is provided as parameter
|
||||||
|
$object = new MyClass($db);
|
||||||
|
if (($id > 0 || ! empty($ref)) && $action != 'add') {
|
||||||
|
$result = $object->fetch($id, $ref);
|
||||||
|
if ($result < 0) {
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ACTIONS
|
||||||
|
*
|
||||||
|
* Put here all code to do according to value of "action" parameter
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ($action == 'add') {
|
||||||
|
$myobject = new MyClass($db);
|
||||||
|
$myobject->prop1 = $_POST["field1"];
|
||||||
|
$myobject->prop2 = $_POST["field2"];
|
||||||
|
$result = $myobject->create($user);
|
||||||
|
if ($result > 0) {
|
||||||
|
// Creation OK
|
||||||
|
} {
|
||||||
|
// Creation KO
|
||||||
|
$mesg = $myobject->error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* VIEW
|
||||||
|
*
|
||||||
|
* Put here all code to build page
|
||||||
|
*/
|
||||||
|
|
||||||
|
llxHeader('', $langs->trans('MyPageName'), '');
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
// Put here content of your page
|
||||||
|
// Example 1: Adding jquery code
|
||||||
|
echo '<script type=application/javascript" language="javascript">
|
||||||
|
jQuery(document).ready(function() {
|
||||||
|
function init_myfunc()
|
||||||
|
{
|
||||||
|
jQuery("#myid")
|
||||||
|
.removeAttr(\'disabled\')
|
||||||
|
.attr(\'disabled\',\'disabled\');
|
||||||
|
}
|
||||||
|
init_myfunc();
|
||||||
|
jQuery("#mybutton").click(function() {
|
||||||
|
init_needroot();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>';
|
||||||
|
|
||||||
|
// Example 2: Adding links to objects
|
||||||
|
// The class must extend CommonObject for this method to be available
|
||||||
|
$somethingshown = $form->showLinkedObjectBlock($myobject);
|
||||||
|
|
||||||
|
// End of page
|
||||||
|
llxFooter();
|
||||||
30
htdocs/modulebuilder/template/phpdoc.dist.xml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
|
<phpdoc>
|
||||||
|
<title>MyModule</title>
|
||||||
|
<parser>
|
||||||
|
<target>build/phpdoc</target>
|
||||||
|
<encoding>utf8</encoding>
|
||||||
|
<markers>
|
||||||
|
<item>TODO</item>
|
||||||
|
<item>FIXME</item>
|
||||||
|
</markers>
|
||||||
|
<extensions>
|
||||||
|
<extension>php</extension>
|
||||||
|
<extension>css</extension>
|
||||||
|
<extension>js</extension>
|
||||||
|
</extensions>
|
||||||
|
</parser>
|
||||||
|
<transformer>
|
||||||
|
<target>doc/code/phpdoc</target>
|
||||||
|
</transformer>
|
||||||
|
<transformations>
|
||||||
|
<template name="responsive"/>
|
||||||
|
</transformations>
|
||||||
|
<files>
|
||||||
|
<directory>.</directory>
|
||||||
|
<ignore>build/*</ignore>
|
||||||
|
<ignore>dev/*</ignore>
|
||||||
|
<ignore>doc/*</ignore>
|
||||||
|
<ignore>vendor/*</ignore>
|
||||||
|
</files>
|
||||||
|
</phpdoc>
|
||||||
203
htdocs/modulebuilder/template/scripts/myscript.php
Normal file
@@ -0,0 +1,203 @@
|
|||||||
|
#!/usr/bin/env php
|
||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file scripts/myscript.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example command line script.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$sapi_type = php_sapi_name();
|
||||||
|
$script_file = basename(__FILE__);
|
||||||
|
$path = dirname(__FILE__) . '/';
|
||||||
|
|
||||||
|
// Test if batch mode
|
||||||
|
if (substr($sapi_type, 0, 3) == 'cgi') {
|
||||||
|
echo "Error: You are using PHP for CGI. To execute ";
|
||||||
|
echo $script_file;
|
||||||
|
echo " from command line, you must use PHP for CLI mode.\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Global variables
|
||||||
|
$version = '1.0.0';
|
||||||
|
$error = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* -------------------- YOUR CODE STARTS HERE --------------------
|
||||||
|
*/
|
||||||
|
/* Set this define to 0 if you want to allow execution of your script
|
||||||
|
* even if dolibarr setup is "locked to admin user only". */
|
||||||
|
define('EVEN_IF_ONLY_LOGIN_ALLOWED', 0);
|
||||||
|
|
||||||
|
/* Include Dolibarr environment
|
||||||
|
* Customize to your needs
|
||||||
|
*/
|
||||||
|
require_once $path . '../../../master.inc.php';
|
||||||
|
/* After this $db, $conf, $langs, $mysoc, $user and other Dolibarr utility variables should be defined.
|
||||||
|
* Warning: this still requires a valid htdocs/conf.php file
|
||||||
|
*/
|
||||||
|
|
||||||
|
global $conf, $db, $langs, $mysoc, $user;
|
||||||
|
|
||||||
|
// No timeout for this script
|
||||||
|
@set_time_limit(0);
|
||||||
|
|
||||||
|
// Set the default language
|
||||||
|
//$langs->setDefaultLang('en_US');
|
||||||
|
|
||||||
|
// Load translations for the default language
|
||||||
|
$langs->load("main");
|
||||||
|
|
||||||
|
/* User and permissions loading
|
||||||
|
* Loads user for login 'admin'.
|
||||||
|
* Comment out to run as anonymous user. */
|
||||||
|
$result = $user->fetch('', 'admin');
|
||||||
|
if (! $result > 0) {
|
||||||
|
dol_print_error('', $user->error);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
$user->getrights();
|
||||||
|
|
||||||
|
// Display banner and help
|
||||||
|
echo "***** " . $script_file . " (" . $version . ") pid=" . getmypid() . " *****\n";
|
||||||
|
dol_syslog($script_file . " launched with arg " . join(',', $argv));
|
||||||
|
if (! isset($argv[1])) {
|
||||||
|
// Check parameters
|
||||||
|
echo "Usage: " . $script_file . " param1 param2 ...\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
echo '--- start' . "\n";
|
||||||
|
echo 'Argument 1=' . $argv[1] . "\n";
|
||||||
|
echo 'Argument 2=' . $argv[2] . "\n";
|
||||||
|
|
||||||
|
// Start database transaction
|
||||||
|
$db->begin();
|
||||||
|
|
||||||
|
// Examples for manipulating a class
|
||||||
|
require_once '../class/myclass.class.php';
|
||||||
|
$myobject = new MyClass($db);
|
||||||
|
|
||||||
|
// Example for inserting creating object in database
|
||||||
|
/*
|
||||||
|
dol_syslog($script_file . " CREATE", LOG_DEBUG);
|
||||||
|
$myobject->prop1 = 'value_prop1';
|
||||||
|
$myobject->prop2 = 'value_prop2';
|
||||||
|
$id = $myobject->create($user);
|
||||||
|
if ($id < 0) {
|
||||||
|
$error++;
|
||||||
|
dol_print_error($db, $myobject->error);
|
||||||
|
} else {
|
||||||
|
echo "Object created with id=" . $id . "\n";
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Example for reading object from database
|
||||||
|
/*
|
||||||
|
dol_syslog($script_file . " FETCH", LOG_DEBUG);
|
||||||
|
$result = $myobject->fetch($id);
|
||||||
|
if ($result < 0) {
|
||||||
|
$error;
|
||||||
|
dol_print_error($db, $myobject->error);
|
||||||
|
} else {
|
||||||
|
echo "Object with id=" . $id . " loaded\n";
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Example for updating object in database
|
||||||
|
// ($myobject must have been loaded by a fetch before)
|
||||||
|
/*
|
||||||
|
dol_syslog($script_file . " UPDATE", LOG_DEBUG);
|
||||||
|
$myobject->prop1 = 'newvalue_prop1';
|
||||||
|
$myobject->prop2 = 'newvalue_prop2';
|
||||||
|
$result = $myobject->update($user);
|
||||||
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
dol_print_error($db, $myobject->error);
|
||||||
|
} else {
|
||||||
|
echo "Object with id " . $myobject->id . " updated\n";
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Example for deleting object in database
|
||||||
|
// ($myobject must have been loaded by a fetch before)
|
||||||
|
/*
|
||||||
|
dol_syslog($script_file . " DELETE", LOG_DEBUG);
|
||||||
|
$result = $myobject->delete($user);
|
||||||
|
if ($result < 0) {
|
||||||
|
$error++;
|
||||||
|
dol_print_error($db, $myobject->error);
|
||||||
|
} else {
|
||||||
|
echo "Object with id " . $myobject->id . " deleted\n";
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
// An example of a direct SQL read without using the fetch method
|
||||||
|
/*
|
||||||
|
$sql = "SELECT field1, field2";
|
||||||
|
$sql.= " FROM " . MAIN_DB_PREFIX . "c_pays";
|
||||||
|
$sql.= " WHERE field3 = 'xxx'";
|
||||||
|
$sql.= " ORDER BY field1 ASC";
|
||||||
|
|
||||||
|
dol_syslog($script_file . " sql=" . $sql, LOG_DEBUG);
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$num = $db->num_rows($resql);
|
||||||
|
$i = 0;
|
||||||
|
if ($num) {
|
||||||
|
while ($i < $num) {
|
||||||
|
$obj = $db->fetch_object($resql);
|
||||||
|
if ($obj) {
|
||||||
|
// You can use here results
|
||||||
|
echo $obj->field1;
|
||||||
|
echo $obj->field2;
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$error++;
|
||||||
|
dol_print_error($db);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* --------------------- YOUR CODE ENDS HERE ----------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Error management
|
||||||
|
if (! $error) {
|
||||||
|
$db->commit();
|
||||||
|
echo '--- end ok' . "\n";
|
||||||
|
$exit_status = 0; // UNIX no errors exit status
|
||||||
|
} else {
|
||||||
|
echo '--- end error code=' . $error . "\n";
|
||||||
|
$db->rollback();
|
||||||
|
$exit_status = 1; // UNIX general error exit status
|
||||||
|
}
|
||||||
|
|
||||||
|
// Close database handler
|
||||||
|
$db->close();
|
||||||
|
|
||||||
|
// Return exit status code
|
||||||
|
return $exit_status;
|
||||||
19
htdocs/modulebuilder/template/sql/data.sql
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
-- <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
-- Copyright (C) <year> <name of author>
|
||||||
|
--
|
||||||
|
-- This program is free software: you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation, either version 3 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
INSERT INTO llx_mytable VALUES (
|
||||||
|
1, 1, 'mydata'
|
||||||
|
);
|
||||||
17
htdocs/modulebuilder/template/sql/llx_mytable.key.sql
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
-- <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
-- Copyright (C) <year> <name of author>
|
||||||
|
--
|
||||||
|
-- This program is free software: you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation, either version 3 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
ALTER TABLE llx_mytable ADD UNIQUE INDEX uk_fk_othertable (fk_othertable);
|
||||||
22
htdocs/modulebuilder/template/sql/llx_mytable.sql
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
-- <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
-- Copyright (C) <year> <name of author>
|
||||||
|
--
|
||||||
|
-- This program is free software: you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation, either version 3 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
CREATE TABLE llx_mytable(
|
||||||
|
rowid INTEGER AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
entity INTEGER DEFAULT 1 NOT NULL,
|
||||||
|
fk_othertable INTEGER NOT NULL,
|
||||||
|
name VARCHAR(189)
|
||||||
|
);
|
||||||
15
htdocs/modulebuilder/template/sql/update_x.x.x-y.y.y.sql
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
-- <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
-- Copyright (C) <year> <name of author>
|
||||||
|
--
|
||||||
|
-- This program is free software: you can redistribute it and/or modify
|
||||||
|
-- it under the terms of the GNU General Public License as published by
|
||||||
|
-- the Free Software Foundation, either version 3 of the License, or
|
||||||
|
-- (at your option) any later version.
|
||||||
|
--
|
||||||
|
-- This program is distributed in the hope that it will be useful,
|
||||||
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
-- GNU General Public License for more details.
|
||||||
|
--
|
||||||
|
-- You should have received a copy of the GNU General Public License
|
||||||
|
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
@@ -0,0 +1,291 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file test/functional/MyModuleFunctionalTest.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example Selenium test.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace test\functional;
|
||||||
|
|
||||||
|
use PHPUnit_Extensions_Selenium2TestCase_WebDriverException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MyModuleFunctionalTest
|
||||||
|
*
|
||||||
|
* Requires chromedriver for Google Chrome
|
||||||
|
* Requires geckodriver for Mozilla Firefox
|
||||||
|
*
|
||||||
|
* @fixme Firefox (Geckodriver/Marionette) support
|
||||||
|
* @todo Opera linux support
|
||||||
|
* @todo Windows support (IE, Google Chrome, Mozilla Firefox, Safari)
|
||||||
|
* @todo OSX support (Safari, Google Chrome, Mozilla Firefox)
|
||||||
|
*
|
||||||
|
* @package test\functional
|
||||||
|
*/
|
||||||
|
class MyModuleFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
|
||||||
|
{
|
||||||
|
// TODO: move to a global configuration file?
|
||||||
|
/** @var string Base URL of the webserver under test */
|
||||||
|
protected static $base_url = 'http://dev.zenfusion.fr';
|
||||||
|
/**
|
||||||
|
* @var string Dolibarr admin username
|
||||||
|
* @see authenticate
|
||||||
|
*/
|
||||||
|
protected static $dol_admin_user = 'admin';
|
||||||
|
/**
|
||||||
|
* @var string Dolibarr admin password
|
||||||
|
* @see authenticate
|
||||||
|
*/
|
||||||
|
protected static $dol_admin_pass = 'admin';
|
||||||
|
/** @var int Dolibarr module ID */
|
||||||
|
private static $module_id = 500000; // TODO: autodetect?
|
||||||
|
|
||||||
|
/** @var array Browsers to test with */
|
||||||
|
public static $browsers = array(
|
||||||
|
array(
|
||||||
|
'browser' => 'Google Chrome on Linux',
|
||||||
|
'browserName' => 'chrome',
|
||||||
|
'sessionStrategy' => 'shared',
|
||||||
|
'desiredCapabilities' => array()
|
||||||
|
),
|
||||||
|
// Geckodriver does not keep the session at the moment?!
|
||||||
|
// XPath selectors also don't seem to work
|
||||||
|
// array(
|
||||||
|
// 'browser' => 'Mozilla Firefox on Linux',
|
||||||
|
// 'browserName' => 'firefox',
|
||||||
|
// 'sessionStrategy' => 'shared',
|
||||||
|
// 'desiredCapabilities' => array(
|
||||||
|
// 'marionette' => true
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to select links by href
|
||||||
|
*
|
||||||
|
* @param $value
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
protected function byHref($value)
|
||||||
|
{
|
||||||
|
$anchor = null;
|
||||||
|
$anchors = $this->elements($this->using('tag name')->value('a'));
|
||||||
|
foreach ($anchors as $anchor) {
|
||||||
|
if (strstr($anchor->attribute('href'), $value)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $anchor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global test setup
|
||||||
|
*/
|
||||||
|
public static function setUpBeforeClass()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test setup
|
||||||
|
*/
|
||||||
|
public function setUp()
|
||||||
|
{
|
||||||
|
$this->setSeleniumServerRequestsTimeout(3600);
|
||||||
|
$this->setBrowserUrl(self::$base_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify pre conditions
|
||||||
|
*/
|
||||||
|
protected function assertPreConditions()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle Dolibarr authentication
|
||||||
|
*/
|
||||||
|
private function authenticate()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if ($this->byId('login')) {
|
||||||
|
$login = $this->byId('username');
|
||||||
|
$login->clear();
|
||||||
|
$login->value('admin');
|
||||||
|
$password = $this->byId('password');
|
||||||
|
$password->clear();
|
||||||
|
$password->value('admin');
|
||||||
|
$this->byId('login')->submit();
|
||||||
|
}
|
||||||
|
} catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
|
||||||
|
// Login does not exist. Assume we are already authenticated
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test enabling developer mode
|
||||||
|
*/
|
||||||
|
public function testEnableDeveloperMode()
|
||||||
|
{
|
||||||
|
$this->url('/admin/const.php');
|
||||||
|
$this->authenticate();
|
||||||
|
$main_features_level_path='//input[@value="MAIN_FEATURES_LEVEL"]/following::input[@type="text"]';
|
||||||
|
$main_features_level = $this->byXPath($main_features_level_path);
|
||||||
|
$main_features_level->clear();
|
||||||
|
$main_features_level->value('2');
|
||||||
|
$this->byName('update')->click();
|
||||||
|
// Page reloaded, we need a new XPath
|
||||||
|
$main_features_level = $this->byXPath($main_features_level_path);
|
||||||
|
return $this->assertEquals('2', $main_features_level->value(), "MAIN_FEATURES_LEVEL value is 2");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test enabling the module
|
||||||
|
*
|
||||||
|
* @depends testEnableDeveloperMode
|
||||||
|
*/
|
||||||
|
public function testModuleEnabled()
|
||||||
|
{
|
||||||
|
$this->url('/admin/modules.php');
|
||||||
|
$this->authenticate();
|
||||||
|
$module_status_image_path='//a[contains(@href, "' . self::$module_id . '")]/img';
|
||||||
|
$module_status_image = $this->byXPath($module_status_image_path);
|
||||||
|
if (strstr($module_status_image->attribute('src'), 'switch_off.png')) {
|
||||||
|
// Enable the module
|
||||||
|
$this->byHref('modMyModule')->click();
|
||||||
|
} else {
|
||||||
|
// Disable the module
|
||||||
|
$this->byHref('modMyModule')->click();
|
||||||
|
// Reenable the module
|
||||||
|
$this->byHref('modMyModule')->click();
|
||||||
|
}
|
||||||
|
// Page reloaded, we need a new Xpath
|
||||||
|
$module_status_image = $this->byXPath($module_status_image_path);
|
||||||
|
return $this->assertContains('switch_on.png', $module_status_image->attribute('src'), "Module enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test access to the configuration page
|
||||||
|
*
|
||||||
|
* @depends testModuleEnabled
|
||||||
|
*/
|
||||||
|
public function testConfigurationPage()
|
||||||
|
{
|
||||||
|
$this->url('/custom/mymodule/admin/setup.php');
|
||||||
|
$this->authenticate();
|
||||||
|
return $this->assertContains('mymodule/admin/setup.php', $this->url(), 'Configuration page');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test access to the about page
|
||||||
|
*
|
||||||
|
* @depends testConfigurationPage
|
||||||
|
*/
|
||||||
|
public function testAboutPage()
|
||||||
|
{
|
||||||
|
$this->url('/custom/mymodule/admin/about.php');
|
||||||
|
$this->authenticate();
|
||||||
|
return $this->assertContains('mymodule/admin/about.php', $this->url(), 'About page');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test about page is rendering Markdown
|
||||||
|
*
|
||||||
|
* @depends testAboutPage
|
||||||
|
*/
|
||||||
|
public function testAboutPageRendersMarkdownReadme()
|
||||||
|
{
|
||||||
|
$this->url('/custom/mymodule/admin/about.php');
|
||||||
|
$this->authenticate();
|
||||||
|
return $this->assertEquals(
|
||||||
|
'Dolibarr Module Template (aka My Module)',
|
||||||
|
$this->byTag('h1')->text(),
|
||||||
|
"Readme title"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test box is properly declared
|
||||||
|
*
|
||||||
|
* @depends testModuleEnabled
|
||||||
|
*/
|
||||||
|
public function testBoxDeclared()
|
||||||
|
{
|
||||||
|
$this->url('/admin/boxes.php');
|
||||||
|
$this->authenticate();
|
||||||
|
return $this->assertContains('mybox', $this->source(), "Box enabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test trigger is properly enabled
|
||||||
|
*
|
||||||
|
* @depends testModuleEnabled
|
||||||
|
*/
|
||||||
|
public function testTriggerDeclared()
|
||||||
|
{
|
||||||
|
$this->url('/admin/triggers.php');
|
||||||
|
$this->authenticate();
|
||||||
|
return $this->assertContains(
|
||||||
|
'interface_99_modMyModule_MyTrigger.class.php',
|
||||||
|
$this->byTag('body')->text(),
|
||||||
|
"Trigger declared"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test trigger is properly declared
|
||||||
|
*
|
||||||
|
* @depends testTriggerDeclared
|
||||||
|
*/
|
||||||
|
public function testTriggerEnabled()
|
||||||
|
{
|
||||||
|
$this->url('/admin/triggers.php');
|
||||||
|
$this->authenticate();
|
||||||
|
return $this->assertContains(
|
||||||
|
'tick.png',
|
||||||
|
$this
|
||||||
|
->byXPath('//td[text()="interface_99_modMyModule_MyTrigger.class.php"]/following::img')
|
||||||
|
->attribute('src'),
|
||||||
|
"Trigger enabled"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify post conditions
|
||||||
|
*/
|
||||||
|
protected function assertPostConditions()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test teardown
|
||||||
|
*/
|
||||||
|
public function tearDown()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global test teardown
|
||||||
|
*/
|
||||||
|
public static function tearDownAfterClass()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
104
htdocs/modulebuilder/template/test/unit/MyClassTest.php
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
<?php
|
||||||
|
/* <one line to give the program's name and a brief idea of what it does.>
|
||||||
|
* Copyright (C) <year> <name of author>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file test/unit/MyClassTest.php
|
||||||
|
* \ingroup mymodule
|
||||||
|
* \brief Example PHPUnit test.
|
||||||
|
*
|
||||||
|
* Put detailed description here.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace test\unit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class MyClassTest
|
||||||
|
* @package test\unit
|
||||||
|
*/
|
||||||
|
class MyClassTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Global test setup
|
||||||
|
*/
|
||||||
|
public static function setUpBeforeClass()
|
||||||
|
{
|
||||||
|
fwrite(STDOUT, __METHOD__ . "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test setup
|
||||||
|
*/
|
||||||
|
protected function setUp()
|
||||||
|
{
|
||||||
|
fwrite(STDOUT, __METHOD__ . "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify pre conditions
|
||||||
|
*/
|
||||||
|
protected function assertPreConditions()
|
||||||
|
{
|
||||||
|
fwrite(STDOUT, __METHOD__ . "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A sample test
|
||||||
|
*/
|
||||||
|
public function testSomething()
|
||||||
|
{
|
||||||
|
fwrite(STDOUT, __METHOD__ . "\n");
|
||||||
|
// TODO: test something
|
||||||
|
$this->assertTrue(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify post conditions
|
||||||
|
*/
|
||||||
|
protected function assertPostConditions()
|
||||||
|
{
|
||||||
|
fwrite(STDOUT, __METHOD__ . "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unit test teardown
|
||||||
|
*/
|
||||||
|
protected function tearDown()
|
||||||
|
{
|
||||||
|
fwrite(STDOUT, __METHOD__ . "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Global test teardown
|
||||||
|
*/
|
||||||
|
public static function tearDownAfterClass()
|
||||||
|
{
|
||||||
|
fwrite(STDOUT, __METHOD__ . "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unsuccessful test
|
||||||
|
*
|
||||||
|
* @param \Exception $e
|
||||||
|
* @throws \Exception
|
||||||
|
*/
|
||||||
|
protected function onNotSuccessfulTest(\Exception $e)
|
||||||
|
{
|
||||||
|
fwrite(STDOUT, __METHOD__ . "\n");
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2914,7 +2914,10 @@ img.boxhandle, img.boxclose {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modulebuilderbox {
|
||||||
|
border: 1px solid #888;
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||