feat: Elektroplanung Modul v1.0.0
Elektrotechnische Berechnungstools für Dolibarr: - Leitungsquerschnittsrechner (DIN VDE 0100-520, DIN VDE 0298-4) - Widerstandsrechner für Potentialausgleich (VDE 0100-534/540) - Selektivitäts-Assistent (VDE 0100-530) Features: - Dark Mode Unterstützung - Responsive Design - PDF-Export - Dolibarr-Berechtigungssystem Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
commit
0b5056337a
19 changed files with 6210 additions and 0 deletions
621
COPYING
Normal file
621
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
|
||||
44
ChangeLog.md
Normal file
44
ChangeLog.md
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# CHANGELOG - Elektroplanung Modul für Dolibarr
|
||||
|
||||
Alle wichtigen Änderungen an diesem Projekt werden in dieser Datei dokumentiert.
|
||||
|
||||
## [1.0.0] - 2026-02-24
|
||||
|
||||
### Neu
|
||||
- **Leitungsquerschnittsrechner** nach DIN VDE 0100-520 und DIN VDE 0298-4
|
||||
- Berechnung über Strom oder Leistung
|
||||
- Unterstützung für 1-phasig, 3-phasig und DC-Netze
|
||||
- Spannungsfall- und Strombelastbarkeitsberechnung
|
||||
- Temperatur- und Häufungskorrekturfaktoren
|
||||
- Anzeige der angewendeten Formeln
|
||||
- PDF-Export der Berechnungsergebnisse
|
||||
|
||||
- **Widerstandsrechner für Potentialausgleich** nach VDE 0100-534/540
|
||||
- Anwendungsfälle: Haupt-PA, Zusatz-PA, SPD Typ 1/2, Blitzschutz
|
||||
- Berücksichtigung von Klemmen- und Schienenwiderständen
|
||||
- Temperaturkorrektur für spezifischen Widerstand
|
||||
- Querschnittsermittlung aus Zielwiderstand
|
||||
- VDE-Anforderungen Übersicht
|
||||
- PDF-Export der Berechnungsergebnisse
|
||||
|
||||
- **Selektivitäts-Assistent** nach VDE 0100-530
|
||||
- Selektivitätsprüfung zwischen Vor- und Nachsicherung
|
||||
- Sicherungsketten-Analyse mit visueller Darstellung
|
||||
- Vorlagen für typische Installationen
|
||||
- Selektivitätstabellen für Schmelzsicherungen, SLS und RCD
|
||||
- VDE-Normen Übersicht
|
||||
- PDF-Export der Prüfergebnisse
|
||||
|
||||
- **Allgemeine Features**
|
||||
- Dark Mode Unterstützung (automatische Theme-Anpassung)
|
||||
- Responsive Design für Mobile und Desktop
|
||||
- Zentrale CSS-Datei für einheitliches Design
|
||||
- Dolibarr-Berechtigungssystem Integration
|
||||
- Menüintegration unter "Startseite"
|
||||
|
||||
### Technisch
|
||||
- Modul-Nummer: 500030
|
||||
- Mindestanforderung: Dolibarr 19.0, PHP 7.1
|
||||
- Berechtigung: `elektroplanung->tools->read`
|
||||
- CSS mit CSS-Variablen für Theme-Anpassung
|
||||
- jsPDF für clientseitige PDF-Generierung
|
||||
92
README.md
Normal file
92
README.md
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
# Elektroplanung - Dolibarr Module
|
||||
|
||||
Elektrotechnische Berechnungstools für Dolibarr ERP & CRM.
|
||||
|
||||
## Features
|
||||
|
||||
Das Modul bietet drei professionelle Berechnungstools für Elektriker und Elektrofachplaner:
|
||||
|
||||
### 1. Leitungsquerschnittsrechner
|
||||
- Berechnung nach DIN VDE 0100-520 und DIN VDE 0298-4
|
||||
- Berücksichtigung von Spannungsfall, Strombelastbarkeit, Verlegeart
|
||||
- Temperatur- und Häufungskorrekturfaktoren
|
||||
- Automatische Ermittlung des Normquerschnitts
|
||||
- PDF-Export der Berechnungsergebnisse
|
||||
|
||||
### 2. Widerstandsrechner für Potentialausgleich
|
||||
- Berechnung nach VDE 0100-534/540
|
||||
- Prüfung für verschiedene Anwendungsfälle (Haupt-PA, Zusatz-PA, SPD, Blitzschutz)
|
||||
- Berücksichtigung von Klemmen- und Schienenwiderständen
|
||||
- Temperaturkorrektur für den spezifischen Widerstand
|
||||
- PDF-Export der Berechnungsergebnisse
|
||||
|
||||
### 3. Selektivitäts-Assistent
|
||||
- Prüfung nach VDE 0100-530
|
||||
- Selektivitätsprüfung zwischen zwei Sicherungen
|
||||
- Sicherungsketten-Analyse mit visueller Darstellung
|
||||
- Vorlagen für typische Installationen (Wohnung, EFH, Gewerbe)
|
||||
- Übersichtstabellen für Schmelzsicherungen, SLS und RCD
|
||||
- PDF-Export der Prüfergebnisse
|
||||
|
||||
## Allgemeine Features
|
||||
|
||||
- **Dark Mode kompatibel**: Passt sich automatisch an das Dolibarr-Theme an
|
||||
- **Responsive Design**: Optimiert für Desktop und Mobile
|
||||
- **PDF-Export**: Alle Berechnungen können als PDF exportiert werden
|
||||
- **Dolibarr-Integration**: Vollständig integriert in Menü und Berechtigungssystem
|
||||
|
||||
## Anforderungen
|
||||
|
||||
- Dolibarr ERP & CRM >= 19.0
|
||||
- PHP >= 7.1
|
||||
|
||||
## Installation
|
||||
|
||||
### Per ZIP-Datei
|
||||
|
||||
1. Lade das Modul als ZIP herunter
|
||||
2. In Dolibarr: Einstellungen > Module > Externe Module deployen
|
||||
3. ZIP-Datei hochladen
|
||||
|
||||
### Per Git
|
||||
|
||||
```bash
|
||||
cd /pfad/zu/dolibarr/custom/
|
||||
git clone https://git.data-it-solution.de/data/dolibarr.elektroplanung.git elektroplanung
|
||||
```
|
||||
|
||||
### Aktivierung
|
||||
|
||||
1. Als Admin in Dolibarr einloggen
|
||||
2. Einstellungen > Module > Andere Module
|
||||
3. "Elektroplanung" aktivieren
|
||||
|
||||
## Berechtigungen
|
||||
|
||||
Das Modul verwendet das Dolibarr-Berechtigungssystem:
|
||||
|
||||
- **Elektroplanung Tools verwenden**: Berechtigt zur Nutzung aller Berechnungstools
|
||||
|
||||
Berechtigungen können unter Einstellungen > Benutzer & Gruppen > Berechtigungen verwaltet werden.
|
||||
|
||||
## Verwendete Normen
|
||||
|
||||
- DIN VDE 0100-520: Auswahl und Errichtung elektrischer Betriebsmittel - Kabel- und Leitungsanlagen
|
||||
- DIN VDE 0298-4: Verwendung von Kabeln und isolierten Leitungen für Starkstromanlagen
|
||||
- VDE 0100-530: Schutzeinrichtungen
|
||||
- VDE 0100-534: Schutz bei Überspannungen
|
||||
- VDE 0100-540: Erdungsanlagen und Schutzleiter
|
||||
- VDE 0185-305: Blitzschutz
|
||||
- TAB 2019: Technische Anschlussbedingungen
|
||||
|
||||
## Haftungsausschluss
|
||||
|
||||
Alle Berechnungen dienen als Hilfsmittel und ersetzen nicht die Fachplanung durch einen qualifizierten Elektrofachplaner. Die Ergebnisse sind immer von einer Elektrofachkraft zu prüfen und freizugeben.
|
||||
|
||||
## Autor
|
||||
|
||||
Eduard Wisch - [DATA IT Solution](https://data-it-solution.de)
|
||||
|
||||
## Lizenz
|
||||
|
||||
GPLv3 oder höher. Siehe [COPYING](COPYING) für Details.
|
||||
118
admin/about.php
Normal file
118
admin/about.php
Normal file
|
|
@ -0,0 +1,118 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file elektroplanung/admin/about.php
|
||||
* \ingroup elektroplanung
|
||||
* \brief About page of module Elektroplanung.
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
|
||||
$tmp2 = realpath(__FILE__);
|
||||
$i = strlen($tmp) - 1;
|
||||
$j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
|
||||
$i--;
|
||||
$j--;
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
|
||||
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
|
||||
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php using relative path
|
||||
if (!$res && file_exists("../../main.inc.php")) {
|
||||
$res = @include "../../main.inc.php";
|
||||
}
|
||||
if (!$res && file_exists("../../../main.inc.php")) {
|
||||
$res = @include "../../../main.inc.php";
|
||||
}
|
||||
if (!$res) {
|
||||
die("Include of main fails");
|
||||
}
|
||||
|
||||
// Libraries
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||
require_once '../lib/elektroplanung.lib.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("errors", "admin", "elektroplanung@elektroplanung"));
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// None
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$help_url = '';
|
||||
$title = "ElektroplanungSetup";
|
||||
|
||||
llxHeader('', $langs->trans($title), $help_url, '', 0, 0, '', '', '', 'mod-elektroplanung page-admin_about');
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
|
||||
|
||||
// Configuration header
|
||||
$head = elektroplanungAdminPrepareHead();
|
||||
print dol_get_fiche_head($head, 'about', $langs->trans($title), 0, 'elektroplanung@elektroplanung');
|
||||
|
||||
dol_include_once('/elektroplanung/core/modules/modElektroplanung.class.php');
|
||||
$tmpmodule = new modElektroplanung($db);
|
||||
print $tmpmodule->getDescLong();
|
||||
|
||||
// Page end
|
||||
print dol_get_fiche_end();
|
||||
llxFooter();
|
||||
$db->close();
|
||||
629
admin/setup.php
Normal file
629
admin/setup.php
Normal file
|
|
@ -0,0 +1,629 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file elektroplanung/admin/setup.php
|
||||
* \ingroup elektroplanung
|
||||
* \brief Elektroplanung setup page.
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
|
||||
$tmp2 = realpath(__FILE__);
|
||||
$i = strlen($tmp) - 1;
|
||||
$j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
|
||||
$i--;
|
||||
$j--;
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
|
||||
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
|
||||
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php using relative path
|
||||
if (!$res && file_exists("../../main.inc.php")) {
|
||||
$res = @include "../../main.inc.php";
|
||||
}
|
||||
if (!$res && file_exists("../../../main.inc.php")) {
|
||||
$res = @include "../../../main.inc.php";
|
||||
}
|
||||
if (!$res) {
|
||||
die("Include of main fails");
|
||||
}
|
||||
|
||||
// Libraries
|
||||
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||
require_once '../lib/elektroplanung.lib.php';
|
||||
//require_once "../class/myclass.class.php";
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
|
||||
// Translations
|
||||
$langs->loadLangs(array("admin", "elektroplanung@elektroplanung"));
|
||||
|
||||
// Initialize a technical object to manage hooks of page. Note that conf->hooks_modules contains an array of hook context
|
||||
/** @var HookManager $hookmanager */
|
||||
$hookmanager->initHooks(array('elektroplanungsetup', 'globalsetup'));
|
||||
|
||||
// Parameters
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
$backtopage = GETPOST('backtopage', 'alpha');
|
||||
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
|
||||
|
||||
$value = GETPOST('value', 'alpha');
|
||||
$label = GETPOST('label', 'alpha');
|
||||
$scandir = GETPOST('scan_dir', 'alpha');
|
||||
$type = 'myobject';
|
||||
|
||||
$error = 0;
|
||||
$setupnotempty = 0;
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
// Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only
|
||||
$useFormSetup = 1;
|
||||
|
||||
if (!class_exists('FormSetup')) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
|
||||
}
|
||||
$formSetup = new FormSetup($db);
|
||||
|
||||
// Access control
|
||||
if (!$user->admin) {
|
||||
accessforbidden();
|
||||
}
|
||||
|
||||
|
||||
// Enter here all parameters in your setup page
|
||||
|
||||
// Setup conf for selection of an URL
|
||||
$item = $formSetup->newItem('ELEKTROPLANUNG_MYPARAM1');
|
||||
$item->fieldParams['isMandatory'] = 1;
|
||||
$item->fieldAttr['placeholder'] = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'];
|
||||
$item->cssClass = 'minwidth500';
|
||||
|
||||
// Setup conf for selection of a simple string input
|
||||
$item = $formSetup->newItem('ELEKTROPLANUNG_MYPARAM2');
|
||||
$item->defaultFieldValue = 'default value';
|
||||
$item->fieldAttr['placeholder'] = 'A placeholder here';
|
||||
$item->helpText = 'Tooltip text';
|
||||
|
||||
// Setup conf for selection of a simple textarea input but we replace the text of field title
|
||||
$item = $formSetup->newItem('ELEKTROPLANUNG_MYPARAM3');
|
||||
$item->nameText = $item->getNameText().' more html text ';
|
||||
|
||||
// Setup conf for a selection of a Thirdparty
|
||||
$item = $formSetup->newItem('ELEKTROPLANUNG_MYPARAM4');
|
||||
$item->setAsThirdpartyType();
|
||||
|
||||
// Setup conf for a selection of a boolean
|
||||
$formSetup->newItem('ELEKTROPLANUNG_MYPARAM5')->setAsYesNo();
|
||||
|
||||
// Setup conf for a selection of an Email template of type thirdparty
|
||||
$formSetup->newItem('ELEKTROPLANUNG_MYPARAM6')->setAsEmailTemplate('thirdparty');
|
||||
|
||||
// Setup conf for a selection of a secured key
|
||||
//$formSetup->newItem('ELEKTROPLANUNG_MYPARAM7')->setAsSecureKey();
|
||||
|
||||
// Setup conf for a selection of a Product
|
||||
$formSetup->newItem('ELEKTROPLANUNG_MYPARAM8')->setAsProduct();
|
||||
|
||||
// Add a title for a new section
|
||||
$formSetup->newItem('NewSection')->setAsTitle();
|
||||
|
||||
$TField = array(
|
||||
'test01' => $langs->trans('test01'),
|
||||
'test02' => $langs->trans('test02'),
|
||||
'test03' => $langs->trans('test03'),
|
||||
'test04' => $langs->trans('test04'),
|
||||
'test05' => $langs->trans('test05'),
|
||||
'test06' => $langs->trans('test06'),
|
||||
);
|
||||
|
||||
// Setup conf for a simple combo list
|
||||
$formSetup->newItem('ELEKTROPLANUNG_MYPARAM9')->setAsSelect($TField);
|
||||
|
||||
// Setup conf for a multiselect combo list
|
||||
$item = $formSetup->newItem('ELEKTROPLANUNG_MYPARAM10');
|
||||
$item->setAsMultiSelect($TField);
|
||||
$item->helpText = $langs->transnoentities('ELEKTROPLANUNG_MYPARAM10');
|
||||
|
||||
// Setup conf for a category selection
|
||||
$formSetup->newItem('ELEKTROPLANUNG_CATEGORY_ID_XXX')->setAsCategory('product');
|
||||
|
||||
// Setup conf ELEKTROPLANUNG_MYPARAM10
|
||||
$item = $formSetup->newItem('ELEKTROPLANUNG_MYPARAM10');
|
||||
$item->setAsColor();
|
||||
$item->defaultFieldValue = '#FF0000';
|
||||
//$item->fieldValue = '';
|
||||
//$item->fieldAttr = array() ; // fields attribute only for compatible fields like input text
|
||||
//$item->fieldOverride = false; // set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too
|
||||
//$item->fieldInputOverride = false; // set this var to override field input
|
||||
//$item->fieldOutputOverride = false; // set this var to override field output
|
||||
|
||||
$item = $formSetup->newItem('ELEKTROPLANUNG_MYPARAM11')->setAsHtml();
|
||||
$item->nameText = $item->getNameText().' more html text ';
|
||||
$item->fieldInputOverride = '';
|
||||
$item->helpText = $langs->transnoentities('HelpMessage');
|
||||
$item->cssClass = 'minwidth500';
|
||||
|
||||
$item = $formSetup->newItem('ELEKTROPLANUNG_MYPARAM12');
|
||||
$item->fieldOverride = "Value forced, can't be modified";
|
||||
$item->cssClass = 'minwidth500';
|
||||
|
||||
//$item = $formSetup->newItem('ELEKTROPLANUNG_MYPARAM13')->setAsDate(); // Not yet implemented
|
||||
|
||||
// End of definition of parameters
|
||||
|
||||
|
||||
$setupnotempty += count($formSetup->items);
|
||||
|
||||
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
|
||||
$moduledir = 'elektroplanung';
|
||||
$myTmpObjects = array();
|
||||
// TODO Scan list of objects to fill this array
|
||||
$myTmpObjects['myobject'] = array('label' => 'MyObject', 'includerefgeneration' => 0, 'includedocgeneration' => 0, 'class' => 'MyObject');
|
||||
|
||||
$tmpobjectkey = GETPOST('object', 'aZ09');
|
||||
if ($tmpobjectkey && !array_key_exists($tmpobjectkey, $myTmpObjects)) {
|
||||
accessforbidden('Bad value for object. Hack attempt ?');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// For retrocompatibility Dolibarr < 15.0
|
||||
if (versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) {
|
||||
$formSetup->saveConfFromPost();
|
||||
}
|
||||
|
||||
include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
|
||||
|
||||
if ($action == 'updateMask') {
|
||||
$maskconst = GETPOST('maskconst', 'aZ09');
|
||||
$maskvalue = GETPOST('maskvalue', 'alpha');
|
||||
|
||||
if ($maskconst && preg_match('/_MASK$/', $maskconst)) {
|
||||
$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
|
||||
if (!($res > 0)) {
|
||||
$error++;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$error) {
|
||||
setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
|
||||
} else {
|
||||
setEventMessages($langs->trans("Error"), null, 'errors');
|
||||
}
|
||||
} elseif ($action == 'specimen' && $tmpobjectkey) {
|
||||
$modele = GETPOST('module', 'alpha');
|
||||
|
||||
$className = $myTmpObjects[$tmpobjectkey]['class'];
|
||||
$tmpobject = new $className($db);
|
||||
'@phan-var-force MyObject $tmpobject';
|
||||
$tmpobject->initAsSpecimen();
|
||||
|
||||
// Search template files
|
||||
$file = '';
|
||||
$className = '';
|
||||
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$file = dol_buildpath($reldir."core/modules/elektroplanung/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
|
||||
if (file_exists($file)) {
|
||||
$className = "pdf_".$modele."_".strtolower($tmpobjectkey);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($className !== '') {
|
||||
require_once $file;
|
||||
|
||||
$module = new $className($db);
|
||||
'@phan-var-force ModelePDFMyObject $module';
|
||||
|
||||
'@phan-var-force ModelePDFMyObject $module';
|
||||
|
||||
if ($module->write_file($tmpobject, $langs) > 0) {
|
||||
header("Location: ".DOL_URL_ROOT."/document.php?modulepart=elektroplanung-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
|
||||
return;
|
||||
} else {
|
||||
setEventMessages($module->error, null, 'errors');
|
||||
dol_syslog($module->error, LOG_ERR);
|
||||
}
|
||||
} else {
|
||||
setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
|
||||
dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
|
||||
}
|
||||
} elseif ($action == 'setmod') {
|
||||
// TODO Check if numbering module chosen can be activated by calling method canBeActivated
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'ELEKTROPLANUNG_'.strtoupper($tmpobjectkey)."_ADDON";
|
||||
dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
|
||||
}
|
||||
} elseif ($action == 'set') {
|
||||
// Activate a model
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
} elseif ($action == 'del') {
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'ELEKTROPLANUNG_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if (getDolGlobalString($constforval) == "$value") {
|
||||
dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'setdoc') {
|
||||
// Set or unset default model
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'ELEKTROPLANUNG_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
|
||||
// The constant that was read before the new set
|
||||
// We therefore requires a variable to have a coherent view
|
||||
$conf->global->{$constforval} = $value;
|
||||
}
|
||||
|
||||
// We disable/enable the document template (into llx_document_model table)
|
||||
$ret = delDocumentModel($value, $type);
|
||||
if ($ret > 0) {
|
||||
$ret = addDocumentModel($value, $type, $label, $scandir);
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'unsetdoc') {
|
||||
if (!empty($tmpobjectkey)) {
|
||||
$constforval = 'ELEKTROPLANUNG_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
|
||||
dolibarr_del_const($db, $constforval, $conf->entity);
|
||||
}
|
||||
}
|
||||
|
||||
$action = 'edit';
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
$help_url = '';
|
||||
$title = "ElektroplanungSetup";
|
||||
|
||||
llxHeader('', $langs->trans($title), $help_url, '', 0, 0, '', '', '', 'mod-elektroplanung page-admin');
|
||||
|
||||
// Subheader
|
||||
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||
|
||||
print load_fiche_titre($langs->trans($title), $linkback, 'title_setup');
|
||||
|
||||
// Configuration header
|
||||
$head = elektroplanungAdminPrepareHead();
|
||||
print dol_get_fiche_head($head, 'settings', $langs->trans($title), -1, "elektroplanung@elektroplanung");
|
||||
|
||||
// Setup page goes here
|
||||
echo '<span class="opacitymedium">'.$langs->trans("ElektroplanungSetupPage").'</span><br><br>';
|
||||
|
||||
|
||||
/*if ($action == 'edit') {
|
||||
print $formSetup->generateOutput(true);
|
||||
print '<br>';
|
||||
} elseif (!empty($formSetup->items)) {
|
||||
print $formSetup->generateOutput();
|
||||
print '<div class="tabsAction">';
|
||||
print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
|
||||
print '</div>';
|
||||
}
|
||||
*/
|
||||
if (!empty($formSetup->items)) {
|
||||
print $formSetup->generateOutput(true);
|
||||
print '<br>';
|
||||
}
|
||||
|
||||
|
||||
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
if (!empty($myTmpObjectArray['includerefgeneration'])) {
|
||||
// Numbering models
|
||||
|
||||
$setupnotempty++;
|
||||
|
||||
print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectArray['label']), '', '');
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="nowrap">'.$langs->trans("Example").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
|
||||
print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '</tr>'."\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
$dir = dol_buildpath($reldir."core/modules/".$moduledir);
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
|
||||
$file = substr($file, 0, dol_strlen($file) - 4);
|
||||
|
||||
require_once $dir.'/'.$file.'.php';
|
||||
|
||||
$module = new $file($db);
|
||||
'@phan-var-force ModeleNumRefMyObject $module';
|
||||
|
||||
// Show modules according to features level
|
||||
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
continue;
|
||||
}
|
||||
if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($module->isEnabled()) {
|
||||
dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
|
||||
|
||||
print '<tr class="oddeven"><td>'.$module->getName($langs)."</td><td>\n";
|
||||
print $module->info($langs);
|
||||
print '</td>';
|
||||
|
||||
// Show example of numbering model
|
||||
print '<td class="nowrap">';
|
||||
$tmp = $module->getExample();
|
||||
if (preg_match('/^Error/', $tmp)) {
|
||||
$langs->load("errors");
|
||||
print '<div class="error">'.$langs->trans($tmp).'</div>';
|
||||
} elseif ($tmp == 'NotConfigured') {
|
||||
print $langs->trans($tmp);
|
||||
} else {
|
||||
print $tmp;
|
||||
}
|
||||
print '</td>'."\n";
|
||||
|
||||
print '<td class="center">';
|
||||
$constforvar = 'ELEKTROPLANUNG_'.strtoupper($myTmpObjectKey).'_ADDON';
|
||||
$defaultifnotset = 'thevaluetousebydefault';
|
||||
$activenumberingmodel = getDolGlobalString($constforvar, $defaultifnotset);
|
||||
if ($activenumberingmodel == $file) {
|
||||
print img_picto($langs->trans("Activated"), 'switch_on');
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
|
||||
print img_picto($langs->trans("Disabled"), 'switch_off');
|
||||
print '</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
$className = $myTmpObjectArray['class'];
|
||||
$mytmpinstance = new $className($db);
|
||||
'@phan-var-force MyObject $mytmpinstance';
|
||||
$mytmpinstance->initAsSpecimen();
|
||||
|
||||
// Info
|
||||
$htmltooltip = '';
|
||||
$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
|
||||
|
||||
$nextval = $module->getNextValue($mytmpinstance);
|
||||
if ("$nextval" != $langs->trans("NotAvailable")) { // Keep " on nextval
|
||||
$htmltooltip .= ''.$langs->trans("NextValue").': ';
|
||||
if ($nextval) {
|
||||
if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
|
||||
$nextval = $langs->trans($nextval);
|
||||
}
|
||||
$htmltooltip .= $nextval.'<br>';
|
||||
} else {
|
||||
$htmltooltip .= $langs->trans($module->error).'<br>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 'info');
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
print "</table><br>\n";
|
||||
}
|
||||
|
||||
if (!empty($myTmpObjectArray['includedocgeneration'])) {
|
||||
/*
|
||||
* Document templates generators
|
||||
*/
|
||||
$setupnotempty++;
|
||||
$type = strtolower($myTmpObjectKey);
|
||||
|
||||
print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
|
||||
|
||||
// Load array def with activated templates
|
||||
$def = array();
|
||||
$sql = "SELECT nom";
|
||||
$sql .= " FROM ".$db->prefix()."document_model";
|
||||
$sql .= " WHERE type = '".$db->escape($type)."'";
|
||||
$sql .= " AND entity = ".$conf->entity;
|
||||
$resql = $db->query($sql);
|
||||
if ($resql) {
|
||||
$i = 0;
|
||||
$num_rows = $db->num_rows($resql);
|
||||
while ($i < $num_rows) {
|
||||
$array = $db->fetch_array($resql);
|
||||
array_push($def, $array[0]);
|
||||
$i++;
|
||||
}
|
||||
} else {
|
||||
dol_print_error($db);
|
||||
}
|
||||
|
||||
print '<table class="noborder centpercent">'."\n";
|
||||
print '<tr class="liste_titre">'."\n";
|
||||
print '<td>'.$langs->trans("Name").'</td>';
|
||||
print '<td>'.$langs->trans("Description").'</td>';
|
||||
print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
|
||||
print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
|
||||
print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
|
||||
print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
|
||||
print "</tr>\n";
|
||||
|
||||
clearstatcache();
|
||||
|
||||
foreach ($dirmodels as $reldir) {
|
||||
foreach (array('', '/doc') as $valdir) {
|
||||
$realpath = $reldir."core/modules/".$moduledir.$valdir;
|
||||
$dir = dol_buildpath($realpath);
|
||||
|
||||
if (is_dir($dir)) {
|
||||
$handle = opendir($dir);
|
||||
if (is_resource($handle)) {
|
||||
$filelist = array();
|
||||
while (($file = readdir($handle)) !== false) {
|
||||
$filelist[] = $file;
|
||||
}
|
||||
closedir($handle);
|
||||
arsort($filelist);
|
||||
|
||||
foreach ($filelist as $file) {
|
||||
if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
|
||||
if (file_exists($dir.'/'.$file)) {
|
||||
$name = substr($file, 4, dol_strlen($file) - 16);
|
||||
$className = substr($file, 0, dol_strlen($file) - 12);
|
||||
|
||||
require_once $dir.'/'.$file;
|
||||
$module = new $className($db);
|
||||
'@phan-var-force ModelePDFMyObject $module';
|
||||
|
||||
$modulequalified = 1;
|
||||
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
if ($module->version == 'experimental' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 1) {
|
||||
$modulequalified = 0;
|
||||
}
|
||||
|
||||
if ($modulequalified) {
|
||||
print '<tr class="oddeven"><td width="100">';
|
||||
print(empty($module->name) ? $name : $module->name);
|
||||
print "</td><td>\n";
|
||||
if (method_exists($module, 'info')) {
|
||||
print $module->info($langs); // @phan-suppress-current-line PhanUndeclaredMethod
|
||||
} else {
|
||||
print $module->description;
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Active
|
||||
if (in_array($name, $def)) {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
|
||||
print img_picto($langs->trans("Enabled"), 'switch_on');
|
||||
print '</a>';
|
||||
print '</td>';
|
||||
} else {
|
||||
print '<td class="center">'."\n";
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
|
||||
print "</td>";
|
||||
}
|
||||
|
||||
// Default
|
||||
print '<td class="center">';
|
||||
$constforvar = 'ELEKTROPLANUNG_'.strtoupper($myTmpObjectKey).'_ADDON_PDF';
|
||||
if (getDolGlobalString($constforvar) == $name) {
|
||||
//print img_picto($langs->trans("Default"), 'on');
|
||||
// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
|
||||
} else {
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
// Info
|
||||
$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
|
||||
$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
|
||||
if ($module->type == 'pdf') {
|
||||
$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
|
||||
}
|
||||
$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
|
||||
|
||||
$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
|
||||
$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
|
||||
$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
|
||||
|
||||
print '<td class="center">';
|
||||
print $form->textwithpicto('', $htmltooltip, 1, 'info');
|
||||
print '</td>';
|
||||
|
||||
// Preview
|
||||
print '<td class="center">';
|
||||
if ($module->type == 'pdf') {
|
||||
$newname = preg_replace('/_'.preg_quote(strtolower($myTmpObjectKey), '/').'/', '', $name);
|
||||
print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.urlencode($newname).'&object='.urlencode($myTmpObjectKey).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
|
||||
} else {
|
||||
print img_object($langs->transnoentitiesnoconv("PreviewNotAvailable"), 'generic');
|
||||
}
|
||||
print '</td>';
|
||||
|
||||
print "</tr>\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
print '</table>';
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($setupnotempty)) {
|
||||
print '<br>'.$langs->trans("NothingToSetup");
|
||||
}
|
||||
|
||||
// Page end
|
||||
print dol_get_fiche_end();
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
316
build/buildzip.php
Normal file
316
build/buildzip.php
Normal file
|
|
@ -0,0 +1,316 @@
|
|||
#!/usr/bin/env php -d memory_limit=256M
|
||||
<?php
|
||||
/**
|
||||
* buildzip.php
|
||||
*
|
||||
* Copyright (c) 2023-2025 Eric Seigne <eric.seigne@cap-rel.fr>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
The goal of that php CLI script is to make zip package of your module
|
||||
as an alternative to web "build zip" or "perl script makepack"
|
||||
*/
|
||||
|
||||
// ============================================= configuration
|
||||
|
||||
/**
|
||||
* list of files & dirs of your module
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
$listOfModuleContent = [
|
||||
'admin',
|
||||
'ajax',
|
||||
'backport',
|
||||
'class',
|
||||
'css',
|
||||
'COPYING',
|
||||
'core',
|
||||
'img',
|
||||
'js',
|
||||
'langs',
|
||||
'lib',
|
||||
'sql',
|
||||
'tpl',
|
||||
'*.md',
|
||||
'*.json',
|
||||
'*.php',
|
||||
'modulebuilder.txt',
|
||||
];
|
||||
|
||||
/**
|
||||
* if you want to exclude some files from your zip
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
$exclude_list = [
|
||||
'/^.git$/',
|
||||
'/.*js.map/',
|
||||
'/DEV.md/'
|
||||
];
|
||||
|
||||
// ============================================= end of configuration
|
||||
|
||||
/**
|
||||
* auto detect module name and version from file name
|
||||
*
|
||||
* @return (string|string)[] module name and module version
|
||||
*/
|
||||
function detectModule()
|
||||
{
|
||||
$name = $version = "";
|
||||
$tab = glob("core/modules/mod*.class.php");
|
||||
if (count($tab) == 0) {
|
||||
echo "[fail] Error on auto detect data : there is no mod*.class.php file into core/modules dir\n";
|
||||
exit(-1);
|
||||
}
|
||||
if (count($tab) == 1) {
|
||||
$file = $tab[0];
|
||||
$pattern = "/.*mod(?<mod>.*)\.class\.php/";
|
||||
if (preg_match_all($pattern, $file, $matches)) {
|
||||
$name = strtolower(reset($matches['mod']));
|
||||
}
|
||||
|
||||
echo "extract data from $file\n";
|
||||
if (!file_exists($file) || $name == "") {
|
||||
echo "[fail] Error on auto detect data\n";
|
||||
exit(-2);
|
||||
}
|
||||
} else {
|
||||
echo "[fail] Error there is more than one mod*.class.php file into core/modules dir\n";
|
||||
exit(-3);
|
||||
}
|
||||
|
||||
//extract version from file
|
||||
$contents = file_get_contents($file);
|
||||
$pattern = "/^.*this->version\s*=\s*'(?<version>.*)'\s*;.*\$/m";
|
||||
|
||||
// search, and store all matching occurrences in $matches
|
||||
if (preg_match_all($pattern, $contents, $matches)) {
|
||||
$version = reset($matches['version']);
|
||||
}
|
||||
|
||||
if (version_compare($version, '0.0.1', '>=') != 1) {
|
||||
echo "[fail] Error auto extract version fail\n";
|
||||
exit(-4);
|
||||
}
|
||||
|
||||
echo "module name = $name, version = $version\n";
|
||||
return [(string) $name, (string) $version];
|
||||
}
|
||||
|
||||
/**
|
||||
* delete recursively a directory
|
||||
*
|
||||
* @param string $dir dir path to delete
|
||||
*
|
||||
* @return bool true on success or false on failure.
|
||||
*/
|
||||
function delTree($dir)
|
||||
{
|
||||
$files = array_diff(scandir($dir), array('.', '..'));
|
||||
foreach ($files as $file) {
|
||||
(is_dir("$dir/$file")) ? delTree("$dir/$file") : secureUnlink("$dir/$file");
|
||||
}
|
||||
return rmdir($dir);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* do a secure delete file/dir with double check
|
||||
* (don't trust unlink return)
|
||||
*
|
||||
* @param string $path full path to delete
|
||||
*
|
||||
* @return bool true on success ($path does not exists at the end of process), else exit
|
||||
*/
|
||||
function secureUnlink($path)
|
||||
{
|
||||
if (file_exists($path)) {
|
||||
if (unlink($path)) {
|
||||
//then check if really deleted
|
||||
clearstatcache();
|
||||
if (file_exists($path)) { // @phpstan-ignore-line
|
||||
echo "[fail] unlink of $path fail !\n";
|
||||
exit(-5);
|
||||
}
|
||||
} else {
|
||||
echo "[fail] unlink of $path fail !\n";
|
||||
exit(-6);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* create a directory and check if dir exists
|
||||
*
|
||||
* @param string $path path to make
|
||||
*
|
||||
* @return bool true on success ($path exists at the end of process), else exit
|
||||
*/
|
||||
function mkdirAndCheck($path)
|
||||
{
|
||||
if (mkdir($path)) {
|
||||
clearstatcache();
|
||||
if (is_dir($path)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
echo "[fail] Error on $path (mkdir)\n";
|
||||
exit(7);
|
||||
}
|
||||
|
||||
/**
|
||||
* check if that filename is concerned by exclude filter
|
||||
*
|
||||
* @param string $filename file name to check
|
||||
*
|
||||
* @return bool true if file is in excluded list
|
||||
*/
|
||||
function is_excluded($filename)
|
||||
{
|
||||
global $exclude_list;
|
||||
$count = 0;
|
||||
$notused = preg_filter($exclude_list, '1', $filename, -1, $count);
|
||||
if ($count > 0) {
|
||||
echo " - exclude $filename\n";
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* recursive copy files & dirs
|
||||
*
|
||||
* @param string $src source dir
|
||||
* @param string $dst target dir
|
||||
*
|
||||
* @return bool true on success or false on failure.
|
||||
*/
|
||||
function rcopy($src, $dst)
|
||||
{
|
||||
if (is_dir($src)) {
|
||||
// Make the destination directory if not exist
|
||||
mkdirAndCheck($dst);
|
||||
// open the source directory
|
||||
$dir = opendir($src);
|
||||
|
||||
// Loop through the files in source directory
|
||||
while ($file = readdir($dir)) {
|
||||
if (($file != '.') && ($file != '..')) {
|
||||
if (is_dir($src . '/' . $file)) {
|
||||
// Recursively calling custom copy function
|
||||
// for sub directory
|
||||
if (!rcopy($src . '/' . $file, $dst . '/' . $file)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!is_excluded($file)) {
|
||||
if (!copy($src . '/' . $file, $dst . '/' . $file)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($dir);
|
||||
} elseif (is_file($src)) {
|
||||
if (!is_excluded($src)) {
|
||||
if (!copy($src, $dst)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* build a zip file with only php code and no external depends
|
||||
* on "zip" exec for example
|
||||
*
|
||||
* @param string $folder folder to use as zip root
|
||||
* @param ZipArchive $zip zip object (ZipArchive)
|
||||
* @param string $root relative root path into the zip
|
||||
*
|
||||
* @return bool true on success or false on failure.
|
||||
*/
|
||||
function zipDir($folder, &$zip, $root = "")
|
||||
{
|
||||
foreach (new \DirectoryIterator($folder) as $f) {
|
||||
if ($f->isDot()) {
|
||||
continue;
|
||||
} //skip . ..
|
||||
$src = $folder . '/' . $f;
|
||||
$dst = substr($f->getPathname(), strlen($root));
|
||||
if ($f->isDir()) {
|
||||
if ($zip->addEmptyDir($dst)) {
|
||||
if (zipDir($src, $zip, $root)) {
|
||||
continue;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($f->isFile()) {
|
||||
if (! $zip->addFile($src, $dst)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* main part of script
|
||||
*/
|
||||
|
||||
list($mod, $version) = detectModule();
|
||||
$outzip = sys_get_temp_dir() . "/module_" . $mod . "-" . $version . ".zip";
|
||||
if (file_exists($outzip)) {
|
||||
secureUnlink($outzip);
|
||||
}
|
||||
|
||||
//copy all sources into system temp directory
|
||||
$tmpdir = tempnam(sys_get_temp_dir(), $mod . "-module");
|
||||
secureUnlink($tmpdir);
|
||||
mkdirAndCheck($tmpdir);
|
||||
$dst = $tmpdir . "/" . $mod;
|
||||
mkdirAndCheck($dst);
|
||||
|
||||
foreach ($listOfModuleContent as $moduleContent) {
|
||||
foreach (glob($moduleContent) as $entry) {
|
||||
if (!rcopy($entry, $dst . '/' . $entry)) {
|
||||
echo "[fail] Error on copy " . $entry . " to " . $dst . "/" . $entry . "\n";
|
||||
echo "Please take time to analyze the problem and fix the bug\n";
|
||||
exit(-8);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$z = new ZipArchive();
|
||||
$z->open($outzip, ZIPARCHIVE::CREATE);
|
||||
zipDir($tmpdir, $z, $tmpdir . '/');
|
||||
$z->close();
|
||||
delTree($tmpdir);
|
||||
if (file_exists($outzip)) {
|
||||
echo "[success] module archive is ready : $outzip ...\n";
|
||||
} else {
|
||||
echo "[fail] build zip error\n";
|
||||
exit(-9);
|
||||
}
|
||||
11
build/makepack-elektroplanung.conf
Normal file
11
build/makepack-elektroplanung.conf
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# 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
|
||||
mymodule/
|
||||
530
core/modules/modElektroplanung.class.php
Normal file
530
core/modules/modElektroplanung.class.php
Normal file
|
|
@ -0,0 +1,530 @@
|
|||
<?php
|
||||
/* Copyright (C) 2004-2018 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2018-2019 Nicolas ZABOURI <info@inovea-conseil.com>
|
||||
* Copyright (C) 2019-2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \defgroup elektroplanung Module Elektroplanung
|
||||
* \brief Elektroplanung module descriptor.
|
||||
*
|
||||
* \file htdocs/elektroplanung/core/modules/modElektroplanung.class.php
|
||||
* \ingroup elektroplanung
|
||||
* \brief Description and activation file for module Elektroplanung
|
||||
*/
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
|
||||
|
||||
|
||||
/**
|
||||
* Description and activation class for module Elektroplanung
|
||||
*/
|
||||
class modElektroplanung extends DolibarrModules
|
||||
{
|
||||
/**
|
||||
* Constructor. Define names, constants, directories, boxes, permissions
|
||||
*
|
||||
* @param DoliDB $db Database handler
|
||||
*/
|
||||
public function __construct($db)
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
$this->db = $db;
|
||||
|
||||
// Id for module (must be unique).
|
||||
// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
|
||||
$this->numero = 500030; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module
|
||||
|
||||
// Key text used to identify module (for permissions, menus, etc...)
|
||||
$this->rights_class = 'elektroplanung';
|
||||
|
||||
// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
|
||||
// It is used to group modules by family in module setup page
|
||||
$this->family = "other";
|
||||
|
||||
// Module position in the family on 2 digits ('01', '10', '20', ...)
|
||||
$this->module_position = '90';
|
||||
|
||||
// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
|
||||
//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
|
||||
// Module label (no space allowed), used if translation string 'ModuleElektroplanungName' not found (Elektroplanung is name of module).
|
||||
$this->name = preg_replace('/^mod/i', '', get_class($this));
|
||||
|
||||
// DESCRIPTION_FLAG
|
||||
// Module description, used if translation string 'ModuleElektroplanungDesc' not found (Elektroplanung is name of module).
|
||||
$this->description = "ElektroplanungDescription";
|
||||
// Used only if file README.md and README-LL.md not found.
|
||||
$this->descriptionlong = "ElektroplanungDescription";
|
||||
|
||||
// Author
|
||||
$this->editor_name = 'Alles Watt laeuft';
|
||||
$this->editor_url = ''; // Must be an external online web site
|
||||
$this->editor_squarred_logo = ''; // Must be image filename into the module/img directory followed with @modulename. Example: 'myimage.png@elektroplanung'
|
||||
|
||||
// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated', 'experimental_deprecated' or a version string like 'x.y.z'
|
||||
$this->version = '1.0';
|
||||
// Url to the file with your last numberversion of this module
|
||||
//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
|
||||
|
||||
// Key used in llx_const table to save module status enabled/disabled (where ELEKTROPLANUNG is value of property name of module in uppercase)
|
||||
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
|
||||
|
||||
// Name of image file used for this module.
|
||||
// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
|
||||
// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
|
||||
// To use a supported fa-xxx css style of font awesome, use this->picto='xxx'
|
||||
$this->picto = 'fa-file';
|
||||
|
||||
// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
|
||||
$this->module_parts = array(
|
||||
// Set this to 1 if module has its own trigger directory (core/triggers)
|
||||
'triggers' => 0,
|
||||
// Set this to 1 if module has its own login method file (core/login)
|
||||
'login' => 0,
|
||||
// Set this to 1 if module has its own substitution function file (core/substitutions)
|
||||
'substitutions' => 0,
|
||||
// Set this to 1 if module has its own menus handler directory (core/menus)
|
||||
'menus' => 0,
|
||||
// Set this to 1 if module overwrite template dir (core/tpl)
|
||||
'tpl' => 0,
|
||||
// Set this to 1 if module has its own barcode directory (core/modules/barcode)
|
||||
'barcode' => 0,
|
||||
// Set this to 1 if module has its own models directory (core/modules/xxx)
|
||||
'models' => 0,
|
||||
// Set this to 1 if module has its own printing directory (core/modules/printing)
|
||||
'printing' => 0,
|
||||
// Set this to 1 if module has its own theme directory (theme)
|
||||
'theme' => 0,
|
||||
// Set this to relative path of css file if module has its own css file
|
||||
'css' => array(
|
||||
'/elektroplanung/css/elektroplanung.css',
|
||||
),
|
||||
// Set this to relative path of js file if module must load a js on all pages
|
||||
'js' => array(
|
||||
// '/elektroplanung/js/elektroplanung.js.php',
|
||||
),
|
||||
// Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all'
|
||||
/* BEGIN MODULEBUILDER HOOKSCONTEXTS */
|
||||
'hooks' => array(
|
||||
// 'data' => array(
|
||||
// 'hookcontext1',
|
||||
// 'hookcontext2',
|
||||
// ),
|
||||
// 'entity' => '0',
|
||||
),
|
||||
/* END MODULEBUILDER HOOKSCONTEXTS */
|
||||
// Set this to 1 if features of module are opened to external users
|
||||
'moduleforexternal' => 0,
|
||||
// Set this to 1 if the module provides a website template into doctemplates/websites/website_template-mytemplate
|
||||
'websitetemplates' => 0,
|
||||
// Set this to 1 if the module provides a captcha driver
|
||||
'captcha' => 0
|
||||
);
|
||||
|
||||
// Data directories to create when module is enabled.
|
||||
// Example: this->dirs = array("/elektroplanung/temp","/elektroplanung/subdir");
|
||||
$this->dirs = array("/elektroplanung/temp");
|
||||
|
||||
// Config pages. Put here list of php page, stored into elektroplanung/admin directory, to use to setup module.
|
||||
$this->config_page_url = array("setup.php@elektroplanung");
|
||||
|
||||
// Dependencies
|
||||
// A condition to hide module
|
||||
$this->hidden = getDolGlobalInt('MODULE_ELEKTROPLANUNG_DISABLED'); // A condition to disable module;
|
||||
// List of module class names that must be enabled if this module is enabled. Example: array('always'=>array('modModuleToEnable1','modModuleToEnable2'), 'FR'=>array('modModuleToEnableFR')...)
|
||||
$this->depends = array();
|
||||
// List of module class names to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
|
||||
$this->requiredby = array();
|
||||
// List of module class names this module is in conflict with. Example: array('modModuleToDisable1', ...)
|
||||
$this->conflictwith = array();
|
||||
|
||||
// The language file dedicated to your module
|
||||
$this->langfiles = array("elektroplanung@elektroplanung");
|
||||
|
||||
// Prerequisites
|
||||
$this->phpmin = array(7, 1); // Minimum version of PHP required by module
|
||||
// $this->phpmax = array(8, 0); // Maximum version of PHP required by module
|
||||
$this->need_dolibarr_version = array(19, -3); // Minimum version of Dolibarr required by module
|
||||
// $this->max_dolibarr_version = array(19, -3); // Maximum version of Dolibarr required by module
|
||||
$this->need_javascript_ajax = 0;
|
||||
|
||||
// Messages at activation
|
||||
$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','MX'='textmx'...)
|
||||
$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','MX'='textmx'...)
|
||||
//$this->automatic_activation = array('FR'=>'ElektroplanungWasAutomaticallyActivatedBecauseOfYourCountryChoice');
|
||||
//$this->always_enabled = true; // If true, can't be disabled
|
||||
|
||||
// Constants
|
||||
// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
|
||||
// Example: $this->const=array(1 => array('ELEKTROPLANUNG_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
|
||||
// 2 => array('ELEKTROPLANUNG_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
|
||||
// );
|
||||
$this->const = array();
|
||||
|
||||
// Some keys to add into the overwriting translation tables
|
||||
/*$this->overwrite_translation = array(
|
||||
'en_US:ParentCompany'=>'Parent company or reseller',
|
||||
'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
|
||||
)*/
|
||||
|
||||
if (!isModEnabled("elektroplanung")) {
|
||||
$conf->elektroplanung = new stdClass();
|
||||
$conf->elektroplanung->enabled = 0;
|
||||
}
|
||||
|
||||
// Array to add new pages in new tabs
|
||||
/* BEGIN MODULEBUILDER TABS */
|
||||
$this->tabs = array();
|
||||
/* END MODULEBUILDER TABS */
|
||||
// Example:
|
||||
// To add a new tab identified by code tabname1
|
||||
// $this->tabs[] = array('data' => 'objecttype:+tabname1:Title1:mylangfile@elektroplanung:$user->hasRight(\'elektroplanung\', \'read\'):/elektroplanung/mynewtab1.php?id=__ID__');
|
||||
// To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
|
||||
// $this->tabs[] = array('data' => 'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@elektroplanung:$user->hasRight(\'othermodule\', \'read\'):/elektroplanung/mynewtab2.php?id=__ID__',
|
||||
// To remove an existing tab identified by code tabname
|
||||
// $this->tabs[] = array('data' => 'objecttype:-tabname:NU:conditiontoremove');
|
||||
//
|
||||
// Where objecttype can be
|
||||
// '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
|
||||
// 'delivery' to add a tab in delivery 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
|
||||
// 'supplier_invoice' to add a tab in supplier invoice view
|
||||
// 'member' to add a tab in foundation member view
|
||||
// 'opensurveypoll' to add a tab in opensurvey poll view
|
||||
// 'order' to add a tab in sale order view
|
||||
// 'supplier_order' to add a tab in supplier order view
|
||||
// 'payment' to add a tab in payment view
|
||||
// 'supplier_payment' 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
|
||||
/* Example:
|
||||
$this->dictionaries=array(
|
||||
'langs' => 'elektroplanung@elektroplanung',
|
||||
// List of tables we want to see into dictionary editor
|
||||
'tabname' => array("table1", "table2", "table3"),
|
||||
// Label of tables
|
||||
'tablib' => array("Table1", "Table2", "Table3"),
|
||||
// Request to select fields
|
||||
'tabsql' => array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.$this->db->prefix().'table1 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.$this->db->prefix().'table2 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.$this->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(isModEnabled('elektroplanung'), isModEnabled('elektroplanung'), isModEnabled('elektroplanung')),
|
||||
// Tooltip for every fields of dictionaries: DO NOT PUT AN EMPTY ARRAY
|
||||
'tabhelp' => array(array('code' => $langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip'), array('code' => $langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip'), ...),
|
||||
);
|
||||
*/
|
||||
/* BEGIN MODULEBUILDER DICTIONARIES */
|
||||
$this->dictionaries = array();
|
||||
/* END MODULEBUILDER DICTIONARIES */
|
||||
|
||||
// Boxes/Widgets
|
||||
// Add here list of php file(s) stored in elektroplanung/core/boxes that contains a class to show a widget.
|
||||
/* BEGIN MODULEBUILDER WIDGETS */
|
||||
$this->boxes = array(
|
||||
// 0 => array(
|
||||
// 'file' => 'elektroplanungwidget1.php@elektroplanung',
|
||||
// 'note' => 'Widget provided by Elektroplanung',
|
||||
// 'enabledbydefaulton' => 'Home',
|
||||
// ),
|
||||
// ...
|
||||
);
|
||||
/* END MODULEBUILDER WIDGETS */
|
||||
|
||||
// Cronjobs (List of cron jobs entries to add when module is enabled)
|
||||
// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
|
||||
/* BEGIN MODULEBUILDER CRON */
|
||||
$this->cronjobs = array(
|
||||
// 0 => array(
|
||||
// 'label' => 'MyJob label',
|
||||
// 'jobtype' => 'method',
|
||||
// 'class' => '/elektroplanung/class/myobject.class.php',
|
||||
// 'objectname' => 'MyObject',
|
||||
// 'method' => 'doScheduledJob',
|
||||
// 'parameters' => '',
|
||||
// 'comment' => 'Comment',
|
||||
// 'frequency' => 2,
|
||||
// 'unitfrequency' => 3600,
|
||||
// 'status' => 0,
|
||||
// 'test' => 'isModEnabled("elektroplanung")',
|
||||
// 'priority' => 50,
|
||||
// ),
|
||||
);
|
||||
/* END MODULEBUILDER CRON */
|
||||
// Example: $this->cronjobs=array(
|
||||
// 0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'isModEnabled("elektroplanung")', 'priority'=>50),
|
||||
// 1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'isModEnabled("elektroplanung")', 'priority'=>50)
|
||||
// );
|
||||
|
||||
// Permissions provided by this module
|
||||
$this->rights = array();
|
||||
$r = 0;
|
||||
// Add here entries to declare new permissions
|
||||
/* BEGIN MODULEBUILDER PERMISSIONS */
|
||||
$this->rights[$r][0] = $this->numero . sprintf("%02d", 11); // Permission id: 50003011
|
||||
$this->rights[$r][1] = 'Elektroplanung Tools verwenden'; // Permission label
|
||||
$this->rights[$r][3] = 1; // Default enabled for all users
|
||||
$this->rights[$r][4] = 'tools';
|
||||
$this->rights[$r][5] = 'read'; // In php code: $user->hasRight('elektroplanung', 'tools', 'read')
|
||||
$r++;
|
||||
/* END MODULEBUILDER PERMISSIONS */
|
||||
|
||||
|
||||
// Main menu entries to add
|
||||
$this->menu = array();
|
||||
$r = 0;
|
||||
|
||||
/* BEGIN MODULEBUILDER LEFTMENU - Unter Startseite (home) */
|
||||
// Elektroplanung Hauptmenü unter Startseite
|
||||
$this->menu[$r++] = array(
|
||||
'fk_menu' => 'fk_mainmenu=home',
|
||||
'type' => 'left',
|
||||
'titre' => 'ModuleElektroplanungName',
|
||||
'prefix' => img_picto('', 'fa-bolt', 'class="pictofixedwidth valignmiddle paddingright"'),
|
||||
'mainmenu' => 'home',
|
||||
'leftmenu' => 'elektroplanung',
|
||||
'url' => '/elektroplanung/elektroplanungindex.php',
|
||||
'langs' => 'elektroplanung@elektroplanung',
|
||||
'position' => 100 + $r,
|
||||
'enabled' => 'isModEnabled("elektroplanung")',
|
||||
'perms' => '$user->hasRight("elektroplanung", "tools", "read")',
|
||||
'target' => '',
|
||||
'user' => 2,
|
||||
);
|
||||
|
||||
// Querschnittsrechner
|
||||
$this->menu[$r++] = array(
|
||||
'fk_menu' => 'fk_mainmenu=home,fk_leftmenu=elektroplanung',
|
||||
'type' => 'left',
|
||||
'titre' => 'ElektroplanungQuerschnittsrechner',
|
||||
'prefix' => img_picto('', 'fa-ruler', 'class="pictofixedwidth valignmiddle paddingright"'),
|
||||
'mainmenu' => 'home',
|
||||
'leftmenu' => 'elektroplanung_querschnitt',
|
||||
'url' => '/elektroplanung/tools/querschnittsrechner.php',
|
||||
'langs' => 'elektroplanung@elektroplanung',
|
||||
'position' => 100 + $r,
|
||||
'enabled' => 'isModEnabled("elektroplanung")',
|
||||
'perms' => '$user->hasRight("elektroplanung", "tools", "read")',
|
||||
'target' => '',
|
||||
'user' => 2,
|
||||
);
|
||||
|
||||
// Widerstandsberechnung
|
||||
$this->menu[$r++] = array(
|
||||
'fk_menu' => 'fk_mainmenu=home,fk_leftmenu=elektroplanung',
|
||||
'type' => 'left',
|
||||
'titre' => 'ElektroplanungWiderstandsrechner',
|
||||
'prefix' => img_picto('', 'fa-microchip', 'class="pictofixedwidth valignmiddle paddingright"'),
|
||||
'mainmenu' => 'home',
|
||||
'leftmenu' => 'elektroplanung_widerstand',
|
||||
'url' => '/elektroplanung/tools/widerstandsrechner.php',
|
||||
'langs' => 'elektroplanung@elektroplanung',
|
||||
'position' => 100 + $r,
|
||||
'enabled' => 'isModEnabled("elektroplanung")',
|
||||
'perms' => '$user->hasRight("elektroplanung", "tools", "read")',
|
||||
'target' => '',
|
||||
'user' => 2,
|
||||
);
|
||||
|
||||
// Selektivitäts-Assistent
|
||||
$this->menu[$r++] = array(
|
||||
'fk_menu' => 'fk_mainmenu=home,fk_leftmenu=elektroplanung',
|
||||
'type' => 'left',
|
||||
'titre' => 'ElektroplanungSelektivitaet',
|
||||
'prefix' => img_picto('', 'fa-project-diagram', 'class="pictofixedwidth valignmiddle paddingright"'),
|
||||
'mainmenu' => 'home',
|
||||
'leftmenu' => 'elektroplanung_selektivitaet',
|
||||
'url' => '/elektroplanung/tools/selektivitaet.php',
|
||||
'langs' => 'elektroplanung@elektroplanung',
|
||||
'position' => 100 + $r,
|
||||
'enabled' => 'isModEnabled("elektroplanung")',
|
||||
'perms' => '$user->hasRight("elektroplanung", "tools", "read")',
|
||||
'target' => '',
|
||||
'user' => 2,
|
||||
);
|
||||
/* END MODULEBUILDER LEFTMENU */
|
||||
|
||||
|
||||
// Exports profiles provided by this module
|
||||
$r = 0;
|
||||
/* BEGIN MODULEBUILDER EXPORT MYOBJECT */
|
||||
/*
|
||||
$langs->load("elektroplanung@elektroplanung");
|
||||
$this->export_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->export_label[$r] = 'MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->export_icon[$r] = $this->picto;
|
||||
// Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
|
||||
$keyforclass = 'MyObject'; $keyforclassfile='/elektroplanung/class/myobject.class.php'; $keyforelement='myobject@elektroplanung';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
//$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
|
||||
//unset($this->export_fields_array[$r]['t.fieldtoremove']);
|
||||
//$keyforclass = 'MyObjectLine'; $keyforclassfile='/elektroplanung/class/myobject.class.php'; $keyforelement='myobjectline@elektroplanung'; $keyforalias='tl';
|
||||
//include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
|
||||
$keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject@elektroplanung';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$keyforselect='myobjectline'; $keyforaliasextra='extraline'; $keyforelement='myobjectline@elektroplanung';
|
||||
//include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
|
||||
//$this->export_dependencies_array[$r] = array('myobjectline' => array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
|
||||
//$this->export_special_array[$r] = array('t.field' => '...');
|
||||
//$this->export_examplevalues_array[$r] = array('t.field' => 'Example');
|
||||
//$this->export_help_array[$r] = array('t.field' => 'FieldDescHelp');
|
||||
$this->export_sql_start[$r]='SELECT DISTINCT ';
|
||||
$this->export_sql_end[$r] =' FROM '.$this->db->prefix().'elektroplanung_myobject as t';
|
||||
//$this->export_sql_end[$r] .=' LEFT JOIN '.$this->db->prefix().'elektroplanung_myobject_line as tl ON tl.fk_myobject = t.rowid';
|
||||
$this->export_sql_end[$r] .=' WHERE 1 = 1';
|
||||
$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('myobject').')';
|
||||
$r++; */
|
||||
/* END MODULEBUILDER EXPORT MYOBJECT */
|
||||
|
||||
// Imports profiles provided by this module
|
||||
$r = 0;
|
||||
/* BEGIN MODULEBUILDER IMPORT MYOBJECT */
|
||||
/*
|
||||
$langs->load("elektroplanung@elektroplanung");
|
||||
$this->import_code[$r] = $this->rights_class.'_'.$r;
|
||||
$this->import_label[$r] = 'MyObjectLines'; // Translation key (used only if key ExportDataset_xxx_z not found)
|
||||
$this->import_icon[$r] = $this->picto;
|
||||
$this->import_tables_array[$r] = array('t' => $this->db->prefix().'elektroplanung_myobject', 'extra' => $this->db->prefix().'elektroplanung_myobject_extrafields');
|
||||
$this->import_tables_creator_array[$r] = array('t' => 'fk_user_author'); // Fields to store import user id
|
||||
$import_sample = array();
|
||||
$keyforclass = 'MyObject'; $keyforclassfile='/elektroplanung/class/myobject.class.php'; $keyforelement='myobject@elektroplanung';
|
||||
include DOL_DOCUMENT_ROOT.'/core/commonfieldsinimport.inc.php';
|
||||
$import_extrafield_sample = array();
|
||||
$keyforselect='myobject'; $keyforaliasextra='extra'; $keyforelement='myobject@elektroplanung';
|
||||
include DOL_DOCUMENT_ROOT.'/core/extrafieldsinimport.inc.php';
|
||||
$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.$this->db->prefix().'elektroplanung_myobject');
|
||||
$this->import_regex_array[$r] = array();
|
||||
$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
|
||||
$this->import_updatekeys_array[$r] = array('t.ref' => 'Ref');
|
||||
$this->import_convertvalue_array[$r] = array(
|
||||
't.ref' => array(
|
||||
'rule'=>'getrefifauto',
|
||||
'class'=>(!getDolGlobalString('ELEKTROPLANUNG_MYOBJECT_ADDON') ? 'mod_myobject_standard' : getDolGlobalString('ELEKTROPLANUNG_MYOBJECT_ADDON')),
|
||||
'path'=>"/core/modules/elektroplanung/".(!getDolGlobalString('ELEKTROPLANUNG_MYOBJECT_ADDON') ? 'mod_myobject_standard' : getDolGlobalString('ELEKTROPLANUNG_MYOBJECT_ADDON')).'.php',
|
||||
'classobject'=>'MyObject',
|
||||
'pathobject'=>'/elektroplanung/class/myobject.class.php',
|
||||
),
|
||||
't.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'),
|
||||
't.fk_user_valid' => array('rule' => 'fetchidfromref', 'file' => '/user/class/user.class.php', 'class' => 'User', 'method' => 'fetch', 'element' => 'user'),
|
||||
't.fk_mode_reglement' => array('rule' => 'fetchidfromcodeorlabel', 'file' => '/compta/paiement/class/cpaiement.class.php', 'class' => 'Cpaiement', 'method' => 'fetch', 'element' => 'cpayment'),
|
||||
);
|
||||
$this->import_run_sql_after_array[$r] = array();
|
||||
$r++; */
|
||||
/* END MODULEBUILDER IMPORT MYOBJECT */
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,1> 1 if OK, <=0 if KO
|
||||
*/
|
||||
public function init($options = '')
|
||||
{
|
||||
global $conf, $langs;
|
||||
|
||||
// Create tables of module at module activation
|
||||
//$result = $this->_load_tables('/install/mysql/', 'elektroplanung');
|
||||
$result = $this->_load_tables('/elektroplanung/sql/');
|
||||
if ($result < 0) {
|
||||
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||
}
|
||||
|
||||
// Create extrafields during init
|
||||
//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
|
||||
//$extrafields = new ExtraFields($this->db);
|
||||
//$result0=$extrafields->addExtraField('elektroplanung_separator1', "Separator 1", 'separator', 1, 0, 'thirdparty', 0, 0, '', array('options'=>array(1=>1)), 1, '', 1, 0, '', '', 'elektroplanung@elektroplanung', 'isModEnabled("elektroplanung")');
|
||||
//$result1=$extrafields->addExtraField('elektroplanung_myattr1', "New Attr 1 label", 'boolean', 1, 3, 'thirdparty', 0, 0, '', '', 1, '', -1, 0, '', '', 'elektroplanung@elektroplanung', 'isModEnabled("elektroplanung")');
|
||||
//$result2=$extrafields->addExtraField('elektroplanung_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project', 0, 0, '', '', 1, '', -1, 0, '', '', 'elektroplanung@elektroplanung', 'isModEnabled("elektroplanung")');
|
||||
//$result3=$extrafields->addExtraField('elektroplanung_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', -1, 0, '', '', 'elektroplanung@elektroplanung', 'isModEnabled("elektroplanung")');
|
||||
//$result4=$extrafields->addExtraField('elektroplanung_myattr4', "New Attr 4 label", 'select', 1, 3, 'thirdparty', 0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', -1, 0, '', '', 'elektroplanung@elektroplanung', 'isModEnabled("elektroplanung")');
|
||||
//$result5=$extrafields->addExtraField('elektroplanung_myattr5', "New Attr 5 label", 'text', 1, 10, 'user', 0, 0, '', '', 1, '', -1, 0, '', '', 'elektroplanung@elektroplanung', 'isModEnabled("elektroplanung")');
|
||||
|
||||
// Permissions
|
||||
$this->remove($options);
|
||||
|
||||
$sql = array();
|
||||
|
||||
// Document templates
|
||||
$moduledir = dol_sanitizeFileName('elektroplanung');
|
||||
$myTmpObjects = array();
|
||||
$myTmpObjects['MyObject'] = array('includerefgeneration' => 0, 'includedocgeneration' => 0);
|
||||
|
||||
foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
|
||||
if ($myTmpObjectArray['includerefgeneration']) {
|
||||
$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_myobjects.odt';
|
||||
$dirodt = DOL_DATA_ROOT.($conf->entity > 1 ? '/'.$conf->entity : '').'/doctemplates/'.$moduledir;
|
||||
$dest = $dirodt.'/template_myobjects.odt';
|
||||
|
||||
if (file_exists($src) && !file_exists($dest)) {
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||
dol_mkdir($dirodt);
|
||||
$result = dol_copy($src, $dest, '0', 0);
|
||||
if ($result < 0) {
|
||||
$langs->load("errors");
|
||||
$this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
$sql = array_merge($sql, array(
|
||||
"DELETE FROM ".$this->db->prefix()."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
|
||||
"INSERT INTO ".$this->db->prefix()."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."', '".$this->db->escape(strtolower($myTmpObjectKey))."', ".((int) $conf->entity).")",
|
||||
"DELETE FROM ".$this->db->prefix()."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
|
||||
"INSERT INTO ".$this->db->prefix()."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".$this->db->escape(strtolower($myTmpObjectKey))."', ".((int) $conf->entity).")"
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return $this->_init($sql, $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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,1> 1 if OK, <=0 if KO
|
||||
*/
|
||||
public function remove($options = '')
|
||||
{
|
||||
$sql = array();
|
||||
return $this->_remove($sql, $options);
|
||||
}
|
||||
}
|
||||
739
css/elektroplanung.css
Normal file
739
css/elektroplanung.css
Normal file
|
|
@ -0,0 +1,739 @@
|
|||
/**
|
||||
* ELEKTROPLANUNG - Zentrale CSS-Datei
|
||||
* Verwendet Dolibarr-Theme-Farben via inherit
|
||||
*
|
||||
* Copyright (C) 2026 Eduard Wisch
|
||||
*/
|
||||
|
||||
/* ========================================
|
||||
VARIABLEN - Nur für Akzentfarben
|
||||
======================================== */
|
||||
|
||||
:root {
|
||||
--ep-primary: #b89d5b;
|
||||
--ep-primary-hover: #a68b4a;
|
||||
--ep-success: #10b981;
|
||||
--ep-warning: #f59e0b;
|
||||
--ep-danger: #ef4444;
|
||||
--ep-info: #3b82f6;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
CONTAINER & LAYOUT
|
||||
======================================== */
|
||||
|
||||
.ep-calculator {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 10px;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
SEKTIONEN - Dolibarr-Stil
|
||||
======================================== */
|
||||
|
||||
.ep-section {
|
||||
background: inherit;
|
||||
border: 1px solid;
|
||||
border-color: inherit;
|
||||
border-radius: 8px;
|
||||
padding: 15px;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.ep-section-title {
|
||||
font-size: 15px;
|
||||
font-weight: 600;
|
||||
color: inherit;
|
||||
margin-bottom: 15px;
|
||||
padding-bottom: 10px;
|
||||
border-bottom: 2px solid;
|
||||
border-color: inherit;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
FORMULAR - MOBILE FIRST
|
||||
======================================== */
|
||||
|
||||
.ep-form-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr;
|
||||
gap: 12px;
|
||||
}
|
||||
|
||||
.ep-form-group {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ep-form-group label {
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
color: inherit;
|
||||
opacity: 0.8;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
/* Input-Felder erben Dolibarr-Farben */
|
||||
.ep-form-group input[type="number"],
|
||||
.ep-form-group input[type="text"],
|
||||
.ep-form-group select {
|
||||
padding: 12px;
|
||||
border: 1px solid;
|
||||
border-color: inherit;
|
||||
border-radius: 6px;
|
||||
font-size: 16px; /* Verhindert Zoom auf iOS */
|
||||
background: inherit;
|
||||
color: inherit;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Select-Felder custom Pfeil */
|
||||
.ep-form-group select {
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
|
||||
background-position: right 10px center;
|
||||
background-repeat: no-repeat;
|
||||
background-size: 20px;
|
||||
padding-right: 40px;
|
||||
}
|
||||
|
||||
.ep-form-group input:focus,
|
||||
.ep-form-group select:focus {
|
||||
outline: none;
|
||||
border-color: var(--ep-primary) !important;
|
||||
box-shadow: 0 0 0 3px rgba(184, 157, 91, 0.2);
|
||||
}
|
||||
|
||||
/* Unit Label */
|
||||
.ep-unit {
|
||||
font-size: 11px;
|
||||
opacity: 0.7;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
RADIO & CHECKBOX
|
||||
======================================== */
|
||||
|
||||
.ep-radio-group {
|
||||
display: flex;
|
||||
gap: 15px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.ep-radio-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
cursor: pointer;
|
||||
font-size: 14px;
|
||||
color: inherit;
|
||||
padding: 8px 12px;
|
||||
background: inherit;
|
||||
border-radius: 6px;
|
||||
border: 1px solid;
|
||||
border-color: inherit;
|
||||
}
|
||||
|
||||
.ep-radio-label:has(input:checked) {
|
||||
border-color: var(--ep-primary);
|
||||
background: rgba(184, 157, 91, 0.15);
|
||||
}
|
||||
|
||||
.ep-radio-label input[type="radio"],
|
||||
.ep-radio-label input[type="checkbox"] {
|
||||
accent-color: var(--ep-primary);
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
/* Sichtbarkeit im Dark Mode sicherstellen */
|
||||
-webkit-appearance: auto;
|
||||
appearance: auto;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
TABS - MOBILE OPTIMIERT
|
||||
======================================== */
|
||||
|
||||
.ep-tabs {
|
||||
display: flex;
|
||||
gap: 4px;
|
||||
margin-bottom: 15px;
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
scrollbar-width: none;
|
||||
-ms-overflow-style: none;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
.ep-tabs::-webkit-scrollbar {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ep-tab {
|
||||
padding: 10px 14px;
|
||||
cursor: pointer;
|
||||
background: inherit;
|
||||
color: inherit;
|
||||
border-radius: 6px;
|
||||
font-weight: 500;
|
||||
font-size: 13px;
|
||||
transition: all 0.2s;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
border: 1px solid;
|
||||
border-color: inherit;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.ep-tab:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.ep-tab.active {
|
||||
background: var(--ep-primary);
|
||||
color: white;
|
||||
border-color: var(--ep-primary);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.ep-tab-content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ep-tab-content.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
TOOLBAR
|
||||
======================================== */
|
||||
|
||||
.ep-toolbar {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.ep-toolbar .butAction,
|
||||
.ep-toolbar .butActionDelete {
|
||||
flex: 1 1 auto;
|
||||
min-width: 120px;
|
||||
text-align: center;
|
||||
padding: 10px 15px;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
ERGEBNIS-BOXEN
|
||||
======================================== */
|
||||
|
||||
.ep-result-box {
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
margin-top: 15px;
|
||||
display: none;
|
||||
color: #ffffff;
|
||||
}
|
||||
|
||||
.ep-result-box.show {
|
||||
display: block;
|
||||
animation: epSlideIn 0.3s ease-out;
|
||||
}
|
||||
|
||||
.ep-result-box.success {
|
||||
background: linear-gradient(135deg, var(--ep-success) 0%, #059669 100%);
|
||||
}
|
||||
|
||||
.ep-result-box.warning {
|
||||
background: linear-gradient(135deg, var(--ep-warning) 0%, #d97706 100%);
|
||||
}
|
||||
|
||||
.ep-result-box.error {
|
||||
background: linear-gradient(135deg, var(--ep-danger) 0%, #dc2626 100%);
|
||||
}
|
||||
|
||||
.ep-result-box.info {
|
||||
background: linear-gradient(135deg, var(--ep-info) 0%, #1d4ed8 100%);
|
||||
}
|
||||
|
||||
@keyframes epSlideIn {
|
||||
from { opacity: 0; transform: translateY(-10px); }
|
||||
to { opacity: 1; transform: translateY(0); }
|
||||
}
|
||||
|
||||
.ep-result-main {
|
||||
font-size: 32px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin-bottom: 8px;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.ep-result-status,
|
||||
.ep-result-label {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
margin-bottom: 15px;
|
||||
opacity: 0.95;
|
||||
}
|
||||
|
||||
.ep-result-details {
|
||||
background: rgba(255,255,255,0.15);
|
||||
padding: 12px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.ep-result-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 8px 0;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.2);
|
||||
font-size: 13px;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.ep-result-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.ep-result-item span:first-child {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ep-result-value {
|
||||
font-weight: bold;
|
||||
text-align: right;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
TABELLEN - MOBILE SCROLL
|
||||
======================================== */
|
||||
|
||||
.ep-table-wrapper {
|
||||
overflow-x: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
margin: 0 -15px;
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
.ep-table {
|
||||
width: 100%;
|
||||
min-width: 500px;
|
||||
border-collapse: collapse;
|
||||
font-size: 12px;
|
||||
background: inherit;
|
||||
}
|
||||
|
||||
.ep-table th,
|
||||
.ep-table td {
|
||||
border: 1px solid;
|
||||
border-color: inherit;
|
||||
padding: 8px 10px;
|
||||
text-align: left;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.ep-table th {
|
||||
font-weight: 600;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
BADGES
|
||||
======================================== */
|
||||
|
||||
.ep-badge {
|
||||
display: inline-block;
|
||||
padding: 3px 8px;
|
||||
border-radius: 4px;
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.ep-badge-success {
|
||||
background: var(--ep-success);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.ep-badge-warning {
|
||||
background: var(--ep-warning);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.ep-badge-error {
|
||||
background: var(--ep-danger);
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
INFO-BOX
|
||||
======================================== */
|
||||
|
||||
.ep-info-box {
|
||||
background: rgba(59, 130, 246, 0.15);
|
||||
border-left: 4px solid var(--ep-info);
|
||||
padding: 12px;
|
||||
border-radius: 6px;
|
||||
margin-top: 15px;
|
||||
color: inherit;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.ep-info-box ul {
|
||||
margin: 8px 0 0 20px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.ep-info-box li {
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
WARNING-BOX
|
||||
======================================== */
|
||||
|
||||
.ep-warning-box {
|
||||
background: rgba(245, 158, 11, 0.15);
|
||||
border-left: 4px solid var(--ep-warning);
|
||||
padding: 12px;
|
||||
border-radius: 6px;
|
||||
margin-top: 15px;
|
||||
color: inherit;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
KETTEN-VISUALISIERUNG
|
||||
======================================== */
|
||||
|
||||
.ep-chain {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
padding: 15px;
|
||||
background: inherit;
|
||||
border-radius: 8px;
|
||||
border: 1px solid;
|
||||
border-color: inherit;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.ep-chain-item {
|
||||
background: inherit;
|
||||
border: 2px solid;
|
||||
border-color: inherit;
|
||||
border-radius: 8px;
|
||||
padding: 10px 15px;
|
||||
text-align: center;
|
||||
min-width: 100px;
|
||||
}
|
||||
|
||||
.ep-chain-item.selektiv {
|
||||
border-color: var(--ep-success);
|
||||
background: rgba(16, 185, 129, 0.15);
|
||||
}
|
||||
|
||||
.ep-chain-item.nicht-selektiv {
|
||||
border-color: var(--ep-danger);
|
||||
background: rgba(239, 68, 68, 0.15);
|
||||
}
|
||||
|
||||
.ep-chain-item .typ {
|
||||
font-size: 10px;
|
||||
opacity: 0.7;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.ep-chain-item .wert {
|
||||
font-size: 18px;
|
||||
font-weight: bold;
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.ep-chain-item .name {
|
||||
font-size: 11px;
|
||||
opacity: 0.7;
|
||||
margin-top: 3px;
|
||||
}
|
||||
|
||||
.ep-chain-item select {
|
||||
background: inherit;
|
||||
color: inherit;
|
||||
border: 1px solid;
|
||||
border-color: inherit;
|
||||
padding: 4px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ep-chain-arrow {
|
||||
font-size: 20px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
.ep-chain-arrow.ok {
|
||||
color: var(--ep-success);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.ep-chain-arrow.nok {
|
||||
color: var(--ep-danger);
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
FORMELN
|
||||
======================================== */
|
||||
|
||||
.ep-formulas-section {
|
||||
background: inherit;
|
||||
border: 1px solid;
|
||||
border-color: inherit;
|
||||
border-radius: 8px;
|
||||
padding: 15px;
|
||||
margin-top: 15px;
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ep-formulas-section.show {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.ep-formula-box {
|
||||
background: inherit;
|
||||
border: 1px solid;
|
||||
border-color: inherit;
|
||||
border-left: 4px solid var(--ep-primary);
|
||||
padding: 12px;
|
||||
margin-bottom: 12px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.ep-formula-label {
|
||||
font-size: 12px;
|
||||
opacity: 0.8;
|
||||
margin-bottom: 8px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.ep-formula-content {
|
||||
font-family: 'Courier New', monospace;
|
||||
font-size: 12px;
|
||||
color: inherit;
|
||||
line-height: 1.6;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
background: rgba(128, 128, 128, 0.1);
|
||||
padding: 10px;
|
||||
border-radius: 4px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
SVG DIAGRAMM - Theme-kompatibel
|
||||
======================================== */
|
||||
|
||||
.ep-pa-diagram {
|
||||
background: inherit;
|
||||
border: 1px solid;
|
||||
border-color: inherit;
|
||||
border-radius: 6px;
|
||||
padding: 15px;
|
||||
margin-top: 15px;
|
||||
text-align: center;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.ep-pa-diagram svg {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
min-width: 350px;
|
||||
}
|
||||
|
||||
/* SVG Elemente */
|
||||
.ep-svg-box {
|
||||
fill: rgba(128, 128, 128, 0.3);
|
||||
stroke: currentColor;
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.ep-svg-spd {
|
||||
fill: var(--ep-warning);
|
||||
stroke: currentColor;
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.ep-svg-pas {
|
||||
fill: var(--ep-success);
|
||||
stroke: currentColor;
|
||||
stroke-width: 2;
|
||||
}
|
||||
|
||||
.ep-svg-text {
|
||||
fill: currentColor;
|
||||
}
|
||||
|
||||
.ep-svg-text-dark {
|
||||
fill: #1f2937;
|
||||
}
|
||||
|
||||
.ep-svg-text-light {
|
||||
fill: white;
|
||||
}
|
||||
|
||||
.ep-svg-text-success {
|
||||
fill: var(--ep-success);
|
||||
}
|
||||
|
||||
.ep-svg-line-primary {
|
||||
stroke: var(--ep-primary);
|
||||
}
|
||||
|
||||
.ep-svg-line-success {
|
||||
stroke: var(--ep-success);
|
||||
}
|
||||
|
||||
.ep-svg-line-earth {
|
||||
stroke: currentColor;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
RESPONSIVE - TABLET
|
||||
======================================== */
|
||||
|
||||
@media (min-width: 600px) {
|
||||
.ep-calculator {
|
||||
padding: 0 15px;
|
||||
}
|
||||
|
||||
.ep-section {
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.ep-form-grid {
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 15px;
|
||||
}
|
||||
|
||||
.ep-result-main {
|
||||
font-size: 40px;
|
||||
}
|
||||
|
||||
.ep-table {
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.ep-toolbar .butAction,
|
||||
.ep-toolbar .butActionDelete {
|
||||
flex: 0 1 auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
RESPONSIVE - DESKTOP
|
||||
======================================== */
|
||||
|
||||
@media (min-width: 900px) {
|
||||
.ep-form-grid {
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
}
|
||||
|
||||
.ep-result-details {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 0 20px;
|
||||
}
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
HILFSELEMENTE FÜR SELEKTIVITÄT
|
||||
======================================== */
|
||||
|
||||
.ep-hint {
|
||||
opacity: 0.7;
|
||||
margin-bottom: 15px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.ep-hint-small {
|
||||
margin-top: 10px;
|
||||
font-size: 12px;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.ep-centered-hint {
|
||||
opacity: 0.7;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.ep-result-hint {
|
||||
margin-top: 15px;
|
||||
padding: 10px;
|
||||
background: rgba(128, 128, 128, 0.15);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
/* Selektivität Ketten-Item Select */
|
||||
.ep-chain-item select {
|
||||
background: inherit;
|
||||
color: inherit;
|
||||
border: 1px solid;
|
||||
border-color: inherit;
|
||||
padding: 4px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.ep-chain-item select.ep-chain-wert {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.ep-chain-delete {
|
||||
margin-top: 5px;
|
||||
padding: 2px 8px;
|
||||
background: var(--ep-danger);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.ep-chain-delete:hover {
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* ========================================
|
||||
PRINT STYLES
|
||||
======================================== */
|
||||
|
||||
@media print {
|
||||
.ep-toolbar,
|
||||
.ep-tabs {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.ep-tab-content {
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.ep-result-box {
|
||||
display: block !important;
|
||||
-webkit-print-color-adjust: exact;
|
||||
print-color-adjust: exact;
|
||||
}
|
||||
}
|
||||
253
elektroplanungindex.php
Normal file
253
elektroplanungindex.php
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
<?php
|
||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2015 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file elektroplanung/elektroplanungindex.php
|
||||
* \ingroup elektroplanung
|
||||
* \brief Home page of elektroplanung top menu
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME'];
|
||||
$tmp2 = realpath(__FILE__);
|
||||
$i = strlen($tmp) - 1;
|
||||
$j = strlen($tmp2) - 1;
|
||||
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
|
||||
$i--;
|
||||
$j--;
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
|
||||
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||
}
|
||||
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
|
||||
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||
}
|
||||
// Try main.inc.php using relative path
|
||||
if (!$res && file_exists("../main.inc.php")) {
|
||||
$res = @include "../main.inc.php";
|
||||
}
|
||||
if (!$res && file_exists("../../main.inc.php")) {
|
||||
$res = @include "../../main.inc.php";
|
||||
}
|
||||
if (!$res && file_exists("../../../main.inc.php")) {
|
||||
$res = @include "../../../main.inc.php";
|
||||
}
|
||||
if (!$res) {
|
||||
die("Include of main fails");
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
|
||||
|
||||
/**
|
||||
* @var Conf $conf
|
||||
* @var DoliDB $db
|
||||
* @var HookManager $hookmanager
|
||||
* @var Translate $langs
|
||||
* @var User $user
|
||||
*/
|
||||
|
||||
// Load translation files required by the page
|
||||
$langs->loadLangs(array("elektroplanung@elektroplanung"));
|
||||
|
||||
$action = GETPOST('action', 'aZ09');
|
||||
|
||||
$now = dol_now();
|
||||
$max = getDolGlobalInt('MAIN_SIZE_SHORTLIST_LIMIT', 5);
|
||||
|
||||
// Security check - Protection if external user
|
||||
$socid = GETPOSTINT('socid');
|
||||
if (!empty($user->socid) && $user->socid > 0) {
|
||||
$action = '';
|
||||
$socid = $user->socid;
|
||||
}
|
||||
|
||||
// Initialize a technical object to manage hooks. Note that conf->hooks_modules contains array
|
||||
//$hookmanager->initHooks(array($object->element.'index'));
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('elektroplanung')) {
|
||||
accessforbidden('Module not enabled');
|
||||
}
|
||||
if (!$user->hasRight('elektroplanung', 'tools', 'read')) {
|
||||
accessforbidden('Permission denied');
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Actions
|
||||
*/
|
||||
|
||||
// None
|
||||
|
||||
|
||||
/*
|
||||
* View
|
||||
*/
|
||||
|
||||
$form = new Form($db);
|
||||
$formfile = new FormFile($db);
|
||||
|
||||
llxHeader("", $langs->trans("ElektroplanungArea"), '', '', 0, 0, '', '', '', 'mod-elektroplanung page-index');
|
||||
|
||||
print load_fiche_titre($langs->trans("ElektroplanungArea"), '', 'elektroplanung.png@elektroplanung');
|
||||
|
||||
print '<div class="fichecenter"><div class="fichethirdleft">';
|
||||
|
||||
|
||||
/* BEGIN MODULEBUILDER DRAFT MYOBJECT
|
||||
// Draft MyObject
|
||||
if (isModEnabled('elektroplanung') && $user->hasRight('elektroplanung', 'read')) {
|
||||
$langs->load("orders");
|
||||
|
||||
$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
|
||||
$sql.= ", s.code_client";
|
||||
$sql.= " FROM ".$db->prefix()."commande as c";
|
||||
$sql.= ", ".$db->prefix()."societe as s";
|
||||
$sql.= " WHERE c.fk_soc = s.rowid";
|
||||
$sql.= " AND c.fk_statut = 0";
|
||||
$sql.= " AND c.entity IN (".getEntity('commande').")";
|
||||
if ($socid) $sql.= " AND c.fk_soc = ".((int) $socid);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$total = 0;
|
||||
$num = $db->num_rows($resql);
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="3">'.$langs->trans("DraftMyObjects").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
|
||||
|
||||
$var = true;
|
||||
if ($num > 0)
|
||||
{
|
||||
$i = 0;
|
||||
while ($i < $num)
|
||||
{
|
||||
|
||||
$obj = $db->fetch_object($resql);
|
||||
print '<tr class="oddeven"><td class="nowrap">';
|
||||
|
||||
$myobjectstatic->id=$obj->rowid;
|
||||
$myobjectstatic->ref=$obj->ref;
|
||||
$myobjectstatic->ref_client=$obj->ref_client;
|
||||
$myobjectstatic->total_ht = $obj->total_ht;
|
||||
$myobjectstatic->total_tva = $obj->total_tva;
|
||||
$myobjectstatic->total_ttc = $obj->total_ttc;
|
||||
|
||||
print $myobjectstatic->getNomUrl(1);
|
||||
print '</td>';
|
||||
print '<td class="nowrap">';
|
||||
print '</td>';
|
||||
print '<td class="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
|
||||
$i++;
|
||||
$total += $obj->total_ttc;
|
||||
}
|
||||
if ($total>0)
|
||||
{
|
||||
|
||||
print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" class="right">'.price($total)."</td></tr>";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
|
||||
$db->free($resql);
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($db);
|
||||
}
|
||||
}
|
||||
END MODULEBUILDER DRAFT MYOBJECT */
|
||||
|
||||
|
||||
print '</div><div class="fichetwothirdright">';
|
||||
|
||||
|
||||
/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
|
||||
// Last modified myobject
|
||||
if (isModEnabled('elektroplanung') && $user->hasRight('elektroplanung', 'read')) {
|
||||
$sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms";
|
||||
$sql.= " FROM ".$db->prefix()."elektroplanung_myobject as s";
|
||||
$sql.= " WHERE s.entity IN (".getEntity($myobjectstatic->element).")";
|
||||
//if ($socid) $sql.= " AND s.rowid = $socid";
|
||||
$sql .= " ORDER BY s.tms DESC";
|
||||
$sql .= $db->plimit($max, 0);
|
||||
|
||||
$resql = $db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$num = $db->num_rows($resql);
|
||||
$i = 0;
|
||||
|
||||
print '<table class="noborder centpercent">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<th colspan="2">';
|
||||
print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
|
||||
print '</th>';
|
||||
print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
|
||||
print '</tr>';
|
||||
if ($num)
|
||||
{
|
||||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
$myobjectstatic->id=$objp->rowid;
|
||||
$myobjectstatic->ref=$objp->ref;
|
||||
$myobjectstatic->label=$objp->label;
|
||||
$myobjectstatic->status = $objp->status;
|
||||
|
||||
print '<tr class="oddeven">';
|
||||
print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
|
||||
print '<td class="right nowrap">';
|
||||
print "</td>";
|
||||
print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
|
||||
print '</tr>';
|
||||
$i++;
|
||||
}
|
||||
|
||||
$db->free($resql);
|
||||
} else {
|
||||
print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
|
||||
}
|
||||
print "</table><br>";
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
print '</div></div>';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
$db->close();
|
||||
14
img/README.md
Normal file
14
img/README.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
Directory for module image files
|
||||
--------------------------------
|
||||
|
||||
You can put here the .png files of your module:
|
||||
|
||||
|
||||
If the picto of your module is an image (property $picto has been set to 'elektroplanung.png@elektroplanung', you can put into this
|
||||
directory a .png file called *object_elektroplanung.png* (16x16 or 32x32 pixels)
|
||||
|
||||
|
||||
If the picto of an object is an image (property $picto of the object.class.php has been set to 'myobject.png@elektroplanung', then you can put into this
|
||||
directory a .png file called *object_myobject.png* (16x16 or 32x32 pixels)
|
||||
|
||||
208
langs/de_DE/elektroplanung.lang
Normal file
208
langs/de_DE/elektroplanung.lang
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
# Elektroplanung - Deutsche Sprachdatei
|
||||
# Copyright (C) 2026 Eduard Wisch
|
||||
|
||||
#
|
||||
# Modul
|
||||
#
|
||||
ModuleElektroplanungName = Elektroplanung
|
||||
ModuleElektroplanungDesc = Berechnungstools für Elektroinstallationen nach VDE
|
||||
|
||||
#
|
||||
# Admin
|
||||
#
|
||||
ElektroplanungSetup = Elektroplanung Einstellungen
|
||||
Settings = Einstellungen
|
||||
ElektroplanungSetupPage = Elektroplanung Konfiguration
|
||||
|
||||
#
|
||||
# Menü
|
||||
#
|
||||
ElektroplanungUebersicht = Übersicht
|
||||
ElektroplanungBerechnungstools = Berechnungstools
|
||||
ElektroplanungQuerschnittsrechner = Querschnittsrechner
|
||||
ElektroplanungWiderstandsrechner = Widerstandsrechner
|
||||
|
||||
#
|
||||
# Allgemein
|
||||
#
|
||||
Calculate = Berechnen
|
||||
Reset = Zurücksetzen
|
||||
ElektroplanungFormelnAnzeigen = Formeln anzeigen
|
||||
ElektroplanungFormelnAusblenden = Formeln ausblenden
|
||||
|
||||
#
|
||||
# Querschnittsrechner - Eingabe
|
||||
#
|
||||
ElektroplanungEingabeNetzart = Eingabe & Netzart
|
||||
ElektroplanungEingabeart = Eingabeart
|
||||
ElektroplanungStrom = Strom
|
||||
ElektroplanungLeistung = Leistung
|
||||
ElektroplanungNetzart = Netzart
|
||||
ElektroplanungSpannung = Spannung
|
||||
|
||||
#
|
||||
# Querschnittsrechner - Leitungsdaten
|
||||
#
|
||||
ElektroplanungLeitungsdaten = Leitungsdaten
|
||||
ElektroplanungLeitungslaenge = Leitungslänge
|
||||
ElektroplanungLeistungsfaktor = Leistungsfaktor
|
||||
ElektroplanungMaxSpannungsfall = Max. Spannungsfall
|
||||
ElektroplanungLeitermaterial = Leitermaterial
|
||||
|
||||
#
|
||||
# Querschnittsrechner - Verlegung
|
||||
#
|
||||
ElektroplanungVerlegungUmgebung = Verlegung & Umgebung
|
||||
ElektroplanungVerlegeart = Verlegeart
|
||||
ElektroplanungUmgebungstemperatur = Umgebungstemperatur
|
||||
ElektroplanungAnzahlKabel = Anzahl Kabel nebeneinander
|
||||
ElektroplanungIsolierung = Isolierung
|
||||
|
||||
#
|
||||
# Querschnittsrechner - Ergebnis
|
||||
#
|
||||
ElektroplanungEmpfohlenerQuerschnitt = Empfohlener Leitungsquerschnitt
|
||||
ElektroplanungBerechnet = Berechnet
|
||||
ElektroplanungSpannungsfallResult = Spannungsfall
|
||||
ElektroplanungStrombelastbar = Strombelastbar
|
||||
ElektroplanungKabeltyp = Kabeltyp
|
||||
|
||||
#
|
||||
# Querschnittsrechner - Formeln
|
||||
#
|
||||
ElektroplanungAngewendeteFormeln = Angewendete Formeln und Berechnungen
|
||||
|
||||
#
|
||||
# Querschnittsrechner - Hinweise
|
||||
#
|
||||
ElektroplanungHinweise = Hinweise
|
||||
ElektroplanungHinweisDIN = Berechnung nach DIN VDE 0100-520 (Spannungsfall) und DIN VDE 0298-4 (Strombelastbarkeit)
|
||||
ElektroplanungHinweisLaenge = Leitungslänge = einfache Länge (nicht Hin + Rück)
|
||||
ElektroplanungHinweisFachplanung = Bei kritischen Installationen immer zusätzlich Fachplanung hinzuziehen
|
||||
ElektroplanungHinweisNormquerschnitte = Normquerschnitte: 1,5 / 2,5 / 4 / 6 / 10 / 16 / 25 / 35 / 50 / 70 / 95 / 120 / 150 / 185 / 240 mm²
|
||||
|
||||
#
|
||||
# Widerstandsrechner - Tabs
|
||||
#
|
||||
ElektroplanungWiderstandBerechnung = Widerstand berechnen
|
||||
ElektroplanungQuerschnittErmitteln = Querschnitt ermitteln
|
||||
ElektroplanungVDEAnforderungen = VDE Anforderungen
|
||||
|
||||
#
|
||||
# Widerstandsrechner - Anwendung
|
||||
#
|
||||
ElektroplanungAnwendungsfall = Anwendungsfall
|
||||
ElektroplanungAnwendung = Anwendung
|
||||
ElektroplanungHauptPA = Hauptpotentialausgleich
|
||||
ElektroplanungZusatzPA = Zusatz-Potentialausgleich
|
||||
ElektroplanungSPDTyp1 = SPD Typ 1 (Blitzstromableiter)
|
||||
ElektroplanungSPDTyp2 = SPD Typ 2 (Überspannungsableiter)
|
||||
ElektroplanungBlitzschutz = Blitzschutz-Potentialausgleich
|
||||
ElektroplanungBenutzerdefiniert = Benutzerdefiniert
|
||||
ElektroplanungMaxWiderstand = Max. Widerstand
|
||||
|
||||
#
|
||||
# Widerstandsrechner - Leitung
|
||||
#
|
||||
ElektroplanungQuerschnitt = Querschnitt
|
||||
ElektroplanungTemperatur = Temperatur
|
||||
|
||||
#
|
||||
# Widerstandsrechner - Verbindungen
|
||||
#
|
||||
ElektroplanungVerbindungen = Verbindungen & Klemmen
|
||||
ElektroplanungAnzahlKlemmen = Anzahl Klemmen/Verbindungen
|
||||
ElektroplanungWiderstandProKlemme = Widerstand pro Klemme
|
||||
ElektroplanungAnzahlSchienen = Anzahl Potentialausgleichsschienen
|
||||
ElektroplanungWiderstandProSchiene = Widerstand pro Schiene
|
||||
|
||||
#
|
||||
# Widerstandsrechner - Ergebnis
|
||||
#
|
||||
ElektroplanungLeitungswiderstand = Leitungswiderstand
|
||||
ElektroplanungKlemmenwiderstand = Klemmenwiderstand
|
||||
ElektroplanungSchienenwiderstand = Schienenwiderstand
|
||||
ElektroplanungMaxZulaessig = Max. zulässig
|
||||
ElektroplanungReserve = Reserve
|
||||
ElektroplanungWiderstandOK = Widerstand in Ordnung
|
||||
ElektroplanungWiderstandZuHoch = Widerstand zu hoch!
|
||||
|
||||
#
|
||||
# Widerstandsrechner - Querschnitt ermitteln
|
||||
#
|
||||
ElektroplanungZielwerte = Zielwerte
|
||||
ElektroplanungQuerschnittBerechnen = Querschnitt berechnen
|
||||
ElektroplanungMindestquerschnitt = Mindestquerschnitt
|
||||
ElektroplanungTatsWiderstand = Tatsächlicher Widerstand
|
||||
ElektroplanungMaxLaenge = Max. Länge mit diesem Querschnitt
|
||||
|
||||
#
|
||||
# Widerstandsrechner - VDE
|
||||
#
|
||||
ElektroplanungVDEPotentialausgleich = Potentialausgleich nach VDE
|
||||
ElektroplanungVDEPABeschreibung = Der Potentialausgleich ist eine wichtige Schutzmaßnahme, die alle leitfähigen Teile einer Anlage auf gleiches elektrisches Potential bringt. Die maximalen Widerstände sind in den VDE-Normen festgelegt.
|
||||
ElektroplanungNorm = Norm
|
||||
ElektroplanungMindestquerschnittCu = Mindestquerschnitt
|
||||
ElektroplanungSPDAnschluss = SPD Anschluss
|
||||
ElektroplanungSPDBeschreibung = Überspannungsschutzgeräte (SPD) müssen möglichst kurz und mit niedrigem Widerstand an die Potentialausgleichsschiene angeschlossen werden. Die Gesamtlänge der Anschlussleitung sollte 0,5 m nicht überschreiten.
|
||||
ElektroplanungLegende = Legende
|
||||
ElektroplanungWichtig = Wichtig
|
||||
ElektroplanungVDEHinweis1 = Die Verbindungsleitungen müssen möglichst kurz gehalten werden
|
||||
ElektroplanungVDEHinweis2 = Alle Klemmverbindungen müssen dauerhaft kontaktsicher sein
|
||||
ElektroplanungVDEHinweis3 = Der Gesamtwiderstand muss regelmäßig überprüft werden
|
||||
|
||||
#
|
||||
# Selektivitäts-Assistent
|
||||
#
|
||||
ElektroplanungSelektivitaet = Selektivität
|
||||
ElektroplanungSelPruefen = Prüfen
|
||||
ElektroplanungSelKette = Sicherungskette
|
||||
ElektroplanungSelTabellen = Tabellen
|
||||
ElektroplanungSelVDE = VDE Normen
|
||||
ElektroplanungSelPruefenBtn = Selektivität prüfen
|
||||
ElektroplanungSelVorsicherung = Vorsicherung
|
||||
ElektroplanungSelNachsicherung = Nachsicherung
|
||||
ElektroplanungSelTyp = Typ
|
||||
ElektroplanungSelNennstrom = Nennstrom
|
||||
ElektroplanungSelOrt = Einbauort
|
||||
ElektroplanungSelVerhaeltnis = Verhältnis
|
||||
ElektroplanungSelVDENorm = VDE-Norm
|
||||
ElektroplanungSelKetteConfig = Sicherungskette konfigurieren
|
||||
ElektroplanungSelKetteInfo = Fügen Sie die Sicherungen von HAK bis Endstromkreis hinzu und prüfen Sie die gesamte Kette auf Selektivität.
|
||||
ElektroplanungSelVorlage = Vorlage laden
|
||||
ElektroplanungSelVorlageWaehlen = -- Vorlage wählen --
|
||||
ElektroplanungSelKetteLeer = Keine Sicherungen in der Kette. Fügen Sie Elemente hinzu.
|
||||
ElektroplanungSelHinzufuegen = Hinzufügen
|
||||
ElektroplanungSelKettePruefen = Kette prüfen
|
||||
ElektroplanungSelKetteLoeschen = Kette löschen
|
||||
ElektroplanungSelTabelleSchmelz = Schmelzsicherungen (gG/gL)
|
||||
ElektroplanungSelSchmelzInfo = Faktor ≥ 1,6 zwischen Vor- und Nachsicherung für volle Selektivität (= 2 Nennstromstufen Abstand)
|
||||
ElektroplanungSelTabelleSLS = SLS zu LS-Schalter
|
||||
ElektroplanungSelSLSInfo = SLS-Schalter sind speziell für Selektivität zu nachgeschalteten LS-Schaltern konstruiert.
|
||||
ElektroplanungSelTabelleRCD = RCD Selektivität
|
||||
ElektroplanungSelRCDInfo = Vorgeschaltete RCD muss Typ S sein UND mindestens 3-fachen IΔn haben.
|
||||
ElektroplanungSelMindestwert = Mindestwert für Selektivität
|
||||
ElektroplanungSelNachgeschaltet = Nachgeschaltet
|
||||
ElektroplanungSelVorgeschaltet = Vorgeschaltet
|
||||
ElektroplanungSelErgebnis = Ergebnis
|
||||
ElektroplanungSelVDENormen = VDE Normen zur Selektivität
|
||||
ElektroplanungSelInhalt = Inhalt
|
||||
ElektroplanungSelPflicht = Pflicht?
|
||||
ElektroplanungSelWichtig = Wichtige Hinweise
|
||||
ElektroplanungSelWichtigTitel = Merke
|
||||
ElektroplanungSelPraxistipps = Praxistipps
|
||||
ElektroplanungSelSituation = Situation
|
||||
ElektroplanungSelEmpfehlung = Empfehlung
|
||||
|
||||
#
|
||||
# About
|
||||
#
|
||||
About = Über
|
||||
ElektroplanungAbout = Über Elektroplanung
|
||||
ElektroplanungAboutPage = Elektroplanung Informationen
|
||||
|
||||
#
|
||||
# Startseite
|
||||
#
|
||||
ElektroplanungArea = Elektroplanung
|
||||
MyPageName = Meine Seite
|
||||
208
langs/en_US/elektroplanung.lang
Normal file
208
langs/en_US/elektroplanung.lang
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
# Elektroplanung - English Language File
|
||||
# Copyright (C) 2026 Eduard Wisch
|
||||
|
||||
#
|
||||
# Module
|
||||
#
|
||||
ModuleElektroplanungName = Electrical Planning
|
||||
ModuleElektroplanungDesc = Calculation tools for electrical installations according to VDE
|
||||
|
||||
#
|
||||
# Admin
|
||||
#
|
||||
ElektroplanungSetup = Electrical Planning Setup
|
||||
Settings = Settings
|
||||
ElektroplanungSetupPage = Electrical Planning Configuration
|
||||
|
||||
#
|
||||
# Menu
|
||||
#
|
||||
ElektroplanungUebersicht = Overview
|
||||
ElektroplanungBerechnungstools = Calculation Tools
|
||||
ElektroplanungQuerschnittsrechner = Cable Cross-Section Calculator
|
||||
ElektroplanungWiderstandsrechner = Resistance Calculator
|
||||
|
||||
#
|
||||
# General
|
||||
#
|
||||
Calculate = Calculate
|
||||
Reset = Reset
|
||||
ElektroplanungFormelnAnzeigen = Show formulas
|
||||
ElektroplanungFormelnAusblenden = Hide formulas
|
||||
|
||||
#
|
||||
# Cross-Section Calculator - Input
|
||||
#
|
||||
ElektroplanungEingabeNetzart = Input & Network Type
|
||||
ElektroplanungEingabeart = Input type
|
||||
ElektroplanungStrom = Current
|
||||
ElektroplanungLeistung = Power
|
||||
ElektroplanungNetzart = Network type
|
||||
ElektroplanungSpannung = Voltage
|
||||
|
||||
#
|
||||
# Cross-Section Calculator - Cable Data
|
||||
#
|
||||
ElektroplanungLeitungsdaten = Cable Data
|
||||
ElektroplanungLeitungslaenge = Cable length
|
||||
ElektroplanungLeistungsfaktor = Power factor
|
||||
ElektroplanungMaxSpannungsfall = Max. voltage drop
|
||||
ElektroplanungLeitermaterial = Conductor material
|
||||
|
||||
#
|
||||
# Cross-Section Calculator - Installation
|
||||
#
|
||||
ElektroplanungVerlegungUmgebung = Installation & Environment
|
||||
ElektroplanungVerlegeart = Installation method
|
||||
ElektroplanungUmgebungstemperatur = Ambient temperature
|
||||
ElektroplanungAnzahlKabel = Number of cables side by side
|
||||
ElektroplanungIsolierung = Insulation
|
||||
|
||||
#
|
||||
# Cross-Section Calculator - Result
|
||||
#
|
||||
ElektroplanungEmpfohlenerQuerschnitt = Recommended cable cross-section
|
||||
ElektroplanungBerechnet = Calculated
|
||||
ElektroplanungSpannungsfallResult = Voltage drop
|
||||
ElektroplanungStrombelastbar = Current capacity
|
||||
ElektroplanungKabeltyp = Cable type
|
||||
|
||||
#
|
||||
# Cross-Section Calculator - Formulas
|
||||
#
|
||||
ElektroplanungAngewendeteFormeln = Applied formulas and calculations
|
||||
|
||||
#
|
||||
# Cross-Section Calculator - Notes
|
||||
#
|
||||
ElektroplanungHinweise = Notes
|
||||
ElektroplanungHinweisDIN = Calculation according to DIN VDE 0100-520 (voltage drop) and DIN VDE 0298-4 (current capacity)
|
||||
ElektroplanungHinweisLaenge = Cable length = single length (not round trip)
|
||||
ElektroplanungHinweisFachplanung = For critical installations always consult professional planning
|
||||
ElektroplanungHinweisNormquerschnitte = Standard cross-sections: 1.5 / 2.5 / 4 / 6 / 10 / 16 / 25 / 35 / 50 / 70 / 95 / 120 / 150 / 185 / 240 mm²
|
||||
|
||||
#
|
||||
# Resistance Calculator - Tabs
|
||||
#
|
||||
ElektroplanungWiderstandBerechnung = Calculate resistance
|
||||
ElektroplanungQuerschnittErmitteln = Determine cross-section
|
||||
ElektroplanungVDEAnforderungen = VDE Requirements
|
||||
|
||||
#
|
||||
# Resistance Calculator - Application
|
||||
#
|
||||
ElektroplanungAnwendungsfall = Application
|
||||
ElektroplanungAnwendung = Application
|
||||
ElektroplanungHauptPA = Main equipotential bonding
|
||||
ElektroplanungZusatzPA = Supplementary equipotential bonding
|
||||
ElektroplanungSPDTyp1 = SPD Type 1 (Lightning arrester)
|
||||
ElektroplanungSPDTyp2 = SPD Type 2 (Surge arrester)
|
||||
ElektroplanungBlitzschutz = Lightning protection bonding
|
||||
ElektroplanungBenutzerdefiniert = Custom
|
||||
ElektroplanungMaxWiderstand = Max. resistance
|
||||
|
||||
#
|
||||
# Resistance Calculator - Cable
|
||||
#
|
||||
ElektroplanungQuerschnitt = Cross-section
|
||||
ElektroplanungTemperatur = Temperature
|
||||
|
||||
#
|
||||
# Resistance Calculator - Connections
|
||||
#
|
||||
ElektroplanungVerbindungen = Connections & Terminals
|
||||
ElektroplanungAnzahlKlemmen = Number of terminals/connections
|
||||
ElektroplanungWiderstandProKlemme = Resistance per terminal
|
||||
ElektroplanungAnzahlSchienen = Number of equipotential busbars
|
||||
ElektroplanungWiderstandProSchiene = Resistance per busbar
|
||||
|
||||
#
|
||||
# Resistance Calculator - Result
|
||||
#
|
||||
ElektroplanungLeitungswiderstand = Cable resistance
|
||||
ElektroplanungKlemmenwiderstand = Terminal resistance
|
||||
ElektroplanungSchienenwiderstand = Busbar resistance
|
||||
ElektroplanungMaxZulaessig = Max. permissible
|
||||
ElektroplanungReserve = Reserve
|
||||
ElektroplanungWiderstandOK = Resistance OK
|
||||
ElektroplanungWiderstandZuHoch = Resistance too high!
|
||||
|
||||
#
|
||||
# Resistance Calculator - Determine cross-section
|
||||
#
|
||||
ElektroplanungZielwerte = Target values
|
||||
ElektroplanungQuerschnittBerechnen = Calculate cross-section
|
||||
ElektroplanungMindestquerschnitt = Minimum cross-section
|
||||
ElektroplanungTatsWiderstand = Actual resistance
|
||||
ElektroplanungMaxLaenge = Max. length with this cross-section
|
||||
|
||||
#
|
||||
# Resistance Calculator - VDE
|
||||
#
|
||||
ElektroplanungVDEPotentialausgleich = Equipotential bonding according to VDE
|
||||
ElektroplanungVDEPABeschreibung = Equipotential bonding is an important protective measure that brings all conductive parts of an installation to the same electrical potential. The maximum resistances are specified in the VDE standards.
|
||||
ElektroplanungNorm = Standard
|
||||
ElektroplanungMindestquerschnittCu = Minimum cross-section
|
||||
ElektroplanungSPDAnschluss = SPD Connection
|
||||
ElektroplanungSPDBeschreibung = Surge protective devices (SPD) must be connected to the equipotential busbar as short as possible and with low resistance. The total length of the connection cable should not exceed 0.5 m.
|
||||
ElektroplanungLegende = Legend
|
||||
ElektroplanungWichtig = Important
|
||||
ElektroplanungVDEHinweis1 = Connection cables must be kept as short as possible
|
||||
ElektroplanungVDEHinweis2 = All terminal connections must be permanently contact-safe
|
||||
ElektroplanungVDEHinweis3 = The total resistance must be checked regularly
|
||||
|
||||
#
|
||||
# Selectivity Assistant
|
||||
#
|
||||
ElektroplanungSelektivitaet = Selectivity
|
||||
ElektroplanungSelPruefen = Check
|
||||
ElektroplanungSelKette = Fuse Chain
|
||||
ElektroplanungSelTabellen = Tables
|
||||
ElektroplanungSelVDE = VDE Standards
|
||||
ElektroplanungSelPruefenBtn = Check Selectivity
|
||||
ElektroplanungSelVorsicherung = Upstream Fuse
|
||||
ElektroplanungSelNachsicherung = Downstream Fuse
|
||||
ElektroplanungSelTyp = Type
|
||||
ElektroplanungSelNennstrom = Rated Current
|
||||
ElektroplanungSelOrt = Location
|
||||
ElektroplanungSelVerhaeltnis = Ratio
|
||||
ElektroplanungSelVDENorm = VDE Standard
|
||||
ElektroplanungSelKetteConfig = Configure Fuse Chain
|
||||
ElektroplanungSelKetteInfo = Add fuses from main connection to final circuit and check the entire chain for selectivity.
|
||||
ElektroplanungSelVorlage = Load Template
|
||||
ElektroplanungSelVorlageWaehlen = -- Select Template --
|
||||
ElektroplanungSelKetteLeer = No fuses in chain. Add elements.
|
||||
ElektroplanungSelHinzufuegen = Add
|
||||
ElektroplanungSelKettePruefen = Check Chain
|
||||
ElektroplanungSelKetteLoeschen = Clear Chain
|
||||
ElektroplanungSelTabelleSchmelz = Fuse Links (gG/gL)
|
||||
ElektroplanungSelSchmelzInfo = Factor ≥ 1.6 between upstream and downstream fuse for full selectivity (= 2 rated current steps apart)
|
||||
ElektroplanungSelTabelleSLS = SLS to MCB
|
||||
ElektroplanungSelSLSInfo = SLS switches are specifically designed for selectivity with downstream MCBs.
|
||||
ElektroplanungSelTabelleRCD = RCD Selectivity
|
||||
ElektroplanungSelRCDInfo = Upstream RCD must be Type S AND have at least 3x IΔn.
|
||||
ElektroplanungSelMindestwert = Minimum value for selectivity
|
||||
ElektroplanungSelNachgeschaltet = Downstream
|
||||
ElektroplanungSelVorgeschaltet = Upstream
|
||||
ElektroplanungSelErgebnis = Result
|
||||
ElektroplanungSelVDENormen = VDE Standards for Selectivity
|
||||
ElektroplanungSelInhalt = Content
|
||||
ElektroplanungSelPflicht = Required?
|
||||
ElektroplanungSelWichtig = Important Notes
|
||||
ElektroplanungSelWichtigTitel = Remember
|
||||
ElektroplanungSelPraxistipps = Practical Tips
|
||||
ElektroplanungSelSituation = Situation
|
||||
ElektroplanungSelEmpfehlung = Recommendation
|
||||
|
||||
#
|
||||
# About
|
||||
#
|
||||
About = About
|
||||
ElektroplanungAbout = About Electrical Planning
|
||||
ElektroplanungAboutPage = Electrical Planning Information
|
||||
|
||||
#
|
||||
# Home
|
||||
#
|
||||
ElektroplanungArea = Electrical Planning
|
||||
MyPageName = My Page
|
||||
85
lib/elektroplanung.lib.php
Normal file
85
lib/elektroplanung.lib.php
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
/* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file elektroplanung/lib/elektroplanung.lib.php
|
||||
* \ingroup elektroplanung
|
||||
* \brief Library files with common functions for Elektroplanung
|
||||
*/
|
||||
|
||||
/**
|
||||
* Prepare admin pages header
|
||||
*
|
||||
* @return array<array{string,string,string}>
|
||||
*/
|
||||
function elektroplanungAdminPrepareHead()
|
||||
{
|
||||
global $langs, $conf;
|
||||
|
||||
// global $db;
|
||||
// $extrafields = new ExtraFields($db);
|
||||
// $extrafields->fetch_name_optionals_label('myobject');
|
||||
|
||||
$langs->load("elektroplanung@elektroplanung");
|
||||
|
||||
$h = 0;
|
||||
$head = array();
|
||||
|
||||
$head[$h][0] = dol_buildpath("/elektroplanung/admin/setup.php", 1);
|
||||
$head[$h][1] = $langs->trans("Settings");
|
||||
$head[$h][2] = 'settings';
|
||||
$h++;
|
||||
|
||||
/*
|
||||
$head[$h][0] = dol_buildpath("/elektroplanung/admin/myobject_extrafields.php", 1);
|
||||
$head[$h][1] = $langs->trans("ExtraFields");
|
||||
$nbExtrafields = (isset($extrafields->attributes['myobject']['label']) && is_countable($extrafields->attributes['myobject']['label'])) ? count($extrafields->attributes['myobject']['label']) : 0;
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbExtrafields . '</span>';
|
||||
}
|
||||
$head[$h][2] = 'myobject_extrafields';
|
||||
$h++;
|
||||
|
||||
$head[$h][0] = dol_buildpath("/elektroplanung/admin/myobjectline_extrafields.php", 1);
|
||||
$head[$h][1] = $langs->trans("ExtraFieldsLines");
|
||||
$nbExtrafields = (isset($extrafields->attributes['myobjectline']['label']) && is_countable($extrafields->attributes['myobjectline']['label'])) ? count($extrafields->attributes['myobject']['label']) : 0;
|
||||
if ($nbExtrafields > 0) {
|
||||
$head[$h][1] .= '<span class="badge marginleftonlyshort">' . $nbExtrafields . '</span>';
|
||||
}
|
||||
$head[$h][2] = 'myobject_extrafieldsline';
|
||||
$h++;
|
||||
*/
|
||||
|
||||
$head[$h][0] = dol_buildpath("/elektroplanung/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:@elektroplanung:/elektroplanung/mypage.php?id=__ID__'
|
||||
//); // to add new tab
|
||||
//$this->tabs = array(
|
||||
// 'entity:-tabname:Title:@elektroplanung:/elektroplanung/mypage.php?id=__ID__'
|
||||
//); // to remove a tab
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'elektroplanung@elektroplanung');
|
||||
|
||||
complete_head_from_modules($conf, $langs, null, $head, $h, 'elektroplanung@elektroplanung', 'remove');
|
||||
|
||||
return $head;
|
||||
}
|
||||
3
modulebuilder.txt
Normal file
3
modulebuilder.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# DO NOT DELETE THIS FILE MANUALLY
|
||||
# File to flag module built using official module template.
|
||||
# When this file is present into a module directory, you can edit it with the module builder tool.
|
||||
3
sql/dolibarr_allversions.sql
Normal file
3
sql/dolibarr_allversions.sql
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
--
|
||||
-- Script run when an upgrade of Dolibarr is done. Whatever is the Dolibarr version.
|
||||
--
|
||||
615
tools/querschnittsrechner.php
Normal file
615
tools/querschnittsrechner.php
Normal file
|
|
@ -0,0 +1,615 @@
|
|||
<?php
|
||||
/* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file tools/querschnittsrechner.php
|
||||
* \ingroup elektroplanung
|
||||
* \brief Leitungsquerschnitt-Rechner nach DIN VDE 0100-520 und DIN VDE 0298-4
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
if (!$res && file_exists("../../main.inc.php")) {
|
||||
$res = @include "../../main.inc.php";
|
||||
}
|
||||
if (!$res && file_exists("../../../main.inc.php")) {
|
||||
$res = @include "../../../main.inc.php";
|
||||
}
|
||||
if (!$res) {
|
||||
die("Include of main fails");
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
|
||||
// Load translation files
|
||||
$langs->loadLangs(array("elektroplanung@elektroplanung"));
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('elektroplanung')) {
|
||||
accessforbidden('Module not enabled');
|
||||
}
|
||||
if (!$user->hasRight('elektroplanung', 'tools', 'read')) {
|
||||
accessforbidden('Permission denied');
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
// Page header
|
||||
llxHeader('', $langs->trans("ElektroplanungQuerschnittsrechner"), '', '', 0, 0, array(
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js'
|
||||
), array(
|
||||
'/elektroplanung/css/elektroplanung.css'
|
||||
), '', 'mod-elektroplanung page-querschnittsrechner');
|
||||
|
||||
// Viewport für Mobile
|
||||
print '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">';
|
||||
|
||||
print load_fiche_titre($langs->trans("ElektroplanungQuerschnittsrechner"), '', 'fa-bolt');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
?>
|
||||
|
||||
<!-- Styles sind in /elektroplanung/css/elektroplanung.css -->
|
||||
|
||||
<div class="ep-calculator">
|
||||
<div class="ep-toolbar">
|
||||
<button class="butAction" onclick="epBerechnen()">
|
||||
<span class="fa fa-search"></span> <?php echo $langs->trans("Calculate"); ?>
|
||||
</button>
|
||||
<button class="butActionDelete" onclick="epToggleFormulas()">
|
||||
<span class="fa fa-calculator"></span> <span id="epFormulaToggleText"><?php echo $langs->trans("ElektroplanungFormelnAnzeigen"); ?></span>
|
||||
</button>
|
||||
<button class="butAction" onclick="epExportPDF()">
|
||||
<span class="fa fa-file-pdf-o"></span> PDF
|
||||
</button>
|
||||
<button class="butActionDelete" onclick="epResetForm()">
|
||||
<span class="fa fa-refresh"></span> <?php echo $langs->trans("Reset"); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- EINGABE SEKTION -->
|
||||
<div class="ep-section">
|
||||
<div class="ep-section-title">
|
||||
<span class="fa fa-bolt"></span> <?php echo $langs->trans("ElektroplanungEingabeNetzart"); ?>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group" style="margin-bottom: 15px;">
|
||||
<label><?php echo $langs->trans("ElektroplanungEingabeart"); ?>:</label>
|
||||
<div class="ep-radio-group">
|
||||
<label class="ep-radio-label">
|
||||
<input type="radio" name="inputType" value="strom" checked onchange="epToggleInputType()">
|
||||
<span><?php echo $langs->trans("ElektroplanungStrom"); ?> (A)</span>
|
||||
</label>
|
||||
<label class="ep-radio-label">
|
||||
<input type="radio" name="inputType" value="leistung" onchange="epToggleInputType()">
|
||||
<span><?php echo $langs->trans("ElektroplanungLeistung"); ?> (kW)</span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-grid">
|
||||
<div class="ep-form-group" id="epStromInput">
|
||||
<label><?php echo $langs->trans("ElektroplanungStrom"); ?> <span class="ep-unit">[A]</span></label>
|
||||
<input type="number" id="epStrom" value="16" step="0.1" min="0">
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group" id="epLeistungInput" style="display: none;">
|
||||
<label><?php echo $langs->trans("ElektroplanungLeistung"); ?> <span class="ep-unit">[kW]</span></label>
|
||||
<input type="number" id="epLeistung" value="3.68" step="0.01" min="0">
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungNetzart"); ?>:</label>
|
||||
<select id="epNetzart" onchange="epUpdateSpannung()">
|
||||
<option value="1ph230">1-phasig 230V (AC)</option>
|
||||
<option value="3ph400" selected>3-phasig 400V (Drehstrom)</option>
|
||||
<option value="dc12">12V DC</option>
|
||||
<option value="dc24">24V DC</option>
|
||||
<option value="dc48">48V DC</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungSpannung"); ?> <span class="ep-unit">[V]</span></label>
|
||||
<input type="number" id="epSpannung" value="400" step="1" min="0">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- LEITUNGSDATEN -->
|
||||
<div class="ep-section">
|
||||
<div class="ep-section-title">
|
||||
<span class="fa fa-plug"></span> <?php echo $langs->trans("ElektroplanungLeitungsdaten"); ?>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-grid">
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungLeitungslaenge"); ?> <span class="ep-unit">[m]</span></label>
|
||||
<input type="number" id="epLaenge" value="20" step="0.1" min="0">
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungLeistungsfaktor"); ?> (cos φ) <span class="ep-unit">[-]</span></label>
|
||||
<input type="number" id="epCosphi" value="0.95" step="0.01" min="0.1" max="1.0">
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungMaxSpannungsfall"); ?> <span class="ep-unit">[%]</span></label>
|
||||
<select id="epSpannungsfall">
|
||||
<option value="3">3% (Beleuchtung)</option>
|
||||
<option value="5" selected>5% (Andere Verbraucher)</option>
|
||||
<option value="1">1% (Sehr kritisch)</option>
|
||||
<option value="2">2% (Kritisch)</option>
|
||||
<option value="4">4% (Baustellen)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungLeitermaterial"); ?>:</label>
|
||||
<select id="epMaterial">
|
||||
<option value="56" selected>Kupfer (Cu)</option>
|
||||
<option value="35">Aluminium (Al)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- VERLEGUNG -->
|
||||
<div class="ep-section">
|
||||
<div class="ep-section-title">
|
||||
<span class="fa fa-cogs"></span> <?php echo $langs->trans("ElektroplanungVerlegungUmgebung"); ?>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-grid">
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungVerlegeart"); ?>:</label>
|
||||
<select id="epVerlegeart">
|
||||
<option value="B1">B1 - Mehradrig an/auf Wand</option>
|
||||
<option value="B2" selected>B2 - Mehradrig in Mauerwerk</option>
|
||||
<option value="C">C - Einadrig in Rohr</option>
|
||||
<option value="E">E - Frei in Luft</option>
|
||||
<option value="F">F - Einadrig frei</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungUmgebungstemperatur"); ?> <span class="ep-unit">[°C]</span></label>
|
||||
<input type="number" id="epTemperatur" value="30" step="1" min="-20" max="80">
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungAnzahlKabel"); ?>:</label>
|
||||
<select id="epHaeufung">
|
||||
<option value="1" selected>1 Kabel (keine Häufung)</option>
|
||||
<option value="2">2 Kabel</option>
|
||||
<option value="3">3 Kabel</option>
|
||||
<option value="4">4 Kabel</option>
|
||||
<option value="5">5 Kabel</option>
|
||||
<option value="6">6-9 Kabel</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungIsolierung"); ?>:</label>
|
||||
<select id="epIsolierung">
|
||||
<option value="70" selected>PVC (70°C)</option>
|
||||
<option value="90">XLPE/EPR (90°C)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ERGEBNIS -->
|
||||
<div id="epResultBox" class="ep-result-box">
|
||||
<div class="ep-result-main" id="epResultQuerschnitt">2.5 mm²</div>
|
||||
<div class="ep-result-label"><?php echo $langs->trans("ElektroplanungEmpfohlenerQuerschnitt"); ?></div>
|
||||
|
||||
<div class="ep-result-details">
|
||||
<div class="ep-result-item">
|
||||
<span><?php echo $langs->trans("ElektroplanungBerechnet"); ?>:</span>
|
||||
<span class="ep-result-value" id="epResultBerechnet">-</span>
|
||||
</div>
|
||||
<div class="ep-result-item">
|
||||
<span><?php echo $langs->trans("ElektroplanungSpannungsfallResult"); ?>:</span>
|
||||
<span class="ep-result-value" id="epResultSpannungsfall">-</span>
|
||||
</div>
|
||||
<div class="ep-result-item">
|
||||
<span><?php echo $langs->trans("ElektroplanungStrombelastbar"); ?>:</span>
|
||||
<span class="ep-result-value" id="epResultStrombelastbar">-</span>
|
||||
</div>
|
||||
<div class="ep-result-item">
|
||||
<span><?php echo $langs->trans("ElektroplanungKabeltyp"); ?>:</span>
|
||||
<span class="ep-result-value" id="epResultKabeltyp">-</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="epWarnings"></div>
|
||||
</div>
|
||||
|
||||
<!-- FORMELN SEKTION -->
|
||||
<div id="epFormulasSection" class="ep-formulas-section">
|
||||
<div class="ep-section-title">
|
||||
<span class="fa fa-calculator"></span> <?php echo $langs->trans("ElektroplanungAngewendeteFormeln"); ?>
|
||||
</div>
|
||||
<div id="epFormulasContent"></div>
|
||||
</div>
|
||||
|
||||
<div class="ep-info-box">
|
||||
<strong><span class="fa fa-info-circle"></span> <?php echo $langs->trans("ElektroplanungHinweise"); ?>:</strong>
|
||||
<ul style="margin-left: 20px; margin-top: 5px;">
|
||||
<li><?php echo $langs->trans("ElektroplanungHinweisDIN"); ?></li>
|
||||
<li><?php echo $langs->trans("ElektroplanungHinweisLaenge"); ?></li>
|
||||
<li><?php echo $langs->trans("ElektroplanungHinweisFachplanung"); ?></li>
|
||||
<li><?php echo $langs->trans("ElektroplanungHinweisNormquerschnitte"); ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Globale Variablen
|
||||
let epCalculationData = {};
|
||||
|
||||
// Normquerschnitte nach DIN VDE
|
||||
const epNormQuerschnitte = [1.5, 2.5, 4, 6, 10, 16, 25, 35, 50, 70, 95, 120, 150, 185, 240, 300, 400, 500, 630];
|
||||
|
||||
// Strombelastbarkeit-Tabelle (Kupfer, PVC 70°C)
|
||||
const epStrombelastbarkeit = {
|
||||
'B1': { 1.5: 15.5, 2.5: 21, 4: 28, 6: 36, 10: 49, 16: 66, 25: 89, 35: 110, 50: 134, 70: 171, 95: 207, 120: 239, 150: 271, 185: 310, 240: 361, 300: 424, 400: 502 },
|
||||
'B2': { 1.5: 18.5, 2.5: 25, 4: 34, 6: 43, 10: 60, 16: 80, 25: 107, 35: 133, 50: 164, 70: 209, 95: 253, 120: 290, 150: 328, 185: 375, 240: 435, 300: 509, 400: 599 },
|
||||
'C': { 1.5: 19.5, 2.5: 27, 4: 37, 6: 47, 10: 64, 16: 86, 25: 114, 35: 141, 50: 175, 70: 222, 95: 269, 120: 309, 150: 349, 185: 399, 240: 461, 300: 537, 400: 629 },
|
||||
'E': { 1.5: 24, 2.5: 32, 4: 42, 6: 54, 10: 73, 16: 98, 25: 131, 35: 162, 50: 199, 70: 253, 95: 306, 120: 351, 150: 396, 185: 453, 240: 524, 300: 611, 400: 716 },
|
||||
'F': { 1.5: 22, 2.5: 30, 4: 40, 6: 51, 10: 69, 16: 93, 25: 125, 35: 154, 50: 190, 70: 242, 95: 293, 120: 336, 150: 379, 185: 434, 240: 502, 300: 585, 400: 685 }
|
||||
};
|
||||
|
||||
// Temperatur-Korrekturfaktoren
|
||||
function epGetTempFaktor(temp, isolierung) {
|
||||
if (isolierung == 70) {
|
||||
if (temp <= 10) return 1.22;
|
||||
if (temp <= 15) return 1.17;
|
||||
if (temp <= 20) return 1.12;
|
||||
if (temp <= 25) return 1.06;
|
||||
if (temp <= 30) return 1.0;
|
||||
if (temp <= 35) return 0.94;
|
||||
if (temp <= 40) return 0.87;
|
||||
if (temp <= 45) return 0.79;
|
||||
if (temp <= 50) return 0.71;
|
||||
return 0.58;
|
||||
} else {
|
||||
if (temp <= 10) return 1.15;
|
||||
if (temp <= 15) return 1.12;
|
||||
if (temp <= 20) return 1.08;
|
||||
if (temp <= 25) return 1.04;
|
||||
if (temp <= 30) return 1.0;
|
||||
if (temp <= 35) return 0.96;
|
||||
if (temp <= 40) return 0.91;
|
||||
if (temp <= 45) return 0.87;
|
||||
if (temp <= 50) return 0.82;
|
||||
if (temp <= 55) return 0.76;
|
||||
return 0.71;
|
||||
}
|
||||
}
|
||||
|
||||
// Häufungs-Korrekturfaktoren
|
||||
function epGetHaeufungsFaktor(anzahl) {
|
||||
const faktoren = { 1: 1.0, 2: 0.80, 3: 0.70, 4: 0.65, 5: 0.60, 6: 0.57 };
|
||||
return faktoren[anzahl] || 0.57;
|
||||
}
|
||||
|
||||
// Toggle Strom/Leistung Eingabe
|
||||
function epToggleInputType() {
|
||||
const inputType = document.querySelector('input[name="inputType"]:checked').value;
|
||||
document.getElementById('epStromInput').style.display = inputType === 'strom' ? 'flex' : 'none';
|
||||
document.getElementById('epLeistungInput').style.display = inputType === 'leistung' ? 'flex' : 'none';
|
||||
}
|
||||
|
||||
// Spannung aktualisieren
|
||||
function epUpdateSpannung() {
|
||||
const netzart = document.getElementById('epNetzart').value;
|
||||
const spannungen = { '1ph230': 230, '3ph400': 400, 'dc12': 12, 'dc24': 24, 'dc48': 48 };
|
||||
document.getElementById('epSpannung').value = spannungen[netzart];
|
||||
}
|
||||
|
||||
// Nächsten Normquerschnitt finden
|
||||
function epGetNormQuerschnitt(berechnet) {
|
||||
for (let qs of epNormQuerschnitte) {
|
||||
if (qs >= berechnet) return qs;
|
||||
}
|
||||
return epNormQuerschnitte[epNormQuerschnitte.length - 1];
|
||||
}
|
||||
|
||||
// Formeln anzeigen/verbergen
|
||||
function epToggleFormulas() {
|
||||
const section = document.getElementById('epFormulasSection');
|
||||
const text = document.getElementById('epFormulaToggleText');
|
||||
if (section.classList.contains('show')) {
|
||||
section.classList.remove('show');
|
||||
text.textContent = '<?php echo addslashes($langs->trans("ElektroplanungFormelnAnzeigen")); ?>';
|
||||
} else {
|
||||
section.classList.add('show');
|
||||
text.textContent = '<?php echo addslashes($langs->trans("ElektroplanungFormelnAusblenden")); ?>';
|
||||
section.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
}
|
||||
}
|
||||
|
||||
// Formeln generieren
|
||||
function epGenerateFormulas(data) {
|
||||
let html = '';
|
||||
|
||||
if (data.inputType === 'leistung') {
|
||||
html += '<div class="ep-formula-box">';
|
||||
html += '<div class="ep-formula-label">1. Stromberechnung aus Leistung</div>';
|
||||
html += '<div class="ep-formula-content">';
|
||||
if (data.netzart.startsWith('3ph')) {
|
||||
html += `I = P / (√3 × U × cos φ)\nI = ${data.leistung} kW / (√3 × ${data.spannung} V × ${data.cosphi})\nI = ${data.strom.toFixed(2)} A`;
|
||||
} else {
|
||||
html += `I = P / (U × cos φ)\nI = ${data.leistung} kW / (${data.spannung} V × ${data.cosphi})\nI = ${data.strom.toFixed(2)} A`;
|
||||
}
|
||||
html += '</div></div>';
|
||||
}
|
||||
|
||||
html += `<div class="ep-formula-box">
|
||||
<div class="ep-formula-label">2. Querschnitt nach Spannungsfall (DIN VDE 0100-520)</div>
|
||||
<div class="ep-formula-content">A = (2 × l × I × cos φ) / (κ × ΔU_zul)
|
||||
|
||||
Werte:
|
||||
l = ${data.laenge} m
|
||||
I = ${data.strom.toFixed(2)} A
|
||||
cos φ = ${data.cosphi}
|
||||
κ = ${data.kappa} m/(Ω·mm²) (${data.material})
|
||||
ΔU_zul = ${data.deltaU_zul.toFixed(2)} V (${data.spannungsfallProzent}% von ${data.spannung}V)
|
||||
|
||||
A = (2 × ${data.laenge} × ${data.strom.toFixed(2)} × ${data.cosphi}) / (${data.kappa} × ${data.deltaU_zul.toFixed(2)})
|
||||
A = ${data.A_spannungsfall.toFixed(3)} mm²
|
||||
|
||||
Normquerschnitt: ${data.querschnitt_spannungsfall} mm²</div>
|
||||
</div>`;
|
||||
|
||||
html += `<div class="ep-formula-box">
|
||||
<div class="ep-formula-label">3. Tatsächlicher Spannungsfall</div>
|
||||
<div class="ep-formula-content">ΔU = (2 × l × I × cos φ) / (κ × A)
|
||||
|
||||
Mit ${data.querschnitt} mm²:
|
||||
ΔU = ${data.deltaU_ist.toFixed(2)} V (${data.deltaU_prozent.toFixed(2)}%)
|
||||
${data.deltaU_prozent <= data.spannungsfallProzent ? '✓ OK' : '✗ Zu hoch!'}</div>
|
||||
</div>`;
|
||||
|
||||
html += `<div class="ep-formula-box">
|
||||
<div class="ep-formula-label">4. Strombelastbarkeit (DIN VDE 0298-4)</div>
|
||||
<div class="ep-formula-content">I_zul = I_Tabelle × f_Temp × f_Häufung
|
||||
|
||||
I_zul = ${data.I_tabelle.toFixed(1)} A × ${data.tempFaktor.toFixed(3)} × ${data.haeufungsFaktor.toFixed(2)}
|
||||
I_zul = ${data.maxStrom.toFixed(1)} A
|
||||
|
||||
Benötigt: ${data.strom.toFixed(2)} A
|
||||
${data.maxStrom >= data.strom ? '✓ Ausreichend' : '✗ Erhöhung nötig!'}</div>
|
||||
</div>`;
|
||||
|
||||
document.getElementById('epFormulasContent').innerHTML = html;
|
||||
}
|
||||
|
||||
// Hauptberechnung
|
||||
function epBerechnen() {
|
||||
try {
|
||||
const inputType = document.querySelector('input[name="inputType"]:checked').value;
|
||||
let strom, leistung = 0;
|
||||
|
||||
const spannung = parseFloat(document.getElementById('epSpannung').value);
|
||||
const cosphi = parseFloat(document.getElementById('epCosphi').value);
|
||||
const netzart = document.getElementById('epNetzart').value;
|
||||
|
||||
if (inputType === 'leistung') {
|
||||
leistung = parseFloat(document.getElementById('epLeistung').value);
|
||||
strom = netzart.startsWith('3ph')
|
||||
? (leistung * 1000) / (Math.sqrt(3) * spannung * cosphi)
|
||||
: (leistung * 1000) / (spannung * cosphi);
|
||||
} else {
|
||||
strom = parseFloat(document.getElementById('epStrom').value);
|
||||
}
|
||||
|
||||
const laenge = parseFloat(document.getElementById('epLaenge').value);
|
||||
const spannungsfallProzent = parseFloat(document.getElementById('epSpannungsfall').value);
|
||||
const kappa = parseFloat(document.getElementById('epMaterial').value);
|
||||
const verlegeart = document.getElementById('epVerlegeart').value;
|
||||
const temperatur = parseFloat(document.getElementById('epTemperatur').value);
|
||||
const haeufung = parseInt(document.getElementById('epHaeufung').value);
|
||||
const isolierung = parseInt(document.getElementById('epIsolierung').value);
|
||||
const material = kappa === 56 ? 'Kupfer' : 'Aluminium';
|
||||
|
||||
if (strom <= 0 || laenge <= 0 || spannung <= 0) {
|
||||
throw new Error('Bitte alle Werte korrekt eingeben!');
|
||||
}
|
||||
|
||||
const deltaU_zul = spannung * (spannungsfallProzent / 100);
|
||||
const A_spannungsfall = (2 * laenge * strom * cosphi) / (kappa * deltaU_zul);
|
||||
const querschnitt_spannungsfall = epGetNormQuerschnitt(A_spannungsfall);
|
||||
|
||||
let querschnitt = querschnitt_spannungsfall;
|
||||
const tempFaktor = epGetTempFaktor(temperatur, isolierung);
|
||||
const haeufungsFaktor = epGetHaeufungsFaktor(haeufung);
|
||||
|
||||
let I_tabelle = epStrombelastbarkeit[verlegeart][querschnitt] || 0;
|
||||
let maxStrom = I_tabelle * tempFaktor * haeufungsFaktor;
|
||||
|
||||
let warnings = [];
|
||||
while (maxStrom < strom && querschnitt < 500) {
|
||||
const index = epNormQuerschnitte.indexOf(querschnitt);
|
||||
if (index < epNormQuerschnitte.length - 1) {
|
||||
const vorher = querschnitt;
|
||||
querschnitt = epNormQuerschnitte[index + 1];
|
||||
I_tabelle = epStrombelastbarkeit[verlegeart][querschnitt] || 0;
|
||||
maxStrom = I_tabelle * tempFaktor * haeufungsFaktor;
|
||||
warnings.push(`⚠️ Querschnitt von ${vorher}mm² auf ${querschnitt}mm² erhöht (Strombelastbarkeit)`);
|
||||
} else break;
|
||||
}
|
||||
|
||||
const deltaU_ist = (2 * laenge * strom * cosphi) / (kappa * querschnitt);
|
||||
const deltaU_prozent = (deltaU_ist / spannung) * 100;
|
||||
|
||||
let kabeltyp = '';
|
||||
if (netzart === '1ph230') kabeltyp = `NYM-J 3x${querschnitt}`;
|
||||
else if (netzart.startsWith('3ph')) kabeltyp = `NYM-J 5x${querschnitt}`;
|
||||
else kabeltyp = `H07V-K 2x${querschnitt}`;
|
||||
|
||||
if (deltaU_prozent > spannungsfallProzent) {
|
||||
warnings.push(`⚠️ Spannungsfall ${deltaU_prozent.toFixed(2)}% > ${spannungsfallProzent}%`);
|
||||
}
|
||||
if (maxStrom / strom < 1.25) {
|
||||
warnings.push(`💡 Nur ${((maxStrom/strom - 1)*100).toFixed(0)}% Reserve`);
|
||||
}
|
||||
if (temperatur > 40 && isolierung == 70) {
|
||||
warnings.push(`⚠️ Hohe Temperatur! XLPE empfohlen`);
|
||||
}
|
||||
|
||||
epCalculationData = {
|
||||
inputType, strom, leistung, laenge, cosphi, spannungsfallProzent, spannung,
|
||||
kappa, material, verlegeart, temperatur, haeufung, isolierung, netzart,
|
||||
deltaU_zul, A_spannungsfall, querschnitt_spannungsfall, querschnitt,
|
||||
deltaU_ist, deltaU_prozent, I_tabelle, tempFaktor, haeufungsFaktor,
|
||||
maxStrom, kabeltyp, warnings
|
||||
};
|
||||
|
||||
document.getElementById('epResultQuerschnitt').textContent = `${querschnitt} mm²`;
|
||||
document.getElementById('epResultBerechnet').textContent = `${A_spannungsfall.toFixed(2)} mm²`;
|
||||
document.getElementById('epResultSpannungsfall').textContent = `${deltaU_ist.toFixed(2)}V (${deltaU_prozent.toFixed(2)}%)`;
|
||||
document.getElementById('epResultStrombelastbar').textContent = `${maxStrom.toFixed(1)} A`;
|
||||
document.getElementById('epResultKabeltyp').textContent = kabeltyp;
|
||||
|
||||
const warningsDiv = document.getElementById('epWarnings');
|
||||
warningsDiv.innerHTML = warnings.length > 0
|
||||
? '<div class="ep-warning-box">' + warnings.join('<br>') + '</div>'
|
||||
: '';
|
||||
|
||||
epGenerateFormulas(epCalculationData);
|
||||
|
||||
const resultBox = document.getElementById('epResultBox');
|
||||
resultBox.classList.add('show');
|
||||
resultBox.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
|
||||
} catch (error) {
|
||||
alert('Fehler: ' + error.message);
|
||||
}
|
||||
}
|
||||
|
||||
// Formular zurücksetzen
|
||||
function epResetForm() {
|
||||
document.getElementById('epStrom').value = 16;
|
||||
document.getElementById('epLeistung').value = 3.68;
|
||||
document.getElementById('epNetzart').value = '3ph400';
|
||||
document.getElementById('epSpannung').value = 400;
|
||||
document.getElementById('epLaenge').value = 20;
|
||||
document.getElementById('epCosphi').value = 0.95;
|
||||
document.getElementById('epSpannungsfall').value = 5;
|
||||
document.getElementById('epMaterial').value = 56;
|
||||
document.getElementById('epVerlegeart').value = 'B2';
|
||||
document.getElementById('epTemperatur').value = 30;
|
||||
document.getElementById('epHaeufung').value = 1;
|
||||
document.getElementById('epIsolierung').value = 70;
|
||||
|
||||
document.getElementById('epResultBox').classList.remove('show');
|
||||
document.getElementById('epFormulasSection').classList.remove('show');
|
||||
document.getElementById('epFormulaToggleText').textContent = '<?php echo addslashes($langs->trans("ElektroplanungFormelnAnzeigen")); ?>';
|
||||
}
|
||||
|
||||
// PDF Export
|
||||
function epExportPDF() {
|
||||
if (!epCalculationData.querschnitt) {
|
||||
alert('Bitte erst eine Berechnung durchführen!');
|
||||
return;
|
||||
}
|
||||
|
||||
const { jsPDF } = window.jspdf;
|
||||
const doc = new jsPDF();
|
||||
const data = epCalculationData;
|
||||
const datum = new Date().toLocaleDateString('de-DE');
|
||||
|
||||
let y = 20;
|
||||
|
||||
doc.setFontSize(18);
|
||||
doc.setFont(undefined, 'bold');
|
||||
doc.text('Leitungsquerschnitt-Berechnung', 105, y, { align: 'center' });
|
||||
y += 8;
|
||||
|
||||
doc.setFontSize(10);
|
||||
doc.setFont(undefined, 'normal');
|
||||
doc.text('Nach DIN VDE 0100-520 und DIN VDE 0298-4', 105, y, { align: 'center' });
|
||||
y += 5;
|
||||
doc.text('Erstellt: ' + datum, 105, y, { align: 'center' });
|
||||
y += 10;
|
||||
|
||||
doc.line(20, y, 190, y);
|
||||
y += 10;
|
||||
|
||||
doc.setFontSize(14);
|
||||
doc.setFont(undefined, 'bold');
|
||||
doc.text('Eingabewerte', 20, y);
|
||||
y += 7;
|
||||
|
||||
doc.setFontSize(10);
|
||||
doc.setFont(undefined, 'normal');
|
||||
|
||||
const inputs = [
|
||||
data.inputType === 'leistung' ? `Leistung: ${data.leistung} kW` : null,
|
||||
`Strom: ${data.strom.toFixed(2)} A`,
|
||||
`Spannung: ${data.spannung} V (${data.netzart})`,
|
||||
`Leitungslänge: ${data.laenge} m`,
|
||||
`Leistungsfaktor: ${data.cosphi}`,
|
||||
`Max. Spannungsfall: ${data.spannungsfallProzent}%`,
|
||||
`Material: ${data.material}`,
|
||||
`Verlegeart: ${data.verlegeart}`,
|
||||
`Temperatur: ${data.temperatur}°C`
|
||||
].filter(Boolean);
|
||||
|
||||
inputs.forEach(line => { doc.text(line, 20, y); y += 6; });
|
||||
y += 5;
|
||||
|
||||
doc.setFontSize(14);
|
||||
doc.setFont(undefined, 'bold');
|
||||
doc.text('Ergebnis', 20, y);
|
||||
y += 7;
|
||||
|
||||
doc.setFontSize(16);
|
||||
doc.setTextColor(16, 185, 129);
|
||||
doc.text(`Querschnitt: ${data.querschnitt} mm²`, 20, y);
|
||||
doc.setTextColor(0, 0, 0);
|
||||
y += 8;
|
||||
|
||||
doc.setFontSize(10);
|
||||
doc.setFont(undefined, 'normal');
|
||||
doc.text(`Berechneter Querschnitt: ${data.A_spannungsfall.toFixed(2)} mm²`, 20, y); y += 6;
|
||||
doc.text(`Spannungsfall: ${data.deltaU_ist.toFixed(2)} V (${data.deltaU_prozent.toFixed(2)}%)`, 20, y); y += 6;
|
||||
doc.text(`Strombelastbarkeit: ${data.maxStrom.toFixed(1)} A`, 20, y); y += 6;
|
||||
doc.text(`Kabeltyp: ${data.kabeltyp}`, 20, y);
|
||||
|
||||
doc.setFontSize(8);
|
||||
doc.setTextColor(150);
|
||||
doc.text('Elektroplanung - Alle Angaben ohne Gewähr', 105, 290, { align: 'center' });
|
||||
|
||||
doc.save(`Leitungsberechnung_${data.querschnitt}mm2_${datum.replace(/\./g, '-')}.pdf`);
|
||||
}
|
||||
|
||||
// Initial berechnen
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
epBerechnen();
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
print '</div>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
1083
tools/selektivitaet.php
Normal file
1083
tools/selektivitaet.php
Normal file
File diff suppressed because it is too large
Load diff
638
tools/widerstandsrechner.php
Normal file
638
tools/widerstandsrechner.php
Normal file
|
|
@ -0,0 +1,638 @@
|
|||
<?php
|
||||
/* Copyright (C) 2026 Eduard Wisch <data@data-it-solution.de>
|
||||
*
|
||||
* 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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \file tools/widerstandsrechner.php
|
||||
* \ingroup elektroplanung
|
||||
* \brief Widerstandsrechner für Potentialausgleich nach VDE 0100-534/540
|
||||
*/
|
||||
|
||||
// Load Dolibarr environment
|
||||
$res = 0;
|
||||
if (!$res && file_exists("../../main.inc.php")) {
|
||||
$res = @include "../../main.inc.php";
|
||||
}
|
||||
if (!$res && file_exists("../../../main.inc.php")) {
|
||||
$res = @include "../../../main.inc.php";
|
||||
}
|
||||
if (!$res) {
|
||||
die("Include of main fails");
|
||||
}
|
||||
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
|
||||
|
||||
// Load translation files
|
||||
$langs->loadLangs(array("elektroplanung@elektroplanung"));
|
||||
|
||||
// Security check
|
||||
if (!isModEnabled('elektroplanung')) {
|
||||
accessforbidden('Module not enabled');
|
||||
}
|
||||
if (!$user->hasRight('elektroplanung', 'tools', 'read')) {
|
||||
accessforbidden('Permission denied');
|
||||
}
|
||||
|
||||
$form = new Form($db);
|
||||
|
||||
// Page header
|
||||
llxHeader('', $langs->trans("ElektroplanungWiderstandsrechner"), '', '', 0, 0, array(
|
||||
'https://cdnjs.cloudflare.com/ajax/libs/jspdf/2.5.1/jspdf.umd.min.js'
|
||||
), array(
|
||||
'/elektroplanung/css/elektroplanung.css'
|
||||
), '', 'mod-elektroplanung page-widerstandsrechner');
|
||||
|
||||
// Viewport für Mobile
|
||||
print '<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">';
|
||||
|
||||
print load_fiche_titre($langs->trans("ElektroplanungWiderstandsrechner"), '', 'fa-microchip');
|
||||
|
||||
print '<div class="fichecenter">';
|
||||
?>
|
||||
|
||||
<!-- Styles sind in /elektroplanung/css/elektroplanung.css -->
|
||||
|
||||
<div class="ep-calculator">
|
||||
<!-- TABS -->
|
||||
<div class="ep-tabs">
|
||||
<div class="ep-tab active" onclick="wrSwitchTab('widerstand')">
|
||||
<span class="fa fa-calculator"></span> <?php echo $langs->trans("ElektroplanungWiderstandBerechnung"); ?>
|
||||
</div>
|
||||
<div class="ep-tab" onclick="wrSwitchTab('querschnitt')">
|
||||
<span class="fa fa-ruler"></span> <?php echo $langs->trans("ElektroplanungQuerschnittErmitteln"); ?>
|
||||
</div>
|
||||
<div class="ep-tab" onclick="wrSwitchTab('vde')">
|
||||
<span class="fa fa-book"></span> <?php echo $langs->trans("ElektroplanungVDEAnforderungen"); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TAB 1: Widerstand berechnen -->
|
||||
<div id="wrTabWiderstand" class="ep-tab-content active">
|
||||
<div class="ep-toolbar">
|
||||
<button class="butAction" onclick="wrBerechneWiderstand()">
|
||||
<span class="fa fa-search"></span> <?php echo $langs->trans("Calculate"); ?>
|
||||
</button>
|
||||
<button class="butAction" onclick="wrExportPDF()">
|
||||
<span class="fa fa-file-pdf-o"></span> PDF
|
||||
</button>
|
||||
<button class="butActionDelete" onclick="wrResetWiderstand()">
|
||||
<span class="fa fa-refresh"></span> <?php echo $langs->trans("Reset"); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="ep-section">
|
||||
<div class="ep-section-title">
|
||||
<span class="fa fa-bolt"></span> <?php echo $langs->trans("ElektroplanungAnwendungsfall"); ?>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-grid">
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungAnwendung"); ?>:</label>
|
||||
<select id="wrAnwendung" onchange="wrUpdateMaxWiderstand()">
|
||||
<option value="pa_haupt" data-max="1.0"><?php echo $langs->trans("ElektroplanungHauptPA"); ?> (≤ 1Ω)</option>
|
||||
<option value="pa_zusatz" data-max="0.5"><?php echo $langs->trans("ElektroplanungZusatzPA"); ?> (≤ 0.5Ω)</option>
|
||||
<option value="spd_typ1" data-max="0.5"><?php echo $langs->trans("ElektroplanungSPDTyp1"); ?> (≤ 0.5Ω)</option>
|
||||
<option value="spd_typ2" data-max="1.0"><?php echo $langs->trans("ElektroplanungSPDTyp2"); ?> (≤ 1Ω)</option>
|
||||
<option value="blitzschutz" data-max="0.2"><?php echo $langs->trans("ElektroplanungBlitzschutz"); ?> (≤ 0.2Ω)</option>
|
||||
<option value="custom" data-max="1.0"><?php echo $langs->trans("ElektroplanungBenutzerdefiniert"); ?></option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungMaxWiderstand"); ?> <span class="ep-unit">[Ω]</span></label>
|
||||
<input type="number" id="wrMaxWiderstand" value="1.0" step="0.01" min="0.01">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ep-section">
|
||||
<div class="ep-section-title">
|
||||
<span class="fa fa-plug"></span> <?php echo $langs->trans("ElektroplanungLeitungsdaten"); ?>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-grid">
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungQuerschnitt"); ?> <span class="ep-unit">[mm²]</span></label>
|
||||
<select id="wrQuerschnitt">
|
||||
<option value="4">4 mm²</option>
|
||||
<option value="6" selected>6 mm²</option>
|
||||
<option value="10">10 mm²</option>
|
||||
<option value="16">16 mm²</option>
|
||||
<option value="25">25 mm²</option>
|
||||
<option value="35">35 mm²</option>
|
||||
<option value="50">50 mm²</option>
|
||||
<option value="70">70 mm²</option>
|
||||
<option value="95">95 mm²</option>
|
||||
<option value="120">120 mm²</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungLeitungslaenge"); ?> <span class="ep-unit">[m]</span></label>
|
||||
<input type="number" id="wrLaenge" value="10" step="0.1" min="0.1">
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungLeitermaterial"); ?>:</label>
|
||||
<select id="wrMaterial">
|
||||
<option value="56" selected>Kupfer (Cu) - κ = 56</option>
|
||||
<option value="35">Aluminium (Al) - κ = 35</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungTemperatur"); ?> <span class="ep-unit">[°C]</span></label>
|
||||
<input type="number" id="wrTemperatur" value="20" step="1" min="-20" max="80">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ep-section">
|
||||
<div class="ep-section-title">
|
||||
<span class="fa fa-link"></span> <?php echo $langs->trans("ElektroplanungVerbindungen"); ?>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-grid">
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungAnzahlKlemmen"); ?>:</label>
|
||||
<input type="number" id="wrKlemmen" value="2" step="1" min="0" max="20">
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungWiderstandProKlemme"); ?> <span class="ep-unit">[mΩ]</span></label>
|
||||
<input type="number" id="wrKlemmenWiderstand" value="0.5" step="0.1" min="0">
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungAnzahlSchienen"); ?>:</label>
|
||||
<input type="number" id="wrSchienen" value="1" step="1" min="0" max="10">
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungWiderstandProSchiene"); ?> <span class="ep-unit">[mΩ]</span></label>
|
||||
<input type="number" id="wrSchienenWiderstand" value="1.0" step="0.1" min="0">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ERGEBNIS Widerstand -->
|
||||
<div id="wrResultBox" class="ep-result-box">
|
||||
<div class="ep-result-main" id="wrResultWiderstand">0.000 Ω</div>
|
||||
<div class="ep-result-status" id="wrResultStatus">-</div>
|
||||
|
||||
<div class="ep-result-details">
|
||||
<div class="ep-result-item">
|
||||
<span><?php echo $langs->trans("ElektroplanungLeitungswiderstand"); ?>:</span>
|
||||
<span class="ep-result-value" id="wrResultLeitung">-</span>
|
||||
</div>
|
||||
<div class="ep-result-item">
|
||||
<span><?php echo $langs->trans("ElektroplanungKlemmenwiderstand"); ?>:</span>
|
||||
<span class="ep-result-value" id="wrResultKlemmen">-</span>
|
||||
</div>
|
||||
<div class="ep-result-item">
|
||||
<span><?php echo $langs->trans("ElektroplanungSchienenwiderstand"); ?>:</span>
|
||||
<span class="ep-result-value" id="wrResultSchienen">-</span>
|
||||
</div>
|
||||
<div class="ep-result-item">
|
||||
<span><?php echo $langs->trans("ElektroplanungMaxZulaessig"); ?>:</span>
|
||||
<span class="ep-result-value" id="wrResultMax">-</span>
|
||||
</div>
|
||||
<div class="ep-result-item">
|
||||
<span><?php echo $langs->trans("ElektroplanungReserve"); ?>:</span>
|
||||
<span class="ep-result-value" id="wrResultReserve">-</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TAB 2: Querschnitt ermitteln -->
|
||||
<div id="wrTabQuerschnitt" class="ep-tab-content">
|
||||
<div class="ep-toolbar">
|
||||
<button class="butAction" onclick="wrBerechneQuerschnitt()">
|
||||
<span class="fa fa-search"></span> <?php echo $langs->trans("ElektroplanungQuerschnittBerechnen"); ?>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div class="ep-section">
|
||||
<div class="ep-section-title">
|
||||
<span class="fa fa-crosshairs"></span> <?php echo $langs->trans("ElektroplanungZielwerte"); ?>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-grid">
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungAnwendung"); ?>:</label>
|
||||
<select id="wrQsAnwendung" onchange="wrQsUpdateMaxWiderstand()">
|
||||
<option value="pa_haupt" data-max="1.0"><?php echo $langs->trans("ElektroplanungHauptPA"); ?> (≤ 1Ω)</option>
|
||||
<option value="pa_zusatz" data-max="0.5"><?php echo $langs->trans("ElektroplanungZusatzPA"); ?> (≤ 0.5Ω)</option>
|
||||
<option value="spd_typ1" data-max="0.5"><?php echo $langs->trans("ElektroplanungSPDTyp1"); ?> (≤ 0.5Ω)</option>
|
||||
<option value="spd_typ2" data-max="1.0"><?php echo $langs->trans("ElektroplanungSPDTyp2"); ?> (≤ 1Ω)</option>
|
||||
<option value="blitzschutz" data-max="0.2"><?php echo $langs->trans("ElektroplanungBlitzschutz"); ?> (≤ 0.2Ω)</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungMaxWiderstand"); ?> <span class="ep-unit">[Ω]</span></label>
|
||||
<input type="number" id="wrQsMaxWiderstand" value="1.0" step="0.01" min="0.01" readonly>
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungLeitungslaenge"); ?> <span class="ep-unit">[m]</span></label>
|
||||
<input type="number" id="wrQsLaenge" value="15" step="0.1" min="0.1">
|
||||
</div>
|
||||
|
||||
<div class="ep-form-group">
|
||||
<label><?php echo $langs->trans("ElektroplanungLeitermaterial"); ?>:</label>
|
||||
<select id="wrQsMaterial">
|
||||
<option value="56" selected>Kupfer (Cu)</option>
|
||||
<option value="35">Aluminium (Al)</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- ERGEBNIS Querschnitt -->
|
||||
<div id="wrQsResultBox" class="ep-result-box">
|
||||
<div class="ep-result-main" id="wrQsResultQuerschnitt">- mm²</div>
|
||||
<div class="ep-result-status"><?php echo $langs->trans("ElektroplanungMindestquerschnitt"); ?></div>
|
||||
|
||||
<div class="ep-result-details">
|
||||
<div class="ep-result-item">
|
||||
<span><?php echo $langs->trans("ElektroplanungBerechnet"); ?>:</span>
|
||||
<span class="ep-result-value" id="wrQsResultBerechnet">-</span>
|
||||
</div>
|
||||
<div class="ep-result-item">
|
||||
<span><?php echo $langs->trans("ElektroplanungTatsWiderstand"); ?>:</span>
|
||||
<span class="ep-result-value" id="wrQsResultWiderstand">-</span>
|
||||
</div>
|
||||
<div class="ep-result-item">
|
||||
<span><?php echo $langs->trans("ElektroplanungMaxLaenge"); ?>:</span>
|
||||
<span class="ep-result-value" id="wrQsResultMaxLaenge">-</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TAB 3: VDE Anforderungen -->
|
||||
<div id="wrTabVde" class="ep-tab-content">
|
||||
<div class="ep-section">
|
||||
<div class="ep-section-title">
|
||||
<span class="fa fa-book"></span> <?php echo $langs->trans("ElektroplanungVDEPotentialausgleich"); ?>
|
||||
</div>
|
||||
|
||||
<p><?php echo $langs->trans("ElektroplanungVDEPABeschreibung"); ?></p>
|
||||
|
||||
<table class="ep-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php echo $langs->trans("ElektroplanungAnwendung"); ?></th>
|
||||
<th><?php echo $langs->trans("ElektroplanungNorm"); ?></th>
|
||||
<th><?php echo $langs->trans("ElektroplanungMaxWiderstand"); ?></th>
|
||||
<th><?php echo $langs->trans("ElektroplanungMindestquerschnittCu"); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><strong><?php echo $langs->trans("ElektroplanungHauptPA"); ?></strong></td>
|
||||
<td>VDE 0100-540</td>
|
||||
<td>≤ 1 Ω</td>
|
||||
<td>6 mm² (Cu) / 16 mm² (Al)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><?php echo $langs->trans("ElektroplanungZusatzPA"); ?></strong></td>
|
||||
<td>VDE 0100-410</td>
|
||||
<td>≤ 0.5 Ω</td>
|
||||
<td>Je nach Anwendung</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><?php echo $langs->trans("ElektroplanungSPDTyp1"); ?></strong></td>
|
||||
<td>VDE 0100-534</td>
|
||||
<td>≤ 0.5 Ω</td>
|
||||
<td>16 mm² (Cu)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><?php echo $langs->trans("ElektroplanungSPDTyp2"); ?></strong></td>
|
||||
<td>VDE 0100-534</td>
|
||||
<td>≤ 1 Ω</td>
|
||||
<td>6 mm² (Cu)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong><?php echo $langs->trans("ElektroplanungBlitzschutz"); ?></strong></td>
|
||||
<td>VDE 0185-305</td>
|
||||
<td>≤ 0.2 Ω</td>
|
||||
<td>25 mm² (Cu)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="ep-section">
|
||||
<div class="ep-section-title">
|
||||
<span class="fa fa-bolt"></span> <?php echo $langs->trans("ElektroplanungSPDAnschluss"); ?>
|
||||
</div>
|
||||
|
||||
<p><?php echo $langs->trans("ElektroplanungSPDBeschreibung"); ?></p>
|
||||
|
||||
<div class="ep-pa-diagram">
|
||||
<svg viewBox="0 0 400 200" style="max-width: 400px;">
|
||||
<!-- HAK -->
|
||||
<rect x="10" y="80" width="60" height="40" class="ep-svg-box" />
|
||||
<text x="40" y="105" text-anchor="middle" font-size="12" font-weight="bold" class="ep-svg-text">HAK</text>
|
||||
|
||||
<!-- Leitung zum SPD -->
|
||||
<line x1="70" y1="100" x2="130" y2="100" class="ep-svg-line-primary" stroke-width="3"/>
|
||||
<text x="100" y="90" text-anchor="middle" font-size="10" class="ep-svg-text">L ≤ 0.5m</text>
|
||||
|
||||
<!-- SPD -->
|
||||
<rect x="130" y="70" width="50" height="60" class="ep-svg-spd" />
|
||||
<text x="155" y="95" text-anchor="middle" font-size="10" font-weight="bold" class="ep-svg-text-dark">SPD</text>
|
||||
<text x="155" y="115" text-anchor="middle" font-size="8" class="ep-svg-text-dark">Typ 1/2</text>
|
||||
|
||||
<!-- PE-Leitung -->
|
||||
<line x1="155" y1="130" x2="155" y2="170" class="ep-svg-line-success" stroke-width="3"/>
|
||||
<text x="165" y="155" font-size="9" class="ep-svg-text-success">PE</text>
|
||||
|
||||
<!-- PAS -->
|
||||
<rect x="120" y="170" width="70" height="20" class="ep-svg-pas" />
|
||||
<text x="155" y="184" text-anchor="middle" font-size="10" font-weight="bold" class="ep-svg-text-light">PAS</text>
|
||||
|
||||
<!-- Erdung -->
|
||||
<line x1="155" y1="190" x2="155" y2="195" class="ep-svg-line-earth" stroke-width="2"/>
|
||||
<line x1="140" y1="195" x2="170" y2="195" class="ep-svg-line-earth" stroke-width="2"/>
|
||||
<line x1="145" y1="198" x2="165" y2="198" class="ep-svg-line-earth" stroke-width="1.5"/>
|
||||
<line x1="150" y1="201" x2="160" y2="201" class="ep-svg-line-earth" stroke-width="1"/>
|
||||
|
||||
<!-- Beschriftungen -->
|
||||
<text x="300" y="30" font-size="11" font-weight="bold" class="ep-svg-text"><?php echo $langs->trans("ElektroplanungLegende"); ?>:</text>
|
||||
<rect x="300" y="40" width="15" height="10" class="ep-svg-box" />
|
||||
<text x="320" y="49" font-size="9" class="ep-svg-text">HAK = Hausanschlusskasten</text>
|
||||
<rect x="300" y="55" width="15" height="10" class="ep-svg-spd" />
|
||||
<text x="320" y="64" font-size="9" class="ep-svg-text">SPD = Überspannungsschutz</text>
|
||||
<rect x="300" y="70" width="15" height="10" class="ep-svg-pas" />
|
||||
<text x="320" y="79" font-size="9" class="ep-svg-text">PAS = Potentialausgleichsschiene</text>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ep-info-box">
|
||||
<strong><span class="fa fa-exclamation-triangle"></span> <?php echo $langs->trans("ElektroplanungWichtig"); ?>:</strong>
|
||||
<ul style="margin-left: 20px; margin-top: 5px;">
|
||||
<li><?php echo $langs->trans("ElektroplanungVDEHinweis1"); ?></li>
|
||||
<li><?php echo $langs->trans("ElektroplanungVDEHinweis2"); ?></li>
|
||||
<li><?php echo $langs->trans("ElektroplanungVDEHinweis3"); ?></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Globale Variablen
|
||||
let wrCalculationData = {};
|
||||
|
||||
// Normquerschnitte
|
||||
const wrNormQuerschnitte = [4, 6, 10, 16, 25, 35, 50, 70, 95, 120, 150, 185, 240];
|
||||
|
||||
// Tab-Wechsel
|
||||
function wrSwitchTab(tab) {
|
||||
document.querySelectorAll('.ep-tab').forEach(t => t.classList.remove('active'));
|
||||
document.querySelectorAll('.ep-tab-content').forEach(c => c.classList.remove('active'));
|
||||
|
||||
document.querySelector(`.ep-tab[onclick*="${tab}"]`).classList.add('active');
|
||||
document.getElementById('wrTab' + tab.charAt(0).toUpperCase() + tab.slice(1)).classList.add('active');
|
||||
}
|
||||
|
||||
// Max Widerstand aktualisieren
|
||||
function wrUpdateMaxWiderstand() {
|
||||
const select = document.getElementById('wrAnwendung');
|
||||
const maxInput = document.getElementById('wrMaxWiderstand');
|
||||
const maxValue = select.options[select.selectedIndex].dataset.max;
|
||||
maxInput.value = maxValue;
|
||||
maxInput.readOnly = select.value !== 'custom';
|
||||
}
|
||||
|
||||
function wrQsUpdateMaxWiderstand() {
|
||||
const select = document.getElementById('wrQsAnwendung');
|
||||
const maxInput = document.getElementById('wrQsMaxWiderstand');
|
||||
maxInput.value = select.options[select.selectedIndex].dataset.max;
|
||||
}
|
||||
|
||||
// Temperaturkorrektur für spezifischen Widerstand
|
||||
function wrGetRhoTemp(kappa, temp) {
|
||||
// ρ bei 20°C = 1/κ
|
||||
// Temperaturkoeffizient α ≈ 0.00393 für Cu, 0.00403 für Al
|
||||
const rho20 = 1 / kappa;
|
||||
const alpha = kappa === 56 ? 0.00393 : 0.00403;
|
||||
return rho20 * (1 + alpha * (temp - 20));
|
||||
}
|
||||
|
||||
// Widerstand berechnen
|
||||
function wrBerechneWiderstand() {
|
||||
const querschnitt = parseFloat(document.getElementById('wrQuerschnitt').value);
|
||||
const laenge = parseFloat(document.getElementById('wrLaenge').value);
|
||||
const kappa = parseFloat(document.getElementById('wrMaterial').value);
|
||||
const temperatur = parseFloat(document.getElementById('wrTemperatur').value);
|
||||
const maxWiderstand = parseFloat(document.getElementById('wrMaxWiderstand').value);
|
||||
const anzahlKlemmen = parseInt(document.getElementById('wrKlemmen').value);
|
||||
const widerstandKlemme = parseFloat(document.getElementById('wrKlemmenWiderstand').value) / 1000; // mΩ -> Ω
|
||||
const anzahlSchienen = parseInt(document.getElementById('wrSchienen').value);
|
||||
const widerstandSchiene = parseFloat(document.getElementById('wrSchienenWiderstand').value) / 1000; // mΩ -> Ω
|
||||
|
||||
// ρ bei Temperatur berechnen
|
||||
const rho = wrGetRhoTemp(kappa, temperatur);
|
||||
|
||||
// R = ρ * l / A
|
||||
const R_leitung = rho * laenge / querschnitt;
|
||||
const R_klemmen = anzahlKlemmen * widerstandKlemme;
|
||||
const R_schienen = anzahlSchienen * widerstandSchiene;
|
||||
const R_gesamt = R_leitung + R_klemmen + R_schienen;
|
||||
|
||||
const istOK = R_gesamt <= maxWiderstand;
|
||||
const reserve = ((maxWiderstand - R_gesamt) / maxWiderstand) * 100;
|
||||
|
||||
// Daten speichern
|
||||
wrCalculationData = {
|
||||
querschnitt, laenge, kappa, temperatur, maxWiderstand,
|
||||
anzahlKlemmen, widerstandKlemme, anzahlSchienen, widerstandSchiene,
|
||||
rho, R_leitung, R_klemmen, R_schienen, R_gesamt, istOK, reserve,
|
||||
material: kappa === 56 ? 'Kupfer' : 'Aluminium',
|
||||
anwendung: document.getElementById('wrAnwendung').options[document.getElementById('wrAnwendung').selectedIndex].text
|
||||
};
|
||||
|
||||
// Ergebnisse anzeigen
|
||||
const resultBox = document.getElementById('wrResultBox');
|
||||
resultBox.className = 'ep-result-box show ' + (istOK ? (reserve > 30 ? 'success' : 'warning') : 'error');
|
||||
|
||||
document.getElementById('wrResultWiderstand').textContent = R_gesamt.toFixed(4) + ' Ω';
|
||||
document.getElementById('wrResultStatus').textContent = istOK
|
||||
? '✓ <?php echo addslashes($langs->trans("ElektroplanungWiderstandOK")); ?>'
|
||||
: '✗ <?php echo addslashes($langs->trans("ElektroplanungWiderstandZuHoch")); ?>';
|
||||
|
||||
document.getElementById('wrResultLeitung').textContent = (R_leitung * 1000).toFixed(2) + ' mΩ';
|
||||
document.getElementById('wrResultKlemmen').textContent = (R_klemmen * 1000).toFixed(2) + ' mΩ';
|
||||
document.getElementById('wrResultSchienen').textContent = (R_schienen * 1000).toFixed(2) + ' mΩ';
|
||||
document.getElementById('wrResultMax').textContent = maxWiderstand.toFixed(2) + ' Ω';
|
||||
document.getElementById('wrResultReserve').textContent = reserve.toFixed(1) + '%';
|
||||
|
||||
resultBox.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
}
|
||||
|
||||
// Querschnitt ermitteln
|
||||
function wrBerechneQuerschnitt() {
|
||||
const maxWiderstand = parseFloat(document.getElementById('wrQsMaxWiderstand').value);
|
||||
const laenge = parseFloat(document.getElementById('wrQsLaenge').value);
|
||||
const kappa = parseFloat(document.getElementById('wrQsMaterial').value);
|
||||
|
||||
// A = ρ * l / R
|
||||
const rho = 1 / kappa; // bei 20°C
|
||||
const A_min = rho * laenge / maxWiderstand;
|
||||
|
||||
// Nächsten Normquerschnitt finden
|
||||
let querschnitt = wrNormQuerschnitte[wrNormQuerschnitte.length - 1];
|
||||
for (let qs of wrNormQuerschnitte) {
|
||||
if (qs >= A_min) {
|
||||
querschnitt = qs;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Tatsächlicher Widerstand mit Normquerschnitt
|
||||
const R_tats = rho * laenge / querschnitt;
|
||||
|
||||
// Max Länge mit diesem Querschnitt
|
||||
const L_max = maxWiderstand * querschnitt / rho;
|
||||
|
||||
// Ergebnisse anzeigen
|
||||
const resultBox = document.getElementById('wrQsResultBox');
|
||||
resultBox.className = 'ep-result-box show success';
|
||||
|
||||
document.getElementById('wrQsResultQuerschnitt').textContent = querschnitt + ' mm²';
|
||||
document.getElementById('wrQsResultBerechnet').textContent = A_min.toFixed(2) + ' mm²';
|
||||
document.getElementById('wrQsResultWiderstand').textContent = (R_tats * 1000).toFixed(2) + ' mΩ (' + R_tats.toFixed(4) + ' Ω)';
|
||||
document.getElementById('wrQsResultMaxLaenge').textContent = L_max.toFixed(1) + ' m';
|
||||
|
||||
resultBox.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
}
|
||||
|
||||
// Reset
|
||||
function wrResetWiderstand() {
|
||||
document.getElementById('wrAnwendung').value = 'pa_haupt';
|
||||
document.getElementById('wrMaxWiderstand').value = 1.0;
|
||||
document.getElementById('wrQuerschnitt').value = 6;
|
||||
document.getElementById('wrLaenge').value = 10;
|
||||
document.getElementById('wrMaterial').value = 56;
|
||||
document.getElementById('wrTemperatur').value = 20;
|
||||
document.getElementById('wrKlemmen').value = 2;
|
||||
document.getElementById('wrKlemmenWiderstand').value = 0.5;
|
||||
document.getElementById('wrSchienen').value = 1;
|
||||
document.getElementById('wrSchienenWiderstand').value = 1.0;
|
||||
|
||||
document.getElementById('wrResultBox').classList.remove('show');
|
||||
wrUpdateMaxWiderstand();
|
||||
}
|
||||
|
||||
// PDF Export
|
||||
function wrExportPDF() {
|
||||
if (!wrCalculationData.R_gesamt) {
|
||||
alert('Bitte erst eine Berechnung durchführen!');
|
||||
return;
|
||||
}
|
||||
|
||||
const { jsPDF } = window.jspdf;
|
||||
const doc = new jsPDF();
|
||||
const data = wrCalculationData;
|
||||
const datum = new Date().toLocaleDateString('de-DE');
|
||||
|
||||
let y = 20;
|
||||
|
||||
doc.setFontSize(18);
|
||||
doc.setFont(undefined, 'bold');
|
||||
doc.text('Widerstandsberechnung Potentialausgleich', 105, y, { align: 'center' });
|
||||
y += 8;
|
||||
|
||||
doc.setFontSize(10);
|
||||
doc.setFont(undefined, 'normal');
|
||||
doc.text('Nach VDE 0100-534/540', 105, y, { align: 'center' });
|
||||
y += 5;
|
||||
doc.text('Erstellt: ' + datum, 105, y, { align: 'center' });
|
||||
y += 10;
|
||||
|
||||
doc.line(20, y, 190, y);
|
||||
y += 10;
|
||||
|
||||
doc.setFontSize(14);
|
||||
doc.setFont(undefined, 'bold');
|
||||
doc.text('Anwendung', 20, y);
|
||||
y += 7;
|
||||
|
||||
doc.setFontSize(10);
|
||||
doc.setFont(undefined, 'normal');
|
||||
doc.text(data.anwendung, 20, y);
|
||||
y += 10;
|
||||
|
||||
doc.setFontSize(14);
|
||||
doc.setFont(undefined, 'bold');
|
||||
doc.text('Leitungsdaten', 20, y);
|
||||
y += 7;
|
||||
|
||||
doc.setFontSize(10);
|
||||
doc.setFont(undefined, 'normal');
|
||||
doc.text(`Querschnitt: ${data.querschnitt} mm²`, 20, y); y += 6;
|
||||
doc.text(`Länge: ${data.laenge} m`, 20, y); y += 6;
|
||||
doc.text(`Material: ${data.material}`, 20, y); y += 6;
|
||||
doc.text(`Temperatur: ${data.temperatur}°C`, 20, y); y += 10;
|
||||
|
||||
doc.setFontSize(14);
|
||||
doc.setFont(undefined, 'bold');
|
||||
doc.text('Ergebnis', 20, y);
|
||||
y += 7;
|
||||
|
||||
doc.setFontSize(14);
|
||||
if (data.istOK) {
|
||||
doc.setTextColor(16, 185, 129);
|
||||
doc.text(`Gesamtwiderstand: ${data.R_gesamt.toFixed(4)} Ω - OK`, 20, y);
|
||||
} else {
|
||||
doc.setTextColor(239, 68, 68);
|
||||
doc.text(`Gesamtwiderstand: ${data.R_gesamt.toFixed(4)} Ω - ZU HOCH`, 20, y);
|
||||
}
|
||||
doc.setTextColor(0, 0, 0);
|
||||
y += 8;
|
||||
|
||||
doc.setFontSize(10);
|
||||
doc.setFont(undefined, 'normal');
|
||||
doc.text(`Leitungswiderstand: ${(data.R_leitung * 1000).toFixed(2)} mΩ`, 20, y); y += 6;
|
||||
doc.text(`Klemmenwiderstand: ${(data.R_klemmen * 1000).toFixed(2)} mΩ`, 20, y); y += 6;
|
||||
doc.text(`Schienenwiderstand: ${(data.R_schienen * 1000).toFixed(2)} mΩ`, 20, y); y += 6;
|
||||
doc.text(`Max. zulässig: ${data.maxWiderstand.toFixed(2)} Ω`, 20, y); y += 6;
|
||||
doc.text(`Reserve: ${data.reserve.toFixed(1)}%`, 20, y);
|
||||
|
||||
doc.setFontSize(8);
|
||||
doc.setTextColor(150);
|
||||
doc.text('Elektroplanung - Widerstandsberechnung - Alle Angaben ohne Gewähr', 105, 290, { align: 'center' });
|
||||
|
||||
doc.save(`Widerstandsberechnung_${data.querschnitt}mm2_${datum.replace(/\./g, '-')}.pdf`);
|
||||
}
|
||||
|
||||
// Initial
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
wrUpdateMaxWiderstand();
|
||||
});
|
||||
</script>
|
||||
|
||||
<?php
|
||||
print '</div>';
|
||||
|
||||
llxFooter();
|
||||
$db->close();
|
||||
Loading…
Reference in a new issue