mirror of
https://github.com/OpenXE-org/OpenXE.git
synced 2024-11-14 20:17:14 +01:00
Merge branch 'develop.1.8'
This commit is contained in:
commit
691ad237b5
3
.reuse/dep5
Normal file
3
.reuse/dep5
Normal file
@ -0,0 +1,3 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: OpenXE
|
||||
Source: https://openxe.org
|
655
LICENSE.md
655
LICENSE.md
@ -1,654 +1,5 @@
|
||||
GNU Affero General Public License
|
||||
=================================
|
||||
|
||||
_Version 3, 19 November 2007_
|
||||
_Copyright © 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 Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are 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.
|
||||
|
||||
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.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: **(1)** assert copyright on the software, and **(2)** offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing under
|
||||
this license.
|
||||
|
||||
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your version
|
||||
supports such interaction) an opportunity to receive the Corresponding
|
||||
Source of your version by providing access to the Corresponding Source
|
||||
from a network server at no charge, through some standard or customary
|
||||
means of facilitating copying of software. This Corresponding Source
|
||||
shall include the Corresponding Source for any work covered by version 3
|
||||
of the GNU General Public License that is incorporated pursuant to the
|
||||
following paragraph.
|
||||
|
||||
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 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 work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
### 14. Revised Versions of this License
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU Affero 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 Affero 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 Affero 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 Affero 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_
|
||||
|
||||
## How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the “copyright” line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a “Source” link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for the
|
||||
specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a “copyright disclaimer” for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
<<http://www.gnu.org/licenses/>>.
|
||||
# THE CONTENT OF THIS FILE HAS BEEN MOVED TO THE [LICENSES](LICENSES) SUBFOLDER
|
||||
# SEE [README](README.md) AND [LICENSES](LICENSES) FOLDER FOR MORE INFORMATION
|
||||
|
||||
|
||||
## Plugins/Bibliotheken
|
||||
@ -706,4 +57,4 @@ For more information on this, and how to apply and follow the GNU AGPL, see
|
||||
moxiecode.com
|
||||
Flot
|
||||
http://code.google.com/p/flot/
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
660
LICENSES/AGPL-3.0-only.md
Normal file
660
LICENSES/AGPL-3.0-only.md
Normal file
@ -0,0 +1,660 @@
|
||||
### GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
|
||||
Version 3, 19 November 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc.
|
||||
<https://fsf.org/>
|
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this
|
||||
license document, but changing it is not allowed.
|
||||
|
||||
### Preamble
|
||||
|
||||
The GNU Affero General Public License is a free, copyleft license for
|
||||
software and other kinds of works, specifically designed to ensure
|
||||
cooperation with the community in the case of network server software.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
our General Public Licenses are 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.
|
||||
|
||||
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.
|
||||
|
||||
Developers that use our General Public Licenses protect your rights
|
||||
with two steps: (1) assert copyright on the software, and (2) offer
|
||||
you this License which gives you legal permission to copy, distribute
|
||||
and/or modify the software.
|
||||
|
||||
A secondary benefit of defending all users' freedom is that
|
||||
improvements made in alternate versions of the program, if they
|
||||
receive widespread use, become available for other developers to
|
||||
incorporate. Many developers of free software are heartened and
|
||||
encouraged by the resulting cooperation. However, in the case of
|
||||
software used on network servers, this result may fail to come about.
|
||||
The GNU General Public License permits making a modified version and
|
||||
letting the public access it on a server without ever releasing its
|
||||
source code to the public.
|
||||
|
||||
The GNU Affero General Public License is designed specifically to
|
||||
ensure that, in such cases, the modified source code becomes available
|
||||
to the community. It requires the operator of a network server to
|
||||
provide the source code of the modified version running there to the
|
||||
users of that server. Therefore, public use of a modified version, on
|
||||
a publicly accessible server, gives the public access to the source
|
||||
code of the modified version.
|
||||
|
||||
An older license, called the Affero General Public License and
|
||||
published by Affero, was designed to accomplish similar goals. This is
|
||||
a different license, not a version of the Affero GPL, but Affero has
|
||||
released a new version of the Affero GPL which permits relicensing
|
||||
under this license.
|
||||
|
||||
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 Affero 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. Remote Network Interaction; Use with the GNU General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, if you modify the
|
||||
Program, your modified version must prominently offer all users
|
||||
interacting with it remotely through a computer network (if your
|
||||
version supports such interaction) an opportunity to receive the
|
||||
Corresponding Source of your version by providing access to the
|
||||
Corresponding Source from a network server at no charge, through some
|
||||
standard or customary means of facilitating copying of software. This
|
||||
Corresponding Source shall include the Corresponding Source for any
|
||||
work covered by version 3 of the GNU General Public License that is
|
||||
incorporated pursuant to the following paragraph.
|
||||
|
||||
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 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 work with which it is combined will remain governed by version
|
||||
3 of the GNU General Public License.
|
||||
|
||||
#### 14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Affero 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 Affero 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 Affero 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 Affero 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
|
||||
|
||||
### How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these
|
||||
terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest to
|
||||
attach them to the start of each source file to most effectively state
|
||||
the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU 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/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper
|
||||
mail.
|
||||
|
||||
If your software can interact with users remotely through a computer
|
||||
network, you should also make sure that it provides a way for users to
|
||||
get its source. For example, if your program is a web application, its
|
||||
interface could display a "Source" link that leads users to an archive
|
||||
of the code. There are many ways you could offer source, and different
|
||||
solutions will be better for different programs; see section 13 for
|
||||
the specific requirements.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. For more information on this, and how to apply and follow
|
||||
the GNU AGPL, see <https://www.gnu.org/licenses/>.
|
69
LICENSES/LicenseRef-EGPL-3.1.md
Normal file
69
LICENSES/LicenseRef-EGPL-3.1.md
Normal file
@ -0,0 +1,69 @@
|
||||
# EMBEDDED PROJECTS GENERAL PUBLIC LICENSE Version 3.1
|
||||
‘EGPLv3.1’
|
||||
|
||||
Copyright (C) 2015 embedded projects GmbH, Augsburg, Germany
|
||||
|
||||
## Preamble
|
||||
The EGPLv3.1 incorporates the terms of the GNU AFFERO GENERAL PUBLIC LICENSE Version 3, dated 19 November 2007 (‘AGPLv3’) as shown under EXHIBIT A *and* the following terms, WHEREAS the following terms
|
||||
- extend, amend and/or clarify the AGPLv3 and
|
||||
- prevail in case of any contradictions with the AGPLv3.
|
||||
|
||||
The following terms of the EGPLv3.1 may not be separated from the terms of the AGPLv3 in EXHIBIT A – together they form the EGPLv3.1.
|
||||
It is purpose of the EGPLv3.1 to make any user and/or recipient of this file or its content aware of the identity of the copyright holder/licensor and its business.
|
||||
|
||||
## DEVELOPER & DISTRIBUTOR NOTES:
|
||||
- For purpose of clarification, the following terms have priority over the terms of the AGPLv3, especially No. 7 of the AGPLv3. This however, may render the EGPLv3.1 incompatible with any other AGPLv3s or any other GPL.
|
||||
- Inasmuch as embedded projects GmbH is the licensor, embedded projects reserves the right to publish guidelines for the interpretation of the EGPLv3.1 on http://www.wawision.de which are incorporated into this license by reference in case they are published prior to your obtainment of the EGPLv3.1. You bear the burden of proof that you obtained this license prior to the publishment of a certain guideline.
|
||||
|
||||
## 0. Definition of ‘the program’
|
||||
‘The Program’ hereinafeter (and pursuant to No. 0 AGPLv3) includes but is not limited to any file or portion of it that
|
||||
- a) references to the EGPLv3.1 including but not limited to such references from source code header files
|
||||
|
||||
OR
|
||||
|
||||
- b) is referenced to the EGPLv3.1 by
|
||||
- (i) any documentation provided with the file OR
|
||||
- (ii) a notice file that is contained in the same directory in which the file is stored. In the absence of such notice file in the same directory, said notice file can be found in the upper directory that is next to the file – which would be the root directory as a last resort.
|
||||
|
||||
The use of this file and its content (including but not limited to all modules, databases, pictorial images and documentation and all forms of computer program codes and parts thereof) are subject to the EGPLv3.1.
|
||||
|
||||
## 1. Adevertising Clauses
|
||||
- a) All advertising materials for (i) any work that contains this file, its content and/or any portion of it or (ii) mentioning features and/or use of this file, its content and/or any portion of it must mention at least ONE of the following statements:
|
||||
> “Diese Software ist eine Ableitung und Veränderung von WaWision ERP. WaWision ERP wurde von embedded projects GmbH entwickelt und steht unter der EGPLv3.1-Lizenz als Open Source Software. Informationen zu WaWision und der Open-Source Version findet man unter http://www.wawision.de.”
|
||||
|
||||
AND/OR
|
||||
|
||||
> “This Software is a derivative and modification of WaWision ERP. WaWision ERP was developed by embedded projects GmbH und is licensed under the EGPLv3.1 license as Open Source Software. Information on WaWision and its open source distribution can be obtained from http://www.wawision.”
|
||||
|
||||
- b) The statement under clause 1 a) has to be displayed in black latin font (“Arial” or “Times New Roman”) on white background with font size of at least 12pt.
|
||||
- c) The “advertising materials” under clause 1 a) comprises all non-verbal forms of advertising and business in theprogram, including but not limited to digital or printed offers or displays (e.g. on convention displays, brochures, websites or webshops) or terms and conditions for the distribution or cloud/SaaS use of the program.
|
||||
- d) You are required to provide customers and/or any recipients of your advertising materials with the text of the complete EGPLv3.1 text upon request. You may not charge any fee for the provision of the EGPLv3.1 text, when you are requested to provide the EGPLv3.1 by means of electronic communication (e.g. e-mail).
|
||||
|
||||
## 2. Integrity of Copyright and License Notices
|
||||
You are not allowed to remove or modify any copyright and license notices from the program unless you only add your own copyright notice exclusively for your own contributions.
|
||||
|
||||
## 3. Network Interaction
|
||||
- a) A user interaction with the program pursuant to No. 13 AGPLv3 includes but is not limited to situations in which the user receives parts of the program on a client machine during interaction with a server. For the purpose of clarification,
|
||||
- i) said user interaction does not necessarily mean access to all functions of the program in order to interact with it. Said interaction comprises but is not limited to any code of the program that is purposefully cached on the user’s machine for preparing code execution and any login dialog of the program – no matter whether the user has the suitable login information.
|
||||
- ii) the term ‘user’ means anyone but the licensee, i.e. comprising but not limited to employees of the licensee.
|
||||
- b) Instead of providing the user that interacts with the program pursuant to No. 13 AGPLv3 with the source code of the original program, you are obliged to offer the complete corresponding code of the licensee’s covered work for internet download to the PUBLIC under the EGPLv3.1, including but not limited to No. 5 AGPLv3. The aforementioned offer has to be prominently positioned
|
||||
|
||||
## 4. Defintion of a ‘Work Based on the Program’
|
||||
A ‘work based on the program’ includes but is not limited to
|
||||
- a) any new arrangement of the program with other new files, e.g. libraries – without regard to the form of linking (dynamic or static) AND
|
||||
- b) any other new module that contains portions of the program, e.g. any code fragment of the program. In case, the aforementioned incorporation of a code fragment into a new module does not require the permission by the licensor, said module must be licensed under the EGPLv3.1 when the module is conveyed together with the program.
|
||||
|
||||
## 5. No Trademark or Name Rights
|
||||
Notwithstanding No. 1 and 5 EGPLv3.1, nothing in the EGPLv3.1 grants you the to right to use the trademark ‘WaWision’ or the name of the embedded projects GmbH.
|
||||
|
||||
## 6. Integrity of the EGPLv3.1
|
||||
The EGPLv3.1 may not be changed, including but not limited for the distribution of the program or any work based on the program; No. 14 AGPLv3 does not apply.
|
||||
|
||||
## 7. Choice of Law, Jurisdiction
|
||||
The EGPLv3.1 is governed by the laws of Germany whereas the application of the International Convention of the Sale of Goods (CISG) is excluded. Inasmuch as you are a merchant pursuant to Sec. 13 German Civil Code (BGB), all courts in Germany shall have jurisdiction for any dispute arising from the EGPLv3.1.
|
||||
|
||||
# – EXHIBIT A –
|
||||
## GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
Version 3, 19 November 2007
|
||||
|
||||
-> See [AGPL-3.0-only.md](AGPL-3.0-only.md)
|
@ -36,4 +36,6 @@ Neuimplementierung des Xentral 20 Enterprise Ticketsystems mit vielen Verbesseru
|
||||
|
||||
[Hier gehts zur OpenXE Installation](INSTALL.md)
|
||||
|
||||
OpenXE ist freie Software, lizensiert unter AGPL 3 und basiert auf der Open Source Version von Xentral https://xentral.com/
|
||||
OpenXE ist freie Software, lizensiert unter der EGPL 3.1.
|
||||
Diese Software ist eine Ableitung und Veränderung von WaWision ERP. WaWision ERP wurde von embedded projects GmbH entwickelt und steht unter der EGPLv3.1-Lizenz als Open Source Software. Informationen zu WaWision und der Open-Source Version findet man unter http://www.wawision.de
|
||||
|
||||
|
20
classes/Carrier/Dhl/Data/Bank.php
Normal file
20
classes/Carrier/Dhl/Data/Bank.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Bank
|
||||
{
|
||||
public string $accountOwner;
|
||||
public string $bankName;
|
||||
public string $iban;
|
||||
public string $note1;
|
||||
public string $note2;
|
||||
public ?string $bic;
|
||||
public ?string $accountreference;
|
||||
}
|
16
classes/Carrier/Dhl/Data/Communication.php
Normal file
16
classes/Carrier/Dhl/Data/Communication.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Communication
|
||||
{
|
||||
public ?string $phone;
|
||||
public ?string $email;
|
||||
public ?string $contactPerson;
|
||||
}
|
16
classes/Carrier/Dhl/Data/Contact.php
Normal file
16
classes/Carrier/Dhl/Data/Contact.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Contact
|
||||
{
|
||||
public ?Communication $Communication;
|
||||
public ?NativeAddress $Address;
|
||||
public ?Name $Name;
|
||||
}
|
24
classes/Carrier/Dhl/Data/Country.php
Normal file
24
classes/Carrier/Dhl/Data/Country.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Country
|
||||
{
|
||||
public ?string $country;
|
||||
public string $countryISOCode;
|
||||
public ?string $state;
|
||||
|
||||
public static function Create(string $isoCode, ?string $state = null):Country {
|
||||
$obj = new Country();
|
||||
$obj->countryISOCode = $isoCode;
|
||||
$obj->state = $state;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
}
|
20
classes/Carrier/Dhl/Data/CreateShipmentOrderRequest.php
Normal file
20
classes/Carrier/Dhl/Data/CreateShipmentOrderRequest.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class CreateShipmentOrderRequest
|
||||
{
|
||||
public Version $Version;
|
||||
public ShipmentOrder $ShipmentOrder;
|
||||
public ?string $labelResponseType;
|
||||
public ?string $groupProfileName;
|
||||
public ?string $labelFormat;
|
||||
public ?string $labelFormatRetoure;
|
||||
public ?string $combinedPrinting;
|
||||
}
|
16
classes/Carrier/Dhl/Data/CreateShipmentOrderResponse.php
Normal file
16
classes/Carrier/Dhl/Data/CreateShipmentOrderResponse.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class CreateShipmentOrderResponse
|
||||
{
|
||||
public Version $Version;
|
||||
public Statusinformation $Status;
|
||||
public ?CreationState $CreationState;
|
||||
}
|
17
classes/Carrier/Dhl/Data/CreationState.php
Normal file
17
classes/Carrier/Dhl/Data/CreationState.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class CreationState
|
||||
{
|
||||
public string $sequenceNumber;
|
||||
public ?string $shipmentNumber;
|
||||
public ?string $returnShipmentNumber;
|
||||
public LabelData $LabelData;
|
||||
}
|
20
classes/Carrier/Dhl/Data/Customer.php
Normal file
20
classes/Carrier/Dhl/Data/Customer.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Customer
|
||||
{
|
||||
public Name $Name;
|
||||
public ?string $vatID;
|
||||
public string $EKP;
|
||||
public NativeAddress $Address;
|
||||
public Contact $Contact;
|
||||
public ?Bank $Bank;
|
||||
public ?string $note;
|
||||
}
|
15
classes/Carrier/Dhl/Data/DeleteShipmentOrderRequest.php
Normal file
15
classes/Carrier/Dhl/Data/DeleteShipmentOrderRequest.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class DeleteShipmentOrderRequest
|
||||
{
|
||||
public Version $Version;
|
||||
public string $shipmentNumber;
|
||||
}
|
16
classes/Carrier/Dhl/Data/DeleteShipmentOrderResponse.php
Normal file
16
classes/Carrier/Dhl/Data/DeleteShipmentOrderResponse.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class DeleteShipmentOrderResponse
|
||||
{
|
||||
public Version $Version;
|
||||
public Statusinformation $Status;
|
||||
public ?DeletionState $DeletionState;
|
||||
}
|
15
classes/Carrier/Dhl/Data/DeletionState.php
Normal file
15
classes/Carrier/Dhl/Data/DeletionState.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class DeletionState
|
||||
{
|
||||
public string $shipmentNumber;
|
||||
public Statusinformation $Status;
|
||||
}
|
18
classes/Carrier/Dhl/Data/DeliveryAddress.php
Normal file
18
classes/Carrier/Dhl/Data/DeliveryAddress.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class DeliveryAddress
|
||||
{
|
||||
public ?NativeAddress $NativeAddress;
|
||||
public ?Postfiliale $PostOffice;
|
||||
public ?PackStation $PackStation;
|
||||
public ?string $streetNameCode;
|
||||
public ?string $streetNumberCode;
|
||||
}
|
17
classes/Carrier/Dhl/Data/Dimension.php
Normal file
17
classes/Carrier/Dhl/Data/Dimension.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Dimension
|
||||
{
|
||||
public int $length;
|
||||
public int $width;
|
||||
public int $height;
|
||||
public ?string $unit;
|
||||
}
|
19
classes/Carrier/Dhl/Data/ExportDocPosition.php
Normal file
19
classes/Carrier/Dhl/Data/ExportDocPosition.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class ExportDocPosition
|
||||
{
|
||||
public string $description;
|
||||
public string $countryCodeOrigin;
|
||||
public string $customsTariffNumber;
|
||||
public int $amount;
|
||||
public float $netWeightInKG;
|
||||
public float $customsValue;
|
||||
}
|
40
classes/Carrier/Dhl/Data/ExportDocument.php
Normal file
40
classes/Carrier/Dhl/Data/ExportDocument.php
Normal file
@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class ExportDocument
|
||||
{
|
||||
const TYPE_PRESENT = 'PRESENT';
|
||||
const TYPE_DOCUMENT = 'DOCUMENT';
|
||||
const TYPE_COMMERCIAL_GOODS = 'COMMERCIAL_GOODS';
|
||||
const TYPE_COMMERCIAL_SAMPLE = 'COMMERCIAL_SAMPLE';
|
||||
const TYPE_RETURN_OF_GOODS= 'RETURN_OF_GOODS';
|
||||
const TYPE_OTHER = 'OTHER';
|
||||
|
||||
const TERMS_DDP = 'DDP';
|
||||
const TERMS_DXV = 'DXV';
|
||||
const TERMS_DAP = 'DAP';
|
||||
const TERMS_DDX = 'DDX';
|
||||
const TERMS_CPT = 'CPT';
|
||||
|
||||
public ?string $invoiceNumber;
|
||||
public string $exportType;
|
||||
public ?string $exportTypeDescription;
|
||||
public ?string $termsOfTrade;
|
||||
public string $placeOfCommital;
|
||||
public ?float $additionalFee;
|
||||
public ?string $customsCurrency;
|
||||
public ?string $permitNumber;
|
||||
public ?string $attestationNumber;
|
||||
public ?string $addresseesCustomsReference;
|
||||
public ?string $sendersCustomsReference;
|
||||
public ?bool $WithElectronicExportNtfctn;
|
||||
/** @var ExportDocPosition[] $ExportDocPosition */
|
||||
public array $ExportDocPosition;
|
||||
}
|
23
classes/Carrier/Dhl/Data/LabelData.php
Normal file
23
classes/Carrier/Dhl/Data/LabelData.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class LabelData
|
||||
{
|
||||
public Statusinformation $Status;
|
||||
public ?string $shipmentNumber;
|
||||
public ?string $labelUrl;
|
||||
public ?string $labelData;
|
||||
public ?string $returnLabelUrl;
|
||||
public ?string $returnLabelData;
|
||||
public ?string $exportLabelUrl;
|
||||
public ?string $exportLabelData;
|
||||
public ?string $codLabelUrl;
|
||||
public ?string $codLabelData;
|
||||
}
|
16
classes/Carrier/Dhl/Data/Name.php
Normal file
16
classes/Carrier/Dhl/Data/Name.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Name
|
||||
{
|
||||
public string $name1;
|
||||
public ?string $name2;
|
||||
public ?string $name3;
|
||||
}
|
25
classes/Carrier/Dhl/Data/NativeAddress.php
Normal file
25
classes/Carrier/Dhl/Data/NativeAddress.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class NativeAddress
|
||||
{
|
||||
public string $streetName;
|
||||
public ?string $streetNumber;
|
||||
|
||||
/**
|
||||
* @var string[]
|
||||
*/
|
||||
public array $addressAddition;
|
||||
public ?string $dispatchingInformation;
|
||||
public string $zip;
|
||||
public string $city;
|
||||
public ?string $province;
|
||||
public ?Country $Origin;
|
||||
}
|
18
classes/Carrier/Dhl/Data/NativeAddressNew.php
Normal file
18
classes/Carrier/Dhl/Data/NativeAddressNew.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class NativeAddressNew
|
||||
{
|
||||
public string $streetName;
|
||||
public ?string $streetNumber;
|
||||
public string $zip;
|
||||
public string $city;
|
||||
public ?Country $Origin;
|
||||
}
|
19
classes/Carrier/Dhl/Data/PackStation.php
Normal file
19
classes/Carrier/Dhl/Data/PackStation.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class PackStation
|
||||
{
|
||||
public string $postNumber;
|
||||
public string $packstationNumber;
|
||||
public string $zip;
|
||||
public string $city;
|
||||
public ?string $province;
|
||||
public ?Country $Origin;
|
||||
}
|
18
classes/Carrier/Dhl/Data/Postfiliale.php
Normal file
18
classes/Carrier/Dhl/Data/Postfiliale.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Postfiliale
|
||||
{
|
||||
public string $postfilialeNumber;
|
||||
public string $postNumber;
|
||||
public string $zip;
|
||||
public string $city;
|
||||
public ?Country $Origin;
|
||||
}
|
18
classes/Carrier/Dhl/Data/Receiver.php
Normal file
18
classes/Carrier/Dhl/Data/Receiver.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Receiver
|
||||
{
|
||||
public string $name1;
|
||||
public ?ReceiverNativeAddress $Address;
|
||||
public ?PackStation $Packstation;
|
||||
public ?Postfiliale $Postfiliale;
|
||||
public ?Communication $Communication;
|
||||
}
|
23
classes/Carrier/Dhl/Data/ReceiverNativeAddress.php
Normal file
23
classes/Carrier/Dhl/Data/ReceiverNativeAddress.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class ReceiverNativeAddress
|
||||
{
|
||||
public ?string $name2;
|
||||
public ?string $name3;
|
||||
public string $streetName;
|
||||
public ?string $streetNumber;
|
||||
public array|string|null $addressAddition;
|
||||
public ?string $dispatchingInformation;
|
||||
public string $zip;
|
||||
public string $city;
|
||||
public ?string $province;
|
||||
public ?Country $Origin;
|
||||
}
|
28
classes/Carrier/Dhl/Data/Shipment.php
Normal file
28
classes/Carrier/Dhl/Data/Shipment.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Shipment
|
||||
{
|
||||
public ShipmentDetails $ShipmentDetails;
|
||||
public Shipper $Shipper;
|
||||
public string $ShipperReference;
|
||||
public Receiver $Receiver;
|
||||
public ?Shipper $ReturnReceiver;
|
||||
public ?ExportDocument $ExportDocument;
|
||||
public ?string $feederSystem;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->ShipmentDetails = new ShipmentDetails();
|
||||
$this->Shipper = new Shipper();
|
||||
$this->ShipperReference = '';
|
||||
$this->Receiver = new Receiver();
|
||||
}
|
||||
}
|
34
classes/Carrier/Dhl/Data/ShipmentDetails.php
Normal file
34
classes/Carrier/Dhl/Data/ShipmentDetails.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
use DateTimeImmutable;
|
||||
|
||||
class ShipmentDetails
|
||||
{
|
||||
public string $product;
|
||||
public string $accountNumber;
|
||||
public string $customerReference;
|
||||
private string $shipmentDate;
|
||||
public string $costCentre;
|
||||
public string $returnShipmentAccountNumber;
|
||||
public string $returnShipmentReference;
|
||||
public ShipmentItem $ShipmentItem;
|
||||
public ShipmentService $Service;
|
||||
public ShipmentNotification $Notification;
|
||||
public Bank $BankData;
|
||||
|
||||
public function SetShipmentDate(DateTimeImmutable $date): void {
|
||||
$this->shipmentDate = $date->format('Y-m-d');
|
||||
}
|
||||
|
||||
public function GetShipmentDate(): DateTimeImmutable {
|
||||
return DateTimeImmutable::createFromFormat('Y-m-d', $this->shipmentDate);
|
||||
}
|
||||
}
|
17
classes/Carrier/Dhl/Data/ShipmentItem.php
Normal file
17
classes/Carrier/Dhl/Data/ShipmentItem.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class ShipmentItem
|
||||
{
|
||||
public float $weightInKG;
|
||||
public ?int $lengthInCM;
|
||||
public ?int $widthInCM;
|
||||
public ?int $heightInCM;
|
||||
}
|
15
classes/Carrier/Dhl/Data/ShipmentNotification.php
Normal file
15
classes/Carrier/Dhl/Data/ShipmentNotification.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class ShipmentNotification
|
||||
{
|
||||
public string $recipientEmailAddress;
|
||||
public ?string $templateId;
|
||||
}
|
16
classes/Carrier/Dhl/Data/ShipmentOrder.php
Normal file
16
classes/Carrier/Dhl/Data/ShipmentOrder.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class ShipmentOrder
|
||||
{
|
||||
public string $sequenceNumber;
|
||||
public Shipment $Shipment;
|
||||
public ?Serviceconfiguration $PrintOnlyIfCodeable;
|
||||
}
|
13
classes/Carrier/Dhl/Data/ShipmentService.php
Normal file
13
classes/Carrier/Dhl/Data/ShipmentService.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class ShipmentService
|
||||
{
|
||||
}
|
22
classes/Carrier/Dhl/Data/Shipper.php
Normal file
22
classes/Carrier/Dhl/Data/Shipper.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Shipper
|
||||
{
|
||||
public Name $Name;
|
||||
public NativeAddressNew $Address;
|
||||
public ?Communication $Communication;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->Name = new Name();
|
||||
$this->Address = new NativeAddressNew();
|
||||
}
|
||||
}
|
15
classes/Carrier/Dhl/Data/Status.php
Normal file
15
classes/Carrier/Dhl/Data/Status.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Status
|
||||
{
|
||||
public string $statuscode;
|
||||
public string $statusDescription;
|
||||
}
|
15
classes/Carrier/Dhl/Data/StatusElement.php
Normal file
15
classes/Carrier/Dhl/Data/StatusElement.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class StatusElement
|
||||
{
|
||||
public string $statusElement;
|
||||
public string $statusMessage;
|
||||
}
|
19
classes/Carrier/Dhl/Data/Statusinformation.php
Normal file
19
classes/Carrier/Dhl/Data/Statusinformation.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Statusinformation
|
||||
{
|
||||
public int $statusCode;
|
||||
public string $statusText;
|
||||
public array|string $statusMessage;
|
||||
public string $statusType;
|
||||
public StatusElement $errorMessage;
|
||||
public StatusElement $warningMessage;
|
||||
}
|
16
classes/Carrier/Dhl/Data/Version.php
Normal file
16
classes/Carrier/Dhl/Data/Version.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl\Data;
|
||||
|
||||
class Version
|
||||
{
|
||||
public string $majorRelease;
|
||||
public string $minorRelease;
|
||||
public ?string $build;
|
||||
}
|
76
classes/Carrier/Dhl/DhlApi.php
Normal file
76
classes/Carrier/Dhl/DhlApi.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\Dhl;
|
||||
|
||||
use SoapClient;
|
||||
use SoapHeader;
|
||||
use Xentral\Carrier\Dhl\Data\CreateShipmentOrderRequest;
|
||||
use Xentral\Carrier\Dhl\Data\CreateShipmentOrderResponse;
|
||||
use Xentral\Carrier\Dhl\Data\CreationState;
|
||||
use Xentral\Carrier\Dhl\Data\LabelData;
|
||||
use Xentral\Carrier\Dhl\Data\Shipment;
|
||||
use Xentral\Carrier\Dhl\Data\ShipmentOrder;
|
||||
use Xentral\Carrier\Dhl\Data\Statusinformation;
|
||||
use Xentral\Carrier\Dhl\Data\Version;
|
||||
|
||||
class DhlApi
|
||||
{
|
||||
private SoapClient $soapClient;
|
||||
|
||||
private const SANDBOX_URL = 'https://cig.dhl.de/services/sandbox/soap';
|
||||
private const PRODUCTION_URL = 'https://cig.dhl.de/services/production/soap';
|
||||
private const NAMESPACE_CIS = 'http://dhl.de/webservice/cisbase';
|
||||
|
||||
public function __construct(string $user, string $signature)
|
||||
{
|
||||
$this->soapClient = new SoapClient(__DIR__ . '/Wsdl/geschaeftskundenversand-api-3.4.0.wsdl', [
|
||||
'login' => 'OpenXE_1',
|
||||
'password' => 'cjzNEpGXxbbnRwcYLISX3ZTTcQrQrz',
|
||||
'location' => self::PRODUCTION_URL,
|
||||
'trace' => 1,
|
||||
'connection_timeout' => 30,
|
||||
'classmap' => [
|
||||
'CreateShipmentOrderResponse' => CreateShipmentOrderResponse::class,
|
||||
'CreationState' => CreationState::class,
|
||||
'LabelData' => LabelData::class,
|
||||
'Statusinformation' => Statusinformation::class,
|
||||
'Version' => Version::class,
|
||||
]
|
||||
]);
|
||||
|
||||
$authHeader = new SoapHeader(self::NAMESPACE_CIS, 'Authentification', [
|
||||
'user' => $user,
|
||||
'signature' => $signature
|
||||
]);
|
||||
$this->soapClient->__setSoapHeaders($authHeader);
|
||||
}
|
||||
|
||||
public function CreateShipment(Shipment $shipment): CreateShipmentOrderResponse|string
|
||||
{
|
||||
$request = new CreateShipmentOrderRequest();
|
||||
$request->Version = $this->getVersion();
|
||||
$request->ShipmentOrder = new ShipmentOrder();
|
||||
$request->ShipmentOrder->Shipment = $shipment;
|
||||
$request->ShipmentOrder->sequenceNumber = '1';
|
||||
$request->labelResponseType = "B64";
|
||||
try {
|
||||
$response = $this->soapClient->createShipmentOrder($request);
|
||||
return $response;
|
||||
} catch (\SoapFault $e) {
|
||||
return $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
private function getVersion() {
|
||||
$version = new Version();
|
||||
$version->majorRelease = '3';
|
||||
$version->minorRelease = '4';
|
||||
return $version;
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
340
classes/Carrier/Dhl/Wsdl/geschaeftskundenversand-api-3.4.0.wsdl
Normal file
340
classes/Carrier/Dhl/Wsdl/geschaeftskundenversand-api-3.4.0.wsdl
Normal file
@ -0,0 +1,340 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
Version: 3.4.0
|
||||
Date: 2022-08-01T22:00:51Z
|
||||
--><wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
|
||||
xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
|
||||
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
|
||||
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
|
||||
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
|
||||
xmlns:cis="http://dhl.de/webservice/cisbase"
|
||||
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
|
||||
xmlns:bcs="http://dhl.de/webservices/businesscustomershipping/3.0"
|
||||
targetNamespace="http://dhl.de/webservices/businesscustomershipping/3.0">
|
||||
<wsdl:types>
|
||||
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified">
|
||||
<xs:import namespace="http://dhl.de/webservice/cisbase"
|
||||
schemaLocation="geschaeftskundenversand-api-3.4.0-schema-cis_base.xsd"/>
|
||||
<xs:import namespace="http://dhl.de/webservices/businesscustomershipping/3.0"
|
||||
schemaLocation="geschaeftskundenversand-api-3.4.0-schema-bcs_base.xsd"/>
|
||||
</xs:schema>
|
||||
</wsdl:types>
|
||||
<wsdl:message name="AuthentificationHeaderMessage">
|
||||
<wsdl:documentation>The authentication data.</wsdl:documentation>
|
||||
<wsdl:part name="header" element="cis:Authentification"/>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="createShipmentOrderMessage">
|
||||
<wsdl:documentation>The shipmentdata for creating a shipment.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:CreateShipmentOrderRequest"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="createShipmentOrderResponseMessage">
|
||||
<wsdl:documentation>The status of the createShipment operation and the identifier for the
|
||||
shipment.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:CreateShipmentOrderResponse"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="validateShipmentMessage">
|
||||
<wsdl:documentation>The shipmentdata for validating a shipment.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:ValidateShipmentOrderRequest"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="validateShipmentResponseMessage">
|
||||
<wsdl:documentation>The status of the validateShipment operation and the identifier for the
|
||||
shipment.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:ValidateShipmentResponse"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="deleteShipmentOrderMessage">
|
||||
<wsdl:documentation>The identifier for the shipment which should be
|
||||
deleted.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:DeleteShipmentOrderRequest"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="deleteShipmentOrderResponseMessage">
|
||||
<wsdl:documentation>The status of the deletion operation.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:DeleteShipmentOrderResponse"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="doManifestMessage">
|
||||
<wsdl:documentation>The identifier for the shipment which should be
|
||||
manifested.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:DoManifestRequest"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="doManifestResponseMessage">
|
||||
<wsdl:documentation>The status of the manifest operation.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:DoManifestResponse"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="getLabelMessage">
|
||||
<wsdl:documentation>The identifier for the DD shipment for which the label url is
|
||||
requested.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:GetLabelRequest"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="getLabelResponseMessage">
|
||||
<wsdl:documentation>The status of the operation and the label url (if
|
||||
available).</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:GetLabelResponse"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="getVersionRequestMessage">
|
||||
<wsdl:documentation>The version of webservice implementation.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:Version"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="getVersionResponseMessage">
|
||||
<wsdl:documentation>The version of webservice implementation.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:GetVersionResponse"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="getExportDocMessage">
|
||||
<wsdl:documentation>The identifier for the DD shipment for which the label url is
|
||||
requested.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:GetExportDocRequest"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="getExportDocResponseMessage">
|
||||
<wsdl:documentation>The status of the operation and the label url (if
|
||||
available).</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:GetExportDocResponse"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="getManifestRequestMessage">
|
||||
<wsdl:documentation>Request a manifest of the given date / date range.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:GetManifestRequest"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="getManifestResponseMessage">
|
||||
<wsdl:documentation>The status of the operation and the manifest url (if
|
||||
available).</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:GetManifestResponse"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="updateShipmentOrderRequestMessage">
|
||||
<wsdl:documentation>Request a manifest of the given date / date range.</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:UpdateShipmentOrderRequest"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="updateShipmentOrderResponseMessage">
|
||||
<wsdl:documentation>The status of the operation and the manifest url (if
|
||||
available).</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:UpdateShipmentOrderResponse"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:message name="readShipmentOrderResponseMessage">
|
||||
<wsdl:documentation>The status of the operation and the manifest url (if
|
||||
available).</wsdl:documentation>
|
||||
<wsdl:part name="part1" element="bcs:ReadShipmentOrderResponse"> </wsdl:part>
|
||||
</wsdl:message>
|
||||
<wsdl:portType name="GKV3XAPIServicePortType">
|
||||
<wsdl:operation name="createShipmentOrder">
|
||||
<wsdl:documentation>Creates shipments.</wsdl:documentation>
|
||||
<wsdl:input message="bcs:createShipmentOrderMessage">
|
||||
<wsdl:documentation>The shipment data.</wsdl:documentation>
|
||||
</wsdl:input>
|
||||
<wsdl:output message="bcs:createShipmentOrderResponseMessage">
|
||||
<wsdl:documentation>The status of the createShipment operation and the identifier for the
|
||||
shipment.</wsdl:documentation>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="validateShipment">
|
||||
<wsdl:documentation>Creates shipments.</wsdl:documentation>
|
||||
<wsdl:input message="bcs:validateShipmentMessage">
|
||||
<wsdl:documentation>The shipment data.</wsdl:documentation>
|
||||
</wsdl:input>
|
||||
<wsdl:output message="bcs:validateShipmentResponseMessage">
|
||||
<wsdl:documentation>The status of the validateShipment operation and the identifier for the
|
||||
shipment.</wsdl:documentation>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="deleteShipmentOrder">
|
||||
<wsdl:documentation>Deletes the requested shipments.</wsdl:documentation>
|
||||
<wsdl:input message="bcs:deleteShipmentOrderMessage">
|
||||
<wsdl:documentation>The identifier for the shipment which should be
|
||||
deleted.</wsdl:documentation>
|
||||
</wsdl:input>
|
||||
<wsdl:output message="bcs:deleteShipmentOrderResponseMessage">
|
||||
<wsdl:documentation>The status of the deletion operation.</wsdl:documentation>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="doManifest">
|
||||
<wsdl:documentation>Manifest the requested DD shipments.</wsdl:documentation>
|
||||
<wsdl:input message="bcs:doManifestMessage">
|
||||
<wsdl:documentation>The identifier for the shipment which should be
|
||||
manifested.</wsdl:documentation>
|
||||
</wsdl:input>
|
||||
<wsdl:output message="bcs:doManifestResponseMessage">
|
||||
<wsdl:documentation>The status of the manifest operation.</wsdl:documentation>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="getLabel">
|
||||
<wsdl:documentation>Returns the request-url for getting a label.</wsdl:documentation>
|
||||
<wsdl:input message="bcs:getLabelMessage">
|
||||
<wsdl:documentation>The identifier for the shipment for which the label url is
|
||||
requested.</wsdl:documentation>
|
||||
</wsdl:input>
|
||||
<wsdl:output message="bcs:getLabelResponseMessage">
|
||||
<wsdl:documentation>The status of the operation and the label url (if
|
||||
available).</wsdl:documentation>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="getVersion">
|
||||
<wsdl:documentation>Returns the actual version of the implementation of the whole ISService
|
||||
webservice.</wsdl:documentation>
|
||||
<wsdl:input message="bcs:getVersionRequestMessage"/>
|
||||
<wsdl:output message="bcs:getVersionResponseMessage">
|
||||
<wsdl:documentation>The version of webservice implementation.</wsdl:documentation>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="getExportDoc">
|
||||
<wsdl:documentation>Returns the request-url for getting a export
|
||||
document.</wsdl:documentation>
|
||||
<wsdl:input message="bcs:getExportDocMessage">
|
||||
<wsdl:documentation>The identifier for the shipment for which the export document url is
|
||||
requested.</wsdl:documentation>
|
||||
</wsdl:input>
|
||||
<wsdl:output message="bcs:getExportDocResponseMessage">
|
||||
<wsdl:documentation>The status of the operation and the export document url (if
|
||||
available).</wsdl:documentation>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="getManifest">
|
||||
<wsdl:documentation>Request the manifest.</wsdl:documentation>
|
||||
<wsdl:input message="bcs:getManifestRequestMessage">
|
||||
<wsdl:documentation>The request data.</wsdl:documentation>
|
||||
</wsdl:input>
|
||||
<wsdl:output message="bcs:getManifestResponseMessage">
|
||||
<wsdl:documentation>The status of the getManifest operation and the manifest
|
||||
url.</wsdl:documentation>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="updateShipmentOrder">
|
||||
<wsdl:documentation>Updates a shipment order.</wsdl:documentation>
|
||||
<wsdl:input message="bcs:updateShipmentOrderRequestMessage">
|
||||
<wsdl:documentation>The shipment data.</wsdl:documentation>
|
||||
</wsdl:input>
|
||||
<wsdl:output message="bcs:updateShipmentOrderResponseMessage">
|
||||
<wsdl:documentation>The status of the updateShipment operation and the identifier for the
|
||||
shipment.</wsdl:documentation>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:portType>
|
||||
<wsdl:binding name="GKV3XAPISOAP11Binding" type="bcs:GKV3XAPIServicePortType">
|
||||
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
|
||||
<wsdl:operation name="createShipmentOrder">
|
||||
<wsdl:documentation>Creates shipments.</wsdl:documentation>
|
||||
<soap:operation soapAction="urn:createShipmentOrder" style="document"/>
|
||||
<wsdl:input>
|
||||
<wsdl:documentation>The authentication data and the shipment data.</wsdl:documentation>
|
||||
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<wsdl:documentation>The status of the operation and the shipment
|
||||
identifier.</wsdl:documentation>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="validateShipment">
|
||||
<wsdl:documentation>Validates shipments.</wsdl:documentation>
|
||||
<soap:operation soapAction="urn:validateShipment" style="document"/>
|
||||
<wsdl:input>
|
||||
<wsdl:documentation>The authentication data and the shipment data.</wsdl:documentation>
|
||||
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<wsdl:documentation>The status of the operation and the shipment
|
||||
identifier.</wsdl:documentation>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="deleteShipmentOrder">
|
||||
<wsdl:documentation>Deletes the requested shipments.</wsdl:documentation>
|
||||
<soap:operation soapAction="urn:deleteShipmentOrder" style="document"/>
|
||||
<wsdl:input>
|
||||
<wsdl:documentation>The authentication data and the shipment
|
||||
identifier.</wsdl:documentation>
|
||||
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<wsdl:documentation>The status of the operation.</wsdl:documentation>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="doManifest">
|
||||
<wsdl:documentation>Manifest the requested shipments.</wsdl:documentation>
|
||||
<soap:operation soapAction="urn:doManifest" style="document"/>
|
||||
<wsdl:input>
|
||||
<wsdl:documentation>The authentication data and the shipment
|
||||
identifier.</wsdl:documentation>
|
||||
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<wsdl:documentation>The status of the operation.</wsdl:documentation>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="getLabel">
|
||||
<wsdl:documentation>Returns the request-url for getting a label.</wsdl:documentation>
|
||||
<soap:operation soapAction="urn:getLabel" style="document"/>
|
||||
<wsdl:input>
|
||||
<wsdl:documentation>The authentication data and the shipment
|
||||
identifier.</wsdl:documentation>
|
||||
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<wsdl:documentation>The status of the operation and the url for requesting the
|
||||
label.</wsdl:documentation>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="getVersion">
|
||||
<wsdl:documentation>Returns the actual version of the implementation of the whole ISService
|
||||
webservice.</wsdl:documentation>
|
||||
<soap:operation soapAction="urn:getVersion" style="document"/>
|
||||
<wsdl:input>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<wsdl:documentation>The version of the implementation.</wsdl:documentation>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="getExportDoc">
|
||||
<wsdl:documentation>Returns the request-url for getting a export
|
||||
document.</wsdl:documentation>
|
||||
<soap:operation soapAction="urn:getExportDoc" style="document"/>
|
||||
<wsdl:input>
|
||||
<wsdl:documentation>The authentication data and the shipment
|
||||
identifier.</wsdl:documentation>
|
||||
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<wsdl:documentation>The status of the operation and the url for requesting the export
|
||||
document.</wsdl:documentation>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="getManifest">
|
||||
<wsdl:documentation>Requests the manifest.</wsdl:documentation>
|
||||
<soap:operation soapAction="urn:getManifest" style="document"/>
|
||||
<wsdl:input>
|
||||
<wsdl:documentation>The authentication data and the shipment data.</wsdl:documentation>
|
||||
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<wsdl:documentation>The status of the operation and the manifest url.</wsdl:documentation>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
<wsdl:operation name="updateShipmentOrder">
|
||||
<wsdl:documentation>Updates a shipment order.</wsdl:documentation>
|
||||
<soap:operation soapAction="urn:updateShipmentOrder" style="document"/>
|
||||
<wsdl:input>
|
||||
<wsdl:documentation>The authentication data and the shipment data.</wsdl:documentation>
|
||||
<soap:header message="bcs:AuthentificationHeaderMessage" part="header" use="literal"/>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:input>
|
||||
<wsdl:output>
|
||||
<wsdl:documentation>The status of the operation</wsdl:documentation>
|
||||
<soap:body use="literal"/>
|
||||
</wsdl:output>
|
||||
</wsdl:operation>
|
||||
</wsdl:binding>
|
||||
<wsdl:service name="GVAPI_2_0_de">
|
||||
<wsdl:port name="GKVAPISOAP11port0" binding="bcs:GKV3XAPISOAP11Binding">
|
||||
<soap:address location="https://cig.dhl.de/services/production/soap"/>
|
||||
</wsdl:port>
|
||||
</wsdl:service>
|
||||
</wsdl:definitions>
|
31
classes/Carrier/SendCloud/Data/Document.php
Normal file
31
classes/Carrier/SendCloud/Data/Document.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\SendCloud\Data;
|
||||
|
||||
class Document
|
||||
{
|
||||
public const TYPE_LABEL = 'label';
|
||||
public const TYPE_CP71 = 'cp71';
|
||||
public const TYPE_CN23 = 'cn23';
|
||||
public const TYPE_CN23_DEFAULT = 'cn23-default';
|
||||
public const TYPE_COMMERCIAL_INVOICE = 'commercial-invoice';
|
||||
|
||||
public string $Type;
|
||||
public string $Size;
|
||||
public string $Link;
|
||||
|
||||
public static function fromApiResponse(object $data): Document
|
||||
{
|
||||
$obj = new Document();
|
||||
$obj->Type = $data->type;
|
||||
$obj->Size = $data->size;
|
||||
$obj->Link = $data->link;
|
||||
return $obj;
|
||||
}
|
||||
}
|
42
classes/Carrier/SendCloud/Data/ParcelBase.php
Normal file
42
classes/Carrier/SendCloud/Data/ParcelBase.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\SendCloud\Data;
|
||||
|
||||
abstract class ParcelBase
|
||||
{
|
||||
public ?string $Name = null;
|
||||
public ?string $CompanyName = null;
|
||||
public ?string $Address = null;
|
||||
public ?string $Address2 = null;
|
||||
public ?string $HouseNumber = null;
|
||||
public ?string $City = null;
|
||||
public ?string $PostalCode = null;
|
||||
public ?string $Telephone = null;
|
||||
public bool $RequestLabel = true;
|
||||
public ?string $EMail = null;
|
||||
public ?string $Country = null;
|
||||
public ?int $ShippingMethodId = null;
|
||||
/**
|
||||
* @var ?int weight in grams
|
||||
*/
|
||||
public ?int $Weight = null;
|
||||
public ?string $OrderNumber = null;
|
||||
public ?string $TotalOrderValueCurrency = null;
|
||||
public ?float $TotalOrderValue = null;
|
||||
public ?string $CountryState = null;
|
||||
public ?string $CustomsInvoiceNr = null;
|
||||
public ?int $CustomsShipmentType = null;
|
||||
public ?string $ExternalReference = null;
|
||||
public ?int $TotalInsuredValue = null;
|
||||
public ?array $ParcelItems = array();
|
||||
public bool $IsReturn = false;
|
||||
public ?string $Length = null;
|
||||
public ?string $Width = null;
|
||||
public ?string $Height = null;
|
||||
}
|
47
classes/Carrier/SendCloud/Data/ParcelCreation.php
Normal file
47
classes/Carrier/SendCloud/Data/ParcelCreation.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\SendCloud\Data;
|
||||
|
||||
class ParcelCreation extends ParcelBase
|
||||
{
|
||||
public ?int $SenderAddressId = null;
|
||||
|
||||
public function toApiRequest(): array {
|
||||
return [
|
||||
'name' => $this->Name,
|
||||
'company_name' => $this->CompanyName,
|
||||
'address' => $this->Address,
|
||||
'address_2' => $this->Address2,
|
||||
'house_number' => $this->HouseNumber,
|
||||
'city' => $this->City,
|
||||
'postal_code' => $this->PostalCode,
|
||||
'telephone' => $this->Telephone,
|
||||
'request_label' => $this->RequestLabel,
|
||||
'email' => $this->EMail,
|
||||
'country' => $this->Country,
|
||||
'shipment' => ['id' => $this->ShippingMethodId],
|
||||
'weight' => number_format($this->Weight / 1000, 3, '.', null),
|
||||
'order_number' => $this->OrderNumber,
|
||||
'total_order_value_currency' => $this->TotalOrderValueCurrency,
|
||||
'total_order_value' => number_format($this->TotalOrderValue, 2, '.', null),
|
||||
'country_state' => $this->CountryState,
|
||||
'sender_address' => $this->SenderAddressId,
|
||||
'customs_invoice_nr' => $this->CustomsInvoiceNr,
|
||||
'customs_shipment_type' => $this->CustomsShipmentType,
|
||||
'external_reference' => $this->ExternalReference,
|
||||
'total_insured_value' => $this->TotalInsuredValue ?? 0,
|
||||
'parcel_items' => array_map(fn(ParcelItem $item)=>$item->toApiRequest(), $this->ParcelItems),
|
||||
'is_return' => $this->IsReturn,
|
||||
'length' => $this->Length,
|
||||
'width' => $this->Width,
|
||||
'height' => $this->Height,
|
||||
];
|
||||
}
|
||||
|
||||
}
|
16
classes/Carrier/SendCloud/Data/ParcelCreationError.php
Normal file
16
classes/Carrier/SendCloud/Data/ParcelCreationError.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\SendCloud\Data;
|
||||
|
||||
class ParcelCreationError
|
||||
{
|
||||
public int $Code;
|
||||
public string $Message;
|
||||
public string $Request;
|
||||
}
|
52
classes/Carrier/SendCloud/Data/ParcelItem.php
Normal file
52
classes/Carrier/SendCloud/Data/ParcelItem.php
Normal file
@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\SendCloud\Data;
|
||||
|
||||
class ParcelItem
|
||||
{
|
||||
public string $HsCode;
|
||||
|
||||
/**
|
||||
* @var int weight in grams
|
||||
*/
|
||||
public int $Weight;
|
||||
public int $Quantity;
|
||||
public string $Description;
|
||||
public string $OriginCountry;
|
||||
public float $Price;
|
||||
public ?string $Sku = null;
|
||||
public ?string $ProductId = null;
|
||||
|
||||
public function toApiRequest(): array {
|
||||
return [
|
||||
'hs_code' => $this->HsCode,
|
||||
'weight' => number_format($this->Weight / 1000, 3, '.', null),
|
||||
'quantity' => $this->Quantity,
|
||||
'description' => $this->Description,
|
||||
'value' => $this->Price,
|
||||
'origin_country' => $this->OriginCountry,
|
||||
'sku' => $this->Sku ?? '',
|
||||
'product_id' => $this->ProductId ?? '',
|
||||
];
|
||||
}
|
||||
|
||||
public static function fromApiResponse(object $data): ParcelItem
|
||||
{
|
||||
$obj = new ParcelItem();
|
||||
$obj->HsCode = $data->hs_code;
|
||||
$obj->Weight = intval(floatval($data->weight)*1000);
|
||||
$obj->Quantity = $data->quantity;
|
||||
$obj->Description = $data->description;
|
||||
$obj->Price = $data->value;
|
||||
$obj->OriginCountry = $data->origin_country;
|
||||
$obj->Sku = $data->sku;
|
||||
$obj->ProductId = $data->product_id;
|
||||
return $obj;
|
||||
}
|
||||
}
|
82
classes/Carrier/SendCloud/Data/ParcelResponse.php
Normal file
82
classes/Carrier/SendCloud/Data/ParcelResponse.php
Normal file
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\SendCloud\Data;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use Exception;
|
||||
|
||||
class ParcelResponse extends ParcelBase
|
||||
{
|
||||
public int $Id;
|
||||
public string $CarrierCode;
|
||||
public DateTimeImmutable $DateCreated;
|
||||
public DateTimeImmutable $DateUpdated;
|
||||
public DateTimeImmutable $DateAnnounced;
|
||||
public string $ShipmentMethodName;
|
||||
public int $StatusId;
|
||||
public string $StatusMessage;
|
||||
public array $Documents;
|
||||
public ?string $TrackingNumber = null;
|
||||
public ?string $TrackingUrl = null;
|
||||
public ?array $Errors;
|
||||
|
||||
public function GetDocumentByType(string $type): ?Document
|
||||
{
|
||||
/** @var Document $item */
|
||||
foreach ($this->Documents as $item)
|
||||
if ($item->Type == $type)
|
||||
return $item;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function fromApiResponse(object $data): ParcelResponse
|
||||
{
|
||||
$obj = new ParcelResponse();
|
||||
$obj->Address = $data->address_divided->street;
|
||||
$obj->Address2 = $data->address_2;
|
||||
$obj->HouseNumber = $data->address_divided->house_number;
|
||||
$obj->CarrierCode = $data->carrier->code;
|
||||
$obj->City = $data->city;
|
||||
$obj->CompanyName = $data->company_name;
|
||||
$obj->Country = $data->country->iso_2;
|
||||
$obj->CustomsInvoiceNr = $data->customs_invoice_nr;
|
||||
$obj->CustomsShipmentType = $data->customs_shipment_type;
|
||||
$obj->DateCreated = new DateTimeImmutable($data->date_created);
|
||||
$obj->DateUpdated = new DateTimeImmutable($data->date_updated);
|
||||
$obj->DateAnnounced = new DateTimeImmutable($data->date_announced);
|
||||
$obj->EMail = $data->email;
|
||||
$obj->Id = $data->id;
|
||||
$obj->Name = $data->name;
|
||||
$obj->OrderNumber = $data->order_number;
|
||||
$obj->ParcelItems = array_map(fn($item)=>ParcelItem::fromApiResponse($item), $data->parcel_items);
|
||||
$obj->PostalCode = $data->postal_code;
|
||||
$obj->ExternalReference = $data->external_reference;
|
||||
$obj->ShippingMethodId = $data->shipment->id;
|
||||
$obj->ShipmentMethodName = $data->shipment->name;
|
||||
$obj->StatusId = $data->status->id;
|
||||
$obj->StatusMessage = $data->status->message;
|
||||
$obj->Documents = array_map(fn($item)=>Document::fromApiResponse($item), $data->documents);
|
||||
$obj->Telephone = $data->telephone;
|
||||
$obj->TotalInsuredValue = $data->total_insured_value;
|
||||
$obj->TotalOrderValue = $data->total_order_value;
|
||||
$obj->TotalOrderValueCurrency = $data->total_order_value_currency;
|
||||
$obj->TrackingNumber = $data->tracking_number;
|
||||
$obj->TrackingUrl = $data->tracking_url;
|
||||
$obj->Weight = $data->weight;
|
||||
$obj->Length = $data->length;
|
||||
$obj->Height = $data->height;
|
||||
$obj->Width = $data->width;
|
||||
$obj->IsReturn = $data->is_return;
|
||||
$obj->Errors = $data->errors->non_field_errors;
|
||||
return $obj;
|
||||
}
|
||||
}
|
59
classes/Carrier/SendCloud/Data/SenderAddress.php
Normal file
59
classes/Carrier/SendCloud/Data/SenderAddress.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\SendCloud\Data;
|
||||
|
||||
class SenderAddress {
|
||||
public ?string $City;
|
||||
public ?string $CompanyName;
|
||||
public ?string $ContactName;
|
||||
public string $Country;
|
||||
public ?string $CountryState;
|
||||
public ?string $Email;
|
||||
public ?string $HouseNumber;
|
||||
public int $Id;
|
||||
public ?string $PostalBox;
|
||||
public ?string $PostalCode;
|
||||
public ?string $Street;
|
||||
public ?string $Telephone;
|
||||
public ?string $VatNumber;
|
||||
public ?string $EoriNumber;
|
||||
public int $BrandId;
|
||||
public ?string $Label;
|
||||
public ?string $SignatureFullName;
|
||||
public ?string $SignatureInitials;
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
return "$this->CompanyName; $this->ContactName; $this->Street $this->HouseNumber; $this->PostalCode; $this->City";
|
||||
}
|
||||
|
||||
|
||||
public static function fromApiResponse(object $data): SenderAddress {
|
||||
$obj = new SenderAddress();
|
||||
$obj->City = $data->city;
|
||||
$obj->CompanyName = $data->company_name;
|
||||
$obj->ContactName = $data->contact_name;
|
||||
$obj->Country = $data->country;
|
||||
$obj->CountryState = $data->country_state;
|
||||
$obj->Email = $data->email;
|
||||
$obj->HouseNumber = $data->house_number;
|
||||
$obj->Id = $data->id;
|
||||
$obj->PostalBox = $data->postal_box;
|
||||
$obj->PostalCode = $data->postal_code;
|
||||
$obj->Street = $data->street;
|
||||
$obj->Telephone = $data->telephone;
|
||||
$obj->VatNumber = $data->vat_number;
|
||||
$obj->EoriNumber = $data->eori_number;
|
||||
$obj->BrandId = $data->brand_id;
|
||||
$obj->Label = $data->label;
|
||||
$obj->SignatureFullName = $data->signature_full_name;
|
||||
$obj->SignatureInitials = $data->signature_initials;
|
||||
return $obj;
|
||||
}
|
||||
}
|
35
classes/Carrier/SendCloud/Data/ShippingMethod.php
Normal file
35
classes/Carrier/SendCloud/Data/ShippingMethod.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\SendCloud\Data;
|
||||
|
||||
class ShippingMethod {
|
||||
public int $Id;
|
||||
public string $Name;
|
||||
public ?string $Carrier;
|
||||
public int $MinWeight;
|
||||
public int $MaxWeight;
|
||||
public int $MaxLength;
|
||||
public int $MaxWidth;
|
||||
public int $MaxHeight;
|
||||
public string $Unit;
|
||||
|
||||
public static function fromApiResponse(object $data):ShippingMethod {
|
||||
$obj = new ShippingMethod();
|
||||
$obj->Id = $data->id;
|
||||
$obj->Name = $data->name;
|
||||
$obj->Carrier = $data->carrier ?? null;
|
||||
$obj->MinWeight = $data->properties->min_weight;
|
||||
$obj->MaxWeight = $data->properties->max_weight;
|
||||
$obj->MaxLength = $data->properties->max_dimensions->length;
|
||||
$obj->MaxWidth = $data->properties->max_dimensions->width;
|
||||
$obj->MaxHeight = $data->properties->max_dimensions->height;
|
||||
$obj->Unit = $data->properties->max_dimensions->unit;
|
||||
return $obj;
|
||||
}
|
||||
}
|
35
classes/Carrier/SendCloud/Data/ShippingProduct.php
Normal file
35
classes/Carrier/SendCloud/Data/ShippingProduct.php
Normal file
@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\SendCloud\Data;
|
||||
|
||||
class ShippingProduct {
|
||||
public string $Name;
|
||||
public string $Carrier;
|
||||
public string $ServicePointsCarrier;
|
||||
public string $Code;
|
||||
public int $MinWeight;
|
||||
public int $MaxWeight;
|
||||
public array $ShippingMethods;
|
||||
|
||||
public static function fromApiResponse(object $data): ShippingProduct {
|
||||
$obj = new ShippingProduct();
|
||||
$obj->Name = $data->name;
|
||||
$obj->Carrier = $data->carrier;
|
||||
$obj->ServicePointsCarrier = $data->service_points_carrier;
|
||||
$obj->Code = $data->code;
|
||||
$obj->MinWeight = $data->weight_range->min_weight;
|
||||
$obj->MaxWeight = $data->weight_range->max_weight;
|
||||
foreach ($data->methods as $method) {
|
||||
$child = ShippingMethod::fromApiResponse($method);
|
||||
$child->Carrier = $obj->Carrier;
|
||||
$obj->ShippingMethods[] = $child;
|
||||
}
|
||||
return $obj;
|
||||
}
|
||||
}
|
163
classes/Carrier/SendCloud/SendCloudApi.php
Normal file
163
classes/Carrier/SendCloud/SendCloudApi.php
Normal file
@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\SendCloud;
|
||||
|
||||
use Exception;
|
||||
use Xentral\Carrier\SendCloud\Data\Document;
|
||||
use Xentral\Carrier\SendCloud\Data\ParcelCreation;
|
||||
use Xentral\Carrier\SendCloud\Data\ParcelResponse;
|
||||
use Xentral\Carrier\SendCloud\Data\SenderAddress;
|
||||
use Xentral\Carrier\SendCloud\Data\ShippingProduct;
|
||||
|
||||
class SendCloudApi
|
||||
{
|
||||
/**
|
||||
* @var ?string $public_key
|
||||
*/
|
||||
protected ?string $public_key;
|
||||
/**
|
||||
* @var ?string $private_key
|
||||
*/
|
||||
protected ?string $private_key;
|
||||
|
||||
const PROD_BASE_URI = 'https://panel.sendcloud.sc/api/v2';
|
||||
|
||||
public function __construct($public_key, $private_key)
|
||||
{
|
||||
$this->public_key = $public_key;
|
||||
$this->private_key = $private_key;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SendcloudApiException
|
||||
*/
|
||||
public function GetSenderAddresses(): array
|
||||
{
|
||||
$uri = self::PROD_BASE_URI . '/user/addresses/sender';
|
||||
$response = $this->sendRequest($uri);
|
||||
foreach ($response['body']->sender_addresses as $item)
|
||||
$res[] = SenderAddress::fromApiResponse($item);
|
||||
return $res ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SendcloudApiException
|
||||
*/
|
||||
public function GetShippingProducts(string $sourceCountry, ?string $targetCountry = null, ?int $weight = null,
|
||||
?int $height = null, ?int $length = null, ?int $width = null): array
|
||||
{
|
||||
$uri = self::PROD_BASE_URI . '/shipping-products';
|
||||
$params = ['from_country' => $sourceCountry];
|
||||
if ($targetCountry !== null)
|
||||
$params['to_country'] = $targetCountry;
|
||||
if ($weight !== null && $weight > 0)
|
||||
$params['weight'] = $weight;
|
||||
if ($height !== null && $height > 0) {
|
||||
$params['height'] = $height;
|
||||
$params['height_unit'] = 'centimeter';
|
||||
}
|
||||
if ($length !== null && $length > 0) {
|
||||
$params['length'] = $length;
|
||||
$params['length_unit'] = 'centimeter';
|
||||
}
|
||||
if ($width !== null && $width > 0) {
|
||||
$params['width'] = $width;
|
||||
$params['width_unit'] = 'centimeter';
|
||||
}
|
||||
$response = $this->sendRequest($uri, $params);
|
||||
return array_map(fn($x) => ShippingProduct::fromApiResponse($x), $response['body'] ?? []);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SendcloudApiException
|
||||
*/
|
||||
public function CreateParcel(ParcelCreation $parcel): ParcelResponse|string|null
|
||||
{
|
||||
$uri = self::PROD_BASE_URI . '/parcels';
|
||||
$response = $this->sendRequest($uri, null, true, ['parcel' => $parcel->toApiRequest()], [200,400]);
|
||||
switch ($response['code']) {
|
||||
case 200:
|
||||
if (isset($response['body']->parcel))
|
||||
try {
|
||||
return ParcelResponse::fromApiResponse($response['body']->parcel);
|
||||
} catch (Exception $e) {
|
||||
throw new SendcloudApiException(previous: $e);
|
||||
}
|
||||
break;
|
||||
case 400:
|
||||
if (isset($response->error))
|
||||
return $response->error->message;
|
||||
break;
|
||||
}
|
||||
throw SendcloudApiException::fromResponse($response);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SendcloudApiException
|
||||
*/
|
||||
public function DownloadDocument(Document $document): string
|
||||
{
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_RETURNTRANSFER => 1,
|
||||
CURLOPT_URL => $document->Link,
|
||||
CURLOPT_HTTPHEADER => [
|
||||
"Authorization: Basic " . base64_encode($this->public_key . ':' . $this->private_key)
|
||||
],
|
||||
]);
|
||||
$output = curl_exec($curl);
|
||||
$code = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
|
||||
if ($code != 200)
|
||||
throw SendcloudApiException::fromResponse(['code' => $code, 'body' => $output]);
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws SendcloudApiException
|
||||
*/
|
||||
function sendRequest(string $uri, array $query_params = null, bool $post = false, array $postFields = null,
|
||||
array $allowedResponseCodes = [200]): ?array
|
||||
{
|
||||
if (empty($this->public_key) || empty($this->private_key))
|
||||
return null;
|
||||
|
||||
$curl = curl_init();
|
||||
if (is_array($query_params)) {
|
||||
$uri .= '?' . http_build_query($query_params);
|
||||
}
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_RETURNTRANSFER => 1,
|
||||
CURLOPT_URL => $uri,
|
||||
CURLOPT_HTTPHEADER => [
|
||||
"Authorization: Basic " . base64_encode($this->public_key . ':' . $this->private_key),
|
||||
'Content-Type: application/json'
|
||||
],
|
||||
]);
|
||||
if ($post === true) {
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => json_encode($postFields)
|
||||
]);
|
||||
}
|
||||
|
||||
$output = json_decode(curl_exec($curl));
|
||||
$code = curl_getinfo($curl, CURLINFO_RESPONSE_CODE);
|
||||
curl_close($curl);
|
||||
|
||||
$ret = [
|
||||
'code' => $code,
|
||||
'body' => $output,
|
||||
];
|
||||
|
||||
if (!in_array($code, $allowedResponseCodes))
|
||||
throw SendcloudApiException::fromResponse($ret);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
24
classes/Carrier/SendCloud/SendcloudApiException.php
Normal file
24
classes/Carrier/SendCloud/SendcloudApiException.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
namespace Xentral\Carrier\SendCloud;
|
||||
|
||||
use Exception;
|
||||
|
||||
class SendcloudApiException extends Exception
|
||||
{
|
||||
public static function fromResponse(array $response) : SendcloudApiException {
|
||||
if (!isset($response['body']) || !is_object($response['body']))
|
||||
return new SendcloudApiException(print_r($response,true));
|
||||
|
||||
return new SendcloudApiException(
|
||||
print_r($response['body'],true),
|
||||
$response['code']
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
namespace Xentral\Modules\ShippingMethod\Model;
|
||||
|
||||
class CreateShipmentResult
|
||||
{
|
||||
public bool $Success = false;
|
||||
public array $Errors = [];
|
||||
public ?string $Label;
|
||||
public ?string $ExportDocuments;
|
||||
public ?string $TrackingNumber;
|
||||
public ?string $TrackingUrl;
|
||||
}
|
19
classes/Modules/ShippingMethod/Model/CustomsInfo.php
Normal file
19
classes/Modules/ShippingMethod/Model/CustomsInfo.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
namespace Xentral\Modules\ShippingMethod\Model;
|
||||
|
||||
class CustomsInfo
|
||||
{
|
||||
const CUSTOMS_TYPE_GIFT = 0;
|
||||
const CUSTOMS_TYPE_DOCUMENTS = 1;
|
||||
const CUSTOMS_TYPE_GOODS = 2;
|
||||
const CUSTOMS_TYPE_SAMPLE = 3;
|
||||
const CUSTOMS_TYPE_RETURN = 4;
|
||||
|
||||
}
|
63
classes/Modules/ShippingMethod/Model/Product.php
Normal file
63
classes/Modules/ShippingMethod/Model/Product.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
namespace Xentral\Modules\ShippingMethod\Model;
|
||||
|
||||
class Product
|
||||
{
|
||||
const SERVICE_COD = 'cod';
|
||||
const SERVICE_PREMIUM = 'premium';
|
||||
|
||||
public string $Id;
|
||||
public string $Name;
|
||||
public float $LengthMin = 0;
|
||||
public float $LengthMax = 500;
|
||||
public float $WidthMin = 0;
|
||||
public float $WidthMax = 500;
|
||||
public float $HeightMin = 0;
|
||||
public float $HeightMax = 500;
|
||||
public float $WeightMin = 0;
|
||||
public float $WeightMax = 100;
|
||||
public array $AvailableServices = [];
|
||||
|
||||
public static function Create(string $id, string $name):Product {
|
||||
$obj = new Product();
|
||||
$obj->Id = $id;
|
||||
$obj->Name = $name;
|
||||
return $obj;
|
||||
}
|
||||
|
||||
public function WithLength(float $min, float $max): Product {
|
||||
$this->LengthMin = $min;
|
||||
$this->LengthMax = $max;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function WithWidth(float $min, float $max): Product {
|
||||
$this->WidthMin = $min;
|
||||
$this->WidthMax = $max;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function WithHeight(float $min, float $max): Product {
|
||||
$this->HeightMin = $min;
|
||||
$this->HeightMax = $max;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function WithWeight(float $min, float $max): Product {
|
||||
$this->WeightMin = $min;
|
||||
$this->WeightMax = $max;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function WithServices(array $services): Product {
|
||||
$this->AvailableServices = $services;
|
||||
return $this;
|
||||
}
|
||||
}
|
@ -1,3 +1,10 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
var ShippingMethodCreate = function ($) {
|
||||
'use strict';
|
||||
|
||||
@ -11,35 +18,14 @@ var ShippingMethodCreate = function ($) {
|
||||
vueElementId: '#shipment-create',
|
||||
},
|
||||
search: function (el) {
|
||||
$.ajax({
|
||||
url: 'index.php?module=versandarten&action=create&cmd=suche',
|
||||
type: 'POST',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
val: $(el).val()
|
||||
}
|
||||
let val = $(el).val().toLowerCase();
|
||||
$('.createbutton').each(function() {
|
||||
let desc = $(this).find('.tilegrid-tile-title').text();
|
||||
if (desc.toLowerCase().indexOf(val)>=0)
|
||||
$(this).show();
|
||||
else
|
||||
$(this).hide();
|
||||
})
|
||||
.done(function (data) {
|
||||
if (typeof data != 'undefined' && data != null) {
|
||||
if (typeof data.ausblenden != 'undefined' && data.ausblenden != null) {
|
||||
me.storage.hideElements = data.ausblenden.split(';');
|
||||
$.each(me.storage.hideElements, function (k, v) {
|
||||
if (v != '') {
|
||||
$('#' + v).hide();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
if (typeof data.anzeigen != 'undefined' && data.anzeigen != null) {
|
||||
me.storage.showElements = data.anzeigen.split(';');
|
||||
$.each(me.storage.showElements, function (k, v) {
|
||||
if (v != '') {
|
||||
$('#' + v).show();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
init: function () {
|
||||
if ($(me.selector.vueElementId).length === 0) {
|
||||
|
@ -1,10 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-FileCopyrightText: 2019 Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Xentral\Modules\SubscriptionCycle;
|
||||
|
||||
use Aboabrechnung;
|
||||
use Sabre\CalDAV\Subscriptions\Subscription;
|
||||
use Xentral\Components\SchemaCreator\Collection\SchemaCollection;
|
||||
use Xentral\Components\SchemaCreator\Schema\TableSchema;
|
||||
use Xentral\Components\SchemaCreator\Type;
|
||||
@ -35,6 +42,7 @@ final class Bootstrap
|
||||
'SubscriptionCycleJobService' => 'onInitSubscriptionCycleJobService',
|
||||
'SubscriptionCycleFullTask' => 'onInitSubscriptionCycleFullTask',
|
||||
'TaskMutexService' => 'onInitTaskMutexService',
|
||||
'SubscriptionModule' => 'onInitSubscriptionModule'
|
||||
];
|
||||
}
|
||||
|
||||
@ -60,20 +68,12 @@ final class Bootstrap
|
||||
*/
|
||||
public static function onInitSubscriptionCycleManualJobTask(ContainerInterface $container
|
||||
): SubscriptionCycleManualJobTask {
|
||||
$legacyApp = $container->get('LegacyApplication');
|
||||
|
||||
$subscriptionCycleModule = $legacyApp->loadModule('rechnungslauf');
|
||||
$subscriptionModule = new Aboabrechnung($legacyApp);
|
||||
$subscriptionModule->cronjob = true;
|
||||
|
||||
return new SubscriptionCycleManualJobTask(
|
||||
$legacyApp,
|
||||
$container->get('LegacyApplication'),
|
||||
$container->get('Database'),
|
||||
$container->get('TaskMutexService'),
|
||||
$container->get('SubscriptionCycleJobService'),
|
||||
$subscriptionCycleModule,
|
||||
$subscriptionModule,
|
||||
!empty($legacyApp->erp->GetKonfiguration('rechnungslauf_gruppen'))
|
||||
$container->get('SubscriptionModule')
|
||||
);
|
||||
}
|
||||
|
||||
@ -210,22 +210,10 @@ final class Bootstrap
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param SchemaCollection $collection
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function registerTableSchemas(SchemaCollection $collection): void
|
||||
{
|
||||
$subscriptionCycleJob = new TableSchema('subscription_cycle_job');
|
||||
$subscriptionCycleJob->addColumn(Type\Integer::asAutoIncrement('id'));
|
||||
$subscriptionCycleJob->addColumn(new Type\Integer('address_id'));
|
||||
$subscriptionCycleJob->addColumn(new Type\Varchar('document_type', 32));
|
||||
$subscriptionCycleJob->addColumn(new Type\Varchar('job_type', 32));
|
||||
$subscriptionCycleJob->addColumn(new Type\Integer('printer_id'));
|
||||
$subscriptionCycleJob->addColumn(new Type\Timestamp('created_at', 'CURRENT_TIMESTAMP'));
|
||||
$subscriptionCycleJob->addIndex(new Index\Primary(['id']));
|
||||
$subscriptionCycleJob->addIndex(new Index\Index(['address_id']));
|
||||
$collection->add($subscriptionCycleJob);
|
||||
public static function onInitSubscriptionModule(ContainerInterface $container): SubscriptionModule {
|
||||
return new SubscriptionModule(
|
||||
$container->get('LegacyApplication'),
|
||||
$container->get('Database')
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,9 @@
|
||||
<?php
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-FileCopyrightText: 2019 Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
@ -16,52 +21,33 @@ use Xentral\Modules\SubscriptionCycle\SubscriptionModuleInterface;
|
||||
|
||||
final class SubscriptionCycleManualJobTask
|
||||
{
|
||||
/** @var ApplicationCore $app */
|
||||
private $app;
|
||||
private ApplicationCore $app;
|
||||
private Database $db;
|
||||
private SubscriptionCycleJobService $cycleJobService;
|
||||
private TaskMutexServiceInterface $taskMutexService;
|
||||
private SubscriptionModuleInterface $subscriptionModule;
|
||||
|
||||
/** @var Database $db */
|
||||
private $db;
|
||||
|
||||
/** @var SubscriptionCycleJobService $cycleJobService */
|
||||
private $cycleJobService;
|
||||
|
||||
/** @var TaskMutexServiceInterface $taskMutexService */
|
||||
private $taskMutexService;
|
||||
|
||||
/** @var SubscriptionCycleModuleInterface $subscriptionCycleModule */
|
||||
private $subscriptionCycleModule;
|
||||
|
||||
/** @var SubscriptionModuleInterface $subscriptionModule */
|
||||
private $subscriptionModule;
|
||||
|
||||
/** @var bool $useGroups */
|
||||
private $useGroups;
|
||||
|
||||
/**
|
||||
* SubscriptionCycleManualJobTask constructor.
|
||||
*
|
||||
* @param ApplicationCore $app
|
||||
* @param Database $db
|
||||
* @param SubscriptionCycleJobService $cycleJobService
|
||||
* @param SubscriptionCycleModuleInterface $subscriptionCycleModule
|
||||
* @param bool $useGroups
|
||||
*/
|
||||
/**
|
||||
* SubscriptionCycleManualJobTask constructor.
|
||||
*
|
||||
* @param ApplicationCore $app
|
||||
* @param Database $db
|
||||
* @param TaskMutexServiceInterface $taskMutexService
|
||||
* @param SubscriptionCycleJobService $cycleJobService
|
||||
* @param SubscriptionModuleInterface $subscriptionModule
|
||||
*/
|
||||
public function __construct(
|
||||
ApplicationCore $app,
|
||||
Database $db,
|
||||
TaskMutexServiceInterface $taskMutexService,
|
||||
SubscriptionCycleJobService $cycleJobService,
|
||||
SubscriptionCycleModuleInterface $subscriptionCycleModule,
|
||||
SubscriptionModuleInterface $subscriptionModule,
|
||||
bool $useGroups
|
||||
SubscriptionModuleInterface $subscriptionModule
|
||||
) {
|
||||
$this->app = $app;
|
||||
$this->db = $db;
|
||||
$this->taskMutexService = $taskMutexService;
|
||||
$this->cycleJobService = $cycleJobService;
|
||||
$this->subscriptionCycleModule = $subscriptionCycleModule;
|
||||
$this->subscriptionModule = $subscriptionModule;
|
||||
$this->useGroups = $useGroups;
|
||||
}
|
||||
|
||||
public function execute(): void
|
||||
@ -71,77 +57,16 @@ final class SubscriptionCycleManualJobTask
|
||||
}
|
||||
$this->taskMutexService->setMutex('rechnungslauf_manual');
|
||||
$jobs = $this->cycleJobService->listAll(100);
|
||||
$simulatedDays = $this->getSimulatedDates($jobs);
|
||||
if (empty($jobs)) {
|
||||
return;
|
||||
}
|
||||
foreach (['auftrag', 'rechnung'] as $doctype) {
|
||||
foreach ($simulatedDays as $simulatedDay) {
|
||||
if ($simulatedDay === '') {
|
||||
$simulatedDay = null;
|
||||
} else {
|
||||
try {
|
||||
$simulatedDay = new DateTimeImmutable($simulatedDay);
|
||||
} catch (Exception $exception) {
|
||||
$simulatedDay = null;
|
||||
}
|
||||
}
|
||||
$addresses = $this->getAddressesByTypeFromJobs($jobs, $doctype, $simulatedDay);
|
||||
foreach ($jobs as $job) {
|
||||
$job = $this->cycleJobService->getJob((int)$job['id']);
|
||||
if (empty($job)) {
|
||||
continue;
|
||||
}
|
||||
if ($job['document_type'] !== $doctype) {
|
||||
continue;
|
||||
}
|
||||
if ($job['simulated_day'] === null && $simulatedDay !== null) {
|
||||
continue;
|
||||
}
|
||||
if (
|
||||
$job['simulated_day'] !== null
|
||||
&& ($simulatedDay === null || $simulatedDay->format('Y-m-d') !== $job['simulated_day'])
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (!in_array($job['address_id'], $addresses, false)) {
|
||||
$this->cycleJobService->delete((int)$job['id']);
|
||||
continue;
|
||||
}
|
||||
$simulatedDay = null;
|
||||
if ($job['simulated_day'] !== null) {
|
||||
try {
|
||||
$simulatedDay = new DateTimeImmutable($job['simulated_day']);
|
||||
} catch (Exception $exception) {
|
||||
$simulatedDay = null;
|
||||
}
|
||||
}
|
||||
if ($this->useGroups) {
|
||||
$this->subscriptionCycleModule->generateAndSendSubscriptionCycleGroups(
|
||||
$this->subscriptionModule,
|
||||
[$job['address_id']],
|
||||
$doctype,
|
||||
$job['job_type'],
|
||||
$job['printer_id'],
|
||||
$simulatedDay
|
||||
);
|
||||
} else {
|
||||
$this->subscriptionCycleModule->generateAndSendSubscriptionCycle(
|
||||
$this->subscriptionModule,
|
||||
[$job['address_id']],
|
||||
$doctype,
|
||||
$job['printer_id'],
|
||||
$job['job_type'],
|
||||
$simulatedDay
|
||||
);
|
||||
}
|
||||
$this->cycleJobService->delete((int)$job['id']);
|
||||
if ($this->taskMutexService->isTaskInstanceRunning('rechnungslauf')) {
|
||||
return;
|
||||
}
|
||||
$this->taskMutexService->setMutex('rechnungslauf_manual');
|
||||
}
|
||||
}
|
||||
foreach ($jobs as $job) {
|
||||
switch ($job['document_type']) {
|
||||
case 'rechnung':
|
||||
$this->subscriptionModule->CreateInvoice((int)$job['address_id']);
|
||||
break;
|
||||
case 'auftrag':
|
||||
$this->subscriptionModule->CreateOrder((int)$job['address_id']);
|
||||
break;
|
||||
}
|
||||
$this->cycleJobService->delete((int)$job['id']);
|
||||
}
|
||||
}
|
||||
|
||||
@ -149,52 +74,4 @@ final class SubscriptionCycleManualJobTask
|
||||
{
|
||||
$this->taskMutexService->setMutex('rechnungslauf_manual', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $jobs
|
||||
* @param string $documentType
|
||||
* @param DateTimeInterface|null $simulatedDay
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getAddressesByTypeFromJobs(
|
||||
array $jobs,
|
||||
string $documentType,
|
||||
?DateTimeInterface $simulatedDay = null
|
||||
): array {
|
||||
$addresses = [];
|
||||
foreach ($jobs as $job) {
|
||||
if ($job['document_type'] === $documentType) {
|
||||
$addresses[] = (int)$job['address_id'];
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($addresses)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$addressesWithSubscriptions = array_keys(
|
||||
(array)$this->subscriptionModule->GetRechnungsArray($documentType, true)
|
||||
);
|
||||
|
||||
return array_intersect($addresses, $addressesWithSubscriptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* get all Dates from Setting "Vergangenes Datum für Abrechnungserstellung" to calc old Subscription cycles
|
||||
*
|
||||
* @param array $jobs
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
private function getSimulatedDates(array $jobs): array
|
||||
{
|
||||
$simulatedDates = [];
|
||||
foreach ($jobs as $job) {
|
||||
$simulatedDates[] = (string)$job['simulated_day'];
|
||||
}
|
||||
|
||||
return array_unique($simulatedDates);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,9 @@
|
||||
<?php
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-FileCopyrightText: 2019 Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
@ -11,7 +16,7 @@ use Xentral\Modules\SubscriptionCycle\Exception\InvalidArgumentException;
|
||||
|
||||
final class SubscriptionCycleJobService
|
||||
{
|
||||
private $db;
|
||||
private Database $db;
|
||||
|
||||
/**
|
||||
* SubscriptionCycleJobService constructor.
|
||||
@ -57,29 +62,27 @@ final class SubscriptionCycleJobService
|
||||
* @param string $documentType
|
||||
* @param string|null $jobType
|
||||
* @param int|null $printerId
|
||||
* @param DateTimeInterface|null $simulatedDay
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function create(int $addressId, string $documentType, ?string $jobType, ?int $printerId, ?DateTimeInterface $simulatedDay = null): int
|
||||
public function create(int $addressId, string $documentType, ?string $jobType = null, ?int $printerId = null): int
|
||||
{
|
||||
$this->ensureDocumentType($documentType);
|
||||
$this->db->perform(
|
||||
'INSERT INTO `subscription_cycle_job`
|
||||
(`address_id`, `document_type`, `job_type`, `printer_id`, `created_at`, `simulated_day`)
|
||||
VALUES (:address_id, :document_type, :job_type, :printer_id, NOW(), :simulated_day)',
|
||||
(`address_id`, `document_type`, `job_type`, `printer_id`, `created_at`)
|
||||
VALUES (:address_id, :document_type, :job_type, :printer_id, NOW())',
|
||||
[
|
||||
'address_id' => $addressId,
|
||||
'document_type' => $documentType,
|
||||
'job_type' => $jobType,
|
||||
'printer_id' => $printerId,
|
||||
'simulated_day' => $simulatedDay === null ? null : $simulatedDay->format('Y-m-d'),
|
||||
]
|
||||
);
|
||||
|
||||
return (int)$this->db->lastInsertId();
|
||||
return $this->db->lastInsertId();
|
||||
}
|
||||
|
||||
/**
|
||||
|
115
classes/Modules/SubscriptionCycle/SubscriptionModule.php
Normal file
115
classes/Modules/SubscriptionCycle/SubscriptionModule.php
Normal file
@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
namespace Xentral\Modules\SubscriptionCycle;
|
||||
|
||||
use ApplicationCore;
|
||||
use DateTimeImmutable;
|
||||
use DateTimeInterface;
|
||||
use Xentral\Components\Database\Database;
|
||||
|
||||
class SubscriptionModule implements SubscriptionModuleInterface
|
||||
{
|
||||
private ApplicationCore $app;
|
||||
private Database $db;
|
||||
|
||||
public function __construct(ApplicationCore $app, Database $db)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
public function GetPositions(int $address, string $documentType, DateTimeInterface $calculationDate = null): array
|
||||
{
|
||||
if ($calculationDate === null)
|
||||
$calculationDate = new DateTimeImmutable('today');
|
||||
|
||||
$sql = "SELECT
|
||||
aa.id,
|
||||
@start := GREATEST(aa.startdatum, aa.abgerechnetbis) as start,
|
||||
@end := IF(aa.enddatum = '0000-00-00' OR aa.enddatum > :calcdate, :calcdate, aa.enddatum) as end,
|
||||
@cycles := CASE
|
||||
WHEN aa.preisart = 'monat' THEN
|
||||
TIMESTAMPDIFF(MONTH, @start, @end)
|
||||
WHEN aa.preisart = 'jahr' THEN
|
||||
TIMESTAMPDIFF(YEAR, @start, @end)
|
||||
WHEN aa.preisart = '30tage' THEN
|
||||
FLOOR(TIMESTAMPDIFF(DAY, @start, @end) / 30)
|
||||
END+1 as cycles,
|
||||
CASE
|
||||
WHEN aa.preisart = 'monat' THEN
|
||||
DATE_ADD(@start, INTERVAL @cycles MONTH)
|
||||
WHEN aa.preisart = 'jahr' THEN
|
||||
DATE_ADD(@start, INTERVAL @cycles YEAR)
|
||||
WHEN aa.preisart = '30tage' THEN
|
||||
DATE_ADD(@start, INTERVAL @cycles*30 DAY )
|
||||
END as newend,
|
||||
aa.preisart,
|
||||
aa.adresse,
|
||||
aa.preis,
|
||||
aa.rabatt,
|
||||
aa.bezeichnung,
|
||||
aa.beschreibung,
|
||||
aa.artikel,
|
||||
aa.menge,
|
||||
aa.waehrung
|
||||
FROM abrechnungsartikel aa
|
||||
JOIN artikel a on aa.artikel = a.id
|
||||
WHERE aa.dokument = :doctype
|
||||
AND greatest(aa.startdatum, aa.abgerechnetbis) <= :calcdate
|
||||
AND (aa.enddatum = '0000-00-00' OR aa.abgerechnetbis < aa.enddatum)
|
||||
AND aa.adresse = :address";
|
||||
|
||||
return $this->db->fetchAll($sql, [
|
||||
'doctype' => $documentType,
|
||||
'calcdate' => $calculationDate->format('Y-m-d'),
|
||||
'address' => $address]);
|
||||
}
|
||||
|
||||
public function CreateInvoice(int $address, DateTimeInterface $calculationDate = null) {
|
||||
$positions = $this->GetPositions($address, 'rechnung', $calculationDate);
|
||||
if(empty($positions))
|
||||
return;
|
||||
|
||||
$invoice = $this->app->erp->CreateRechnung($address);
|
||||
$this->app->erp->LoadRechnungStandardwerte($invoice, $address);
|
||||
foreach ($positions as $pos) {
|
||||
$beschreibung = $pos['beschreibung'];
|
||||
|
||||
$starts = DateTimeImmutable::createFromFormat('Y-m-d', $pos['start'])->format('d.m.Y');
|
||||
$newends = DateTimeImmutable::createFromFormat('Y-m-d', $pos['newend'])->format('d.m.Y');
|
||||
$beschreibung .= "<br>Zeitraum: $starts - $newends";
|
||||
|
||||
$this->app->erp->AddRechnungPositionManuell($invoice, $pos['artikel'], $pos['preis'],
|
||||
$pos['menge']*$pos['cycles'], $pos['bezeichnung'], $beschreibung, $pos['waehrung'], $pos['rabatt']);
|
||||
$this->db->exec("UPDATE abrechnungsartikel SET abgerechnetbis='{$pos['newend']}' WHERE id={$pos['id']}");
|
||||
}
|
||||
$this->app->erp->RechnungNeuberechnen($invoice);
|
||||
//$this->app->erp->BelegFreigabe('rechnung', $invoice);
|
||||
}
|
||||
|
||||
public function CreateOrder(int $address, DateTimeInterface $calculationDate = null) {
|
||||
$positions = $this->GetPositions($address, 'auftrag', $calculationDate);
|
||||
if(empty($positions))
|
||||
return;
|
||||
|
||||
$orderid = $this->app->erp->CreateAuftrag($address);
|
||||
$this->app->erp->LoadAuftragStandardwerte($orderid, $address);
|
||||
foreach ($positions as $pos) {
|
||||
$beschreibung = $pos['beschreibung'];
|
||||
|
||||
$starts = DateTimeImmutable::createFromFormat('Y-m-d', $pos['start'])->format('d.m.Y');
|
||||
$newends = DateTimeImmutable::createFromFormat('Y-m-d', $pos['newend'])->format('d.m.Y');
|
||||
$beschreibung .= "<br>Zeitraum: $starts - $newends";
|
||||
|
||||
$this->app->erp->AddAuftragPositionManuell($orderid, $pos['artikel'], $pos['preis'],
|
||||
$pos['menge']*$pos['cycles'], $pos['bezeichnung'], $beschreibung, $pos['waehrung'], $pos['rabatt']);
|
||||
$this->db->exec("UPDATE abrechnungsartikel SET abgerechnetbis='{$pos['newend']}' WHERE id={$pos['id']}");
|
||||
}
|
||||
$this->app->erp->AuftragNeuberechnen($orderid);
|
||||
//$this->app->erp->BelegFreigabe('auftrag', $orderid);
|
||||
}
|
||||
}
|
@ -1,6 +1,8 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
namespace Xentral\Modules\SubscriptionCycle;
|
||||
|
||||
@ -8,36 +10,7 @@ use DateTimeInterface;
|
||||
|
||||
interface SubscriptionModuleInterface
|
||||
{
|
||||
/**
|
||||
* @param int $customer
|
||||
* @param string $documentType
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function RechnungKunde($customer, $documentType);
|
||||
|
||||
/**
|
||||
* @param $customer
|
||||
* @param $invoiceGroupKey
|
||||
* @param $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function AuftragImportAbo($customer, $invoiceGroupKey, $key);
|
||||
|
||||
/**
|
||||
* @param $customer
|
||||
* @param $invoiceGroupKey
|
||||
* @param $key
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function RechnungImportAbo($customer, $invoiceGroupKey, $key);
|
||||
|
||||
/**
|
||||
* @param string $documentType
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function GetRechnungsArray($documentType);
|
||||
public function CreateInvoice(int $address, DateTimeInterface $calculationDate = null);
|
||||
public function CreateOrder(int $address, DateTimeInterface $calculationDate = null);
|
||||
public function GetPositions(int $address, string $documentType, DateTimeInterface $calculationDate = null): array;
|
||||
}
|
||||
|
@ -1,4 +1,11 @@
|
||||
<?php
|
||||
<?php
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
@ -10,8 +17,8 @@
|
||||
* to obtain the text of the corresponding license version.
|
||||
*
|
||||
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*/
|
||||
?>
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
/****************************************************************************
|
||||
@ -163,28 +170,17 @@ class TemplateParser {
|
||||
|
||||
public function addMessage($class, $text, $html = false, $_var = 'MESSAGE')
|
||||
{
|
||||
$ret = '';
|
||||
switch($class)
|
||||
{
|
||||
case 'error':
|
||||
case 'warning':
|
||||
case 'info':
|
||||
|
||||
break;
|
||||
default:
|
||||
$class = 'info';
|
||||
break;
|
||||
}
|
||||
if(!in_array($class, ['error', 'warning', 'info', 'success']))
|
||||
$class = 'info';
|
||||
if(!$html)
|
||||
{
|
||||
$text = $this->htmlspecialchars($text);
|
||||
}
|
||||
$ret .= '<div class="'.$class.'">'.$text.'</div>';
|
||||
$ret = sprintf('<div class="%s">%s</div>', $class, $text);
|
||||
if($_var === 'return')
|
||||
{
|
||||
return $ret;
|
||||
}
|
||||
return $this->app->Tpl->Add($_var, $ret);
|
||||
|
||||
$this->app->Tpl->Add($_var, $ret);
|
||||
}
|
||||
|
||||
public function addSelect($_var, $id, $name, $options, $selected = '', $class = '')
|
||||
|
@ -98692,6 +98692,92 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "subscription_cycle_job",
|
||||
"type": "BASE TABLE",
|
||||
"columns": [
|
||||
{
|
||||
"Field": "id",
|
||||
"Type": "int(11)",
|
||||
"Collation": null,
|
||||
"Null": "NO",
|
||||
"Key": "PRI",
|
||||
"Default": "",
|
||||
"Extra": "auto_increment",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Commant": ""
|
||||
},
|
||||
{
|
||||
"Field": "address_id",
|
||||
"Type": "int(11)",
|
||||
"Collation": null,
|
||||
"Null": "NO",
|
||||
"Key": "MUL",
|
||||
"Default": "",
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Commant": ""
|
||||
},
|
||||
{
|
||||
"Field": "document_type",
|
||||
"Type": "varchar(32)",
|
||||
"Collation": "utf8mb3_general_ci",
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": "",
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Commant": ""
|
||||
},
|
||||
{
|
||||
"Field": "job_type",
|
||||
"Type": "varchar(32)",
|
||||
"Collation": "utf8mb3_general_ci",
|
||||
"Null": "YES",
|
||||
"Key": "",
|
||||
"Default": "",
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Commant": ""
|
||||
},
|
||||
{
|
||||
"Field": "printer_id",
|
||||
"Type": "int(11)",
|
||||
"Collation": "",
|
||||
"Null": "YES",
|
||||
"Key": "",
|
||||
"Default": "",
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Commant": ""
|
||||
},
|
||||
{
|
||||
"Field": "created_at",
|
||||
"Type": "timestamp",
|
||||
"Collation": "",
|
||||
"Null": "NO",
|
||||
"Key": "",
|
||||
"Default": "current_timestamp()",
|
||||
"Extra": "",
|
||||
"Privileges": "select,insert,update,references",
|
||||
"Commant": ""
|
||||
}
|
||||
],
|
||||
"keys": [
|
||||
{
|
||||
"Key_name": "PRIMARY",
|
||||
"columns": [
|
||||
"id"
|
||||
]
|
||||
},
|
||||
{
|
||||
"Key_name": "address",
|
||||
"columns": [
|
||||
"address_id"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "supersearch_index_group",
|
||||
"type": "BASE TABLE",
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
$version="OSS";
|
||||
$version_revision="1.7";
|
||||
$version_revision="1.8";
|
||||
$githash = file_get_contents("../githash.txt");
|
||||
if (!empty($githash)) {
|
||||
$version_revision .= " (".substr($githash,0,8).")";
|
||||
|
@ -1,4 +1,11 @@
|
||||
<?php
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
@ -7088,7 +7095,7 @@ title: 'Abschicken',
|
||||
$navarray['menu']['admin'][$menu]['sec'][] = array('Arbeitsnachweis','arbeitsnachweis','list');
|
||||
$navarray['menu']['admin'][$menu]['sec'][] = array('Gutschrift / '.$this->Firmendaten("bezeichnungstornorechnung"),'gutschrift','list');
|
||||
$navarray['menu']['admin'][$menu]['sec'][] = array('Proformarechnung','proformarechnung','list');
|
||||
$navarray['menu']['admin'][$menu]['sec'][] = array('Abolauf','rechnungslauf','rechnungslauf');
|
||||
$navarray['menu']['admin'][$menu]['sec'][] = array('Abolauf','rechnungslauf','list');
|
||||
$navarray['menu']['admin'][$menu]['sec'][] = array('Mahnwesen','mahnwesen','list');
|
||||
|
||||
$navarray['menu']['admin'][$menu]['sec'][] = array('Dokumenten Scanner','docscan','list');
|
||||
@ -15205,33 +15212,11 @@ if($id > 0)
|
||||
}
|
||||
|
||||
//@refactor ApplicationCore
|
||||
function LoadVersandModul($modul, $id)
|
||||
function LoadVersandModul(string $modul, int $id): Versanddienstleister
|
||||
{
|
||||
if(empty($modul) ||
|
||||
strpos($modul,'..') !== false ||
|
||||
!@is_file(__DIR__.'/versandarten/'.$modul.'.php')
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
$class_name = 'Versandart_'.$modul;
|
||||
$class_name_custom = 'Versandart_'.$modul.'Custom';
|
||||
if(!class_exists($class_name))
|
||||
{
|
||||
if(@is_file(__DIR__.'/versandarten/'.$modul.'_custom.php'))
|
||||
{
|
||||
include_once(__DIR__.'/versandarten/'.$modul.'_custom.php');
|
||||
}else{
|
||||
include_once(__DIR__.'/versandarten/'.$modul.'.php');
|
||||
}
|
||||
}
|
||||
if(class_exists($class_name_custom))
|
||||
{
|
||||
return new $class_name_custom($this->app, $id);
|
||||
}elseif(class_exists($class_name))
|
||||
{
|
||||
return new $class_name($this->app, $id);
|
||||
}
|
||||
/** @var Versandarten $versandarten */
|
||||
$versandarten = $this->app->loadModule('versandarten');
|
||||
return $versandarten->loadModule($modul, $id);
|
||||
}
|
||||
|
||||
//@refactor versanddiestleister Modul
|
||||
@ -15304,131 +15289,131 @@ function Paketmarke($parsetarget,$sid="",$zusatz="",$typ="DHL")
|
||||
}
|
||||
}
|
||||
|
||||
if($sid=="versand")
|
||||
{
|
||||
// falche tracingnummer bei DHL da wir in der Funktion PaketmarkeDHLEmbedded sind
|
||||
if((strlen($tracking) < 12 || strlen($tracking) > 21) && $trackingsubmitcancel=="" && ($typ=="DHL" || $typ=="Intraship"))
|
||||
if($sid=="versand")
|
||||
{
|
||||
header("Location: index.php?module=versanderzeugen&action=frankieren&id=$id&land=$land&tracking_again=1");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* $versandartenmodul = $this->app->DB->SelectArr("SELECT id, modul,bezeichnung FROM versandarten WHERE aktiv = 1 AND ausprojekt = 0 AND type = '".$this->app->DB->real_escape_string($typ)."' AND modul != '' AND (projekt = 0 OR projekt = '$projekt') ORDER BY projekt DESC LIMIT 1");
|
||||
if($versandartenmodul && @is_file(dirname(__FILE__).'/versandarten/'.$versandartenmodul[0]['modul'].'.php'))
|
||||
// falche tracingnummer bei DHL da wir in der Funktion PaketmarkeDHLEmbedded sind
|
||||
if((strlen($tracking) < 12 || strlen($tracking) > 21) && $trackingsubmitcancel=="" && ($typ=="DHL" || $typ=="Intraship"))
|
||||
{
|
||||
$obj = $this->LoadVersandModul($versandartenmodul[0]['modul'], $versandartenmodul[0]['id']);
|
||||
if(!empty($obj) && method_exists($obj, 'TrackingReplace'))
|
||||
{
|
||||
$tracking = $obj->TrackingReplace($tracking);
|
||||
}
|
||||
header("Location: index.php?module=versanderzeugen&action=frankieren&id=$id&land=$land&tracking_again=1");
|
||||
exit;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* $versandartenmodul = $this->app->DB->SelectArr("SELECT id, modul,bezeichnung FROM versandarten WHERE aktiv = 1 AND ausprojekt = 0 AND type = '".$this->app->DB->real_escape_string($typ)."' AND modul != '' AND (projekt = 0 OR projekt = '$projekt') ORDER BY projekt DESC LIMIT 1");
|
||||
if($versandartenmodul && @is_file(dirname(__FILE__).'/versandarten/'.$versandartenmodul[0]['modul'].'.php'))
|
||||
{
|
||||
$obj = $this->LoadVersandModul($versandartenmodul[0]['modul'], $versandartenmodul[0]['id']);
|
||||
if(!empty($obj) && method_exists($obj, 'TrackingReplace'))
|
||||
{
|
||||
$tracking = $obj->TrackingReplace($tracking);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
$trackingUser = !empty($this->app->User) && method_exists($this->app->User,'GetParameter')?
|
||||
$this->app->User->GetParameter('versand_lasttracking'):'';
|
||||
$trackingUser = !empty($this->app->User) && method_exists($this->app->User,'GetParameter')?
|
||||
$this->app->User->GetParameter('versand_lasttracking'):'';
|
||||
|
||||
if(!empty($trackingUser) && in_array($trackingUser,[$trackingBefore,$tracking])) {
|
||||
$this->app->User->SetParameter('versand_lasttracking','');
|
||||
$this->app->User->SetParameter('versand_lasttracking_link','');
|
||||
$this->app->User->SetParameter('versand_lasttracking_versand', '');
|
||||
$this->app->User->SetParameter('versand_lasttracking_lieferschein', '');
|
||||
}
|
||||
if(!empty($trackingUser) && in_array($trackingUser,[$trackingBefore,$tracking])) {
|
||||
$this->app->User->SetParameter('versand_lasttracking','');
|
||||
$this->app->User->SetParameter('versand_lasttracking_link','');
|
||||
$this->app->User->SetParameter('versand_lasttracking_versand', '');
|
||||
$this->app->User->SetParameter('versand_lasttracking_lieferschein', '');
|
||||
}
|
||||
|
||||
$this->app->DB->Update("UPDATE versand SET versandunternehmen='$versand', tracking='$tracking',
|
||||
versendet_am=NOW(),versendet_am_zeitstempel=NOW(), abgeschlossen='1',logdatei=NOW() WHERE id='$id' LIMIT 1");
|
||||
if($lieferschein = $this->app->DB->Select("SELECT lieferschein FROM versand WHERE id = '$id' LIMIT 1")) {
|
||||
$this->app->erp->LieferscheinProtokoll($lieferschein,'Verarbeitung im Versandzentrum');
|
||||
}
|
||||
$rechnung = $this->app->DB->Select("SELECT rechnung FROM versand WHERE id = '$id' LIMIT 1");
|
||||
if($lieferschein && ($auftrag = $this->app->DB->Select("SELECT auftragid FROM lieferschein WHERE id = '$lieferschein'"))) {
|
||||
$this->app->erp->AuftragProtokoll($auftrag,'Verarbeitung im Versandzentrum');
|
||||
$this->app->DB->Update("UPDATE versand SET versandunternehmen='$versand', tracking='$tracking',
|
||||
versendet_am=NOW(),versendet_am_zeitstempel=NOW(), abgeschlossen='1',logdatei=NOW() WHERE id='$id' LIMIT 1");
|
||||
if($lieferschein = $this->app->DB->Select("SELECT lieferschein FROM versand WHERE id = '$id' LIMIT 1")) {
|
||||
$this->app->erp->LieferscheinProtokoll($lieferschein,'Verarbeitung im Versandzentrum');
|
||||
}
|
||||
$rechnung = $this->app->DB->Select("SELECT rechnung FROM versand WHERE id = '$id' LIMIT 1");
|
||||
if($lieferschein && ($auftrag = $this->app->DB->Select("SELECT auftragid FROM lieferschein WHERE id = '$lieferschein'"))) {
|
||||
$this->app->erp->AuftragProtokoll($auftrag,'Verarbeitung im Versandzentrum');
|
||||
|
||||
if(empty($rechnung)) {
|
||||
$rechnung = $this->app->DB->Select(
|
||||
sprintf(
|
||||
"SELECT id FROM rechnung WHERE auftragid = %d AND status <> 'storniert' AND belegnr <> '' LIMIT 1",
|
||||
$auftrag
|
||||
)
|
||||
);
|
||||
if($rechnung) {
|
||||
$this->app->DB->Update(
|
||||
if(empty($rechnung)) {
|
||||
$rechnung = $this->app->DB->Select(
|
||||
sprintf(
|
||||
'UPDATE versand SET rechnung = %d WHERE id = %d AND rechnung = 0',
|
||||
$rechnung, $id
|
||||
"SELECT id FROM rechnung WHERE auftragid = %d AND status <> 'storniert' AND belegnr <> '' LIMIT 1",
|
||||
$auftrag
|
||||
)
|
||||
);
|
||||
if($rechnung) {
|
||||
$this->app->DB->Update(
|
||||
sprintf(
|
||||
'UPDATE versand SET rechnung = %d WHERE id = %d AND rechnung = 0',
|
||||
$rechnung, $id
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$projekt = $this->app->DB->Select("SELECT projekt FROM lieferschein WHERE id = '$lieferschein' LIMIT 1");
|
||||
if($lieferschein) {
|
||||
$projekt = $this->app->DB->Select("SELECT projekt FROM lieferschein WHERE id = '$lieferschein' LIMIT 1");
|
||||
if($lieferschein) {
|
||||
|
||||
$this->PDFArchivieren('lieferschein', $lieferschein, true);
|
||||
}
|
||||
$proformaPrinted = false;
|
||||
$druckennachtracking = $this->app->erp->Projektdaten($projekt,'druckennachtracking');
|
||||
if($druckennachtracking
|
||||
&& !($proformarechnung = $this->app->DB->Select(
|
||||
sprintf(
|
||||
'SELECT id FROM proformarechnung WHERE lieferschein = %d LIMIT 1',
|
||||
$lieferschein
|
||||
$this->PDFArchivieren('lieferschein', $lieferschein, true);
|
||||
}
|
||||
$proformaPrinted = false;
|
||||
$druckennachtracking = $this->app->erp->Projektdaten($projekt,'druckennachtracking');
|
||||
if($druckennachtracking
|
||||
&& !($proformarechnung = $this->app->DB->Select(
|
||||
sprintf(
|
||||
'SELECT id FROM proformarechnung WHERE lieferschein = %d LIMIT 1',
|
||||
$lieferschein
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
) {
|
||||
/** @var Versanderzeugen $versandObj */
|
||||
$versandObj = $this->LoadModul('versanderzeugen');
|
||||
if($versandObj !== null && method_exists($versandObj, 'checkPrintCreateProformaInvoice')) {
|
||||
$druckercode = $this->app->DB->Select("SELECT druckerlogistikstufe2 FROM projekt WHERE id='$projekt' LIMIT 1");
|
||||
)
|
||||
) {
|
||||
/** @var Versanderzeugen $versandObj */
|
||||
$versandObj = $this->LoadModul('versanderzeugen');
|
||||
if($versandObj !== null && method_exists($versandObj, 'checkPrintCreateProformaInvoice')) {
|
||||
$druckercode = $this->app->DB->Select("SELECT druckerlogistikstufe2 FROM projekt WHERE id='$projekt' LIMIT 1");
|
||||
|
||||
if($druckercode <=0) {
|
||||
$druckercode = $this->app->erp->Firmendaten('standardversanddrucker'); // standard = 3 // 2 buchhaltung // 1 empfang
|
||||
if($druckercode <=0) {
|
||||
$druckercode = $this->app->erp->Firmendaten('standardversanddrucker'); // standard = 3 // 2 buchhaltung // 1 empfang
|
||||
}
|
||||
$userversanddrucker = $this->app->DB->Select("SELECT standardversanddrucker FROM user WHERE id='".$this->app->User->GetID()."'");
|
||||
if($userversanddrucker>0) {
|
||||
$druckercode = $userversanddrucker;
|
||||
}
|
||||
$deliveryArr = $this->app->DB->SelectRow(
|
||||
sprintf('SELECT land FROM lieferschein WHERE id = %d', $lieferschein)
|
||||
);
|
||||
$country = $deliveryArr['land'];
|
||||
$versandObj->checkPrintCreateProformaInvoice($lieferschein,$country,$projekt,$druckercode,true);
|
||||
$proformaPrinted = $druckercode > 0;
|
||||
}
|
||||
$userversanddrucker = $this->app->DB->Select("SELECT standardversanddrucker FROM user WHERE id='".$this->app->User->GetID()."'");
|
||||
if($userversanddrucker>0) {
|
||||
$druckercode = $userversanddrucker;
|
||||
}
|
||||
$deliveryArr = $this->app->DB->SelectRow(
|
||||
sprintf('SELECT land FROM lieferschein WHERE id = %d', $lieferschein)
|
||||
}
|
||||
if($rechnung) {
|
||||
$this->PDFArchivieren('rechnung', $rechnung, true);
|
||||
}
|
||||
elseif($auftrag && $druckennachtracking
|
||||
&& $this->app->DB->Select(
|
||||
sprintf(
|
||||
"SELECT id FROM auftrag WHERE id = %d AND art <> 'lieferung'",
|
||||
$auftrag
|
||||
)
|
||||
)
|
||||
) {
|
||||
$rechnung = $this->WeiterfuehrenAuftragZuRechnung($auftrag);
|
||||
$this->BelegFreigabe('rechnung', $rechnung);
|
||||
$this->app->DB->Update(
|
||||
sprintf(
|
||||
'UPDATE versand SET rechnung = %d WHERE id = %d LIMIT 1',
|
||||
$rechnung, $id
|
||||
)
|
||||
);
|
||||
$country = $deliveryArr['land'];
|
||||
$versandObj->checkPrintCreateProformaInvoice($lieferschein,$country,$projekt,$druckercode,true);
|
||||
$proformaPrinted = $druckercode > 0;
|
||||
$this->app->DB->Update(
|
||||
sprintf(
|
||||
"UPDATE rechnung SET schreibschutz = 1, status = 'versendet' WHERE id = %d",
|
||||
$rechnung
|
||||
)
|
||||
);
|
||||
$this->PDFArchivieren('rechnung', $rechnung, true);
|
||||
}
|
||||
}
|
||||
if($rechnung) {
|
||||
$this->PDFArchivieren('rechnung', $rechnung, true);
|
||||
}
|
||||
elseif($auftrag && $druckennachtracking
|
||||
&& $this->app->DB->Select(
|
||||
sprintf(
|
||||
"SELECT id FROM auftrag WHERE id = %d AND art <> 'lieferung'",
|
||||
$auftrag
|
||||
)
|
||||
)
|
||||
) {
|
||||
$rechnung = $this->WeiterfuehrenAuftragZuRechnung($auftrag);
|
||||
$this->BelegFreigabe('rechnung', $rechnung);
|
||||
$this->app->DB->Update(
|
||||
sprintf(
|
||||
'UPDATE versand SET rechnung = %d WHERE id = %d LIMIT 1',
|
||||
$rechnung, $id
|
||||
)
|
||||
);
|
||||
$this->app->DB->Update(
|
||||
sprintf(
|
||||
"UPDATE rechnung SET schreibschutz = 1, status = 'versendet' WHERE id = %d",
|
||||
$rechnung
|
||||
)
|
||||
);
|
||||
$this->PDFArchivieren('rechnung', $rechnung, true);
|
||||
}
|
||||
|
||||
if($rechnung > 0 && $druckennachtracking
|
||||
&& $this->app->DB->Select("SELECT count(id) FROM versand WHERE lieferschein = '$lieferschein'") <= 1) {
|
||||
$druckercode = $this->app->DB->Select("SELECT druckerlogistikstufe2 FROM projekt WHERE id='$projekt' LIMIT 1");
|
||||
if($rechnung > 0 && $druckennachtracking
|
||||
&& $this->app->DB->Select("SELECT count(id) FROM versand WHERE lieferschein = '$lieferschein'") <= 1) {
|
||||
$druckercode = $this->app->DB->Select("SELECT druckerlogistikstufe2 FROM projekt WHERE id='$projekt' LIMIT 1");
|
||||
|
||||
if($druckercode <=0)
|
||||
$druckercode = $this->app->erp->Firmendaten("standardversanddrucker"); // standard = 3 // 2 buchhaltung // 1 empfang
|
||||
@ -15437,32 +15422,12 @@ function Paketmarke($parsetarget,$sid="",$zusatz="",$typ="DHL")
|
||||
if($userversanddrucker>0)
|
||||
$druckercode = $userversanddrucker;
|
||||
|
||||
$this->app->erp->BriefpapierHintergrundDisable($druckercode);
|
||||
$this->app->erp->BriefpapierHintergrundDisable($druckercode);
|
||||
|
||||
$addressId = $this->app->DB->Select("SELECT `adresse` FROM `rechnung` WHERE `id` = '{$rechnung}' LIMIT 1");
|
||||
$printInvoice = $this->app->DB->Select("SELECT `rechnung_papier` FROM `adresse` WHERE `id` = '{$addressId}' LIMIT 1");
|
||||
$amountPrintedInvoices = $this->app->DB->Select("SELECT `rechnung_anzahlpapier` FROM `adresse` WHERE `id` = '{$addressId}' LIMIT 1");
|
||||
if($printInvoice === '1' && $amountPrintedInvoices > 0){
|
||||
if(class_exists('RechnungPDFCustom'))
|
||||
{
|
||||
$Brief = new RechnungPDFCustom($this->app,$projekt);
|
||||
}else{
|
||||
$Brief = new RechnungPDF($this->app,$projekt);
|
||||
}
|
||||
$Brief->GetRechnung($rechnung);
|
||||
$tmpfile = $Brief->displayTMP();
|
||||
|
||||
for($i = 1; $i <= $amountPrintedInvoices; $i++) {
|
||||
$this->app->printer->Drucken($druckercode,$tmpfile);
|
||||
}
|
||||
} else {
|
||||
$autodruckrechnungmenge = $this->app->erp->Projektdaten($projekt,"autodruckrechnungmenge");
|
||||
$autodruckrechnung= $this->app->erp->Projektdaten($projekt,"autodruckrechnung");
|
||||
|
||||
if($autodruckrechnungmenge < 0)$autodruckrechnungmenge = 1;
|
||||
|
||||
if($autodruckrechnung > 0)
|
||||
{
|
||||
$addressId = $this->app->DB->Select("SELECT `adresse` FROM `rechnung` WHERE `id` = '{$rechnung}' LIMIT 1");
|
||||
$printInvoice = $this->app->DB->Select("SELECT `rechnung_papier` FROM `adresse` WHERE `id` = '{$addressId}' LIMIT 1");
|
||||
$amountPrintedInvoices = $this->app->DB->Select("SELECT `rechnung_anzahlpapier` FROM `adresse` WHERE `id` = '{$addressId}' LIMIT 1");
|
||||
if($printInvoice === '1' && $amountPrintedInvoices > 0){
|
||||
if(class_exists('RechnungPDFCustom'))
|
||||
{
|
||||
$Brief = new RechnungPDFCustom($this->app,$projekt);
|
||||
@ -15472,88 +15437,108 @@ function Paketmarke($parsetarget,$sid="",$zusatz="",$typ="DHL")
|
||||
$Brief->GetRechnung($rechnung);
|
||||
$tmpfile = $Brief->displayTMP();
|
||||
|
||||
for($i = 1; $i <= $autodruckrechnungmenge; $i++) {
|
||||
for($i = 1; $i <= $amountPrintedInvoices; $i++) {
|
||||
$this->app->printer->Drucken($druckercode,$tmpfile);
|
||||
}
|
||||
} else {
|
||||
$autodruckrechnungmenge = $this->app->erp->Projektdaten($projekt,"autodruckrechnungmenge");
|
||||
$autodruckrechnung= $this->app->erp->Projektdaten($projekt,"autodruckrechnung");
|
||||
|
||||
if($autodruckrechnungmenge < 0)$autodruckrechnungmenge = 1;
|
||||
|
||||
if($autodruckrechnung > 0)
|
||||
{
|
||||
if(class_exists('RechnungPDFCustom'))
|
||||
{
|
||||
$Brief = new RechnungPDFCustom($this->app,$projekt);
|
||||
}else{
|
||||
$Brief = new RechnungPDF($this->app,$projekt);
|
||||
}
|
||||
$Brief->GetRechnung($rechnung);
|
||||
$tmpfile = $Brief->displayTMP();
|
||||
|
||||
for($i = 1; $i <= $autodruckrechnungmenge; $i++) {
|
||||
$this->app->printer->Drucken($druckercode,$tmpfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Print additional invoices for export
|
||||
$exportdruckrechnung = $this->app->erp->Projektdaten($projekt,"exportdruckrechnung");
|
||||
if($exportdruckrechnung)
|
||||
{
|
||||
$exportland = $this->app->DB->Select("SELECT land FROM rechnung WHERE id = '$rechnung' LIMIT 1");
|
||||
$exportdruckrechnung = $this->app->erp->Export($exportland);
|
||||
// Print additional invoices for export
|
||||
$exportdruckrechnung = $this->app->erp->Projektdaten($projekt,"exportdruckrechnung");
|
||||
if($exportdruckrechnung)
|
||||
{
|
||||
$mengedruck = $this->app->erp->Projektdaten($projekt,"exportdruckrechnungmenge");
|
||||
for($mengedruck;$mengedruck > 0;$mengedruck--)
|
||||
$exportland = $this->app->DB->Select("SELECT land FROM rechnung WHERE id = '$rechnung' LIMIT 1");
|
||||
$exportdruckrechnung = $this->app->erp->Export($exportland);
|
||||
if($exportdruckrechnung)
|
||||
{
|
||||
$this->app->printer->Drucken($druckercode,$tmpfile);
|
||||
$mengedruck = $this->app->erp->Projektdaten($projekt,"exportdruckrechnungmenge");
|
||||
for($mengedruck;$mengedruck > 0;$mengedruck--)
|
||||
{
|
||||
$this->app->printer->Drucken($druckercode,$tmpfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unlink($tmpfile);
|
||||
if($this->app->erp->Projektdaten($projekt,"automailrechnung")=="1")
|
||||
{
|
||||
// aber nur das erste mal also wenn es einen eintrag in der versand tabelle gibt
|
||||
$rechnungbereitsversendet = $this->app->DB->Select("SELECT versendet FROM rechnung WHERE id = '$rechnung' LIMIT 1");
|
||||
if($rechnungbereitsversendet!="1")
|
||||
unlink($tmpfile);
|
||||
if($this->app->erp->Projektdaten($projekt,"automailrechnung")=="1")
|
||||
{
|
||||
$this->app->erp->Rechnungsmail($rechnung);
|
||||
}
|
||||
}
|
||||
$this->BriefpapierHintergrundEnable();
|
||||
}
|
||||
|
||||
if($druckennachtracking && $lieferschein && $this->Export($land)
|
||||
&& $this->Projektdaten($projekt, 'proformainvoice_amount') && $proformaRechnungId = $this->app->DB->Select(
|
||||
sprintf(
|
||||
"SELECT id FROM proformarechnung WHERE lieferschein = %d AND status <> 'storniert' LIMIT 1",
|
||||
$lieferschein
|
||||
))
|
||||
) {
|
||||
/** @var Versanderzeugen $objProforma */
|
||||
$objVersand = $this->LoadModul('versanderzeugen');
|
||||
if($objVersand && method_exists($objVersand,'checkPrintCreateProformaInvoice')){
|
||||
if(empty($druckercode)) {
|
||||
$druckercode = $this->app->DB->Select("SELECT druckerlogistikstufe2 FROM projekt WHERE id='$projekt' LIMIT 1");
|
||||
|
||||
if($druckercode <= 0) {
|
||||
$druckercode = $this->app->erp->Firmendaten('standardversanddrucker'); // standard = 3 // 2 buchhaltung // 1 empfang
|
||||
}
|
||||
$userversanddrucker = $this->app->DB->Select("SELECT standardversanddrucker FROM user WHERE id='" . $this->app->User->GetID() . "'");
|
||||
if($userversanddrucker > 0) {
|
||||
$druckercode = $userversanddrucker;
|
||||
// aber nur das erste mal also wenn es einen eintrag in der versand tabelle gibt
|
||||
$rechnungbereitsversendet = $this->app->DB->Select("SELECT versendet FROM rechnung WHERE id = '$rechnung' LIMIT 1");
|
||||
if($rechnungbereitsversendet!="1")
|
||||
{
|
||||
$this->app->erp->Rechnungsmail($rechnung);
|
||||
}
|
||||
}
|
||||
$objVersand->checkPrintCreateProformaInvoice($lieferschein, $land, $projekt, $druckercode, empty($proformaPrinted));
|
||||
$this->BriefpapierHintergrundEnable();
|
||||
}
|
||||
}
|
||||
|
||||
if(!$this->app->erp->Firmendaten('versandmail_zwischenspeichern') || !$this->app->DB->Select("SELECT id FROM prozessstarter WHERE parameter = 'versandmailsundrueckmeldung' AND aktiv = 1"))
|
||||
{
|
||||
$this->VersandAbschluss($id);
|
||||
$this->RunHook('versanderzeugen_frankieren_hook1', 1, $id);
|
||||
//versand mail an kunden
|
||||
$this->Versandmail($id);
|
||||
}else{
|
||||
$this->app->DB->Update("UPDATE versand SET cronjob = 1 WHERE id = '$id' LIMIT 1");
|
||||
}
|
||||
$weiterespaket=$this->app->Secure->GetPOST("weiterespaket");
|
||||
$lieferscheinkopie=$this->app->Secure->GetPOST("lieferscheinkopie");
|
||||
if($weiterespaket=="1")
|
||||
{
|
||||
if($lieferscheinkopie=="1") $lieferscheinkopie=0; else $lieferscheinkopie=1;
|
||||
//$this->app->erp->LogFile("Lieferscheinkopie $lieferscheinkopie");
|
||||
$all = $this->app->DB->SelectArr("SELECT * FROM versand WHERE id='$id' LIMIT 1");
|
||||
$this->app->DB->Insert("INSERT INTO versand (id,adresse,rechnung,lieferschein,versandart,projekt,bearbeiter,versender,versandunternehmen,firma,
|
||||
keinetrackingmail,gelesen,paketmarkegedruckt,papieregedruckt,weitererlieferschein)
|
||||
VALUES ('','{$all[0]['adresse']}','{$all[0]['rechnung']}','{$all[0]['lieferschein']}','{$all[0]['versandart']}','{$all[0]['projekt']}',
|
||||
'{$all[0]['bearbeiter']}','{$all[0]['versender']}','{$all[0]['versandunternehmen']}',
|
||||
'{$all[0]['firma']}','{$all[0]['keinetrackingmail']}','{$all[0]['gelesen']}',0,$lieferscheinkopie,1)");
|
||||
if($druckennachtracking && $lieferschein && $this->Export($land)
|
||||
&& $this->Projektdaten($projekt, 'proformainvoice_amount') && $proformaRechnungId = $this->app->DB->Select(
|
||||
sprintf(
|
||||
"SELECT id FROM proformarechnung WHERE lieferschein = %d AND status <> 'storniert' LIMIT 1",
|
||||
$lieferschein
|
||||
))
|
||||
) {
|
||||
/** @var Versanderzeugen $objProforma */
|
||||
$objVersand = $this->LoadModul('versanderzeugen');
|
||||
if($objVersand && method_exists($objVersand,'checkPrintCreateProformaInvoice')){
|
||||
if(empty($druckercode)) {
|
||||
$druckercode = $this->app->DB->Select("SELECT druckerlogistikstufe2 FROM projekt WHERE id='$projekt' LIMIT 1");
|
||||
|
||||
if($druckercode <= 0) {
|
||||
$druckercode = $this->app->erp->Firmendaten('standardversanddrucker'); // standard = 3 // 2 buchhaltung // 1 empfang
|
||||
}
|
||||
$userversanddrucker = $this->app->DB->Select("SELECT standardversanddrucker FROM user WHERE id='" . $this->app->User->GetID() . "'");
|
||||
if($userversanddrucker > 0) {
|
||||
$druckercode = $userversanddrucker;
|
||||
}
|
||||
}
|
||||
$objVersand->checkPrintCreateProformaInvoice($lieferschein, $land, $projekt, $druckercode, empty($proformaPrinted));
|
||||
}
|
||||
}
|
||||
|
||||
if(!$this->app->erp->Firmendaten('versandmail_zwischenspeichern') || !$this->app->DB->Select("SELECT id FROM prozessstarter WHERE parameter = 'versandmailsundrueckmeldung' AND aktiv = 1"))
|
||||
{
|
||||
$this->VersandAbschluss($id);
|
||||
$this->RunHook('versanderzeugen_frankieren_hook1', 1, $id);
|
||||
//versand mail an kunden
|
||||
$this->Versandmail($id);
|
||||
}else{
|
||||
$this->app->DB->Update("UPDATE versand SET cronjob = 1 WHERE id = '$id' LIMIT 1");
|
||||
}
|
||||
$weiterespaket=$this->app->Secure->GetPOST("weiterespaket");
|
||||
$lieferscheinkopie=$this->app->Secure->GetPOST("lieferscheinkopie");
|
||||
if($weiterespaket=="1")
|
||||
{
|
||||
if($lieferscheinkopie=="1") $lieferscheinkopie=0; else $lieferscheinkopie=1;
|
||||
//$this->app->erp->LogFile("Lieferscheinkopie $lieferscheinkopie");
|
||||
$all = $this->app->DB->SelectArr("SELECT * FROM versand WHERE id='$id' LIMIT 1");
|
||||
$this->app->DB->Insert("INSERT INTO versand (id,adresse,rechnung,lieferschein,versandart,projekt,bearbeiter,versender,versandunternehmen,firma,
|
||||
keinetrackingmail,gelesen,paketmarkegedruckt,papieregedruckt,weitererlieferschein)
|
||||
VALUES ('','{$all[0]['adresse']}','{$all[0]['rechnung']}','{$all[0]['lieferschein']}','{$all[0]['versandart']}','{$all[0]['projekt']}',
|
||||
'{$all[0]['bearbeiter']}','{$all[0]['versender']}','{$all[0]['versandunternehmen']}',
|
||||
'{$all[0]['firma']}','{$all[0]['keinetrackingmail']}','{$all[0]['gelesen']}',0,$lieferscheinkopie,1)");
|
||||
|
||||
$newid = $this->app->DB->GetInsertID();
|
||||
|
||||
@ -15591,7 +15576,7 @@ function Paketmarke($parsetarget,$sid="",$zusatz="",$typ="DHL")
|
||||
$this->app->DB->Insert("INSERT INTO versand (id,versandunternehmen, tracking,
|
||||
versendet_am,abgeschlossen,retoure,
|
||||
freigegeben,firma,adresse,projekt,gewicht,paketmarkegedruckt,anzahlpakete)
|
||||
VALUES ('','$versand','$tracking',NOW(),1,'$id',1,'".$this->app->User->GetFirma()."','$adresse','$projekt','$kg','1','1') ");
|
||||
VALUES ('','$versand','$tracking',NOW(),1,'$id',1,'".$this->app->User->GetFirma()."','$adresse','$projekt','$kg','1','1') ");
|
||||
|
||||
$versandid = $this->app->DB->GetInsertID();
|
||||
if($this->app->DB->Select("SELECT automailversandbestaetigung FROM projekt WHERE id = '$projekt' LIMIT 1"))$this->Versandmail($versandid);
|
||||
@ -15620,23 +15605,6 @@ function Paketmarke($parsetarget,$sid="",$zusatz="",$typ="DHL")
|
||||
if($kg=="") {
|
||||
$kg = $this->VersandartMindestgewicht($id);
|
||||
}
|
||||
/*
|
||||
//Brauchen wir nicht
|
||||
$versandartenmodul = $this->app->DB->SelectArr("SELECT id, modul,bezeichnung FROM versandarten WHERE aktiv = 1 AND ausprojekt = 0 AND type = '".$this->app->DB->real_escape_string($versand)."' AND modul != '' AND (projekt = 0 OR projekt = '$projekt') ORDER BY projekt DESC LIMIT 1");
|
||||
if($versandartenmodul && @is_file(dirname(__FILE__).'/versandarten/'.$versandartenmodul[0]['modul'].'.php'))
|
||||
{
|
||||
$class_name = 'Versandart_'.$versandartenmodul[0]['modul'];
|
||||
if(!class_exists($class_name))include_once(dirname(__FILE__).'/versandarten/'.$versandartenmodul[0]['modul'].'.php');
|
||||
if(class_exists($class_name))
|
||||
{
|
||||
$obj = new $class_name($this->app, $versandartenmodul[0]['id']);
|
||||
if(method_exists($obj, 'TrackingReplace')){
|
||||
$tracking = $obj->TrackingReplace($tracking);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
$trackingUser = !empty($this->app->User) && method_exists($this->app->User,'GetParameter')?
|
||||
$this->app->User->GetParameter('versand_lasttracking'):'';
|
||||
|
||||
@ -15647,9 +15615,9 @@ function Paketmarke($parsetarget,$sid="",$zusatz="",$typ="DHL")
|
||||
$this->app->User->SetParameter('versand_lasttracking_lieferschein', '');
|
||||
}
|
||||
|
||||
$this->app->DB->Insert("INSERT INTO versand (id,versandunternehmen, tracking, tracking_link,
|
||||
versendet_am,abgeschlossen,lieferschein,
|
||||
freigegeben,firma,adresse,projekt,gewicht,paketmarkegedruckt,anzahlpakete)
|
||||
$this->app->DB->Insert("INSERT INTO versand (id,versandunternehmen, tracking, tracking_link,
|
||||
versendet_am,abgeschlossen,lieferschein,
|
||||
freigegeben,firma,adresse,projekt,gewicht,paketmarkegedruckt,anzahlpakete)
|
||||
VALUES ('','$versand','$tracking', '{$trackingLink}',NOW(),1,'$id',1,'".$this->app->User->GetFirma()."','$adresse','$projekt','$kg','1','1') ");
|
||||
|
||||
$versandid = $this->app->DB->GetInsertID();
|
||||
@ -15670,8 +15638,7 @@ function Paketmarke($parsetarget,$sid="",$zusatz="",$typ="DHL")
|
||||
'SELECT zahlweise FROM rechnung WHERE id = %d', $rechnung
|
||||
)
|
||||
);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
$rechnung_projekt = $this->app->DB->Select(
|
||||
sprintf(
|
||||
'SELECT projekt FROM auftrag WHERE id = %d', $auftrag
|
||||
@ -15806,176 +15773,17 @@ function Paketmarke($parsetarget,$sid="",$zusatz="",$typ="DHL")
|
||||
|
||||
if($kg=="") $kg=$this->VersandartMindestgewicht($lieferschein);
|
||||
|
||||
//$versandartenmodul = $this->app->DB->SelectArr("SELECT id, modul FROM versanddienstleister WHERE aktiv = 1 AND modul = '".$this->app->DB->real_escape_string($typ)."' AND (projekt = 0 OR projekt = '$projekt') ORDER BY projekt DESC LIMIT 1");
|
||||
$versandartenmodul = $this->app->DB->SelectArr("SELECT id, modul,bezeichnung, einstellungen_json FROM versandarten WHERE aktiv = 1 AND ausprojekt = 0 AND type = '".$this->app->DB->real_escape_string($typ)."' AND modul != '' AND (projekt = 0 OR projekt = '$projekt') ORDER BY projekt DESC LIMIT 1");
|
||||
if($versandartenmodul && @is_file(dirname(__FILE__).'/versandarten/'.$versandartenmodul[0]['modul'].'.php'))
|
||||
{
|
||||
$obj = $this->LoadVersandModul($versandartenmodul[0]['modul'], $versandartenmodul[0]['id']);
|
||||
$this->app->Tpl->Set("ZUSATZ",$versandartenmodul[0]['bezeichnung']);
|
||||
|
||||
if(!empty($obj) && method_exists($obj, 'Paketmarke'))
|
||||
$versandartenmodul = $this->app->DB->SelectArr("SELECT id, modul,bezeichnung, einstellungen_json FROM versandarten WHERE aktiv = 1 AND ausprojekt = 0 AND type = '".$this->app->DB->real_escape_string($typ)."' AND modul != '' AND (projekt = 0 OR projekt = '$projekt') ORDER BY projekt DESC LIMIT 1");
|
||||
if($versandartenmodul && @is_file(dirname(__FILE__).'/versandarten/'.$versandartenmodul[0]['modul'].'.php'))
|
||||
{
|
||||
$error = $obj->Paketmarke($sid!=''?$sid:'lieferschein',$id);
|
||||
}else $error[] = 'Versandmodul '.$typ.' fehlerhaft!';
|
||||
}else{
|
||||
switch($typ)
|
||||
{
|
||||
case "DHL":
|
||||
if($nachnahme=="" && $versichert=="" && $extraversichert=="")
|
||||
{
|
||||
$this->EasylogPaketmarkeStandard($id,$name,$name2,$name3,$strasse,$hausnummer,$plz,$ort,$land,$kg);
|
||||
} else if ($nachnahme=="1" && $versichert=="" && $extraversichert=="")
|
||||
{
|
||||
$this->EasylogPaketmarkeNachnahme($id,$name,$name2,$name3,$strasse,$hausnummer,$plz,$ort,$land,$kg,$betrag,$rechnungsnummer);
|
||||
} else if ($versichert=="1" && $extraversichert=="" && $nachnahme=="")
|
||||
{
|
||||
$this->EasylogPaketmarke2500($id,$name,$name2,$name3,$strasse,$hausnummer,$plz,$ort,$land,$kg);
|
||||
} else if ($versichert=="1" && $extraversichert=="" && $nachnahme=="1")
|
||||
{
|
||||
$this->EasylogPaketmarkeNachnahme2500($id,$name,$name2,$name3,$strasse,$hausnummer,$plz,$ort,$land,$kg,$betrag,$rechnungsnummer);
|
||||
} else if ($versichert=="" && $extraversichert=="1" && $nachnahme=="1")
|
||||
{
|
||||
$this->EasylogPaketmarkeNachnahme25000($id,$name,$name2,$name3,$strasse,$hausnummer,$plz,$ort,$land,$kg,$betrag,$rechnungsnummer);
|
||||
} else if ($extraversichert=="1" && $versichert=="" && $nachnahme=="")
|
||||
{
|
||||
$this->EasylogPaketmarke25000($id,$name,$name2,$name3,$strasse,$hausnummer,$plz,$ort,$land,$kg);
|
||||
}
|
||||
break;
|
||||
case "Intraship":
|
||||
$kg = (float)str_replace(',','.',$kg);
|
||||
$obj = $this->LoadVersandModul($versandartenmodul[0]['modul'], $versandartenmodul[0]['id']);
|
||||
$this->app->Tpl->Set("ZUSATZ",$versandartenmodul[0]['bezeichnung']);
|
||||
|
||||
$abholdatum = $this->app->Secure->GetPOST("abholdatum");
|
||||
$retourenlabel= $this->app->Secure->GetPOST("retourenlabel");
|
||||
if($retourenlabel)
|
||||
{
|
||||
$this->app->Tpl->Set('RETOURENLABEL', ' checked="checked" ');
|
||||
$zusaetzlich['retourenlabel'] = 1;
|
||||
}
|
||||
if($abholdatum){
|
||||
$this->app->Tpl->Set('ABHOLDATUM',$abholdatum);
|
||||
$zusaetzlich['abholdatum'] = date('Y-m-d', strtotime($abholdatum));
|
||||
$this->app->User->SetParameter("paketmarke_abholdatum",$zusaetzlich['abholdatum']);
|
||||
}
|
||||
if($altersfreigabe)$zusaetzlich['altersfreigabe'] = 1;
|
||||
if($nachnahme=="1")
|
||||
$error = $this->IntrashipPaketmarkeNachnahme($id,$name,$name2,$name3,$strasse,$hausnummer,$plz,$ort,$land,$kg,$betrag,$rechnungsnummer,$zusaetzlich);
|
||||
else
|
||||
$error = $this->IntrashipPaketmarkeStandard($id,$name,$name2,$name3,$strasse,$hausnummer,$plz,$ort,$land,$kg,"",$rechnungsnummer,$zusaetzlich);
|
||||
break;
|
||||
case "UPS":
|
||||
$error = $this->UPSPaketmarke($id,$name,$name2,$name3,$strasse,$hausnummer,$plz,$ort,$land,$kg,$betrag,$rechnungsnummer);
|
||||
break;
|
||||
case "FEDEX":
|
||||
$error = $this->FEDEXPaketmarke($id,$name,$name2,$name3,$strasse,$hausnummer,$plz,$ort,$land,$kg,$betrag,$rechnungsnummer);
|
||||
break;
|
||||
case 'Go':
|
||||
if($name && $strasse && $plz && $ort && (($hausnummer && (!$land || $land == 'DE') || ($land && $land != 'DE'))))
|
||||
{
|
||||
$kg = $this->app->Secure->GetPOST("kg");
|
||||
if($kg=="") $kg=$this->VersandartMindestgewicht($lieferschein);
|
||||
$kg = str_replace(',','.',$kg);
|
||||
$frei = $this->app->Secure->GetPOST("frei")==1?1:0;
|
||||
$auftragid = $this->app->DB->Select("SELECT auftragid FROM lieferschein where id = ".(int)$lieferschein." limit 1");
|
||||
|
||||
if($frei){
|
||||
$this->app->Tpl->Set('FREI',' checked="checked" ');
|
||||
$zusaetzlich['frei'] = 1;
|
||||
}
|
||||
$selbstabholung = $this->app->Secure->GetPOST("selbstabholung");
|
||||
if($selbstabholung){
|
||||
$this->app->Tpl->Set('SELBSTABHOLUNG',' checked="checked" ');
|
||||
$zusaetzlich['selbstabholung'] = 1;
|
||||
}
|
||||
$landesvorwahl = $this->app->Secure->GetPOST("landesvorwahl");
|
||||
if($landesvorwahl){
|
||||
$this->app->Tpl->Set('LANDESVORWAHL',$landesvorwahl);
|
||||
$zusaetzlich['landesvorwahl'] = $landesvorwahl;
|
||||
}
|
||||
$ortsvorwahl = $this->app->Secure->GetPOST("ortsvorwahl");
|
||||
if($ortsvorwahl){
|
||||
$this->app->Tpl->Set('ORTSVORWAHL',$ortsvorwahl);
|
||||
$zusaetzlich['ortsvorwahl'] = $ortsvorwahl;
|
||||
}
|
||||
if($telefon)
|
||||
{
|
||||
$this->app->Tpl->Set('TELEFON',$telefon);
|
||||
$zusaetzlich['telefon'] = $telefon;
|
||||
}
|
||||
if($email)
|
||||
{
|
||||
$this->app->Tpl->Set('EMAIL',trim($email));
|
||||
$zusaetzlich['email'] = trim($email);
|
||||
}
|
||||
|
||||
|
||||
$selbstanlieferung = $this->app->Secure->GetPOST("selbstanlieferung");
|
||||
if($selbstanlieferung){
|
||||
$this->app->Tpl->Set('SELBSTANLIEFERUNG',' checked="checked" ');
|
||||
$zusaetzlich['selbstanlieferung'] = 1;
|
||||
}
|
||||
$abholdatum = $this->app->Secure->GetPOST("abholdatum");
|
||||
if($abholdatum){
|
||||
$this->app->Tpl->Set('ABHOLDATUM',$abholdatum);
|
||||
$zusaetzlich['abholdatum'] = $abholdatum;
|
||||
$this->app->User->SetParameter("paketmarke_abholdatum",$zusaetzlich['abholdatum']);
|
||||
}
|
||||
$zustelldatum = $this->app->Secure->GetPOST("zustelldatum");
|
||||
if(!$zustelldatum)
|
||||
{
|
||||
//$zustelldatum = $this->app->DB->Select("SELECT lieferdatum FROM rechnung where id = ".(int)$rechnungid." and lieferdatum > now() limit 1");
|
||||
$zustelldatum = $this->app->DB->Select("SELECT lieferdatum FROM auftrag where id = ".(int)$auftragid." limit 1");
|
||||
}
|
||||
if($zustelldatum){
|
||||
$this->app->Tpl->Set('ZUSTELLDATUM',$zustelldatum);
|
||||
$zusaetzlich['zustelldatum'] = $zustelldatum;
|
||||
}
|
||||
|
||||
if(!$abholdatum)
|
||||
{
|
||||
//$abholdatum = $this->app->DB->Select("SELECT tatsaechlicheslieferdatum FROM rechnung where id = ".(int)$rechnungid." and tatsaechlicheslieferdatum > now() limit 1");
|
||||
$abholdatum = $this->app->DB->Select("SELECT date_format(now(),'%d.%m.%Y')");
|
||||
/*if(!$abholdatum)
|
||||
{
|
||||
$projekt = $this->app->DB->Select("SELECT projekt FROM auftrag WHERE id='$auftragid' LIMIT 1");
|
||||
$differenztage = $this->Projektdaten($projekt,"differenz_auslieferung_tage");
|
||||
if($differenztage<0) $differenztage=2;
|
||||
$abholdatum = $this->app->DB->Select("SELECT DATE_SUB(lieferdatum, INTERVAL $differenztage DAY) from auftrag WHERE id='$auftragid' and DATE_SUB(lieferdatum, INTERVAL $differenztage DAY) > now() LIMIT 1");
|
||||
}*/
|
||||
if($abholdatum)
|
||||
{
|
||||
$this->app->Tpl->Set('ABHOLDATUM',$abholdatum);
|
||||
$zusaetzlich['abholdatum'] = $abholdatum;
|
||||
$this->app->User->SetParameter("paketmarke_abholdatum",$zusaetzlich['abholdatum']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$Zustellhinweise = $this->app->Secure->GetPOST("Zustellhinweise");
|
||||
if($Zustellhinweise){
|
||||
$this->app->Tpl->Set('ZUSTELLHINWEISE',$Zustellhinweise);
|
||||
$zusaetzlich['Zustellhinweise'] = $Zustellhinweise;
|
||||
}
|
||||
$Abholhinweise = $this->app->Secure->GetPOST("Abholhinweise");
|
||||
if($Abholhinweise){
|
||||
$this->app->Tpl->Set('ABHOLHINWEISE',$Abholhinweise);
|
||||
$zusaetzlich['Abholhinweise'] = $Abholhinweise;
|
||||
}
|
||||
|
||||
|
||||
if($anzahl)$zusaetzlich['menge'] = $anzahl;
|
||||
$inhalt = $this->app->Secure->GetPOST("inhalt");
|
||||
if($inhalt){
|
||||
$this->app->Tpl->Set('INHALT',$inhalt);
|
||||
$zusaetzlich['inhalt'] = $inhalt;
|
||||
}
|
||||
if(isset($nachnahme))$zusaetzlich['nachnahme'] = $nachnahme;
|
||||
$this->GoPaketmarke($id,$name,$name2,$name3,$strasse,$hausnummer,$plz,$ort,$land,$kg,$betrag,$rechnungsnummer, $zusaetzlich);
|
||||
} else header("Location: index.php?module=lieferschein&action=paketmarke&id=$id");
|
||||
break;
|
||||
|
||||
}
|
||||
if(!empty($obj) && method_exists($obj, 'Paketmarke'))
|
||||
{
|
||||
$error = $obj->Paketmarke($sid!=''?$sid:'lieferschein',$id);
|
||||
}else $error[] = 'Versandmodul '.$typ.' fehlerhaft!';
|
||||
}
|
||||
|
||||
if(!isset($error) || !$error)$this->app->DB->Update("UPDATE versand SET gewicht='$kg',paketmarkegedruckt=1,anzahlpakete='$anzahl' WHERE id='$id' LIMIT 1");
|
||||
}
|
||||
if(!$error)
|
||||
@ -16008,8 +15816,7 @@ function Paketmarke($parsetarget,$sid="",$zusatz="",$typ="DHL")
|
||||
break;
|
||||
|
||||
}
|
||||
$this->app->DB->Insert("INSERT INTO versandpakete (id,versand,gewicht,nr,versender) VALUES ('','$id','$kg','$anzahli','".$this->app->User->GetName()."')");
|
||||
}
|
||||
$this->app->DB->Insert("INSERT INTO versandpakete (id,versand,gewicht,nr,versender) VALUES ('','$id','$kg','$anzahli','".$this->app->User->GetName()."')"); }
|
||||
|
||||
}
|
||||
|
||||
@ -29436,11 +29243,23 @@ function Firmendaten($field,$projekt="")
|
||||
|
||||
$process_lock = $this->app->erp->ProzessLock("erpapi_getnextnummer");
|
||||
|
||||
$eigenernummernkreis = 0;
|
||||
$eigenernummernkreis = $this->app->DB->Select("SELECT eigenernummernkreis FROM projekt WHERE id='$projekt' LIMIT 1");
|
||||
$belegnr = '';
|
||||
if($eigenernummernkreis=='1')
|
||||
{
|
||||
$allowedtypes = ['angebot', 'auftrag', 'rechnung', 'lieferschein', 'arbeitsnachweis', 'reisekosten',
|
||||
'bestellung', 'gutschrift', 'kundennummer', 'lieferantennummer', 'mitarbeiternummer', 'waren',
|
||||
'produktion', 'sonstiges', 'anfrage', 'artikelnummer', 'kalkulation', 'preisanfrage', 'proformarechnung',
|
||||
'retoure', 'verbindlichkeit', 'goodspostingdocument', 'receiptdocument'];
|
||||
|
||||
} else {
|
||||
$dbfield = "next_$type";
|
||||
$belegnr = $this->app->DB->Select("SELECT $dbfield FROM projekt WHERE id='$projekt' LIMIT 1");
|
||||
if (!empty($belegnr)) {
|
||||
$newbelegnr = $this->CalcNextNummer($belegnr);
|
||||
$this->app->DB->Update("UPDATE projekt SET $dbfield='$newbelegnr' WHERE id='$projekt' LIMIT 1");
|
||||
}
|
||||
}
|
||||
if (empty($belegnr)) {
|
||||
// naechste
|
||||
switch($type)
|
||||
{
|
||||
|
@ -1,4 +1,11 @@
|
||||
<?php
|
||||
<?php
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
@ -10,8 +17,8 @@
|
||||
* to obtain the text of the corresponding license version.
|
||||
*
|
||||
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*/
|
||||
?>
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
use Xentral\Modules\Onlineshop\Data\ShopConnectorResponseInterface;
|
||||
|
||||
@ -734,8 +741,12 @@ class Remote
|
||||
if($v['path'] != '' && $v['content'] != '')
|
||||
{
|
||||
$path_parts = pathinfo($v['path']);
|
||||
$fileid = $this->app->erp->CreateDatei($path_parts['basename'], 'Shopbild', '', '', base64_decode($v['content']), 'Cronjob');
|
||||
$tmpfilename = tempnam($this->app->erp->GetTMP(), 'img');
|
||||
file_put_contents($tmpfilename, base64_decode($v['content']));
|
||||
$fileid = $this->app->erp->CreateDatei($path_parts['basename'], 'Shopbild', '', '', $tmpfilename, 'Cronjob');
|
||||
$this->app->erp->AddDateiStichwort($fileid, 'Shopbild', 'artikel', $articleid);
|
||||
if (@is_file($tmpfilename))
|
||||
unlink($tmpfilename);
|
||||
}
|
||||
}
|
||||
}elseif($dateien[0]['subjekt'] === 'shopbild'){
|
||||
@ -766,12 +777,16 @@ class Remote
|
||||
if($v['path'] != '' && $v['content'] != '')
|
||||
{
|
||||
$path_parts = pathinfo($v['path']);
|
||||
$fileid = $this->app->erp->CreateDatei($path_parts['basename'], 'Shopbild', '', '', base64_decode($v['content']), 'Cronjob');
|
||||
$tmpfilename = tempnam($this->app->erp->GetTMP(), 'img');
|
||||
file_put_contents($tmpfilename, base64_decode($v['content']));
|
||||
$fileid = $this->app->erp->CreateDatei($path_parts['basename'], 'Shopbild', '', '', $tmpfilename, 'Cronjob');
|
||||
if(isset($v['id']))
|
||||
{
|
||||
$this->ShopexportMappingSet($id, 'datei', $fileid, $v['id'], $articleid);
|
||||
}
|
||||
$this->app->erp->AddDateiStichwort($fileid, 'Shopbild', 'artikel', $articleid);
|
||||
if (@is_file($tmpfilename))
|
||||
unlink($tmpfilename);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,371 +1,324 @@
|
||||
<?php
|
||||
class Versanddienstleister {
|
||||
/** @var int $id */
|
||||
public $id;
|
||||
/** @var Application $app */
|
||||
public $app;
|
||||
<?php
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
public function GetAdressdaten($id, $sid)
|
||||
use Xentral\Modules\ShippingMethod\Model\CreateShipmentResult;
|
||||
use Xentral\Modules\ShippingMethod\Model\CustomsInfo;
|
||||
use Xentral\Modules\ShippingMethod\Model\Product;
|
||||
|
||||
abstract class Versanddienstleister
|
||||
{
|
||||
protected int $id;
|
||||
protected ApplicationCore $app;
|
||||
protected string $type;
|
||||
protected int $projectId;
|
||||
protected ?int $labelPrinterId;
|
||||
protected ?int $documentPrinterId;
|
||||
protected bool $shippingMail;
|
||||
protected ?int $businessLetterTemplateId;
|
||||
protected ?object $settings;
|
||||
|
||||
public function __construct(ApplicationCore $app, ?int $id)
|
||||
{
|
||||
if($sid==='rechnung'){
|
||||
$rechnung = $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$rechnung ='';
|
||||
}
|
||||
$this->app = $app;
|
||||
if ($id === null || $id === 0)
|
||||
return;
|
||||
$this->id = $id;
|
||||
$row = $this->app->DB->SelectRow("SELECT * FROM versandarten WHERE id=$this->id");
|
||||
$this->type = $row['type'];
|
||||
$this->projectId = $row['projekt'];
|
||||
$this->labelPrinterId = $row['paketmarke_drucker'];
|
||||
$this->documentPrinterId = $row['export_drucker'];
|
||||
$this->shippingMail = $row['versandmail'];
|
||||
$this->businessLetterTemplateId = $row['geschaeftsbrief_vorlage'];
|
||||
$this->settings = json_decode($row['einstellungen_json']);
|
||||
}
|
||||
|
||||
if($sid==='versand')
|
||||
{
|
||||
$tid = $this->app->DB->Select("SELECT lieferschein FROM versand WHERE id='$id' LIMIT 1");
|
||||
$rechnung = $this->app->DB->Select("SELECT rechnung FROM versand WHERE id='$id' LIMIT 1");
|
||||
public function isEtikettenDrucker(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public abstract function GetName(): string;
|
||||
|
||||
public function GetAdressdaten($id, $sid): array
|
||||
{
|
||||
$auftragId = $lieferscheinId = $rechnungId = $versandId = 0;
|
||||
if ($sid === 'rechnung')
|
||||
$rechnungId = $id;
|
||||
if ($sid === 'lieferschein') {
|
||||
$lieferscheinId = $id;
|
||||
$auftragId = $this->app->DB->Select("SELECT auftragid FROM lieferschein WHERE id=$lieferscheinId LIMIT 1");
|
||||
$rechnungId = $this->app->DB->Select("SELECT id FROM rechnung WHERE lieferschein = '$lieferscheinId' LIMIT 1");
|
||||
if ($rechnungId <= 0)
|
||||
$rechnungId = $this->app->DB->Select("SELECT rechnungid FROM lieferschein WHERE id='$lieferscheinId' LIMIT 1");
|
||||
}
|
||||
if ($sid === 'versand') {
|
||||
$versandId = $id;
|
||||
$lieferscheinId = $this->app->DB->Select("SELECT lieferschein FROM versand WHERE id='$versandId' LIMIT 1");
|
||||
$rechnungId = $this->app->DB->Select("SELECT rechnung FROM versand WHERE id='$versandId' LIMIT 1");
|
||||
$sid = 'lieferschein';
|
||||
} else {
|
||||
$tid = $id;
|
||||
if($sid === 'lieferschein'){
|
||||
$rechnung = $this->app->DB->Select("SELECT id FROM rechnung WHERE lieferschein = '$tid' LIMIT 1");
|
||||
}
|
||||
if($rechnung<=0) {
|
||||
$rechnung = $this->app->DB->Select("SELECT rechnungid FROM lieferschein WHERE id='$tid' LIMIT 1");
|
||||
}
|
||||
}
|
||||
$ret['tid'] = $tid;
|
||||
$ret['rechnung'] = $rechnung;
|
||||
|
||||
if($rechnung){
|
||||
$artikel_positionen = $this->app->DB->SelectArr("SELECT * FROM rechnung_position WHERE rechnung='$rechnung'");
|
||||
} else {
|
||||
$artikel_positionen = $this->app->DB->SelectArr(sprintf('SELECT * FROM `%s` WHERE `%s` = %d',$sid.'_position',$sid,$tid));
|
||||
}
|
||||
|
||||
if($sid==='rechnung' || $sid==='lieferschein' || $sid==='adresse')
|
||||
{
|
||||
$docArr = $this->app->DB->SelectRow(sprintf('SELECT * FROM `%s` WHERE id = %d LIMIT 1',$sid, $tid));
|
||||
if ($auftragId <= 0 && $rechnungId > 0)
|
||||
$auftragId = $this->app->DB->Select("SELECT auftragid FROM rechnung WHERE id=$rechnungId LIMIT 1");
|
||||
|
||||
$name = trim($docArr['name']);//trim($this->app->DB->Select("SELECT name FROM $sid WHERE id='$tid' LIMIT 1"));
|
||||
$name2 = trim($docArr['adresszusatz']);//trim($this->app->DB->Select("SELECT adresszusatz FROM $sid WHERE id='$tid' LIMIT 1"));
|
||||
$abt = 0;
|
||||
if($name2==='')
|
||||
{
|
||||
$name2 = trim($docArr['abteilung']);//trim($this->app->DB->Select("SELECT abteilung FROM $sid WHERE id='$tid' LIMIT 1"));
|
||||
$abt=1;
|
||||
}
|
||||
$name3 = trim($docArr['ansprechpartner']);//trim($this->app->DB->Select("SELECT ansprechpartner FROM $sid WHERE id='$tid' LIMIT 1"));
|
||||
if($name3==='' && $abt!==1){
|
||||
$name3 = trim($docArr['abteilung']);//trim($this->app->DB->Select("SELECT abteilung FROM $sid WHERE id='$tid' LIMIT 1"));
|
||||
}
|
||||
if ($sid === 'rechnung' || $sid === 'lieferschein' || $sid === 'adresse') {
|
||||
$docArr = $this->app->DB->SelectRow("SELECT * FROM `$sid` WHERE id = $id LIMIT 1");
|
||||
$ret['addressId'] = $docArr['adresse'];
|
||||
$ret['auftragId'] = $auftragId;
|
||||
$ret['rechnungId'] = $rechnungId;
|
||||
$ret['lieferscheinId'] = $lieferscheinId;
|
||||
|
||||
//unterabteilung versuchen einzublenden
|
||||
if($name2==='') {
|
||||
$name2 = trim($docArr['unterabteilung']);//trim($this->app->DB->Select("SELECT unterabteilung FROM $sid WHERE id='$tid' LIMIT 1"));
|
||||
} else if ($name3==='') {
|
||||
$name3 = trim($docArr['unterabteilung']);//trim($this->app->DB->Select("SELECT unterabteilung FROM $sid WHERE id='$tid' LIMIT 1"));
|
||||
}
|
||||
$addressfields = ['name', 'adresszusatz', 'abteilung', 'ansprechpartner', 'unterabteilung', 'ort', 'plz',
|
||||
'strasse', 'land'];
|
||||
$ret['original'] = array_filter($docArr, fn($key) => in_array($key, $addressfields), ARRAY_FILTER_USE_KEY);
|
||||
|
||||
if($name3!=='' && $name2==='') {
|
||||
$name2=$name3;
|
||||
$name3='';
|
||||
}
|
||||
$ret['name'] = empty(trim($docArr['ansprechpartner'])) ? trim($docArr['name']) : trim($docArr['ansprechpartner']);
|
||||
$ret['name2'] = !empty(trim($docArr['ansprechpartner'])) ? trim($docArr['name']) : '';
|
||||
$ret['name3'] = join(';', array_filter([
|
||||
$docArr['abteilung'],
|
||||
$docArr['unterabteilung']
|
||||
], fn(string $item) => !empty(trim($item))));
|
||||
$ret['address2'] = $docArr['adresszusatz'];
|
||||
|
||||
$ort = trim($docArr['ort']);//trim($this->app->DB->Select("SELECT ort FROM $sid WHERE id='$tid' LIMIT 1"));
|
||||
$plz = trim($docArr['plz']);//trim($this->app->DB->Select("SELECT plz FROM $sid WHERE id='$tid' LIMIT 1"));
|
||||
$land = trim($docArr['land']);//trim($this->app->DB->Select("SELECT land FROM $sid WHERE id='$tid' LIMIT 1"));
|
||||
$strasse = trim($docArr['strasse']);//trim($this->app->DB->Select("SELECT strasse FROM $sid WHERE id='$tid' LIMIT 1"));
|
||||
$strassekomplett = $strasse;
|
||||
$ret['city'] = $docArr['ort'];
|
||||
$ret['zip'] = $docArr['plz'];
|
||||
$ret['country'] = $docArr['land'];
|
||||
$ret['phone'] = $docArr['telefon'];
|
||||
$ret['email'] = $docArr['email'];
|
||||
$ret['addresstype'] = 0;
|
||||
|
||||
$strasse = trim($docArr['strasse']);
|
||||
$ret['streetwithnumber'] = $strasse;
|
||||
$hausnummer = trim($this->app->erp->ExtractStreetnumber($strasse));
|
||||
$strasse = trim(str_replace($hausnummer, '', $strasse));
|
||||
$strasse = str_replace('.', '', $strasse);
|
||||
|
||||
$strasse = trim(str_replace($hausnummer,'',$strasse));
|
||||
$strasse = str_replace('.','',$strasse);
|
||||
|
||||
if($strasse=='')
|
||||
{
|
||||
if ($strasse == '') {
|
||||
$strasse = trim($hausnummer);
|
||||
$hausnummer = '';
|
||||
}
|
||||
$telefon = trim($docArr['telefon']);//trim($this->app->DB->Select("SELECT telefon FROM $sid WHERE id='$tid' LIMIT 1"));
|
||||
$email = trim($docArr['email']);//trim($this->app->DB->Select("SELECT email FROM $sid WHERE id='$tid' LIMIT 1"));
|
||||
$ret['street'] = $strasse;
|
||||
$ret['streetnumber'] = $hausnummer;
|
||||
|
||||
if (str_contains($docArr['strasse'], 'Packstation')) {
|
||||
$ret['addresstype'] = 1;
|
||||
$ret['parcelstationNumber'] = $hausnummer;
|
||||
} else if (str_contains($docArr['strasse'], 'Postfiliale')) {
|
||||
$ret['addresstype'] = 2;
|
||||
$ret['postofficeNumber'] = $hausnummer;
|
||||
}
|
||||
|
||||
$tmp = join(' ', [$docArr['ansprechpartner'], $docArr['abteilung'], $docArr['unterabteilung']]);
|
||||
if (preg_match("/\d{6,10}/", $tmp, $match)) {
|
||||
$ret['postnumber'] = $match[0];
|
||||
}
|
||||
|
||||
if ($auftragId > 0) {
|
||||
$internet = $this->app->DB->Select("SELECT internet FROM auftrag WHERE id = $auftragId LIMIT 1");
|
||||
if (!empty($internet))
|
||||
$orderNumberParts[] = $internet;
|
||||
}
|
||||
if (!empty($docArr['ihrebestellnummer'])) {
|
||||
$orderNumberParts[] = $docArr['ihrebestellnummer'];
|
||||
}
|
||||
$orderNumberParts[] = $docArr['belegnr'];
|
||||
$ret['order_number'] = implode(' / ', $orderNumberParts);
|
||||
}
|
||||
|
||||
// wenn rechnung im spiel entweder durch versand oder direkt rechnung
|
||||
if($rechnung >0)
|
||||
{
|
||||
$zahlungsweise = $this->app->DB->Select("SELECT zahlungsweise FROM rechnung WHERE id='$rechnung' LIMIT 1");
|
||||
$soll = $this->app->DB->Select("SELECT soll FROM rechnung WHERE id='$rechnung' LIMIT 1");
|
||||
if ($rechnungId > 0) {
|
||||
$invoice_data = $this->app->DB->SelectRow("SELECT zahlungsweise, soll, belegnr FROM rechnung WHERE id='$rechnungId' LIMIT 1");
|
||||
$ret['zahlungsweise'] = $invoice_data['zahlungsweise'];
|
||||
$ret['betrag'] = $invoice_data['soll'];
|
||||
$ret['invoice_number'] = $invoice_data['belegnr'];
|
||||
|
||||
if($zahlungsweise==='nachnahme'){
|
||||
$nachnahme = true;
|
||||
}
|
||||
|
||||
if($soll >= 500 && $soll <= 2500){
|
||||
$versichert = true;
|
||||
}
|
||||
|
||||
if($soll > 2500) {
|
||||
$extraversichert = true;
|
||||
if ($invoice_data['zahlungsweise'] === 'nachnahme') {
|
||||
$ret['nachnahme'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($frei))$ret['frei'] = $frei;
|
||||
if(isset($inhalt))$ret['inhalt'] = $inhalt;
|
||||
if(isset($keinealtersabfrage))$ret['keinealtersabfrage'] = $keinealtersabfrage;
|
||||
if(isset($altersfreigabe))$ret['altersfreigabe'] = $altersfreigabe;
|
||||
if(isset($zahlungsweise))$ret['zahlungsweise'] = $zahlungsweise;
|
||||
if(isset($versichert))$ret['versichert'] = $versichert;
|
||||
if(isset($soll))$ret['betrag'] = $soll;
|
||||
if(isset($extraversichert))$ret['extraversichert'] = $extraversichert;
|
||||
if(isset($nachnahme))$ret['nachnahme'] = $nachnahme;
|
||||
$ret['name'] = $name;
|
||||
$ret['name2'] = $name2;
|
||||
$ret['name3'] = $name3;
|
||||
$ret['ort'] = $ort;
|
||||
$ret['plz'] = $plz;
|
||||
$ret['strasse'] = $strasse;
|
||||
$ret['strassekomplett'] = $strassekomplett;
|
||||
$ret['hausnummer'] = $hausnummer;
|
||||
$ret['land'] = $land;
|
||||
$ret['telefon'] = $telefon;
|
||||
$ret['phone'] = $telefon;
|
||||
$ret['email'] = trim($email," \t\n\r\0\x0B\xc2\xa0");
|
||||
$sql = "SELECT
|
||||
lp.bezeichnung,
|
||||
lp.menge,
|
||||
coalesce(nullif(lp.zolltarifnummer, '0'), nullif(rp.zolltarifnummer, '0'), nullif(a.zolltarifnummer, '')) as zolltarifnummer,
|
||||
coalesce(nullif(lp.herkunftsland, '0'), nullif(rp.herkunftsland, '0'), nullif(a.herkunftsland, '')) as herkunftsland,
|
||||
coalesce(nullif(lp.zolleinzelwert, '0'), rp.preis *(1-rp.rabatt/100), 0) as zolleinzelwert,
|
||||
coalesce(nullif(lp.zolleinzelgewicht, 0), a.gewicht) as zolleinzelgewicht,
|
||||
lp.zollwaehrung
|
||||
FROM lieferschein_position lp
|
||||
JOIN artikel a on lp.artikel = a.id
|
||||
LEFT JOIN auftrag_position ap on lp.auftrag_position_id = ap.id
|
||||
LEFT JOIN rechnung_position rp on ap.id = rp.auftrag_position_id
|
||||
LEFT JOIN rechnung r on rp.rechnung = r.id
|
||||
WHERE lp.lieferschein = $lieferscheinId
|
||||
AND a.lagerartikel = 1
|
||||
AND r.status != 'storniert'
|
||||
ORDER BY lp.sort";
|
||||
$ret['positions'] = $this->app->DB->SelectArr($sql);
|
||||
|
||||
$check_date = $this->app->DB->Select("SELECT date_format(now(),'%Y-%m-%d')");
|
||||
|
||||
$ret['abholdaumt'] = date('d.m.Y', strtotime($check_date));
|
||||
|
||||
$anzahl = $this->app->Secure->GetGET("anzahl");
|
||||
|
||||
if($anzahl <= 0)
|
||||
{
|
||||
$anzahl=1;
|
||||
}
|
||||
|
||||
if($sid==="lieferschein"){
|
||||
$standardkg = $this->app->erp->VersandartMindestgewicht($tid);
|
||||
}
|
||||
else{
|
||||
if ($sid === "lieferschein") {
|
||||
$standardkg = $this->app->erp->VersandartMindestgewicht($lieferscheinId);
|
||||
} else {
|
||||
$standardkg = $this->app->erp->VersandartMindestgewicht();
|
||||
}
|
||||
//$this->app->erp->PaketmarkeGewichtForm($anzahl, $standardkg, $this->VersandartMindestgewicht());
|
||||
$ret['standardkg'] = $standardkg;
|
||||
$ret['anzahl'] = $anzahl;
|
||||
$ret['weight'] = $standardkg;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $target
|
||||
* Returns an array of additional field definitions to be stored for this module:
|
||||
* [
|
||||
* 'field_name' => [
|
||||
* 'typ' => text(default)|textarea|checkbox|select
|
||||
* 'default' => default value
|
||||
* 'optionen' => just for selects [key=>value]
|
||||
* 'size' => size attribute for text fields
|
||||
* 'placeholder' => placeholder attribute for text fields
|
||||
* ]
|
||||
* ]
|
||||
*
|
||||
* @return string
|
||||
* @return array
|
||||
*/
|
||||
public function Einstellungen($target = 'return')
|
||||
public function AdditionalSettings(): array
|
||||
{
|
||||
if(!$this->id)
|
||||
{
|
||||
return '';
|
||||
}
|
||||
//$id = $this->id;
|
||||
$struktur = $this->EinstellungenStruktur();
|
||||
if($this->app->Secure->GetPOST('speichern'))
|
||||
{
|
||||
$json = $this->app->DB->Select("SELECT einstellungen_json FROM versandarten WHERE id = '".$this->id."' LIMIT 1");
|
||||
$modul = $this->app->DB->Select("SELECT modul FROM versandarten WHERE id = '".$this->id."' LIMIT 1");
|
||||
if(!empty($json))
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders all additional settings as fields into $target
|
||||
* @param string $target template placeholder for rendered output
|
||||
* @param array $form data for form values (from database or form submit)
|
||||
* @return void
|
||||
*/
|
||||
public function RenderAdditionalSettings(string $target, array $form): void
|
||||
{
|
||||
$fields = $this->AdditionalSettings();
|
||||
if ($this->app->Secure->GetPOST('speichern')) {
|
||||
$json = $this->app->DB->Select("SELECT einstellungen_json FROM versandarten WHERE id = '" . $this->id . "' LIMIT 1");
|
||||
$modul = $this->app->DB->Select("SELECT modul FROM versandarten WHERE id = '" . $this->id . "' LIMIT 1");
|
||||
if (!empty($json)) {
|
||||
$json = @json_decode($json, true);
|
||||
}else{
|
||||
} else {
|
||||
$json = array();
|
||||
foreach($struktur as $name => $val)
|
||||
{
|
||||
if(isset($val['default']))
|
||||
{
|
||||
foreach ($fields as $name => $val) {
|
||||
if (isset($val['default'])) {
|
||||
$json[$name] = $val['default'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if(empty($json))
|
||||
{
|
||||
if (empty($json)) {
|
||||
$json = null;
|
||||
}
|
||||
foreach($struktur as $name => $val)
|
||||
{
|
||||
foreach ($fields as $name => $val) {
|
||||
|
||||
if($modul === $this->app->Secure->GetPOST('modul_name'))
|
||||
{
|
||||
$json[$name] = $this->app->Secure->GetPOST($name, '','', 1);
|
||||
if ($modul === $this->app->Secure->GetPOST('modul_name')) {
|
||||
$json[$name] = $this->app->Secure->GetPOST($name, '', '', 1);
|
||||
}
|
||||
|
||||
if(isset($val['replace']))
|
||||
{
|
||||
switch($val['replace'])
|
||||
{
|
||||
|
||||
if (isset($val['replace'])) {
|
||||
switch ($val['replace']) {
|
||||
case 'lieferantennummer':
|
||||
$json[$name] = $this->app->erp->ReplaceLieferantennummer(1,$json[$name],1);
|
||||
break;
|
||||
$json[$name] = $this->app->erp->ReplaceLieferantennummer(1, $json[$name], 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$json_str = $this->app->DB->real_escape_string(json_encode($json));
|
||||
$this->app->DB->Update("UPDATE versandarten SET einstellungen_json = '$json_str' WHERE id = '".$this->id."' LIMIT 1");
|
||||
$this->app->DB->Update("UPDATE versandarten SET einstellungen_json = '$json_str' WHERE id = '" . $this->id . "' LIMIT 1");
|
||||
}
|
||||
$id = $this->id;
|
||||
$html = '';
|
||||
|
||||
$json = $this->app->DB->Select("SELECT einstellungen_json FROM versandarten WHERE id = '$id' LIMIT 1");
|
||||
if($json)
|
||||
{
|
||||
$json = json_decode($json, true);
|
||||
}else{
|
||||
$json = null;
|
||||
}
|
||||
|
||||
$changed = false;
|
||||
foreach($struktur as $name => $val)
|
||||
foreach ($fields as $name => $val) // set missing default values
|
||||
{
|
||||
if(isset($val['default']) && !isset($json[$name]))
|
||||
{
|
||||
$changed = true;
|
||||
$json[$name] = $val['default'];
|
||||
if (isset($val['default']) && !isset($form[$name])) {
|
||||
$form[$name] = $val['default'];
|
||||
}
|
||||
}
|
||||
if($changed)
|
||||
{
|
||||
$json_str = $this->app->DB->real_escape_string(json_encode($json));
|
||||
$this->app->DB->Update("UPDATE versandarten SET einstellungen_json = '$json_str' WHERE id = '".$this->id."' LIMIT 1");
|
||||
}
|
||||
$first = true;
|
||||
foreach($struktur as $name => $val)
|
||||
{
|
||||
if(isset($val['heading']))
|
||||
{
|
||||
$html .= '<tr><td colspan="2"><b>'.html_entity_decode($val['heading']).'</b></td></tr>';
|
||||
}
|
||||
$html .= '<tr><td>'.($first?'<input type="hidden" name="modul_name" value="'.$this->app->DB->Select("SELECT modul FROM versandarten WHERE id = '$id' LIMIT 1").'" />':'').(empty($val['bezeichnung'])?$name:$val['bezeichnung']).'</td><td>';
|
||||
$typ = 'text';
|
||||
if(!empty($val['typ']))
|
||||
{
|
||||
$typ = $val['typ'];
|
||||
}
|
||||
if(isset($val['replace']))
|
||||
{
|
||||
switch($val['replace'])
|
||||
{
|
||||
foreach ($fields as $name => $val) {
|
||||
if (isset($val['heading']))
|
||||
$html .= '<tr><td colspan="2"><b>' . html_entity_decode($val['heading']) . '</b></td></tr>';
|
||||
|
||||
$html .= '<tr><td>' . ($val['bezeichnung'] ?? $name) . '</td><td>';
|
||||
if (isset($val['replace'])) {
|
||||
switch ($val['replace']) {
|
||||
case 'lieferantennummer':
|
||||
$json[$name] = $this->app->erp->ReplaceLieferantennummer(0,$json[$name],0);
|
||||
if($target !== 'return')
|
||||
{
|
||||
$this->app->YUI->AutoComplete($name, 'lieferant', 1);
|
||||
}
|
||||
break;
|
||||
$form[$name] = $this->app->erp->ReplaceLieferantennummer(0, $form[$name], 0);
|
||||
$this->app->YUI->AutoComplete($name, 'lieferant', 1);
|
||||
break;
|
||||
case 'shop':
|
||||
$json[$name] .= ($json[$name]?' '.$this->app->DB->Select("SELECT bezeichnung FROM shopexport WHERE id = '".(int)$json[$name]."'"):'');
|
||||
if($target !== 'return')
|
||||
{
|
||||
$this->app->YUI->AutoComplete($name, 'shopnameid');
|
||||
}
|
||||
break;
|
||||
$form[$name] .= ($form[$name] ? ' ' . $this->app->DB->Select("SELECT bezeichnung FROM shopexport WHERE id = '" . (int)$form[$name] . "'") : '');
|
||||
$this->app->YUI->AutoComplete($name, 'shopnameid');
|
||||
break;
|
||||
case 'etiketten':
|
||||
//$json[$name] = $this->app->erp->ReplaceLieferantennummer(0,$json[$name],0);
|
||||
if($target !== 'return')
|
||||
{
|
||||
$this->app->YUI->AutoComplete($name, 'etiketten');
|
||||
}
|
||||
break;
|
||||
|
||||
$this->app->YUI->AutoComplete($name, 'etiketten');
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*if(!isset($json[$name]) && isset($val['default']))
|
||||
{
|
||||
$json[$name] = $val['default'];
|
||||
}*/
|
||||
switch($typ)
|
||||
{
|
||||
switch ($val['typ'] ?? 'text') {
|
||||
case 'textarea':
|
||||
$html .= '<textarea name="'.$name.'" id="'.$name.'">'.(!isset($json[$name])?'':$json[$name]).'</textarea>';
|
||||
break;
|
||||
$html .= '<textarea name="' . $name . '" id="' . $name . '">' . ($form[$name] ?? '') . '</textarea>';
|
||||
break;
|
||||
case 'checkbox':
|
||||
$html .= '<input type="checkbox" name="'.$name.'" id="'.$name.'" value="1" '.((isset($json[$name]) && $json[$name])?' checked="checked" ':'').' />';
|
||||
break;
|
||||
$html .= '<input type="checkbox" name="' . $name . '" id="' . $name . '" value="1" ' . ($form[$name] ?? false ? ' checked="checked" ' : '') . ' />';
|
||||
break;
|
||||
case 'select':
|
||||
$html .= '<select name="'.$name.'">';
|
||||
if(isset($val['optionen']) && is_array($val['optionen']))
|
||||
{
|
||||
foreach($val['optionen'] as $k => $v)
|
||||
{
|
||||
$html .= '<option value="'.$k.'"'.($k == (isset($json[$name])?$json[$name]:'')?' selected="selected" ':'').'>'.$v.'</option>';
|
||||
}
|
||||
}
|
||||
$html .= '</select>';
|
||||
break;
|
||||
$html .= $this->app->Tpl->addSelect('return', $name, $name, $val['optionen'], $form[$name]);
|
||||
break;
|
||||
case 'submit':
|
||||
if(isset($val['text']))
|
||||
{
|
||||
$html .= '<form method="POST"><input type="submit" name="'.$name.'" value="'.$val['text'].'"></form>';
|
||||
}
|
||||
break;
|
||||
if (isset($val['text']))
|
||||
$html .= '<form method="POST"><input type="submit" name="' . $name . '" value="' . $val['text'] . '"></form>';
|
||||
break;
|
||||
case 'custom':
|
||||
if(isset($val['function']))
|
||||
{
|
||||
if (isset($val['function'])) {
|
||||
$tmpfunction = $val['function'];
|
||||
if(method_exists($this, $tmpfunction))
|
||||
{
|
||||
if (method_exists($this, $tmpfunction)) {
|
||||
$html .= $this->$tmpfunction();
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
|
||||
$html .= '<input type="text" '.(!empty($val['size'])?' size="'.$val['size'].'" ':'').' '.(!empty($val['placeholder'])?' placeholder="'.$val['placeholder'].'" ':'').' name="'.$name.'" id="'.$name.'" value="'.(!isset($json[$name])?'':htmlspecialchars($json[$name])).'" />';
|
||||
break;
|
||||
$html .= '<input type="text"'
|
||||
. (!empty($val['size']) ? ' size="' . $val['size'] . '"' : '')
|
||||
. (!empty($val['placeholder']) ? ' placeholder="' . $val['placeholder'] . '"' : '')
|
||||
. ' name="' . $name . '" id="' . $name . '" value="' . (isset($form[$name]) ? htmlspecialchars($form[$name]) : '') . '" />';
|
||||
break;
|
||||
}
|
||||
if(isset($val['info']) && $val['info'])$html .= ' <i>'.$val['info'].'</i>';
|
||||
|
||||
if (isset($val['info']) && $val['info'])
|
||||
$html .= ' <i>' . $val['info'] . '</i>';
|
||||
|
||||
$html .= '</td></tr>';
|
||||
$first = false;
|
||||
}
|
||||
|
||||
if($target === 'return') {
|
||||
return $html;
|
||||
}
|
||||
$this->app->Tpl->Add($target, $html);
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $target
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function checkInputParameters($target = '')
|
||||
/**
|
||||
* Validate form data for this module
|
||||
* Form data is passed by reference so replacements (id instead of text) can be performed here as well
|
||||
* @param array $form submitted form data
|
||||
* @return array
|
||||
*/
|
||||
public function ValidateSettings(array &$form): array
|
||||
{
|
||||
$error = '';
|
||||
if (trim($this->app->Secure->GetPOST('bezeichnung')) === '') {
|
||||
$error = 'Bitte alle Pflichtfelder ausfüllen!';
|
||||
$this->app->Tpl->Set('MSGBEZEICHNUNG','<span style="color:red">Pflichtfeld!</span>');
|
||||
}
|
||||
if (trim($this->app->Secure->GetPOST('typ')) === '') {
|
||||
$error = 'Bitte alle Pflichtfelder ausfüllen!';
|
||||
$this->app->Tpl->Set('MSGTYP','<span style="color:red">Pflichtfeld!</span>');
|
||||
}
|
||||
|
||||
if ($error !== '') {
|
||||
$this->app->Tpl->Add($target, sprintf('<div class="error">%s</div>', $error));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @param string $tracking
|
||||
* @param int $versand
|
||||
* @param int $lieferschein
|
||||
* @param int $versand
|
||||
* @param int $lieferschein
|
||||
*/
|
||||
public function SetTracking($tracking,$versand=0,$lieferschein=0, $trackingLink = '')
|
||||
public function SetTracking($tracking, $versand = 0, $lieferschein = 0, $trackingLink = '')
|
||||
{
|
||||
//if($versand > 0) $this->app->DB->Update("UPDATE versand SET tracking=CONCAT(tracking,if(tracking!='',';',''),'".$tracking."') WHERE id='$versand' LIMIT 1");
|
||||
$this->app->User->SetParameter('versand_lasttracking',$tracking);
|
||||
$this->app->User->SetParameter('versand_lasttracking_link',$trackingLink);
|
||||
$this->app->User->SetParameter('versand_lasttracking', $tracking);
|
||||
$this->app->User->SetParameter('versand_lasttracking_link', $trackingLink);
|
||||
$this->app->User->SetParameter('versand_lasttracking_versand', $versand);
|
||||
$this->app->User->SetParameter('versand_lasttracking_lieferschein', $lieferschein);
|
||||
}
|
||||
@ -375,17 +328,17 @@ class Versanddienstleister {
|
||||
*/
|
||||
public function deleteTrackingFromUserdata($tracking)
|
||||
{
|
||||
if(empty($tracking)) {
|
||||
if (empty($tracking)) {
|
||||
return;
|
||||
}
|
||||
$trackingUser = !empty($this->app->User) && method_exists($this->app->User,'GetParameter')?
|
||||
$this->app->User->GetParameter('versand_lasttracking'):'';
|
||||
if(empty($trackingUser) || $trackingUser !== $tracking) {
|
||||
$trackingUser = !empty($this->app->User) && method_exists($this->app->User, 'GetParameter') ?
|
||||
$this->app->User->GetParameter('versand_lasttracking') : '';
|
||||
if (empty($trackingUser) || $trackingUser !== $tracking) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->app->User->SetParameter('versand_lasttracking','');
|
||||
$this->app->User->SetParameter('versand_lasttracking_link','');
|
||||
$this->app->User->SetParameter('versand_lasttracking', '');
|
||||
$this->app->User->SetParameter('versand_lasttracking_link', '');
|
||||
$this->app->User->SetParameter('versand_lasttracking_versand', '');
|
||||
$this->app->User->SetParameter('versand_lasttracking_lieferschein', '');
|
||||
}
|
||||
@ -402,17 +355,83 @@ class Versanddienstleister {
|
||||
|
||||
/**
|
||||
* @param string $tracking
|
||||
* @param int $notsend
|
||||
* @param int $notsend
|
||||
* @param string $link
|
||||
* @param string $rawlink
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function Trackinglink($tracking, &$notsend, &$link, &$rawlink) {
|
||||
public function Trackinglink($tracking, &$notsend, &$link, &$rawlink)
|
||||
{
|
||||
$notsend = 0;
|
||||
$rawlink = '';
|
||||
$link = '';
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
public function Paketmarke(string $target, string $docType, int $docId): void
|
||||
{
|
||||
$address = $this->GetAdressdaten($docId, $docType);
|
||||
if (isset($_SERVER['CONTENT_TYPE']) && ($_SERVER['CONTENT_TYPE'] === 'application/json')) {
|
||||
$json = json_decode(file_get_contents('php://input'));
|
||||
$ret = [];
|
||||
if ($json->submit == 'print') {
|
||||
$result = $this->CreateShipment($json, $address);
|
||||
if ($result->Success) {
|
||||
$sql = "INSERT INTO versand
|
||||
(adresse, lieferschein, versandunternehmen, gewicht, tracking, tracking_link, anzahlpakete)
|
||||
VALUES
|
||||
({$address['addressId']}, {$address['lieferscheinId']}, '$this->type',
|
||||
'$json->weight', '$result->TrackingNumber', '$result->TrackingUrl', 1)";
|
||||
$this->app->DB->Insert($sql);
|
||||
|
||||
$filename = $this->app->erp->GetTMP() . join('_', [$this->type, 'Label', $result->TrackingNumber]) . '.pdf';
|
||||
file_put_contents($filename, $result->Label);
|
||||
$this->app->printer->Drucken($this->labelPrinterId, $filename);
|
||||
|
||||
if (isset($result->ExportDocuments)) {
|
||||
$filename = $this->app->erp->GetTMP() . join('_', [$this->type, 'ExportDoc', $result->TrackingNumber]) . '.pdf';
|
||||
file_put_contents($filename, $result->ExportDocuments);
|
||||
$this->app->printer->Drucken($this->documentPrinterId, $filename);
|
||||
}
|
||||
$ret['messages'][] = ['class' => 'info', 'text' => "Paketmarke wurde erfolgreich erstellt: $result->TrackingNumber"];
|
||||
} else {
|
||||
$ret['messages'] = array_map(fn(string $item) => ['class' => 'error', 'text' => $item], array_unique($result->Errors));
|
||||
}
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($ret);
|
||||
$this->app->ExitXentral();
|
||||
}
|
||||
|
||||
$address['shipment_type'] = CustomsInfo::CUSTOMS_TYPE_GOODS;
|
||||
$products = $this->GetShippingProducts();
|
||||
$products = array_combine(array_column($products, 'Id'), $products);
|
||||
$address['product'] = $products[0]->Id ?? '';
|
||||
|
||||
$json['form'] = $address;
|
||||
$json['countries'] = $this->app->erp->GetSelectLaenderliste();
|
||||
$json['products'] = $products;
|
||||
$json['customs_shipment_types'] = [
|
||||
CustomsInfo::CUSTOMS_TYPE_GIFT => 'Geschenk',
|
||||
CustomsInfo::CUSTOMS_TYPE_DOCUMENTS => 'Dokumente',
|
||||
CustomsInfo::CUSTOMS_TYPE_GOODS => 'Handelswaren',
|
||||
CustomsInfo::CUSTOMS_TYPE_SAMPLE => 'Erprobungswaren',
|
||||
CustomsInfo::CUSTOMS_TYPE_RETURN => 'Rücksendung'
|
||||
];
|
||||
$json['messages'] = [];
|
||||
$json['form']['services'] = [
|
||||
Product::SERVICE_PREMIUM => false
|
||||
];
|
||||
$this->app->Tpl->Set('JSON', json_encode($json));
|
||||
$this->app->Tpl->Set('CARRIERNAME', $this->GetName());
|
||||
$this->app->Tpl->Parse($target, 'createshipment.tpl');
|
||||
}
|
||||
|
||||
public abstract function CreateShipment(object $json, array $address): CreateShipmentResult;
|
||||
|
||||
/**
|
||||
* @return Product[]
|
||||
*/
|
||||
public abstract function GetShippingProducts(): array;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
279
www/lib/versandarten/content/createshipment.tpl
Normal file
279
www/lib/versandarten/content/createshipment.tpl
Normal file
@ -0,0 +1,279 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
|
||||
SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
-->
|
||||
|
||||
<div class="container-fluid" id="createshipmentapp">
|
||||
<form action="" method="post" v-on:submit.prevent="submit">
|
||||
<div class="row">
|
||||
<div v-for="msg in messages" :class="msg.class">{{msg.text}}</div>
|
||||
<div>
|
||||
<h1>{|Paketmarken Drucker für|} [CARRIERNAME]</h1>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h2>{|Empfänger|}</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td>{|Adresstyp|}:</td>
|
||||
<td>
|
||||
<select v-model.number="form.addresstype">
|
||||
<option value="0">Haus</option>
|
||||
<option value="1">Packstation</option>
|
||||
<option value="2">Filiale</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Name / Zeile 1|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.name"></td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 0">
|
||||
<td>{|Firmenname / Zeile 2|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.name2"></td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 1 || form.addresstype === 2">
|
||||
<td>{|Postnummer|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.postnumber"></td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 0">
|
||||
<td>{|Firmenname / Zeile 3|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.name3"></td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 0">
|
||||
<td>{|Strasse/Hausnummer|}:</td>
|
||||
<td>
|
||||
<input type="text" size="30" v-model.trim="form.street">
|
||||
<input type="text" size="5" v-model.trim="form.streetnumber">
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 1">
|
||||
<td>{|Packstationsnummer|}:</td>
|
||||
<td><input type="text" size="10" v-model.trim="form.parcelstationNumber"></td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 2">
|
||||
<td>{|Postfilialnummer|}:</td>
|
||||
<td><input type="text" size="10" v-model.trim="form.postofficeNumber"></td>
|
||||
</tr>
|
||||
<tr v-if="form.addresstype === 0">
|
||||
<td>{|Adresszeile 2|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.address2"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|PLZ/Ort|}:</td>
|
||||
<td><input type="text" size="5" v-model.trim="form.zip">
|
||||
<input type="text" size="30" v-model.trim="form.city">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Bundesland|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.state"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Land|}:</td>
|
||||
<td>
|
||||
<select v-model="form.country" required>
|
||||
<option v-for="(value, key) in countries" :value="key">{{value}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Ansprechpartner|}:</td>
|
||||
<td><input type="text" size="36" v-model="form.contactperson"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|E-Mail|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.email"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Telefon|}:</td>
|
||||
<td><input type="text" size="36" v-model.trim="form.phone"></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-4" v-once>
|
||||
<h2>vollst. Adresse</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td>{|Name|}</td>
|
||||
<td>{{form.original.name}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Ansprechpartner|}</td>
|
||||
<td>{{form.original.ansprechpartner}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Abteilung|}</td>
|
||||
<td>{{form.original.abteilung}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Unterabteilung|}</td>
|
||||
<td>{{form.original.unterabteilung}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Adresszusatz|}</td>
|
||||
<td>{{form.original.adresszusatz}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Strasse|}</td>
|
||||
<td>{{form.original.strasse}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|PLZ/Ort|}</td>
|
||||
<td>{{form.original.plz}} {{form.original.ort}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Bundesland|}</td>
|
||||
<td>{{form.original.bundesland}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Land|}</td>
|
||||
<td>{{form.original.land}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<h2>{|Paket|}</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td>{|Gewicht (in kg)|}:</td>
|
||||
<td><input type="text" v-model.number="form.weight"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Höhe (in cm)|}:</td>
|
||||
<td><input type="text" size="10" v-model.number="form.height"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Breite (in cm)|}:</td>
|
||||
<td><input type="text" size="10" v-model.number="form.width"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Länge (in cm)|}:</td>
|
||||
<td><input type="text" size="10" v-model.number="form.length"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Produkt|}:</td>
|
||||
<td>
|
||||
<select v-model="form.product" required>
|
||||
<option v-for="prod in products" :value="prod.Id">{{prod.Name}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="serviceAvailable('premium')">
|
||||
<td>{|Premium|}:</td>
|
||||
<td><input type="checkbox" v-model="form.services.premium"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="clearfix"></div>
|
||||
<div class="col-md-12">
|
||||
<h2>{|Bestellung|}</h2>
|
||||
<table>
|
||||
<tr>
|
||||
<td>{|Bestellnummer|}:</td>
|
||||
<td><input type="text" size="36" v-model="form.order_number"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Rechnungsnummer|}:</td>
|
||||
<td><input type="text" size="36" v-model="form.invoice_number"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Sendungsart|}:</td>
|
||||
<td>
|
||||
<select v-model="form.shipment_type">
|
||||
<option v-for="(value, key) in customs_shipment_types" :value="key">{{value}}</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Versicherungssumme|}:</td>
|
||||
<td><input type="text" size="10" v-model="form.total_insured_value"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<table>
|
||||
<tr>
|
||||
<th>{|Bezeichnung|}</th>
|
||||
<th>{|Menge|}</th>
|
||||
<th>{|HSCode|}</th>
|
||||
<th>{|Herkunftsland|}</th>
|
||||
<th>{|Einzelwert|}</th>
|
||||
<th>{|Einzelgewicht|}</th>
|
||||
<th>{|Gesamtwert|}</th>
|
||||
<th>{|Gesamtgewicht|}</th>
|
||||
<th><a v-on:click="addPosition"><img src="themes/new/images/add.png"></a></
|
||||
</th>
|
||||
</tr>
|
||||
<tr v-for="(pos, index) in form.positions">
|
||||
<td><input type="text" v-model.trim="pos.bezeichnung" required></td>
|
||||
<td><input type="text" v-model.number="pos.menge" required></td>
|
||||
<td><input type="text" v-model.trim="pos.zolltarifnummer"></td>
|
||||
<td><input type="text" v-model.trim="pos.herkunftsland"></td>
|
||||
<td><input type="text" v-model.number="pos.zolleinzelwert"></td>
|
||||
<td><input type="text" v-model.number="pos.zolleinzelgewicht"></td>
|
||||
<td>{{Number(pos.menge*pos.zolleinzelwert || 0).toFixed(2)}}</td>
|
||||
<td>{{Number(pos.menge*pos.zolleinzelgewicht || 0).toFixed(3)}}</td>
|
||||
<td><a v-on:click="deletePosition(index)"><img src="themes/new/images/delete.svg"></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="6"></td>
|
||||
<td>{{total_value.toFixed(2)}}</td>
|
||||
<td>{{total_weight.toFixed(3)}}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div>
|
||||
<input class="btnGreen" type="submit" value="{|Paketmarke drucken|}" name="drucken">
|
||||
<!--<input type="button" value="{|Andere Versandart auswählen|}" name="anders"> -->
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
const createshipmentapp = new Vue({
|
||||
el: '#createshipmentapp',
|
||||
data: [JSON],
|
||||
computed: {
|
||||
total_value() {
|
||||
let sum = 0;
|
||||
for (const pos of this.form.positions) {
|
||||
sum += (pos.menge * pos.zolleinzelwert) || 0;
|
||||
}
|
||||
return sum;
|
||||
},
|
||||
total_weight() {
|
||||
let sum = 0;
|
||||
for (const pos of this.form.positions) {
|
||||
sum += (pos.menge * pos.zolleinzelgewicht) || 0;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
submit: function () {
|
||||
let app = this;
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', location.href, true);
|
||||
xhr.setRequestHeader('Content-Type', 'application/json');
|
||||
xhr.onload = function () {
|
||||
let json = JSON.parse(this.response);
|
||||
app.messages = json.messages;
|
||||
}
|
||||
xhr.send(JSON.stringify($.extend({submit:'print'}, this.form)));
|
||||
},
|
||||
addPosition: function () {
|
||||
this.form.positions.push({});
|
||||
},
|
||||
deletePosition: function (index) {
|
||||
this.form.positions.splice(index, 1);
|
||||
},
|
||||
serviceAvailable: function (service) {
|
||||
if (!this.products.hasOwnProperty(this.form.product))
|
||||
return false;
|
||||
return this.products[this.form.product].AvailableServices.indexOf(service) >= 0;
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
@ -1,84 +0,0 @@
|
||||
<br><br><table id="paketmarketab" align="center">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<br>
|
||||
<form action="" method="post">
|
||||
[ERROR]
|
||||
<h1>Paketmarken Drucker für [ZUSATZ]</h1>
|
||||
<br>
|
||||
<b>Empfänger</b>
|
||||
<br>
|
||||
<br>
|
||||
<table>
|
||||
<tr><td>
|
||||
|
||||
|
||||
<table style="float:left;">
|
||||
<tr><td>Name:</td><td><input type="text" size="36" value="[NAME]" name="name" id="name"><script type="text/javascript">document.getElementById("name").focus(); </script></td></tr>
|
||||
<tr><td>Name 2:</td><td><input type="text" size="36" value="[NAME2]" name="name2"></td></tr>
|
||||
<tr><td>Name 3:</td><td><input type="text" size="36" value="[NAME3]" name="name3"></td></tr>
|
||||
<tr><td>Land:</td><td>[EPROO_SELECT_LAND]</td></tr>
|
||||
<tr><td>PLZ/ort:</td><td><input type="text" name="plz" size="5" value="[PLZ]"> <input type="text" size="30" name="ort" value="[ORT]"></td></tr>
|
||||
<tr><td>Strasse/Hausnummer:</td><td><input type="text" size="30" value="[STRASSE]" name="strasse"> <input type="text" size="5" name="hausnummer" value="[HAUSNUMMER]"></td></tr>
|
||||
<tr><td>E-Mail:</td><td><input type="text" size="36" value="[EMAIL]" name="email"></td></tr>
|
||||
<tr><td>Telefon:</td><td><input type="text" size="36" value="[TELEFON]" name="telefon"></td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<table style="float:left;">
|
||||
<!--<tr><td width="180">Anzahl Pakete:</td><td nowrap><input type="text" name="anzahl" size="5" value="[ANZAHL]" id="anzahl"> <input type="button" onclick=window.location.href="index.php?module=versanderzeugen&action=frankieren&id=[ID]&land=[LAND]&anzahl="+document.getElementById('anzahl').value value="erstellen"></td></tr>-->
|
||||
[GEWICHT]
|
||||
<!--<tr><td>Foto:</td><td><img src="http://t3.gstatic.com/images?q=tbn:QTV_X4YJEI2p7M:http://notebook.pege.org/2005-inode/paket.jpg"></td></tr>
|
||||
<tr><td></td><td><input type="button" value="Nochmal Wiegen+Foto"></td></tr>-->
|
||||
</table>
|
||||
<!--
|
||||
<table>
|
||||
<tr><td>Gewicht:</td><td><input type="text" size="5"></td></tr>
|
||||
<tr><td>Foto:</td><td><img src="http://t3.gstatic.com/images?q=tbn:QTV_X4YJEI2p7M:http://notebook.pege.org/2005-inode/paket.jpg"></td></tr>
|
||||
<tr><td></td><td><input type="button" value="Nochmal Wiegen+Foto"></td></tr>
|
||||
</table>
|
||||
-->
|
||||
</tr>
|
||||
</table>
|
||||
<br><br>
|
||||
|
||||
<table align="center">
|
||||
<tr><td colspan="2"><b>Service</b></td></tr>
|
||||
<tr><td>Nachnahme:</td><td style="min-width:200px;"><input type="checkbox" name="nachnahme" value="1" [NACHNAHME]> (Betrag: [BETRAG] EUR)<input type="hidden" name="betrag" value="[BETRAG]"></td></tr>
|
||||
<!--<tr><td>Versichert 2500 EUR:</td><td><input type="checkbox" name="versichert" value="1" [VERSICHERT]></td></tr>
|
||||
<tr><td>Versichert 25000 EUR:</td><td><input type="checkbox" name="extraversichert" value="1" [EXTRAVERSICHERT]></td></tr>-->
|
||||
<tr><td nowrap>Extra Versicherung:</td><td><input type="checkbox" name="versichert" value="1" [VERSICHERT] /></td></tr>
|
||||
<tr class="versicherung"><td>Versicherungssumme:</td><td><input type="text" size="10" id="versicherungssumme" name="versicherungssumme" value="[VERSICHERUNGSSUMME]" /></td></tr>
|
||||
<tr><td>Leitcodierung:</td><td style="min-width:200px;"><input type="checkbox" name="leitcodierung" value="1" [LEITCODIERUNG]> <i>ohne Leitcodierung können extra Kosten entstehen</i></td></tr>
|
||||
<tr><td>Abholdatum:</td><td><input type="text" size="10" id="abholdatum" name="abholdatum" value="[ABHOLDATUM]" /></td></tr>
|
||||
<tr><td>Wunschtermin:</td><td><input type="checkbox" name="wunschtermin" value="1" [WUNSCHTERMIN] /></td></tr>
|
||||
<tr class="wunschzeitraum"><td>Wunschlieferdatum:</td><td><input type="text" size="10" id="wunschlieferdatum" name="wunschlieferdatum" value="[WUNSCHLIEFERDATUM]" /></td></tr>
|
||||
<tr class="wunschzeitraum"><td>Wunschlieferzeitraum:</td>
|
||||
<td><!--<input type="radio" name="wunschzeitraum" id="wunsch10001200" value="10001200" [WUNSCH10001200] /> 10:00 - 12:00
|
||||
<input type="radio" name="wunschzeitraum" id="wunsch12001400" value="12001400" [WUNSCH12001400] /> 12:00 - 14:00
|
||||
<input type="radio" name="wunschzeitraum" id="wunsch14001600" value="14001600" [WUNSCH14001600] /> 14:00 - 16:00
|
||||
<input type="radio" name="wunschzeitraum" id="wunsch16001800" value="16001800" [WUNSCH16001800] /> 16:00 - 18:00 -->
|
||||
<input type="radio" name="wunschzeitraum" id="wunsch18002000" value="18002000" [WUNSCH18002000] /> 18:00 - 20:00
|
||||
<input type="radio" name="wunschzeitraum" id="wunsch19002100" value="19002100" [WUNSCH19002100] /> 19:00 - 21:00
|
||||
</td></tr>
|
||||
[VORRETOURENLABEL]<tr><td nowrap>Retourenlabel drucken:</td><td><input type="checkbox" value="1" id="retourenlabel" name="retourenlabel" [RETOURENLABEL] /></td></tr>[NACHRETOURENLABEL]
|
||||
[VORALTERSFREIGABE]<tr><td nowrap>Altersfreigabe notwendig:</td><td><input type="checkbox" name="altersfreigabe" value="1" [ALTERSFREIGABE]></td></tr>[NACHALTERSFREIGABE]
|
||||
</table>
|
||||
<br><br>
|
||||
<center><input class="btnGreen" type="submit" value="Paketmarke drucken" name="drucken">
|
||||
|
||||
[TRACKINGMANUELL]
|
||||
<input type="button" value="{|Andere Versandart auswählen|}" onclick="window.location.href='index.php?module=versanderzeugen&action=wechsel&id=[ID]'" name="anders">
|
||||
<!--<input type="button" value="Abbrechen">--></center>
|
||||
</form>
|
||||
</td></tr></table>
|
||||
<br><br>
|
||||
|
||||
<script type="text/JavaScript" language="javascript">
|
||||
$(document).ready(function() {
|
||||
$( "#abholdatum" ).datepicker({ dateFormat: 'dd.mm.yy',dayNamesMin: ['SO', 'MO', 'DI', 'MI', 'DO', 'FR', 'SA'], firstDay:1,
|
||||
showWeek: true, monthNames: ['Januar', 'Februar', 'März', 'April', 'Mai',
|
||||
'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'], });
|
||||
});
|
||||
</script>
|
@ -1,79 +0,0 @@
|
||||
<br><br><table id="paketmarketab" align="center">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<br>
|
||||
<form action="" method="post">
|
||||
[ERROR]
|
||||
<h1>{|Paketmarken Drucker für|} [ZUSATZ]</h1>
|
||||
<br>
|
||||
<b>{|Empfänger|}</b>
|
||||
<br>
|
||||
<br>
|
||||
<table>
|
||||
<tr><td>
|
||||
|
||||
|
||||
<table style="float:left;">
|
||||
<tr><td>{|Name|}:</td><td><input type="text" size="36" value="[NAME]" name="name" id="name"><script type="text/javascript">document.getElementById("name").focus(); </script></td></tr>
|
||||
<tr><td>{|Name 2|}:</td><td><input type="text" size="36" value="[NAME2]" name="name2"></td></tr>
|
||||
<tr><td>{|Name 3|}:</td><td><input type="text" size="36" value="[NAME3]" name="name3"></td></tr>
|
||||
|
||||
<tr><td>{|Land|}:</td><td>[EPROO_SELECT_LAND]</td></tr>
|
||||
<tr><td>{|PLZ/Ort|}:</td><td><input type="text" name="plz" size="5" value="[PLZ]"> <input type="text" size="30" name="ort" value="[ORT]"></td></tr>
|
||||
<tr><td>{|Strasse/Hausnummer|}:</td><td><input type="text" size="30" value="[STRASSE]" name="strasse"> <input type="text" size="5" name="hausnummer" value="[HAUSNUMMER]"></td></tr>
|
||||
|
||||
<tr><td>{|E-Mail|}:</td><td><input type="text" size="36" value="[EMAIL]" name="email"></td></tr>
|
||||
<tr><td>{|Telefon|}:</td><td><input type="text" size="36" value="[TELEFON]" name="telefon"></td></tr>
|
||||
|
||||
[PRODUCT_LIST]
|
||||
|
||||
|
||||
<tr style="[VERSTECKEN]"><td colspan="2"> </td></tr>
|
||||
<tr id="us-states" style="[VERSTECKEN]"><td>{|Bundesland|}:</td><td>[EPROO_SELECT_BUNDESSTAAT]</td></tr>
|
||||
<tr id="states" style="[VERSTECKEN]"><td>{|Bundesland|}:</td><td><input type="text" size="36" value="[BUNDESLAND]" name="state"></td></tr>
|
||||
<tr style="[VERSTECKEN]"><td>{|Rechnungsnummer|}:</td><td><input type="text" size="36" value="[RECHNUNGSNUMMER]" name="rechnungsnummer"></td></tr>
|
||||
<tr style="[VERSTECKEN]"><td>{|Sendungsart|}:</td><td><select name="sendungsart">
|
||||
<option value="0">{|Geschenk|}</option>
|
||||
<option value="1">{|Dokumente|}</option>
|
||||
<option value="2" selected>{|Kommerzielle Waren|}</option>
|
||||
<option value="3">{|Erprobungswaren|}</option>
|
||||
<option value="4">{|Rücksendung|}</option>
|
||||
</select></td></tr>
|
||||
<tr><td nowrap>{|Extra Versicherung|}:</td><td><input type="checkbox" name="versichert" value="1" [VERSICHERT] /></td></tr>
|
||||
<tr class="versicherung"><td>{|Versicherungssumme|}:</td><td><input type="text" size="10" id="versicherungssumme" name="versicherungssumme" value="[VERSICHERUNGSSUMME]" /></td></tr>
|
||||
</table>
|
||||
|
||||
<table style="float:right;">
|
||||
[GEWICHT]
|
||||
<tr>
|
||||
<td>{|Höhe (in cm)|}:</td>
|
||||
<td>
|
||||
<input type="text" size="10" value="[HEIGHT]" name="height">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Breite (in cm)|}:</td>
|
||||
<td>
|
||||
<input type="text" size="10" value="[WIDTH]" name="width">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Länge (in cm)|}:</td>
|
||||
<td>
|
||||
<input type="text" size="10" value="[LENGTH]" name="length">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="clear:both"></div>
|
||||
|
||||
<br><br>
|
||||
<center><input class="btnGreen" type="submit" value="{|Paketmarke drucken|}" name="drucken">
|
||||
[TRACKINGMANUELL]
|
||||
<input type="button" value="{|Andere Versandart auswählen|}" onclick="window.location.href='index.php?module=versanderzeugen&action=wechsel&id=[ID]'" name="anders">
|
||||
<!--<input type="button" value="Abbrechen">--></center>
|
||||
</td></tr></table>
|
||||
</form>
|
||||
|
||||
<br><br>
|
||||
</td></tr></table>
|
@ -1,69 +0,0 @@
|
||||
<br><br><table id="paketmarketab" align="center">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<br>
|
||||
<form action="" method="post">
|
||||
[ERROR]
|
||||
<h1>Paketmarken Drucker für [ZUSATZ]</h1>
|
||||
<br>
|
||||
<b>Empfänger</b>
|
||||
<br>
|
||||
<br>
|
||||
<table>
|
||||
<tr><td>
|
||||
|
||||
|
||||
<table style="float:left;">
|
||||
<tr><td>Name:</td><td><input type="text" size="36" value="[NAME]" name="name" id="name"><script type="text/javascript">document.getElementById("name").focus(); </script></td></tr>
|
||||
<tr><td>Name 2:</td><td><input type="text" size="36" value="[NAME2]" name="name2"></td></tr>
|
||||
<tr><td>p. Adr.:</td><td><input type="text" size="36" value="[NAME3]" name="name3"></td></tr>
|
||||
|
||||
|
||||
<tr><td>Land:</td><td>[EPROO_SELECT_LAND]</td></tr>
|
||||
<tr><td>PLZ/Ort:</td><td><input type="text" name="plz" size="5" value="[PLZ]"> <input type="text" size="30" name="ort" value="[ORT]"></td></tr>
|
||||
<tr><td>Strasse/Hausnummer:</td><td><input type="text" size="30" value="[STRASSE]" name="strasse"> <input type="text" size="5" name="hausnummer" value="[HAUSNUMMER]"></td></tr>
|
||||
|
||||
<tr><td>E-Mail:</td><td><input type="text" size="36" value="[EMAIL]" name="email"></td></tr>
|
||||
<tr><td>Telefon:</td><td><input type="text" size="36" value="[TELEFON]" name="telefon"></td></tr>
|
||||
</table>
|
||||
|
||||
|
||||
<table style="float:right;">
|
||||
[GEWICHT]
|
||||
<tr>
|
||||
<td>Höhe (in cm):</td>
|
||||
<td>
|
||||
<input type="text" size="10" value="[HEIGHT]" name="height">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Breite (in cm):</td>
|
||||
<td>
|
||||
<input type="text" size="10" value="[WIDTH]" name="width">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Länge (in cm):</td>
|
||||
<td>
|
||||
<input type="text" size="10" value="[LENGTH]" name="length">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div style="clear:both"></div>
|
||||
<!-- <br><br>
|
||||
<table align="center">
|
||||
<tr><td colspan="2"><b>Service</b></td></tr>
|
||||
<tr><td>Nachnahme:</td><td><input type="checkbox" name="nachnahme" value="1" [NACHNAHME]> (Betrag: [BETRAG] EUR)<input type="hidden" name="betrag" value="[BETRAG]"></td></tr>
|
||||
</table>-->
|
||||
|
||||
<br><br>
|
||||
<center><input class="btnGreen" type="submit" value="Paketmarke drucken" name="drucken">
|
||||
[TRACKINGMANUELL]
|
||||
<input type="button" value="{|Andere Versandart auswählen|}" onclick="window.location.href='index.php?module=versanderzeugen&action=wechsel&id=[ID]'" name="anders">
|
||||
<!--<input type="button" value="Abbrechen">--></center>
|
||||
</td></tr></table>
|
||||
</form>
|
||||
|
||||
<br><br>
|
||||
</td></tr></table>
|
@ -1,19 +0,0 @@
|
||||
<br><br><table id="paketmarketab" align="center">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<br>
|
||||
<form action="" method="post">
|
||||
[ERROR]
|
||||
<h1>[ZUSATZ]</h1>
|
||||
<!--<br>
|
||||
<h3 style="color:red;">Beim Versand ins Ausland mit UPS müssen die Felder <b>Name</b>, <b>Name 2</b> und <b>Telefon</b> ausgefüllt werden!</h3>-->
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<center><input class="btnGreen" type="submit" value="{|Weiter|}" name="drucken">
|
||||
|
||||
<input type="button" value="{|Andere Versandart auswählen|}" onclick="window.location.href='index.php?module=versanderzeugen&action=wechsel&id=[ID]'" name="anders">
|
||||
<!--<input type="button" value="Abbrechen">--></center>
|
||||
</form>
|
||||
</td></tr></table>
|
||||
<br><br>
|
@ -1,691 +1,222 @@
|
||||
<?php
|
||||
|
||||
use Xentral\Components\Database\Database;
|
||||
use Xentral\Components\Http\JsonResponse;
|
||||
use Xentral\Modules\Dhl\Api\DhlApi;
|
||||
use Xentral\Modules\Dhl\Content\PackageContent;
|
||||
use Xentral\Modules\Dhl\Exception\DhlBaseException;
|
||||
use Xentral\Modules\Dhl\Exception\InvalidCredentialsException;
|
||||
use Xentral\Modules\Dhl\Exception\InvalidRequestDataException;
|
||||
use Xentral\Modules\Dhl\Exception\UnknownProductException;
|
||||
use Xentral\Modules\Dhl\Factory\DhlApiFactory;
|
||||
use Xentral\Modules\Dhl\Request\CreateInterationalShipmentRequest;
|
||||
use Xentral\Modules\Dhl\Request\CreateNationalShipmentRequest;
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
require_once dirname(__DIR__) . '/class.versanddienstleister.php';
|
||||
use Xentral\Carrier\Dhl\Data\Communication;
|
||||
use Xentral\Carrier\Dhl\Data\Country;
|
||||
use Xentral\Carrier\Dhl\Data\CreateShipmentOrderResponse;
|
||||
use Xentral\Carrier\Dhl\Data\PackStation;
|
||||
use Xentral\Carrier\Dhl\Data\Postfiliale;
|
||||
use Xentral\Carrier\Dhl\Data\ReceiverNativeAddress;
|
||||
use Xentral\Carrier\Dhl\Data\Shipment;
|
||||
use Xentral\Carrier\Dhl\Data\ShipmentItem;
|
||||
use Xentral\Carrier\Dhl\DhlApi;
|
||||
use Xentral\Modules\ShippingMethod\Model\CreateShipmentResult;
|
||||
use Xentral\Modules\ShippingMethod\Model\Product;
|
||||
|
||||
class Versandart_dhl extends Versanddienstleister
|
||||
{
|
||||
require_once(dirname(__DIR__).'/class.versanddienstleister.php');
|
||||
class Versandart_dhl extends Versanddienstleister{
|
||||
|
||||
private $einstellungen;
|
||||
|
||||
private $info;
|
||||
|
||||
private $credentials;
|
||||
|
||||
public $paketmarke_drucker;
|
||||
public $export_drucker;
|
||||
|
||||
public $errors;
|
||||
|
||||
public $name;
|
||||
protected $voucherId;
|
||||
|
||||
/**
|
||||
* Versandart_internetmarke constructor.
|
||||
*
|
||||
* @param ApplicationCore $app
|
||||
* @param int $id
|
||||
*/
|
||||
function __construct($app, $id)
|
||||
public function GetName():string
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->app = $app;
|
||||
$einstellungenArr = $this->app->DB->SelectRow("SELECT einstellungen_json,paketmarke_drucker,export_drucker FROM versandarten WHERE id = '$id' LIMIT 1");
|
||||
$einstellungen_json = $einstellungenArr['einstellungen_json'];
|
||||
$this->paketmarke_drucker = $einstellungenArr['paketmarke_drucker'];
|
||||
$this->export_drucker = $einstellungenArr['export_drucker'];
|
||||
|
||||
$this->name = 'DHL 3.0';
|
||||
if($einstellungen_json){
|
||||
$this->einstellungen = json_decode($einstellungen_json, true);
|
||||
}else{
|
||||
$this->einstellungen = [];
|
||||
}
|
||||
$this->errors = [];
|
||||
return 'DHL';
|
||||
}
|
||||
|
||||
function ShowUserdata()
|
||||
{
|
||||
if(isset($this->app->Conf->WFuserdata)){
|
||||
return 'Userdata-Ordner: ' . $this->app->Conf->WFuserdata;
|
||||
}
|
||||
}
|
||||
|
||||
public function Einstellungen($target = 'return')
|
||||
{
|
||||
if($this->app->Secure->GetPOST('testen')){
|
||||
$parameter1 = $this->einstellungen['pfad'];
|
||||
if($parameter1){
|
||||
if(is_dir($parameter1)){
|
||||
if(substr($parameter1, -1) !== '/'){
|
||||
$parameter1 .= '/';
|
||||
}
|
||||
|
||||
if(file_put_contents($parameter1 . 'wawision_test.txt', 'TEST')){
|
||||
$this->app->Tpl->Add('MESSAGE',
|
||||
'<div class="info">Datei ' . $parameter1 . 'wawision_test.txt' . ' wurde erstellt!</div>');
|
||||
}else{
|
||||
$this->app->Tpl->Add('MESSAGE', '<div class="error">Datei konnte nicht angelegt werden!</div>');
|
||||
}
|
||||
}else{
|
||||
$this->app->Tpl->Add('MESSAGE',
|
||||
'<div class="error">Speicherort existiert nicht oder ist nicht erreichbar!</div>');
|
||||
}
|
||||
}else{
|
||||
$this->app->Tpl->Add('MESSAGE', '<div class="error">Bitte einen Speicherort angeben!</div>');
|
||||
}
|
||||
}
|
||||
|
||||
parent::Einstellungen($target);
|
||||
}
|
||||
|
||||
//TODO ....
|
||||
|
||||
/*function Trackinglink($tracking, &$notsend, &$link, &$rawlink)
|
||||
{
|
||||
$notsend = 0;
|
||||
//$rawlink = 'https://tracking.dpd.de/parcelstatus/?locale=de_DE&query='.$tracking;
|
||||
$rawlink = ' https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DE03/DE/5004.htm?txtRefNo='.$tracking.'&txtAction=71000';
|
||||
$link = 'GLS Versand: '.$tracking.' ('.$rawlink.')';
|
||||
}*/
|
||||
|
||||
public function GetBezeichnung()
|
||||
{
|
||||
return 'DHL 3.0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
*/
|
||||
public function getCreateForm()
|
||||
public function AdditionalSettings(): array
|
||||
{
|
||||
return [
|
||||
[
|
||||
'id' => 0,
|
||||
'name' => 'usernameGroup',
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => 'Benutzername',
|
||||
'type' => 'text',
|
||||
'name' => 'dhl_username',
|
||||
'validation' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'id' => 1,
|
||||
'name' => 'passwordGroup',
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => 'Passwort',
|
||||
'type' => 'text',
|
||||
'name' => 'dhl_password',
|
||||
'validation' => true,
|
||||
]
|
||||
],
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'name' => 'accountNumberGroup',
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => 'Abrechnungsnummer',
|
||||
'type' => 'text',
|
||||
'name' => 'dhl_accountnumber',
|
||||
'validation' => true,
|
||||
]
|
||||
],
|
||||
]
|
||||
'user' => array('typ' => 'text', 'bezeichnung' => 'Benutzer:', 'info' => 'geschaeftskunden_api (Versenden/Intraship-Benutzername)'),
|
||||
'signature' => array('typ' => 'text', 'bezeichnung' => 'Signature:', 'info' => 'Dhl_ep_test1 (Versenden/IntrashipPasswort)'),
|
||||
'ekp' => array('typ' => 'text', 'bezeichnung' => 'EKP', 'info' => '5000000000 (gültige DHL Kundennummer)'),
|
||||
'accountnumber' => array('typ' => 'text', 'bezeichnung' => 'Abrechnungsnummer Paket:'),
|
||||
'accountnumber_int' => array('typ' => 'text', 'bezeichnung' => 'Abrechnungsnummer Paket International:'),
|
||||
'accountnumber_euro' => array('typ' => 'text', 'bezeichnung' => 'Abrechnungsnummer Europaket:'),
|
||||
'accountnumber_connect' => array('typ' => 'text', 'bezeichnung' => 'Abrechnungsnummer Paket Connect:'),
|
||||
'accountnumber_wp' => array('typ' => 'text', 'bezeichnung' => 'Abrechnungsnummer Warenpost:'),
|
||||
'accountnumber_wpint' => array('typ' => 'text', 'bezeichnung' => 'Abrechnungsnummer Warenpost International:'),
|
||||
// 'intraship_retourenaccount' => array('typ' => 'text', 'bezeichnung' => 'Retouren Account:', 'info' => '14 Stellige DHL-Retoure Abrechnungsnummer'),
|
||||
// 'intraship_retourenlabel' => array('typ' => 'checkbox', 'bezeichnung' => 'Vorauswahl Retourenlabel:', 'info' => 'Druckt Retourenlabel mit'),
|
||||
|
||||
'sender_name1' => array('typ' => 'text', 'bezeichnung' => 'Versender Firma:'),
|
||||
'sender_street' => array('typ' => 'text', 'bezeichnung' => 'Versender Strasse:'),
|
||||
'sender_streetnumber' => array('typ' => 'text', 'bezeichnung' => 'Versender Strasse Nr.:'),
|
||||
'sender_zip' => array('typ' => 'text', 'bezeichnung' => 'Versender PLZ:'),
|
||||
'sender_city' => array('typ' => 'text', 'bezeichnung' => 'Versender Stadt:'),
|
||||
'sender_country' => array('typ' => 'text', 'bezeichnung' => 'Versender ISO Code:', 'info' => 'DE'),
|
||||
'sender_email' => array('typ' => 'text', 'bezeichnung' => 'Versender E-Mail:'),
|
||||
'sender_phone' => array('typ' => 'text', 'bezeichnung' => 'Versender Telefon:'),
|
||||
'sender_web' => array('typ' => 'text', 'bezeichnung' => 'Versender Web:'),
|
||||
'sender_contact_person' => array('typ' => 'text', 'bezeichnung' => 'Versender Ansprechpartner:'),
|
||||
|
||||
'cod_account_owner' => array('typ' => 'text', 'bezeichnung' => 'Nachnahme Kontoinhaber:'),
|
||||
'cod_bank_name' => array('typ' => 'text', 'bezeichnung' => 'Nachnahme Bank Name:'),
|
||||
'cod_account_iban' => array('typ' => 'text', 'bezeichnung' => 'Nachnahme IBAN:'),
|
||||
'cod_account_bic' => array('typ' => 'text', 'bezeichnung' => 'Nachnahme BIC:'),
|
||||
'cod_extra_fee' => array('typ' => 'text', 'bezeichnung' => 'Nachnahme Gebühr:', 'info' => 'z.B. 2,00 wird auf Rechnungsbetrag addiert, da DHL dies als extra Gebühr für sich behält'),
|
||||
|
||||
'weight' => array('typ' => 'text', 'bezeichnung' => 'Standard Gewicht:', 'info' => 'in KG'),
|
||||
'length' => array('typ' => 'text', 'bezeichnung' => 'Standard Länge:', 'info' => 'in cm'),
|
||||
'width' => array('typ' => 'text', 'bezeichnung' => 'Standard Breite:', 'info' => 'in cm'),
|
||||
'height' => array('typ' => 'text', 'bezeichnung' => 'Standard Höhe:', 'info' => 'in cm'),
|
||||
|
||||
'product' => array('typ' => 'text', 'bezeichnung' => 'Standard Produkt:', 'info' => 'z.B. in DE: V01PAK oder AT: V86PARCEL'),
|
||||
'use_premium' => array('typ' => 'checkbox', 'bezeichnung' => 'Premiumversand verwenden:'),
|
||||
/*
|
||||
'intraship_vorausverfuegung' => array('typ' => 'select', 'bezeichnung' => 'Vorausverfügung: ', 'optionen' => array('-' => 'keine Vorausverfügung', 'IMMEDIATE' => 'Sofortige Rücksendung an den Absender', 'AFTER_DEADLINE' => 'Rücksenden an den Absender nach Ablauf der Frist', 'ABANDONMENT' => 'Preisgabe des Pakets durch den Absender (entgeltfrei)')),
|
||||
|
||||
'sperrgut' => array('typ' => 'checkbox', 'bezeichnung' => 'Sperrgut:'),
|
||||
'keineversicherung' => array('typ' => 'checkbox', 'bezeichnung' => 'Extra Versicherung ausschalten:', 'info' => 'Option muss von Hand im Paketmarkendialog gesetzt werden.'),
|
||||
'leitcodierung' => array('typ' => 'checkbox', 'bezeichnung' => 'Leitcodierung aktivieren:'),
|
||||
'use_shipping_article_from_order_on_export' => ['typ' => 'checkbox', 'bezeichnung' => 'Bei Export Porto aus Auftrag senden:'],
|
||||
'autotracking' => array('typ' => 'checkbox', 'bezeichnung' => 'Tracking übernehmen:'),
|
||||
'log' => array('typ' => 'checkbox', 'bezeichnung' => 'Logging')*/
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $postData
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function updatePostDataForAssistent($postData): array
|
||||
public function CreateShipment(object $json, array $address): CreateShipmentResult
|
||||
{
|
||||
$name = $this->app->erp->Firmendaten('name');
|
||||
$street = $this->app->erp->Firmendaten('strasse');
|
||||
$zip = $this->app->erp->Firmendaten('plz');
|
||||
$city = $this->app->erp->Firmendaten('ort');
|
||||
$country = $this->app->erp->Firmendaten('land');
|
||||
$houseNo = '';
|
||||
|
||||
$streetParts = explode(' ', $street);
|
||||
$partsCount = count($streetParts);
|
||||
|
||||
if($partsCount >= 2){
|
||||
$street = implode(' ', array_slice($streetParts, 0, $partsCount - 1));
|
||||
$houseNo = $streetParts[$partsCount - 1];
|
||||
$shipment = new Shipment();
|
||||
$shipment->ShipmentDetails->product = $json->product;
|
||||
$shipment->ShipmentDetails->accountNumber = $this->GetAccountNumber($json->product);
|
||||
$shipment->ShipmentDetails->SetShipmentDate(new DateTimeImmutable('today'));
|
||||
$shipment->ShipmentDetails->ShipmentItem = new ShipmentItem();
|
||||
$shipment->ShipmentDetails->ShipmentItem->weightInKG = $json->weight ?? 0;
|
||||
$shipment->ShipmentDetails->ShipmentItem->lengthInCM = $json->length;
|
||||
$shipment->ShipmentDetails->ShipmentItem->widthInCM = $json->width;
|
||||
$shipment->ShipmentDetails->ShipmentItem->heightInCM = $json->height;
|
||||
$shipment->Shipper->Name->name1 = $this->settings->sender_name1 ?? '';
|
||||
$shipment->Shipper->Address->streetName = $this->settings->sender_street ?? '';
|
||||
$shipment->Shipper->Address->streetNumber = $this->settings->sender_streetnumber;
|
||||
$shipment->Shipper->Address->zip = $this->settings->sender_zip ?? '';
|
||||
$shipment->Shipper->Address->city = $this->settings->sender_city ?? '';
|
||||
$shipment->Shipper->Address->Origin = Country::Create($this->settings->sender_country ?? 'DE');
|
||||
$shipment->Shipper->Communication = new Communication();
|
||||
$shipment->Shipper->Communication->phone = $this->settings->sender_phone;
|
||||
$shipment->Shipper->Communication->email = $this->settings->sender_email;
|
||||
$shipment->Shipper->Communication->contactPerson = $this->settings->sender_contact_person;
|
||||
$shipment->Receiver->name1 = $json->name;
|
||||
switch ($json->addresstype) {
|
||||
case 0:
|
||||
$shipment->Receiver->Address = new ReceiverNativeAddress();
|
||||
$shipment->Receiver->Address->name2 = $json->name2;
|
||||
$shipment->Receiver->Address->streetName = $json->street ?? '';
|
||||
$shipment->Receiver->Address->streetNumber = $json->streetnumber;
|
||||
$shipment->Receiver->Address->city = $json->city ?? '';
|
||||
$shipment->Receiver->Address->zip = $json->zip ?? '';
|
||||
$shipment->Receiver->Address->Origin = Country::Create($json->country ?? 'DE', $json->state);
|
||||
if (isset($json->address2) && !empty($json->address2))
|
||||
$shipment->Receiver->Address->addressAddition[] = $json->address2;
|
||||
break;
|
||||
case 1:
|
||||
$shipment->Receiver->Packstation = new PackStation();
|
||||
$shipment->Receiver->Packstation->postNumber = $json->postnumber;
|
||||
$shipment->Receiver->Packstation->packstationNumber = $json->parcelstationNumber;
|
||||
$shipment->Receiver->Packstation->city = $json->city ?? '';
|
||||
$shipment->Receiver->Packstation->zip = $json->zip ?? '';
|
||||
$shipment->Receiver->Packstation->Origin = Country::Create($json->country ?? 'DE', $json->state);
|
||||
break;
|
||||
case 2:
|
||||
$shipment->Receiver->Postfiliale = new Postfiliale();
|
||||
$shipment->Receiver->Postfiliale->postNumber = $json->postnumber;
|
||||
$shipment->Receiver->Postfiliale->postfilialeNumber = $json->postofficeNumber;
|
||||
$shipment->Receiver->Postfiliale->city = $json->city ?? '';
|
||||
$shipment->Receiver->Postfiliale->zip = $json->zip ?? '';
|
||||
$shipment->Receiver->Postfiliale->Origin = Country::Create($json->country ?? 'DE', $json->state);
|
||||
break;
|
||||
}
|
||||
$shipment->Receiver->Communication = new Communication();
|
||||
$shipment->Receiver->Communication->email = $json->email;
|
||||
$shipment->Receiver->Communication->phone = $json->phone;
|
||||
$api = new DhlApi($this->settings->user, $this->settings->signature);
|
||||
|
||||
$postData['dhl_origin_name'] = $name;
|
||||
$postData['dhl_origin_street'] = $street;
|
||||
$postData['dhl_origin_houseno'] = $houseNo;
|
||||
$postData['dhl_origin_zip'] = $zip;
|
||||
$postData['dhl_origin_city'] = $city;
|
||||
$postData['dhl_origin_country'] = $country;
|
||||
|
||||
return $postData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JsonResponse|null
|
||||
*/
|
||||
public function AuthByAssistent()
|
||||
{
|
||||
$step = (int)$this->app->Secure->GetPOST('step');
|
||||
if($step == 0){
|
||||
$username = $this->app->Secure->GetPOST('dhl_username');
|
||||
$password = $this->app->Secure->GetPOST('dhl_password');
|
||||
$accountnumber = $this->app->Secure->GetPOST('dhl_accountnumber');
|
||||
|
||||
$error = null;
|
||||
if(empty($username)){
|
||||
$error = 'Bitte Nutzernamen eingeben';
|
||||
}else if(empty($password)){
|
||||
$error = 'Bitte Passwort eingeben';
|
||||
}else if(empty($accountnumber)){
|
||||
$error = 'Bitte Abrechnungsnummer eingeben';
|
||||
}
|
||||
|
||||
if($error != null) {
|
||||
return new JsonResponse(
|
||||
['error' => $error],
|
||||
JsonResponse::HTTP_BAD_REQUEST
|
||||
);
|
||||
}
|
||||
|
||||
try{
|
||||
$this->testCredentials($username, $password, $accountnumber);
|
||||
}catch (DhlBaseException $e){
|
||||
return new JsonResponse(
|
||||
['error' => $e->getMessage()],
|
||||
JsonResponse::HTTP_BAD_REQUEST
|
||||
);
|
||||
}
|
||||
$ret = new CreateShipmentResult();
|
||||
$result = $api->CreateShipment($shipment);
|
||||
if (!$result instanceof CreateShipmentOrderResponse) {
|
||||
$ret->Errors[] = $result;
|
||||
return $ret;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getStructureDataForClickByClickSave(): array
|
||||
{
|
||||
return $this->updatePostDataForAssistent([]);
|
||||
}
|
||||
|
||||
function EinstellungenStruktur()
|
||||
{
|
||||
if(!empty($this->einstellungen['dhl_username']) && !empty($this->einstellungen['dhl_password'])){
|
||||
try{
|
||||
$this->testCredentials($this->einstellungen['dhl_username'], $this->einstellungen['dhl_password'], $this->einstellungen['dhl_accountnumber']);
|
||||
$this->app->Tpl->Set('MESSAGE', '<div class="info">Zugangsdaten erfolgreich überprüft</div>');
|
||||
}catch (DhlBaseException $e){
|
||||
$this->app->Tpl->Set('MESSAGE', '<div class="error">' . $e->getMessage() . '</div>');
|
||||
}
|
||||
if ($result->Status->statusCode === 0) {
|
||||
$ret->Success = true;
|
||||
$ret->TrackingNumber = $result->CreationState->shipmentNumber;
|
||||
$ret->TrackingUrl = sprintf('https://www.dhl.de/de/privatkunden/pakete-empfangen/verfolgen.html?piececode=%s', $ret->TrackingNumber);
|
||||
if (isset($result->CreationState->LabelData->labelData))
|
||||
$ret->Label = base64_decode($result->CreationState->LabelData->labelData);
|
||||
if (isset($result->CreationState->LabelData->exportLabelData))
|
||||
$ret->ExportDocuments = base64_decode($result->CreationState->LabelData->exportLabelData);
|
||||
} else if (isset($result->CreationState)) {
|
||||
if (is_array($result->CreationState->LabelData->Status->statusMessage))
|
||||
$ret->Errors = $result->CreationState->LabelData->Status->statusMessage;
|
||||
else
|
||||
$ret->Errors[] = $result->CreationState->LabelData->Status->statusMessage;
|
||||
} else {
|
||||
$ret->Errors[] = $result->Status->statusText;
|
||||
}
|
||||
|
||||
|
||||
|
||||
return [
|
||||
'dhl_username' => ['typ' => 'text', 'bezeichnung' => 'Benutzername:'],
|
||||
'dhl_password' => ['typ' => 'text', 'bezeichnung' => 'Passwort:'],
|
||||
'dhl_accountnumber' => ['typ' => 'text', 'bezeichnung' => 'Abrechnungsnummer:'],
|
||||
'dhl_origin_name' => ['typ' => 'text', 'bezeichnung' => 'Versender Name:'],
|
||||
'dhl_origin_street' => ['typ' => 'text', 'bezeichnung' => 'Versender Strasse:'],
|
||||
'dhl_origin_houseno' => ['typ' => 'text', 'bezeichnung' => 'Versender Hausnummer:'],
|
||||
'dhl_origin_city' => ['typ' => 'text', 'bezeichnung' => 'Versender Ort:'],
|
||||
'dhl_origin_zip' => ['typ' => 'text', 'bezeichnung' => 'Versender PLZ:'],
|
||||
'dhl_origin_country' => ['typ' => 'text', 'bezeichnung' => 'Versender Land (2-stellig):'],
|
||||
'dhl_origin_email' => ['typ' => 'text', 'bezeichnung' => 'Versender Email:'],
|
||||
|
||||
'dhl_height' => ['typ' => 'text', 'bezeichnung' => 'Standardhöhe'],
|
||||
'dhl_width' => ['typ' => 'text', 'bezeichnung' => 'Standardbreite'],
|
||||
'dhl_length' => ['typ' => 'text', 'bezeichnung' => 'Standardlänge'],
|
||||
|
||||
'dhl_export_product_type' => [
|
||||
'typ' => 'select',
|
||||
'bezeichnung' => 'Export Producttyp',
|
||||
'optionen' => [
|
||||
'PRESENT' => 'Geschenke',
|
||||
'COMMERCIAL_SAMPLE' => 'Kommerzielle Probe',
|
||||
'DOCUMENT' => 'Dokumente',
|
||||
'RETURN_OF_GOODS' => 'Rücksendungen',
|
||||
'OTHER' => 'Andere',
|
||||
]
|
||||
],
|
||||
'dhl_export_product_type_description' => [
|
||||
'typ' => 'text',
|
||||
'bezeichnung' => 'Beschreibung im Falle von "Andere"'
|
||||
],
|
||||
|
||||
'dhl_product' => [
|
||||
'typ' => 'select',
|
||||
'bezeichnung' => 'Produkt:',
|
||||
'optionen' => [
|
||||
'V01PAK' => 'Paket national',
|
||||
'V53WPAK' => 'Paket international'
|
||||
],
|
||||
],
|
||||
'dhl_coding' => ['typ' => 'checkbox', 'bezeichnung' => 'Leitcodierung aktivieren'],
|
||||
'autotracking' => ['typ' => 'checkbox', 'bezeichnung' => 'Tracking übernehmen:'],
|
||||
];
|
||||
}
|
||||
|
||||
public function testCredentials($username, $password, $accountNumber){
|
||||
/** @var DhlApiFactory $dhlApiFactory */
|
||||
$dhlApiFactory = $this->app->Container->get('DhlApiFactory');
|
||||
|
||||
/** @var DhlApi $dhlApi */
|
||||
$dhlApi = $dhlApiFactory->createProductionInstance(
|
||||
$username,
|
||||
$password,
|
||||
$accountNumber,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
''
|
||||
);
|
||||
|
||||
try {
|
||||
$dhlApi->validateShipment(new CreateNationalShipmentRequest(
|
||||
date("Y-m-d"),
|
||||
1.0,
|
||||
10,
|
||||
20,
|
||||
30,
|
||||
"Max muster",
|
||||
'',
|
||||
'',
|
||||
'Teststr. 1',
|
||||
'11',
|
||||
'86153',
|
||||
'Augsburg',
|
||||
'DE',
|
||||
'max.muster@xentral.com',
|
||||
false
|
||||
));
|
||||
}catch (InvalidRequestDataException $e){
|
||||
// do nothing, test data is invalid
|
||||
}
|
||||
}
|
||||
|
||||
public function PaketmarkeDrucken($id, $sid)
|
||||
{
|
||||
$adressdaten = $this->GetAdressdaten($id, $sid);
|
||||
$ret = $this->Paketmarke($sid, $id, '', false, $adressdaten);
|
||||
if($sid === 'lieferschein'){
|
||||
$deliveryNoteArr = $this->app->DB->SelectRow("SELECT adresse,projekt,versandart,auftragid FROM lieferschein WHERE id = '$id' LIMIT 1");
|
||||
$adresse = $deliveryNoteArr['adresse'];
|
||||
$projekt = $deliveryNoteArr['projekt'];
|
||||
$versandart = $deliveryNoteArr['versandart'];
|
||||
$adressvalidation = 2;
|
||||
if($ret){
|
||||
$adressvalidation = 1;
|
||||
}
|
||||
$tracking = '';
|
||||
if(isset($adressdaten['tracking'])){
|
||||
$tracking = $adressdaten['tracking'];
|
||||
}
|
||||
if(!isset($adressdaten['versandid'])){
|
||||
$adressdaten['versandid'] = $this->app->DB->Select("SELECT id FROM versand WHERE abgeschlossen = 0 AND tracking = '' AND lieferschein = '$id' LIMIT 1");
|
||||
}
|
||||
if(!isset($adressdaten['versandid'])){
|
||||
$this->app->DB->Insert("INSERT INTO versand (versandunternehmen, tracking,
|
||||
versendet_am,abgeschlossen,lieferschein,freigegeben,firma,adresse,projekt,paketmarkegedruckt,adressvalidation)
|
||||
VALUES ($versandart','$tracking',NOW(),1,'$id',1,'1','$adresse','$projekt',1,'$adressvalidation') ");
|
||||
$adressdaten['versandid'] = $this->app->DB->GetInsertID();
|
||||
}elseif($tracking){
|
||||
$this->app->DB->Update("UPDATE versand SET freigegeben = 1, abgeschlossen = 1, tracking =1, paketmarkegedruckt = 1, tracking= '$tracking',adressvalidation = '$adressvalidation', versendet_am = now() WHERE id = '" . $adressdaten['versandid'] . "' LIMIT 1");
|
||||
$this->app->DB->Update("UPDATE versand SET versandunternehmen = versandart WHERE id = '" . $adressdaten['versandid'] . "' AND versandunternehmen = '' LIMIT 1");
|
||||
$this->app->DB->Update("UPDATE versand SET versandunternehmen = '$versandart' WHERE id = '" . $adressdaten['versandid'] . "' AND versandunternehmen = '' LIMIT 1");
|
||||
}
|
||||
$auftragid = $deliveryNoteArr['auftragid'];
|
||||
if($auftragid){
|
||||
$this->app->DB->Update("UPDATE auftrag SET schreibschutz = 1, status = 'abgeschlossen' WHERE id = '$auftragid' AND status = 'freigegeben' LIMIT 1");
|
||||
}
|
||||
if($adressvalidation == 1){
|
||||
$this->app->erp->LieferscheinProtokoll($id, 'Paketmarke automatisch gedruckt');
|
||||
if($adressdaten['versandid']){
|
||||
return $adressdaten['versandid'];
|
||||
}
|
||||
}elseif($adressvalidation == 2){
|
||||
$this->app->erp->LieferscheinProtokoll($id, 'automatisches Paketmarke Drucken fehlgeschlagen');
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function Paketmarke($doctyp, $docid, $target = '', $error = false, &$adressdaten = null)
|
||||
public function GetShippingProducts(): array
|
||||
{
|
||||
$id = $docid;
|
||||
$sid = $doctyp;
|
||||
if($adressdaten === null){
|
||||
$drucken = $this->app->Secure->GetPOST('drucken');
|
||||
$anders = $this->app->Secure->GetPOST('anders');
|
||||
$tracking_again = $this->app->Secure->GetGET('tracking_again');
|
||||
$module = $this->app->Secure->GetPOST('module');
|
||||
if(empty($module)){
|
||||
$module = $doctyp;
|
||||
}
|
||||
}else{
|
||||
$drucken = 1;
|
||||
$anders = '';
|
||||
$tracking_again = '';
|
||||
$module = $doctyp;
|
||||
$result = [];
|
||||
if ($this->settings->accountnumber) {
|
||||
$result[] = Product::Create('V01PAK', 'DHL Paket')
|
||||
->WithLength(15, 120)
|
||||
->WithWidth(11, 60)
|
||||
->WithHeight(1, 60)
|
||||
->WithWeight(0.01, 31.5);
|
||||
}
|
||||
|
||||
|
||||
/** @var DhlApiFactory $dhlApiFactory */
|
||||
$dhlApiFactory = $this->app->Container->get('DhlApiFactory');
|
||||
|
||||
/** @var DhlApi $dhlApi */
|
||||
$dhlApi = $dhlApiFactory->createProductionInstance(
|
||||
$this->einstellungen['dhl_username'],
|
||||
$this->einstellungen['dhl_password'],
|
||||
$this->einstellungen['dhl_accountnumber'],
|
||||
$this->einstellungen['dhl_origin_name'],
|
||||
$this->einstellungen['dhl_origin_street'],
|
||||
$this->einstellungen['dhl_origin_houseno'],
|
||||
$this->einstellungen['dhl_origin_zip'],
|
||||
$this->einstellungen['dhl_origin_city'],
|
||||
$this->einstellungen['dhl_origin_country'],
|
||||
$this->einstellungen['dhl_origin_email']
|
||||
);
|
||||
|
||||
if($drucken != '' || $tracking_again == '1'){
|
||||
|
||||
if($tracking_again != "1"){
|
||||
$versandId = 0;
|
||||
if($module === 'retoure'){
|
||||
$Query = $this->app->DB->SelectRow("SELECT * FROM retoure where id='$id'");
|
||||
}elseif($module === 'versand'){
|
||||
$versandId = $id;
|
||||
$lieferschein = $this->app->DB->Select("SELECT lieferschein WHERE id = '$id' LIMIT 1");
|
||||
$Query = $this->app->DB->SelectRow("SELECT * FROM lieferschein where id='$lieferschein'");
|
||||
}else{
|
||||
$Query = $this->app->DB->SelectRow("SELECT * FROM lieferschein where id='$id'");
|
||||
}
|
||||
$projekt = $Query['projekt'];
|
||||
$Adresse = $this->app->DB->SelectRow("SELECT * FROM adresse WHERE id='" . $Query['adresse'] . "'");
|
||||
$product = '';
|
||||
$Country = $Query['land'];
|
||||
if($adressdaten === null){
|
||||
$versandmit = $this->app->Secure->GetPOST("versandmit");
|
||||
$trackingsubmit = $this->app->Secure->GetPOST("trackingsubmit");
|
||||
$versandmitbutton = $this->app->Secure->GetPOST("versandmitbutton");
|
||||
$tracking = $this->app->Secure->GetPOST("tracking");
|
||||
$trackingsubmitcancel = $this->app->Secure->GetPOST("trackingsubmitcancel");
|
||||
$retourenlabel = $this->app->Secure->GetPOST("retourenlabel");
|
||||
|
||||
//$Weight = $this->app->Secure->GetPOST("kg1");
|
||||
$Name = $this->app->Secure->GetPOST("name");
|
||||
$Name2 = $this->app->Secure->GetPOST("name2");
|
||||
$Name3 = $this->app->Secure->GetPOST("name3");
|
||||
$Street = $this->app->Secure->GetPOST("strasse");
|
||||
$HouseNo = $this->app->Secure->GetPOST("hausnummer");
|
||||
$ZipCode = $this->app->Secure->GetPOST("plz");
|
||||
$City = $this->app->Secure->GetPOST("ort");
|
||||
$Mail = $this->app->Secure->GetPOST("email");
|
||||
$Phone = $this->app->Secure->GetPOST("phone");
|
||||
$Country = $this->app->Secure->GetPOST("land");
|
||||
$Weight = $this->app->Secure->GetPOST('kg1');
|
||||
|
||||
$height = $this->app->Secure->GetPOST('height');
|
||||
$wigth = $this->app->Secure->GetPOST('width');
|
||||
$length = $this->app->Secure->GetPOST('length');
|
||||
|
||||
$coding = $this->app->Secure->GetPOST('coding') == '1';
|
||||
}else{
|
||||
$versandmit = '';//$this->app->Secure->GetPOST("versandmit");
|
||||
$trackingsubmit = '';//$this->app->Secure->GetPOST("trackingsubmit");
|
||||
$versandmitbutton = '';//$this->app->Secure->GetPOST("versandmitbutton");
|
||||
$tracking = '';//$this->app->Secure->GetPOST("tracking");
|
||||
$trackingsubmitcancel = '';//$this->app->Secure->GetPOST("trackingsubmitcancel");
|
||||
$retourenlabel = '';// $this->app->Secure->GetPOST("retourenlabel");
|
||||
|
||||
$Name = $adressdaten["name"];
|
||||
$Name2 = $adressdaten["name2"];
|
||||
$Name3 = $adressdaten["name3"];
|
||||
$Street = $adressdaten["strasse"];
|
||||
$HouseNo = $adressdaten["hausnummer"];
|
||||
$ZipCode = $adressdaten['plz'];
|
||||
$City = $adressdaten['ort'];
|
||||
$Mail = $adressdaten['email'];
|
||||
$Phone = $adressdaten["telefon"];
|
||||
$Country = $adressdaten["land"];
|
||||
$Company = "Company";
|
||||
$Weight = $adressdaten["standardkg"];
|
||||
$coding = $this->einstellungen['dhl_coding'] == 1;
|
||||
|
||||
$height = $this->einstellungen('dhl_height');
|
||||
$wigth = $this->einstellungen('dhl_width');
|
||||
$length = $this->einstellungen('dhl_length');
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
$shipmentDate = date("Y-m-d");
|
||||
|
||||
switch ($this->einstellungen['dhl_product']) {
|
||||
case 'V01PAK':
|
||||
{
|
||||
$shipmentData = new CreateNationalShipmentRequest(
|
||||
$shipmentDate,
|
||||
$Weight,
|
||||
$length,
|
||||
$wigth,
|
||||
$height,
|
||||
$Name,
|
||||
$Name2,
|
||||
$Name3,
|
||||
$Street,
|
||||
$HouseNo,
|
||||
$ZipCode,
|
||||
$City,
|
||||
$Country,
|
||||
$Mail,
|
||||
$coding
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 'V53WPAK':
|
||||
{
|
||||
$shipmentData = new CreateInterationalShipmentRequest(
|
||||
$shipmentDate,
|
||||
$Weight,
|
||||
$length,
|
||||
$wigth,
|
||||
$height,
|
||||
$Name,
|
||||
$Name2,
|
||||
$Name3,
|
||||
$Street,
|
||||
$HouseNo,
|
||||
$ZipCode,
|
||||
$City,
|
||||
$Country,
|
||||
$Mail,
|
||||
$coding,
|
||||
$this->einstellungen['dhl_export_product_type'],
|
||||
$this->einstellungen['dhl_export_product_type_description'],
|
||||
$this->getPackageContents($Query['id'])
|
||||
);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new UnknownProductException();
|
||||
}
|
||||
}
|
||||
|
||||
$createResponse = $dhlApi->createShipment($shipmentData);
|
||||
|
||||
if($this->einstellungen['autotracking'] == "1")
|
||||
$this->SetTracking($createResponse->getShipmentNumber(), $sid === 'versand' ? $id : 0, $lieferschein);
|
||||
|
||||
|
||||
$data['drucker'] = $this->paketmarke_drucker;
|
||||
$data['druckerlogistikstufe2'] = $this->export_drucker;
|
||||
|
||||
if(!$data['drucker']){
|
||||
if($this->app->erp->GetStandardPaketmarkendrucker() > 0){
|
||||
$data['drucker'] = $this->app->erp->GetStandardPaketmarkendrucker();
|
||||
}
|
||||
}
|
||||
|
||||
if(!$data['druckerlogistikstufe2']){
|
||||
if($this->app->erp->GetStandardVersanddrucker($projekt) > 0){
|
||||
$data['druckerlogistikstufe2'] = $this->app->erp->GetStandardVersanddrucker($projekt);
|
||||
}
|
||||
}
|
||||
$pdf = $createResponse->getLabelAsPdf();
|
||||
$datei = $this->app->erp->GetTMP() . 'DhlLabel_' . $createResponse->getShipmentNumber() . '.pdf';
|
||||
|
||||
file_put_contents($datei, $pdf);
|
||||
|
||||
$spoolerId = $this->app->printer->Drucken($data['drucker'], $datei);
|
||||
if($spoolerId > 0 && $versandId > 0){
|
||||
$this->app->DB->Update(
|
||||
sprintf(
|
||||
'UPDATE versand SET lastspooler_id = %d, lastprinter = %d WHERE id = %d',
|
||||
$spoolerId, $data['drucker'], $versandId
|
||||
)
|
||||
);
|
||||
}
|
||||
if($module === 'retoure'){
|
||||
if(@is_file($datei) && @filesize($datei)){
|
||||
$fileid = $this->app->erp->CreateDatei('DhlMarkeLabel_' . $this->app->DB->Select("SELECT belegnr FROM retoure WHERE id = '$id' LIMIT 1") . '.pdf',
|
||||
'Anhang', '', "", $datei,
|
||||
$this->app->DB->real_escape_string($this->app->User->GetName()));
|
||||
$this->app->erp->AddDateiStichwort($fileid, 'anhang', 'retoure', $id);
|
||||
}
|
||||
}
|
||||
|
||||
unlink($datei);
|
||||
if($adressdaten !== null){
|
||||
return true;
|
||||
}
|
||||
|
||||
if($createResponse->containsExportDocuments()){
|
||||
$tmppdf = $this->app->erp->GetTMP() . 'DhlExport_' . $createResponse->getShipmentNumber() . '.pdf';
|
||||
file_put_contents($tmppdf, $createResponse->getExportPaperAsPdf());
|
||||
$spoolerId = $this->app->printer->Drucken($data['druckerlogistikstufe2'], $tmppdf);
|
||||
if($versandId && $spoolerId){
|
||||
$this->app->DB->Update(
|
||||
sprintf(
|
||||
'UPDATE versand SET lastexportspooler_id = %d, lastexportprinter = %d WHERE id = %d',
|
||||
$spoolerId, $data['druckerlogistikstufe2'], $versandId
|
||||
)
|
||||
);
|
||||
}
|
||||
if($module === 'retoure'){
|
||||
if(@is_file($tmppdf) && @filesize($tmppdf)){
|
||||
$fileid = $this->app->erp->CreateDatei('Export_' . $this->app->DB->Select("SELECT belegnr FROM retoure WHERE id = '$id' LIMIT 1") . '.pdf', 'Anhang', '', "", $tmppdf, $this->app->DB->real_escape_string($this->app->User->GetName()));
|
||||
$this->app->erp->AddDateiStichwort($fileid, 'anhang', 'retoure', $id);
|
||||
}
|
||||
}
|
||||
|
||||
unlink($tmppdf);
|
||||
}
|
||||
|
||||
|
||||
} catch (DhlBaseException $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
if ($this->settings->accountnumber_int) {
|
||||
$result[] = Product::Create('V53WPAK', 'DHL Paket International')
|
||||
->WithLength(15, 120)
|
||||
->WithWidth(11, 60)
|
||||
->WithHeight(1, 60)
|
||||
->WithWeight(0.01, 31.5)
|
||||
->WithServices([Product::SERVICE_PREMIUM]);
|
||||
}
|
||||
if($adressdaten !== null){
|
||||
return false;
|
||||
if ($this->settings->accountnumber_euro) {
|
||||
$result[] = Product::Create('V54EPAK', 'DHL Europaket')
|
||||
->WithLength(15, 120)
|
||||
->WithWidth(11, 60)
|
||||
->WithHeight(3.5, 60)
|
||||
->WithWeight(0.01, 31.5);
|
||||
}
|
||||
if($target){
|
||||
if($this->einstellungen['dhl_coding'] == '1'){
|
||||
$this->app->Tpl->Set('DHL_CODING_CHECKED', 'checked="checked"');
|
||||
}
|
||||
|
||||
$this->app->Tpl->Add("HEIGHT", $this->einstellungen['dhl_height']);
|
||||
$this->app->Tpl->Add("WIDTH", $this->einstellungen['dhl_width']);
|
||||
$this->app->Tpl->Add("LENGTH", $this->einstellungen['dhl_length']);
|
||||
$this->app->Tpl->Parse($target, 'versandarten_dhl.tpl');
|
||||
if ($this->settings->accountnumber_connect) {
|
||||
$result[] = Product::Create('V55PAK', 'DHL Paket Connect')
|
||||
->WithLength(15, 120)
|
||||
->WithWidth(11, 60)
|
||||
->WithHeight(3.5, 60)
|
||||
->WithWeight(0.01, 31.5);
|
||||
}
|
||||
if(count($this->errors) > 0){
|
||||
return $this->errors;
|
||||
if ($this->settings->accountnumber_wp) {
|
||||
$result[] = Product::Create('V62WP', 'DHL Warenpost')
|
||||
->WithLength(10, 35)
|
||||
->WithWidth(7, 25)
|
||||
->WithHeight(0.1, 5)
|
||||
->WithWeight(0.01, 1);
|
||||
}
|
||||
if ($this->settings->accountnumber_wpint) {
|
||||
$result[] = Product::Create('V66WPI', 'DHL Warenpost International')
|
||||
->WithLength(10, 35)
|
||||
->WithWidth(7, 25)
|
||||
->WithHeight(0.1, 10)
|
||||
->WithWeight(0.01, 1)
|
||||
->WithServices([Product::SERVICE_PREMIUM]);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function getPackageContents($deliveryNoteId)
|
||||
{
|
||||
$contents = [];
|
||||
/** @var Database $db */
|
||||
$db = $this->app->Container->get('Database');
|
||||
|
||||
$select = $db->select()
|
||||
->from('lieferschein_position AS l')
|
||||
->cols([
|
||||
'l.bezeichnung',
|
||||
'l.menge',
|
||||
'l.zolltarifnummer',
|
||||
'l.herkunftsland',
|
||||
'a.umsatz_netto_einzeln',
|
||||
'g.gewicht'
|
||||
])
|
||||
->leftJoin('auftrag_position AS a', 'l.auftrag_position_id = a.id')
|
||||
->leftJoin('artikel AS g', 'l.artikel = g.id')
|
||||
->where('l.lieferschein=:id')
|
||||
->bindValue('id', $deliveryNoteId);
|
||||
|
||||
$positions = $db->fetchAll($select->getStatement(), $select->getBindValues());
|
||||
|
||||
foreach ($positions as $position) {
|
||||
$contents[] = new PackageContent(
|
||||
(int)$position['menge'],
|
||||
$position['bezeichnung'],
|
||||
$position['umsatz_netto_einzeln'],
|
||||
$position['herkunftsland'],
|
||||
$position['zolltarifnummer'],
|
||||
$position['gewicht']
|
||||
);
|
||||
private function GetAccountNumber(string $product):?string {
|
||||
switch ($product) {
|
||||
case 'V01PAK': return $this->settings->accountnumber;
|
||||
case 'V53WPAK': return $this->settings->accountnumber_int;
|
||||
case 'V54EPAK': return $this->settings->accountnumber_euro;
|
||||
case 'V55PAK': return $this->settings->accountnumber_connect;
|
||||
case 'V62WP': return $this->settings->accountnumber_wp;
|
||||
case 'V66WPI': return $this->settings->accountnumber_wpint;
|
||||
}
|
||||
|
||||
return $contents;
|
||||
return null;
|
||||
}
|
||||
|
||||
public function Export($daten)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function log($message)
|
||||
{
|
||||
if(isset($this->einstellungen['log'])){
|
||||
if(is_array($message) || is_object($message)){
|
||||
error_log(print_r($message, true));
|
||||
}else{
|
||||
error_log($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
691
www/lib/versandarten/dhl.php_
Normal file
691
www/lib/versandarten/dhl.php_
Normal file
@ -0,0 +1,691 @@
|
||||
<?php
|
||||
|
||||
use Xentral\Components\Database\Database;
|
||||
use Xentral\Components\Http\JsonResponse;
|
||||
use Xentral\Modules\Dhl\Api\DhlApi;
|
||||
use Xentral\Modules\Dhl\Content\PackageContent;
|
||||
use Xentral\Modules\Dhl\Exception\DhlBaseException;
|
||||
use Xentral\Modules\Dhl\Exception\InvalidCredentialsException;
|
||||
use Xentral\Modules\Dhl\Exception\InvalidRequestDataException;
|
||||
use Xentral\Modules\Dhl\Exception\UnknownProductException;
|
||||
use Xentral\Modules\Dhl\Factory\DhlApiFactory;
|
||||
use Xentral\Modules\Dhl\Request\CreateInterationalShipmentRequest;
|
||||
use Xentral\Modules\Dhl\Request\CreateNationalShipmentRequest;
|
||||
|
||||
require_once dirname(__DIR__) . '/class.versanddienstleister.php';
|
||||
|
||||
class Versandart_dhl extends Versanddienstleister
|
||||
{
|
||||
|
||||
private $einstellungen;
|
||||
|
||||
private $info;
|
||||
|
||||
private $credentials;
|
||||
|
||||
public $paketmarke_drucker;
|
||||
public $export_drucker;
|
||||
|
||||
public $errors;
|
||||
|
||||
public $name;
|
||||
protected $voucherId;
|
||||
|
||||
/**
|
||||
* Versandart_internetmarke constructor.
|
||||
*
|
||||
* @param ApplicationCore $app
|
||||
* @param int $id
|
||||
*/
|
||||
function __construct($app, $id)
|
||||
{
|
||||
$this->id = $id;
|
||||
$this->app = $app;
|
||||
$einstellungenArr = $this->app->DB->SelectRow("SELECT einstellungen_json,paketmarke_drucker,export_drucker FROM versandarten WHERE id = '$id' LIMIT 1");
|
||||
$einstellungen_json = $einstellungenArr['einstellungen_json'];
|
||||
$this->paketmarke_drucker = $einstellungenArr['paketmarke_drucker'];
|
||||
$this->export_drucker = $einstellungenArr['export_drucker'];
|
||||
|
||||
$this->name = 'DHL 3.0';
|
||||
if($einstellungen_json){
|
||||
$this->einstellungen = json_decode($einstellungen_json, true);
|
||||
}else{
|
||||
$this->einstellungen = [];
|
||||
}
|
||||
$this->errors = [];
|
||||
}
|
||||
|
||||
function ShowUserdata()
|
||||
{
|
||||
if(isset($this->app->Conf->WFuserdata)){
|
||||
return 'Userdata-Ordner: ' . $this->app->Conf->WFuserdata;
|
||||
}
|
||||
}
|
||||
|
||||
public function Einstellungen($target = 'return')
|
||||
{
|
||||
if($this->app->Secure->GetPOST('testen')){
|
||||
$parameter1 = $this->einstellungen['pfad'];
|
||||
if($parameter1){
|
||||
if(is_dir($parameter1)){
|
||||
if(substr($parameter1, -1) !== '/'){
|
||||
$parameter1 .= '/';
|
||||
}
|
||||
|
||||
if(file_put_contents($parameter1 . 'wawision_test.txt', 'TEST')){
|
||||
$this->app->Tpl->Add('MESSAGE',
|
||||
'<div class="info">Datei ' . $parameter1 . 'wawision_test.txt' . ' wurde erstellt!</div>');
|
||||
}else{
|
||||
$this->app->Tpl->Add('MESSAGE', '<div class="error">Datei konnte nicht angelegt werden!</div>');
|
||||
}
|
||||
}else{
|
||||
$this->app->Tpl->Add('MESSAGE',
|
||||
'<div class="error">Speicherort existiert nicht oder ist nicht erreichbar!</div>');
|
||||
}
|
||||
}else{
|
||||
$this->app->Tpl->Add('MESSAGE', '<div class="error">Bitte einen Speicherort angeben!</div>');
|
||||
}
|
||||
}
|
||||
|
||||
parent::Einstellungen($target);
|
||||
}
|
||||
|
||||
//TODO ....
|
||||
|
||||
/*function Trackinglink($tracking, &$notsend, &$link, &$rawlink)
|
||||
{
|
||||
$notsend = 0;
|
||||
//$rawlink = 'https://tracking.dpd.de/parcelstatus/?locale=de_DE&query='.$tracking;
|
||||
$rawlink = ' https://www.gls-group.eu/276-I-PORTAL-WEB/content/GLS/DE03/DE/5004.htm?txtRefNo='.$tracking.'&txtAction=71000';
|
||||
$link = 'GLS Versand: '.$tracking.' ('.$rawlink.')';
|
||||
}*/
|
||||
|
||||
public function GetBezeichnung()
|
||||
{
|
||||
return 'DHL 3.0';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array[]
|
||||
*/
|
||||
public function getCreateForm()
|
||||
{
|
||||
return [
|
||||
[
|
||||
'id' => 0,
|
||||
'name' => 'usernameGroup',
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => 'Benutzername',
|
||||
'type' => 'text',
|
||||
'name' => 'dhl_username',
|
||||
'validation' => true,
|
||||
],
|
||||
],
|
||||
],
|
||||
[
|
||||
'id' => 1,
|
||||
'name' => 'passwordGroup',
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => 'Passwort',
|
||||
'type' => 'text',
|
||||
'name' => 'dhl_password',
|
||||
'validation' => true,
|
||||
]
|
||||
],
|
||||
],
|
||||
[
|
||||
'id' => 2,
|
||||
'name' => 'accountNumberGroup',
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => 'Abrechnungsnummer',
|
||||
'type' => 'text',
|
||||
'name' => 'dhl_accountnumber',
|
||||
'validation' => true,
|
||||
]
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $postData
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function updatePostDataForAssistent($postData): array
|
||||
{
|
||||
$name = $this->app->erp->Firmendaten('name');
|
||||
$street = $this->app->erp->Firmendaten('strasse');
|
||||
$zip = $this->app->erp->Firmendaten('plz');
|
||||
$city = $this->app->erp->Firmendaten('ort');
|
||||
$country = $this->app->erp->Firmendaten('land');
|
||||
$houseNo = '';
|
||||
|
||||
$streetParts = explode(' ', $street);
|
||||
$partsCount = count($streetParts);
|
||||
|
||||
if($partsCount >= 2){
|
||||
$street = implode(' ', array_slice($streetParts, 0, $partsCount - 1));
|
||||
$houseNo = $streetParts[$partsCount - 1];
|
||||
}
|
||||
|
||||
$postData['dhl_origin_name'] = $name;
|
||||
$postData['dhl_origin_street'] = $street;
|
||||
$postData['dhl_origin_houseno'] = $houseNo;
|
||||
$postData['dhl_origin_zip'] = $zip;
|
||||
$postData['dhl_origin_city'] = $city;
|
||||
$postData['dhl_origin_country'] = $country;
|
||||
|
||||
return $postData;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JsonResponse|null
|
||||
*/
|
||||
public function AuthByAssistent()
|
||||
{
|
||||
$step = (int)$this->app->Secure->GetPOST('step');
|
||||
if($step == 0){
|
||||
$username = $this->app->Secure->GetPOST('dhl_username');
|
||||
$password = $this->app->Secure->GetPOST('dhl_password');
|
||||
$accountnumber = $this->app->Secure->GetPOST('dhl_accountnumber');
|
||||
|
||||
$error = null;
|
||||
if(empty($username)){
|
||||
$error = 'Bitte Nutzernamen eingeben';
|
||||
}else if(empty($password)){
|
||||
$error = 'Bitte Passwort eingeben';
|
||||
}else if(empty($accountnumber)){
|
||||
$error = 'Bitte Abrechnungsnummer eingeben';
|
||||
}
|
||||
|
||||
if($error != null) {
|
||||
return new JsonResponse(
|
||||
['error' => $error],
|
||||
JsonResponse::HTTP_BAD_REQUEST
|
||||
);
|
||||
}
|
||||
|
||||
try{
|
||||
$this->testCredentials($username, $password, $accountnumber);
|
||||
}catch (DhlBaseException $e){
|
||||
return new JsonResponse(
|
||||
['error' => $e->getMessage()],
|
||||
JsonResponse::HTTP_BAD_REQUEST
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getStructureDataForClickByClickSave(): array
|
||||
{
|
||||
return $this->updatePostDataForAssistent([]);
|
||||
}
|
||||
|
||||
function EinstellungenStruktur()
|
||||
{
|
||||
if(!empty($this->einstellungen['dhl_username']) && !empty($this->einstellungen['dhl_password'])){
|
||||
try{
|
||||
$this->testCredentials($this->einstellungen['dhl_username'], $this->einstellungen['dhl_password'], $this->einstellungen['dhl_accountnumber']);
|
||||
$this->app->Tpl->Set('MESSAGE', '<div class="info">Zugangsdaten erfolgreich überprüft</div>');
|
||||
}catch (DhlBaseException $e){
|
||||
$this->app->Tpl->Set('MESSAGE', '<div class="error">' . $e->getMessage() . '</div>');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return [
|
||||
'dhl_username' => ['typ' => 'text', 'bezeichnung' => 'Benutzername:'],
|
||||
'dhl_password' => ['typ' => 'text', 'bezeichnung' => 'Passwort:'],
|
||||
'dhl_accountnumber' => ['typ' => 'text', 'bezeichnung' => 'Abrechnungsnummer:'],
|
||||
'dhl_origin_name' => ['typ' => 'text', 'bezeichnung' => 'Versender Name:'],
|
||||
'dhl_origin_street' => ['typ' => 'text', 'bezeichnung' => 'Versender Strasse:'],
|
||||
'dhl_origin_houseno' => ['typ' => 'text', 'bezeichnung' => 'Versender Hausnummer:'],
|
||||
'dhl_origin_city' => ['typ' => 'text', 'bezeichnung' => 'Versender Ort:'],
|
||||
'dhl_origin_zip' => ['typ' => 'text', 'bezeichnung' => 'Versender PLZ:'],
|
||||
'dhl_origin_country' => ['typ' => 'text', 'bezeichnung' => 'Versender Land (2-stellig):'],
|
||||
'dhl_origin_email' => ['typ' => 'text', 'bezeichnung' => 'Versender Email:'],
|
||||
|
||||
'dhl_height' => ['typ' => 'text', 'bezeichnung' => 'Standardhöhe'],
|
||||
'dhl_width' => ['typ' => 'text', 'bezeichnung' => 'Standardbreite'],
|
||||
'dhl_length' => ['typ' => 'text', 'bezeichnung' => 'Standardlänge'],
|
||||
|
||||
'dhl_export_product_type' => [
|
||||
'typ' => 'select',
|
||||
'bezeichnung' => 'Export Producttyp',
|
||||
'optionen' => [
|
||||
'PRESENT' => 'Geschenke',
|
||||
'COMMERCIAL_SAMPLE' => 'Kommerzielle Probe',
|
||||
'DOCUMENT' => 'Dokumente',
|
||||
'RETURN_OF_GOODS' => 'Rücksendungen',
|
||||
'OTHER' => 'Andere',
|
||||
]
|
||||
],
|
||||
'dhl_export_product_type_description' => [
|
||||
'typ' => 'text',
|
||||
'bezeichnung' => 'Beschreibung im Falle von "Andere"'
|
||||
],
|
||||
|
||||
'dhl_product' => [
|
||||
'typ' => 'select',
|
||||
'bezeichnung' => 'Produkt:',
|
||||
'optionen' => [
|
||||
'V01PAK' => 'Paket national',
|
||||
'V53WPAK' => 'Paket international'
|
||||
],
|
||||
],
|
||||
'dhl_coding' => ['typ' => 'checkbox', 'bezeichnung' => 'Leitcodierung aktivieren'],
|
||||
'autotracking' => ['typ' => 'checkbox', 'bezeichnung' => 'Tracking übernehmen:'],
|
||||
];
|
||||
}
|
||||
|
||||
public function testCredentials($username, $password, $accountNumber){
|
||||
/** @var DhlApiFactory $dhlApiFactory */
|
||||
$dhlApiFactory = $this->app->Container->get('DhlApiFactory');
|
||||
|
||||
/** @var DhlApi $dhlApi */
|
||||
$dhlApi = $dhlApiFactory->createProductionInstance(
|
||||
$username,
|
||||
$password,
|
||||
$accountNumber,
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
''
|
||||
);
|
||||
|
||||
try {
|
||||
$dhlApi->validateShipment(new CreateNationalShipmentRequest(
|
||||
date("Y-m-d"),
|
||||
1.0,
|
||||
10,
|
||||
20,
|
||||
30,
|
||||
"Max muster",
|
||||
'',
|
||||
'',
|
||||
'Teststr. 1',
|
||||
'11',
|
||||
'86153',
|
||||
'Augsburg',
|
||||
'DE',
|
||||
'max.muster@xentral.com',
|
||||
false
|
||||
));
|
||||
}catch (InvalidRequestDataException $e){
|
||||
// do nothing, test data is invalid
|
||||
}
|
||||
}
|
||||
|
||||
public function PaketmarkeDrucken($id, $sid)
|
||||
{
|
||||
$adressdaten = $this->GetAdressdaten($id, $sid);
|
||||
$ret = $this->Paketmarke($sid, $id, '', false, $adressdaten);
|
||||
if($sid === 'lieferschein'){
|
||||
$deliveryNoteArr = $this->app->DB->SelectRow("SELECT adresse,projekt,versandart,auftragid FROM lieferschein WHERE id = '$id' LIMIT 1");
|
||||
$adresse = $deliveryNoteArr['adresse'];
|
||||
$projekt = $deliveryNoteArr['projekt'];
|
||||
$versandart = $deliveryNoteArr['versandart'];
|
||||
$adressvalidation = 2;
|
||||
if($ret){
|
||||
$adressvalidation = 1;
|
||||
}
|
||||
$tracking = '';
|
||||
if(isset($adressdaten['tracking'])){
|
||||
$tracking = $adressdaten['tracking'];
|
||||
}
|
||||
if(!isset($adressdaten['versandid'])){
|
||||
$adressdaten['versandid'] = $this->app->DB->Select("SELECT id FROM versand WHERE abgeschlossen = 0 AND tracking = '' AND lieferschein = '$id' LIMIT 1");
|
||||
}
|
||||
if(!isset($adressdaten['versandid'])){
|
||||
$this->app->DB->Insert("INSERT INTO versand (versandunternehmen, tracking,
|
||||
versendet_am,abgeschlossen,lieferschein,freigegeben,firma,adresse,projekt,paketmarkegedruckt,adressvalidation)
|
||||
VALUES ($versandart','$tracking',NOW(),1,'$id',1,'1','$adresse','$projekt',1,'$adressvalidation') ");
|
||||
$adressdaten['versandid'] = $this->app->DB->GetInsertID();
|
||||
}elseif($tracking){
|
||||
$this->app->DB->Update("UPDATE versand SET freigegeben = 1, abgeschlossen = 1, tracking =1, paketmarkegedruckt = 1, tracking= '$tracking',adressvalidation = '$adressvalidation', versendet_am = now() WHERE id = '" . $adressdaten['versandid'] . "' LIMIT 1");
|
||||
$this->app->DB->Update("UPDATE versand SET versandunternehmen = versandart WHERE id = '" . $adressdaten['versandid'] . "' AND versandunternehmen = '' LIMIT 1");
|
||||
$this->app->DB->Update("UPDATE versand SET versandunternehmen = '$versandart' WHERE id = '" . $adressdaten['versandid'] . "' AND versandunternehmen = '' LIMIT 1");
|
||||
}
|
||||
$auftragid = $deliveryNoteArr['auftragid'];
|
||||
if($auftragid){
|
||||
$this->app->DB->Update("UPDATE auftrag SET schreibschutz = 1, status = 'abgeschlossen' WHERE id = '$auftragid' AND status = 'freigegeben' LIMIT 1");
|
||||
}
|
||||
if($adressvalidation == 1){
|
||||
$this->app->erp->LieferscheinProtokoll($id, 'Paketmarke automatisch gedruckt');
|
||||
if($adressdaten['versandid']){
|
||||
return $adressdaten['versandid'];
|
||||
}
|
||||
}elseif($adressvalidation == 2){
|
||||
$this->app->erp->LieferscheinProtokoll($id, 'automatisches Paketmarke Drucken fehlgeschlagen');
|
||||
}
|
||||
}
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function Paketmarke($doctyp, $docid, $target = '', $error = false, &$adressdaten = null)
|
||||
{
|
||||
$id = $docid;
|
||||
$sid = $doctyp;
|
||||
if($adressdaten === null){
|
||||
$drucken = $this->app->Secure->GetPOST('drucken');
|
||||
$anders = $this->app->Secure->GetPOST('anders');
|
||||
$tracking_again = $this->app->Secure->GetGET('tracking_again');
|
||||
$module = $this->app->Secure->GetPOST('module');
|
||||
if(empty($module)){
|
||||
$module = $doctyp;
|
||||
}
|
||||
}else{
|
||||
$drucken = 1;
|
||||
$anders = '';
|
||||
$tracking_again = '';
|
||||
$module = $doctyp;
|
||||
}
|
||||
|
||||
|
||||
/** @var DhlApiFactory $dhlApiFactory */
|
||||
$dhlApiFactory = $this->app->Container->get('DhlApiFactory');
|
||||
|
||||
/** @var DhlApi $dhlApi */
|
||||
$dhlApi = $dhlApiFactory->createProductionInstance(
|
||||
$this->einstellungen['dhl_username'],
|
||||
$this->einstellungen['dhl_password'],
|
||||
$this->einstellungen['dhl_accountnumber'],
|
||||
$this->einstellungen['dhl_origin_name'],
|
||||
$this->einstellungen['dhl_origin_street'],
|
||||
$this->einstellungen['dhl_origin_houseno'],
|
||||
$this->einstellungen['dhl_origin_zip'],
|
||||
$this->einstellungen['dhl_origin_city'],
|
||||
$this->einstellungen['dhl_origin_country'],
|
||||
$this->einstellungen['dhl_origin_email']
|
||||
);
|
||||
|
||||
if($drucken != '' || $tracking_again == '1'){
|
||||
|
||||
if($tracking_again != "1"){
|
||||
$versandId = 0;
|
||||
if($module === 'retoure'){
|
||||
$Query = $this->app->DB->SelectRow("SELECT * FROM retoure where id='$id'");
|
||||
}elseif($module === 'versand'){
|
||||
$versandId = $id;
|
||||
$lieferschein = $this->app->DB->Select("SELECT lieferschein WHERE id = '$id' LIMIT 1");
|
||||
$Query = $this->app->DB->SelectRow("SELECT * FROM lieferschein where id='$lieferschein'");
|
||||
}else{
|
||||
$Query = $this->app->DB->SelectRow("SELECT * FROM lieferschein where id='$id'");
|
||||
}
|
||||
$projekt = $Query['projekt'];
|
||||
$Adresse = $this->app->DB->SelectRow("SELECT * FROM adresse WHERE id='" . $Query['adresse'] . "'");
|
||||
$product = '';
|
||||
$Country = $Query['land'];
|
||||
if($adressdaten === null){
|
||||
$versandmit = $this->app->Secure->GetPOST("versandmit");
|
||||
$trackingsubmit = $this->app->Secure->GetPOST("trackingsubmit");
|
||||
$versandmitbutton = $this->app->Secure->GetPOST("versandmitbutton");
|
||||
$tracking = $this->app->Secure->GetPOST("tracking");
|
||||
$trackingsubmitcancel = $this->app->Secure->GetPOST("trackingsubmitcancel");
|
||||
$retourenlabel = $this->app->Secure->GetPOST("retourenlabel");
|
||||
|
||||
//$Weight = $this->app->Secure->GetPOST("kg1");
|
||||
$Name = $this->app->Secure->GetPOST("name");
|
||||
$Name2 = $this->app->Secure->GetPOST("name2");
|
||||
$Name3 = $this->app->Secure->GetPOST("name3");
|
||||
$Street = $this->app->Secure->GetPOST("strasse");
|
||||
$HouseNo = $this->app->Secure->GetPOST("hausnummer");
|
||||
$ZipCode = $this->app->Secure->GetPOST("plz");
|
||||
$City = $this->app->Secure->GetPOST("ort");
|
||||
$Mail = $this->app->Secure->GetPOST("email");
|
||||
$Phone = $this->app->Secure->GetPOST("phone");
|
||||
$Country = $this->app->Secure->GetPOST("land");
|
||||
$Weight = $this->app->Secure->GetPOST('kg1');
|
||||
|
||||
$height = $this->app->Secure->GetPOST('height');
|
||||
$wigth = $this->app->Secure->GetPOST('width');
|
||||
$length = $this->app->Secure->GetPOST('length');
|
||||
|
||||
$coding = $this->app->Secure->GetPOST('coding') == '1';
|
||||
}else{
|
||||
$versandmit = '';//$this->app->Secure->GetPOST("versandmit");
|
||||
$trackingsubmit = '';//$this->app->Secure->GetPOST("trackingsubmit");
|
||||
$versandmitbutton = '';//$this->app->Secure->GetPOST("versandmitbutton");
|
||||
$tracking = '';//$this->app->Secure->GetPOST("tracking");
|
||||
$trackingsubmitcancel = '';//$this->app->Secure->GetPOST("trackingsubmitcancel");
|
||||
$retourenlabel = '';// $this->app->Secure->GetPOST("retourenlabel");
|
||||
|
||||
$Name = $adressdaten["name"];
|
||||
$Name2 = $adressdaten["name2"];
|
||||
$Name3 = $adressdaten["name3"];
|
||||
$Street = $adressdaten["strasse"];
|
||||
$HouseNo = $adressdaten["hausnummer"];
|
||||
$ZipCode = $adressdaten['plz'];
|
||||
$City = $adressdaten['ort'];
|
||||
$Mail = $adressdaten['email'];
|
||||
$Phone = $adressdaten["telefon"];
|
||||
$Country = $adressdaten["land"];
|
||||
$Company = "Company";
|
||||
$Weight = $adressdaten["standardkg"];
|
||||
$coding = $this->einstellungen['dhl_coding'] == 1;
|
||||
|
||||
$height = $this->einstellungen('dhl_height');
|
||||
$wigth = $this->einstellungen('dhl_width');
|
||||
$length = $this->einstellungen('dhl_length');
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
$shipmentDate = date("Y-m-d");
|
||||
|
||||
switch ($this->einstellungen['dhl_product']) {
|
||||
case 'V01PAK':
|
||||
{
|
||||
$shipmentData = new CreateNationalShipmentRequest(
|
||||
$shipmentDate,
|
||||
$Weight,
|
||||
$length,
|
||||
$wigth,
|
||||
$height,
|
||||
$Name,
|
||||
$Name2,
|
||||
$Name3,
|
||||
$Street,
|
||||
$HouseNo,
|
||||
$ZipCode,
|
||||
$City,
|
||||
$Country,
|
||||
$Mail,
|
||||
$coding
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 'V53WPAK':
|
||||
{
|
||||
$shipmentData = new CreateInterationalShipmentRequest(
|
||||
$shipmentDate,
|
||||
$Weight,
|
||||
$length,
|
||||
$wigth,
|
||||
$height,
|
||||
$Name,
|
||||
$Name2,
|
||||
$Name3,
|
||||
$Street,
|
||||
$HouseNo,
|
||||
$ZipCode,
|
||||
$City,
|
||||
$Country,
|
||||
$Mail,
|
||||
$coding,
|
||||
$this->einstellungen['dhl_export_product_type'],
|
||||
$this->einstellungen['dhl_export_product_type_description'],
|
||||
$this->getPackageContents($Query['id'])
|
||||
);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
throw new UnknownProductException();
|
||||
}
|
||||
}
|
||||
|
||||
$createResponse = $dhlApi->createShipment($shipmentData);
|
||||
|
||||
if($this->einstellungen['autotracking'] == "1")
|
||||
$this->SetTracking($createResponse->getShipmentNumber(), $sid === 'versand' ? $id : 0, $lieferschein);
|
||||
|
||||
|
||||
$data['drucker'] = $this->paketmarke_drucker;
|
||||
$data['druckerlogistikstufe2'] = $this->export_drucker;
|
||||
|
||||
if(!$data['drucker']){
|
||||
if($this->app->erp->GetStandardPaketmarkendrucker() > 0){
|
||||
$data['drucker'] = $this->app->erp->GetStandardPaketmarkendrucker();
|
||||
}
|
||||
}
|
||||
|
||||
if(!$data['druckerlogistikstufe2']){
|
||||
if($this->app->erp->GetStandardVersanddrucker($projekt) > 0){
|
||||
$data['druckerlogistikstufe2'] = $this->app->erp->GetStandardVersanddrucker($projekt);
|
||||
}
|
||||
}
|
||||
$pdf = $createResponse->getLabelAsPdf();
|
||||
$datei = $this->app->erp->GetTMP() . 'DhlLabel_' . $createResponse->getShipmentNumber() . '.pdf';
|
||||
|
||||
file_put_contents($datei, $pdf);
|
||||
|
||||
$spoolerId = $this->app->printer->Drucken($data['drucker'], $datei);
|
||||
if($spoolerId > 0 && $versandId > 0){
|
||||
$this->app->DB->Update(
|
||||
sprintf(
|
||||
'UPDATE versand SET lastspooler_id = %d, lastprinter = %d WHERE id = %d',
|
||||
$spoolerId, $data['drucker'], $versandId
|
||||
)
|
||||
);
|
||||
}
|
||||
if($module === 'retoure'){
|
||||
if(@is_file($datei) && @filesize($datei)){
|
||||
$fileid = $this->app->erp->CreateDatei('DhlMarkeLabel_' . $this->app->DB->Select("SELECT belegnr FROM retoure WHERE id = '$id' LIMIT 1") . '.pdf',
|
||||
'Anhang', '', "", $datei,
|
||||
$this->app->DB->real_escape_string($this->app->User->GetName()));
|
||||
$this->app->erp->AddDateiStichwort($fileid, 'anhang', 'retoure', $id);
|
||||
}
|
||||
}
|
||||
|
||||
unlink($datei);
|
||||
if($adressdaten !== null){
|
||||
return true;
|
||||
}
|
||||
|
||||
if($createResponse->containsExportDocuments()){
|
||||
$tmppdf = $this->app->erp->GetTMP() . 'DhlExport_' . $createResponse->getShipmentNumber() . '.pdf';
|
||||
file_put_contents($tmppdf, $createResponse->getExportPaperAsPdf());
|
||||
$spoolerId = $this->app->printer->Drucken($data['druckerlogistikstufe2'], $tmppdf);
|
||||
if($versandId && $spoolerId){
|
||||
$this->app->DB->Update(
|
||||
sprintf(
|
||||
'UPDATE versand SET lastexportspooler_id = %d, lastexportprinter = %d WHERE id = %d',
|
||||
$spoolerId, $data['druckerlogistikstufe2'], $versandId
|
||||
)
|
||||
);
|
||||
}
|
||||
if($module === 'retoure'){
|
||||
if(@is_file($tmppdf) && @filesize($tmppdf)){
|
||||
$fileid = $this->app->erp->CreateDatei('Export_' . $this->app->DB->Select("SELECT belegnr FROM retoure WHERE id = '$id' LIMIT 1") . '.pdf', 'Anhang', '', "", $tmppdf, $this->app->DB->real_escape_string($this->app->User->GetName()));
|
||||
$this->app->erp->AddDateiStichwort($fileid, 'anhang', 'retoure', $id);
|
||||
}
|
||||
}
|
||||
|
||||
unlink($tmppdf);
|
||||
}
|
||||
|
||||
|
||||
} catch (DhlBaseException $e) {
|
||||
$this->errors[] = $e->getMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
if($adressdaten !== null){
|
||||
return false;
|
||||
}
|
||||
if($target){
|
||||
if($this->einstellungen['dhl_coding'] == '1'){
|
||||
$this->app->Tpl->Set('DHL_CODING_CHECKED', 'checked="checked"');
|
||||
}
|
||||
|
||||
$this->app->Tpl->Add("HEIGHT", $this->einstellungen['dhl_height']);
|
||||
$this->app->Tpl->Add("WIDTH", $this->einstellungen['dhl_width']);
|
||||
$this->app->Tpl->Add("LENGTH", $this->einstellungen['dhl_length']);
|
||||
$this->app->Tpl->Parse($target, 'versandarten_dhl.tpl');
|
||||
}
|
||||
if(count($this->errors) > 0){
|
||||
return $this->errors;
|
||||
}
|
||||
}
|
||||
|
||||
private function getPackageContents($deliveryNoteId)
|
||||
{
|
||||
$contents = [];
|
||||
/** @var Database $db */
|
||||
$db = $this->app->Container->get('Database');
|
||||
|
||||
$select = $db->select()
|
||||
->from('lieferschein_position AS l')
|
||||
->cols([
|
||||
'l.bezeichnung',
|
||||
'l.menge',
|
||||
'l.zolltarifnummer',
|
||||
'l.herkunftsland',
|
||||
'a.umsatz_netto_einzeln',
|
||||
'g.gewicht'
|
||||
])
|
||||
->leftJoin('auftrag_position AS a', 'l.auftrag_position_id = a.id')
|
||||
->leftJoin('artikel AS g', 'l.artikel = g.id')
|
||||
->where('l.lieferschein=:id')
|
||||
->bindValue('id', $deliveryNoteId);
|
||||
|
||||
$positions = $db->fetchAll($select->getStatement(), $select->getBindValues());
|
||||
|
||||
foreach ($positions as $position) {
|
||||
$contents[] = new PackageContent(
|
||||
(int)$position['menge'],
|
||||
$position['bezeichnung'],
|
||||
$position['umsatz_netto_einzeln'],
|
||||
$position['herkunftsland'],
|
||||
$position['zolltarifnummer'],
|
||||
$position['gewicht']
|
||||
);
|
||||
}
|
||||
|
||||
return $contents;
|
||||
}
|
||||
|
||||
public function Export($daten)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function log($message)
|
||||
{
|
||||
if(isset($this->einstellungen['log'])){
|
||||
if(is_array($message) || is_object($message)){
|
||||
error_log(print_r($message, true));
|
||||
}else{
|
||||
error_log($message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
163
www/lib/versandarten/sendcloud.php
Normal file
163
www/lib/versandarten/sendcloud.php
Normal file
@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
use Xentral\Carrier\SendCloud\Data\Document;
|
||||
use Xentral\Carrier\SendCloud\Data\ParcelCreation;
|
||||
use Xentral\Carrier\SendCloud\Data\ParcelItem;
|
||||
use Xentral\Carrier\SendCloud\Data\ParcelResponse;
|
||||
use Xentral\Carrier\SendCloud\SendCloudApi;
|
||||
use Xentral\Carrier\SendCloud\Data\SenderAddress;
|
||||
use Xentral\Carrier\SendCloud\Data\ShippingProduct;
|
||||
use Xentral\Carrier\SendCloud\Data\ShippingMethod;
|
||||
use Xentral\Carrier\SendCloud\SendcloudApiException;
|
||||
use Xentral\Modules\ShippingMethod\Model\CreateShipmentResult;
|
||||
use Xentral\Modules\ShippingMethod\Model\Product;
|
||||
|
||||
require_once dirname(__DIR__) . '/class.versanddienstleister.php';
|
||||
|
||||
class Versandart_sendcloud extends Versanddienstleister
|
||||
{
|
||||
protected SendCloudApi $api;
|
||||
protected array $options;
|
||||
|
||||
public function __construct(ApplicationCore $app, ?int $id)
|
||||
{
|
||||
parent::__construct($app, $id);
|
||||
if (!isset($this->id))
|
||||
return;
|
||||
$this->api = new SendCloudApi($this->settings->public_key, $this->settings->private_key);
|
||||
}
|
||||
|
||||
public function GetName(): string
|
||||
{
|
||||
return "SendCloud";
|
||||
}
|
||||
|
||||
protected function FetchOptionsFromApi()
|
||||
{
|
||||
if (isset($this->options))
|
||||
return;
|
||||
try {
|
||||
$list = $this->api->GetSenderAddresses();
|
||||
foreach ($list as $item) {
|
||||
/* @var SenderAddress $item */
|
||||
$senderAddresses[$item->Id] = $item;
|
||||
}
|
||||
$senderCountry = $senderAddresses[$this->settings->sender_address]->Country ?? 'DE';
|
||||
$list = $this->api->GetShippingProducts($senderCountry);
|
||||
foreach ($list as $item) {
|
||||
/* @var ShippingProduct $item */
|
||||
$shippingProducts[$item->Code] = $item;
|
||||
}
|
||||
} catch (SendcloudApiException $e) {
|
||||
$this->app->Tpl->addMessage('error', $e->getMessage());
|
||||
}
|
||||
$this->options['senders'] = array_map(fn(SenderAddress $x) => strval($x), $senderAddresses ?? []);
|
||||
$this->options['products'] = array_map(fn(ShippingProduct $x) => $x->Name, $shippingProducts ?? []);
|
||||
$this->options['products'][0] = '';
|
||||
$this->options['selectedProduct'] = $shippingProducts[$this->settings->shipping_product] ?? [];
|
||||
natcasesort($this->options['products']);
|
||||
}
|
||||
|
||||
public function AdditionalSettings(): array
|
||||
{
|
||||
$this->FetchOptionsFromApi();
|
||||
return [
|
||||
'public_key' => ['typ' => 'text', 'bezeichnung' => 'API Public Key:'],
|
||||
'private_key' => ['typ' => 'text', 'bezeichnung' => 'API Private Key:'],
|
||||
'sender_address' => ['typ' => 'select', 'bezeichnung' => 'Absender-Adresse:', 'optionen' => $this->options['senders']],
|
||||
'shipping_product' => ['typ' => 'select', 'bezeichnung' => 'Versand-Produkt:', 'optionen' => $this->options['products']],
|
||||
];
|
||||
}
|
||||
|
||||
public function CreateShipment(object $json, array $address): CreateShipmentResult
|
||||
{
|
||||
$parcel = new ParcelCreation();
|
||||
$parcel->SenderAddressId = $this->settings->sender_address;
|
||||
$parcel->ShippingMethodId = $json->product;
|
||||
$parcel->Name = $json->name;
|
||||
switch ($json->addresstype) {
|
||||
case 0:
|
||||
$parcel->CompanyName = trim("$json->name2 $json->name3");
|
||||
$parcel->Address = $json->street;
|
||||
$parcel->Address2 = $json->address2;
|
||||
$parcel->HouseNumber = $json->streetnumber;
|
||||
break;
|
||||
case 1:
|
||||
$parcel->CompanyName = $json->postnumber;
|
||||
$parcel->Address = "Packstation";
|
||||
$parcel->HouseNumber = $json->parcelstationNumber;
|
||||
break;
|
||||
case 2:
|
||||
$parcel->CompanyName = $json->postnumber;
|
||||
$parcel->Address = "Postfiliale";
|
||||
$parcel->HouseNumber = $json->postofficeNumber;
|
||||
break;
|
||||
}
|
||||
$parcel->Country = $json->country;
|
||||
$parcel->PostalCode = $json->zip;
|
||||
$parcel->City = $json->city;
|
||||
$parcel->EMail = $json->email;
|
||||
$parcel->Telephone = $json->phone;
|
||||
$parcel->CountryState = $json->state;
|
||||
$parcel->CustomsInvoiceNr = $json->invoice_number;
|
||||
$parcel->CustomsShipmentType = $json->shipment_type;
|
||||
$parcel->TotalInsuredValue = $json->total_insured_value;
|
||||
$parcel->OrderNumber = $json->order_number;
|
||||
foreach ($json->positions as $pos) {
|
||||
$item = new ParcelItem();
|
||||
$item->HsCode = $pos->zolltarifnummer;
|
||||
$item->Description = $pos->bezeichnung;
|
||||
$item->Quantity = $pos->menge;
|
||||
$item->OriginCountry = $pos->herkunftsland;
|
||||
$item->Price = $pos->zolleinzelwert;
|
||||
$item->Weight = $pos->zolleinzelgewicht * 1000;
|
||||
$parcel->ParcelItems[] = $item;
|
||||
}
|
||||
$parcel->Weight = floatval($json->weight) * 1000;
|
||||
$ret = new CreateShipmentResult();
|
||||
try {
|
||||
$result = $this->api->CreateParcel($parcel);
|
||||
if ($result instanceof ParcelResponse) {
|
||||
$ret->Success = true;
|
||||
$ret->TrackingNumber = $result->TrackingNumber;
|
||||
$ret->TrackingUrl = $result->TrackingUrl;
|
||||
|
||||
$doc = $result->GetDocumentByType(Document::TYPE_LABEL);
|
||||
$ret->Label = $this->api->DownloadDocument($doc);
|
||||
|
||||
$doc = $result->GetDocumentByType(Document::TYPE_CN23);
|
||||
if ($doc)
|
||||
$ret->ExportDocuments = $this->api->DownloadDocument($doc);
|
||||
} else {
|
||||
$ret->Errors[] = $result;
|
||||
}
|
||||
} catch (SendcloudApiException $e) {
|
||||
$ret->Errors[] = strval($e);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
public function GetShippingProducts(): array
|
||||
{
|
||||
$this->FetchOptionsFromApi();
|
||||
/** @var ShippingProduct $product */
|
||||
$product = $this->options['selectedProduct'];
|
||||
$result = [];
|
||||
/** @var ShippingMethod $item */
|
||||
foreach ($product->ShippingMethods as $item) {
|
||||
$p = new Product();
|
||||
$p->Id = $item->Id;
|
||||
$p->Name = $item->Name;
|
||||
$result[] = $p;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,4 +1,11 @@
|
||||
<?php
|
||||
<?php
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
@ -10,8 +17,8 @@
|
||||
* to obtain the text of the corresponding license version.
|
||||
*
|
||||
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*/
|
||||
?>
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
use Xentral\Components\Http\JsonResponse;
|
||||
use Xentral\Modules\SystemConfig\SystemConfigModule;
|
||||
@ -2620,7 +2627,7 @@ class Appstore {
|
||||
,'shopimporter_presta'=>array('Bezeichnung'=>'Presta',
|
||||
'Link'=>'index.php?module=onlineshops&action=create&cmd=shopimporter_presta',
|
||||
'Icon'=>'Icons_dunkel_1.gif',
|
||||
'Versionen'=>'ENT','install'=>true, 'beta' => false,'kategorie'=>'{|Shop Schnittstelle|}')
|
||||
'Versionen'=>'ALL','install'=>true, 'beta' => false,'kategorie'=>'{|Shop Schnittstelle|}')
|
||||
,'shopimporter_shopify'=>array(
|
||||
'Bezeichnung'=>'Shopify API Advanced',
|
||||
'Link'=>'index.php?module=onlineshops&action=create&cmd=shopimporter_shopify',
|
||||
|
12
www/pages/content/rechnungslauf_abos.tpl
Normal file
12
www/pages/content/rechnungslauf_abos.tpl
Normal file
@ -0,0 +1,12 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
-->
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li></li>
|
||||
</ul>
|
||||
<div class="ui-tabs-panel">
|
||||
[TAB1]
|
||||
</div>
|
||||
</div>
|
40
www/pages/content/rechnungslauf_list.tpl
Normal file
40
www/pages/content/rechnungslauf_list.tpl
Normal file
@ -0,0 +1,40 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
-->
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1">Rechnungen</a></li>
|
||||
<li><a href="#tabs-2">Aufträge</a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
[MESSAGE_INVOICES]
|
||||
<form method="post" action="#">
|
||||
[TAB_INVOICES]
|
||||
<fieldset>
|
||||
<legend>{|Stapelverarbeitung|}</legend>
|
||||
<input type="checkbox" id="auswahlalle" onchange="alleauswaehlen('#rechnungslauf_invoices');" /> {|alle markieren|}
|
||||
<input type="submit" class="btnBlue" name="createInvoices" value="{|ausführen|}" />
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
<div id="tabs-2">
|
||||
[MESSAGE_ORDERS]
|
||||
<form method="post" action="#">
|
||||
[TAB_ORDERS]
|
||||
<fieldset>
|
||||
<legend>{|Stapelverarbeitung|}</legend>
|
||||
<input type="checkbox" id="auswahlalle" onchange="alleauswaehlen('#rechnungslauf_orders');" /> {|alle markieren|}
|
||||
<input type="submit" class="btnBlue" name="createOrders" value="{|ausführen|}" />
|
||||
</fieldset>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function alleauswaehlen(target)
|
||||
{
|
||||
var wert = $('#auswahlalle').prop('checked');
|
||||
$(target).find(':checkbox').prop('checked',wert);
|
||||
}
|
||||
</script>
|
@ -1,3 +1,8 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
SPDX-FileCopyrightText: 2019 Xentral ERP Sorftware GmbH, Fuggerstrasse 11, D-86150 Augsburg
|
||||
SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
-->
|
||||
<fieldset>
|
||||
<legend>[SUBHEADING]</legend>
|
||||
|
||||
@ -8,7 +13,7 @@
|
||||
<th>{|Menge|}</th>
|
||||
<th>{|Einzelpreis (netto)|}</th>
|
||||
<th>{|Rabatt|}</th>
|
||||
<th>{|UST|}</th>
|
||||
<th>{|Zyklen|}</th>
|
||||
<th>{|Gesamtpreis (netto)|}</th>
|
||||
<th>{|Währung|}</th>
|
||||
</tr>
|
||||
|
@ -1,46 +1,90 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
|
||||
|
||||
SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
-->
|
||||
<!-- gehort zu tabview -->
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-1"></a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
<form action="" method="post" name="eprooform">
|
||||
[FORMHANDLEREVENT]
|
||||
<fieldset>
|
||||
<legend>{|Einstellungen|}</legend>
|
||||
<table width="100%" border="0" class="mkTableFormular">
|
||||
<tr><td>{|Bezeichnung|}: </td><td><input type="text" name="bezeichnung" value="[BEZEICHNUNG]" size="40" data-lang="versandart_bezeichnung_[ID]">[MSGBEZEICHNUNG]</td></tr>
|
||||
<tr><td>{|Typ|}:</td><td><input type="text" name="typ" value="[TYP]" size="40">[MSGTYP] <i>{|z.B. dhl,ups,etc.|}</i></td></tr>
|
||||
<tr><td>{|Modul|}:</td><td><select name="selmodul" id="selmodul" onchange="changemodul();">[SELMODUL]</select></td></tr>
|
||||
<tr><td>{|Projekt|}:</td><td><input type="text" id="projekt" name="projekt" value="[PROJEKT]" size="30"></td></tr>
|
||||
<tr><td>{|Aktiv|}:</td><td><input type="checkbox" name="aktiv" value="1" [AKTIV]><i>{|Aktiv. Nicht mehr verwendete Versandarten können deaktiviert werden.|}</i></td></tr>
|
||||
<tr><td>{|Kein Portocheck|}:</td><td><input type="checkbox" name="keinportocheck" value="1" [KEINPORTOCHECK]><i>{|Porto-Check im Auftrag deaktivieren.|}</i></td></tr>
|
||||
|
||||
<tr><td>{|Drucker Paketmarke|}:</td><td><select name="paketmarke_drucker" id="paketmarke_drucker">[PAKETMARKE_DRUCKER]</select></td></tr>
|
||||
<tr><td>{|Drucker Export|}:</td><td><select name="export_drucker" id="export_drucker">[EXPORT_DRUCKER]</select></td></tr>
|
||||
<tr><td>{|Versandmail|}:</td><td><select name="versandmail" id="versandmail">[SELVERSANDMAIL]</select></td></tr>
|
||||
<tr class="versandbetreff"><td>{|Textvorlage|}:</td><td><select name="geschaeftsbrief_vorlage" id="geschaeftsbrief_vorlage">[SELGESCHAEFTSBRIEF_VORLAGE]</select></td></tr>
|
||||
[JSON]
|
||||
</table>
|
||||
</fieldset>
|
||||
<input type="submit" name="speichern" value="{|Speichern|}" id="speichern" style="float:right"/>
|
||||
</form>
|
||||
<ul>
|
||||
<li><a href="#tabs-1"></a></li>
|
||||
</ul>
|
||||
<div id="tabs-1">
|
||||
[MESSAGE]
|
||||
<form action="" method="post" name="eprooform">
|
||||
[FORMHANDLEREVENT]
|
||||
<fieldset>
|
||||
<legend>{|Einstellungen|}</legend>
|
||||
<table class="mkTableFormular">
|
||||
<tr>
|
||||
<td>{|Bezeichnung|}:</td>
|
||||
<td>
|
||||
<input type="text" name="bezeichnung" value="[BEZEICHNUNG]" size="40"
|
||||
data-lang="versandart_bezeichnung_[ID]" required>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Typ|}:</td>
|
||||
<td>
|
||||
<input type="text" name="type" value="[TYPE]" size="40" required>
|
||||
<i>{|z.B. dhl,ups,etc.|}</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Modul|}:</td>
|
||||
<td>[SELMODUL]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Projekt|}:</td>
|
||||
<td><input type="text" id="projekt" name="projekt" value="[PROJEKT]" size="30"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Aktiv|}:</td>
|
||||
<td>
|
||||
<input type="checkbox" name="aktiv" value="1" [AKTIV]>
|
||||
<i>{|Aktiv. Nicht mehr verwendete Versandarten können deaktiviert werden.|}</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Kein Portocheck|}:</td>
|
||||
<td>
|
||||
<input type="checkbox" name="keinportocheck" value="1" [KEINPORTOCHECK]>
|
||||
<i>{|Porto-Check im Auftrag deaktivieren.|}</i>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Drucker Paketmarke|}:</td>
|
||||
<td>[PAKETMARKE_DRUCKER]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Drucker Export|}:</td>
|
||||
<td>[EXPORT_DRUCKER]</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{|Versandmail|}:</td>
|
||||
<td>[SELVERSANDMAIL]</td>
|
||||
</tr>
|
||||
<tr class="versandbetreff">
|
||||
<td>{|Textvorlage|}:</td>
|
||||
<td>[SELGESCHAEFTSBRIEF_VORLAGE]</td>
|
||||
</tr>
|
||||
[MODULESETTINGS]
|
||||
</table>
|
||||
</fieldset>
|
||||
<input type="submit" name="speichern" value="{|Speichern|}" id="speichern" style="float:right"/>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var modulname = '[AKTMODUL]';
|
||||
function changemodul()
|
||||
{
|
||||
if($('#selmodul').val() != modulname)
|
||||
{
|
||||
if(confirm('{|Wollen Sie das Modul wirklich ändern? Die Einstellungen werden dabei überschrieben|}'))
|
||||
{
|
||||
$( '#speichern' ).trigger( 'click' );
|
||||
}else{
|
||||
$('#selmodul').val(modulname);
|
||||
}
|
||||
var modulname = '[AKTMODUL]';
|
||||
function changemodul() {
|
||||
if ($('#selmodul').val() != modulname) {
|
||||
if (confirm('{|Wollen Sie das Modul wirklich ändern? Die Einstellungen werden dabei überschrieben|}')) {
|
||||
$('#speichern').trigger('click');
|
||||
} else {
|
||||
$('#selmodul').val(modulname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$('#selmodul').on('change', changemodul);
|
||||
</script>
|
||||
|
@ -1,3 +1,9 @@
|
||||
<!--
|
||||
SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
|
||||
|
||||
SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
-->
|
||||
<!-- gehort zu tabview -->
|
||||
<div id="tabs">
|
||||
<ul>
|
||||
@ -12,17 +18,10 @@
|
||||
<fieldset class="moduleList">
|
||||
<legend>{|Auswahl|}</legend>
|
||||
<div id="searchdiv">
|
||||
<label for="suche">{|Suche|}:</label> <input type="text" id="suche" />
|
||||
<label for="suche">{|Suche|}:</label> <input type="text" id="createSearchInput" />
|
||||
</div>
|
||||
[MODULEINSTALLIERT]
|
||||
</fieldset>
|
||||
[BEFOREMODULESTOBUY]
|
||||
<fieldset class="moduleList">
|
||||
<legend>{|Kaufschnittstellen|}</legend>
|
||||
[MODULEVERFUEGBAR]
|
||||
<br />
|
||||
</fieldset>
|
||||
[AFTERMODULESTOBUY]
|
||||
[TAB1NEXT]
|
||||
</div>
|
||||
|
||||
|
@ -1,4 +1,12 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
@ -447,36 +455,24 @@ class Lieferschein extends GenLieferschein
|
||||
|
||||
function LieferscheinPaketmarke()
|
||||
{
|
||||
$id = $this->app->Secure->GetGET("id");
|
||||
$id = (int)$this->app->Secure->GetGET("id");
|
||||
|
||||
$versandart = $this->app->DB->Select("SELECT versandart FROM lieferschein WHERE id='$id' LIMIT 1");
|
||||
$projekt = $this->app->DB->Select("SELECT projekt FROM lieferschein WHERE id = '$id' LIMIT 1");
|
||||
$this->LieferscheinMenu();
|
||||
$this->app->Tpl->Set('TABTEXT',"Paketmarke");
|
||||
|
||||
$versandart = strtolower($versandart);
|
||||
$versandartenmodul = $this->app->DB->SelectArr("SELECT id, modul FROM versandarten WHERE aktiv = 1 AND ausprojekt = 0 AND modul != '' AND type = '".$this->app->DB->real_escape_string($versandart)."' AND (projekt = '$projekt' || projekt = 0) ORDER BY projekt DESC LIMIT 1");
|
||||
if($versandartenmodul && is_file(dirname(__DIR__).'/lib/versandarten/'.$versandartenmodul[0]['modul'].'.php'))
|
||||
{
|
||||
$this->app->erp->Paketmarke('TAB1','lieferschein',"",$versandart);
|
||||
}else{
|
||||
if($versandart=="dpd")
|
||||
$this->app->erp->PaketmarkeDPDEmbedded('TAB1',"lieferschein");
|
||||
else if($versandart=="express_dpd")
|
||||
$this->app->erp->PaketmarkeDPDEmbedded('TAB1',"lieferschein","express");
|
||||
else if($versandart=="export_dpd")
|
||||
$this->app->erp->PaketmarkeDPDEmbedded('TAB1',"lieferschein","export");
|
||||
else if($versandart=="ups")
|
||||
$this->app->erp->PaketmarkeUPSEmbedded('TAB1',"lieferschein");
|
||||
else if($versandart=="fedex")
|
||||
$this->app->erp->PaketmarkeFEDEXEmbedded('TAB1',"lieferschein");
|
||||
else if($versandart=="go")
|
||||
$this->app->erp->PaketmarkeGo('TAB1',"lieferschein");
|
||||
else {
|
||||
$this->app->erp->Paketmarke('TAB1','lieferschein',"","");
|
||||
}
|
||||
//$this->app->erp->PaketmarkeDHLEmbedded('TAB1',"lieferschein");
|
||||
$result = $this->app->DB->SelectRow(
|
||||
"SELECT v.id, v.modul
|
||||
FROM lieferschein l
|
||||
LEFT JOIN versandarten v ON (l.versandart=v.type AND v.projekt in (l.projekt, 0))
|
||||
WHERE l.id=$id
|
||||
AND v.aktiv = 1 AND v.ausprojekt = 0 AND v.modul != ''
|
||||
ORDER BY v.projekt DESC LIMIT 1");
|
||||
if (empty($result['modul']) || empty($result['id'])) {
|
||||
$this->app->Tpl->addMessage('error', 'Bitte zuerst eine gültige Versandart auswählen', false, 'PAGE');
|
||||
return;
|
||||
}
|
||||
$versandmodul = $this->app->erp->LoadVersandModul($result['modul'], $result['id']);
|
||||
$versandmodul->Paketmarke('TAB1', 'lieferschein', $id);
|
||||
$this->app->Tpl->Parse('PAGE',"tabview.tpl");
|
||||
}
|
||||
|
||||
|
283
www/pages/rechnungslauf.php
Normal file
283
www/pages/rechnungslauf.php
Normal file
@ -0,0 +1,283 @@
|
||||
<?php
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
use Xentral\Modules\SubscriptionCycle\Service\SubscriptionCycleJobService;
|
||||
use Xentral\Modules\SubscriptionCycle\SubscriptionModule;
|
||||
|
||||
class Rechnungslauf {
|
||||
/** @var Application $app */
|
||||
protected $app;
|
||||
|
||||
/**
|
||||
* @param Application $app
|
||||
* @param string $name
|
||||
* @param array $erlaubtevars
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function TableSearch($app, $name, $erlaubtevars)
|
||||
{
|
||||
// in dieses switch alle lokalen Tabellen (diese Live Tabellen mit Suche etc.) für dieses Modul
|
||||
switch($name)
|
||||
{
|
||||
case 'rechnungslauf_invoices':
|
||||
case 'rechnungslauf_orders':
|
||||
if ($name == 'rechnungslauf_invoices')
|
||||
$doctype = 'rechnung';
|
||||
else
|
||||
$doctype = 'auftrag';
|
||||
$allowed['rechnungslauf'] = ['rechnungslauf'];
|
||||
|
||||
$heading = array('', '', 'Kunden Nr.', 'Firma/Name', 'Anschreiben', 'E-Mail', 'Projekt', 'Von', 'Bis', 'Betrag netto', 'Menü');
|
||||
$width = ['1%', '1%', '10%', '20%', '10%', '10%', '10%', '10%', '10%', '10%', '1%'];
|
||||
|
||||
$findcols = [
|
||||
'adr.kundennummer',
|
||||
'adr.kundennummer',
|
||||
'adr.kundennummer',
|
||||
'adr.name',
|
||||
'adr.anschreiben',
|
||||
"adr.email",
|
||||
'p.abkuerzung',
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
];
|
||||
$searchsql = ['adr.kundennummer', 'adr.name', 'adr.email'];
|
||||
|
||||
$numbercols = [2, 10];
|
||||
$alignright = [3, 10];
|
||||
$datecols = [7, 8];
|
||||
|
||||
$defaultorder = 3;
|
||||
$defaultorderdesc = 0;
|
||||
$sumcol = [10];
|
||||
|
||||
$menu = '<table cellpadding="0" cellspacing="0">';
|
||||
$menu .= '<tr>';
|
||||
$menu .= '<td nowrap>';
|
||||
$menu .= '<a href="index.php?module=adresse&action=artikel&id=%value%">';
|
||||
$menu .= '<img src="themes/' . $app->Conf->WFconf['defaulttheme'] . '/images/forward.svg" border="0">';
|
||||
$menu .= '</a>';
|
||||
$menu .= '</td>';
|
||||
$menu .= '</tr>';
|
||||
$menu .= '</table>';
|
||||
|
||||
$calcdate = new \DateTimeImmutable('today');
|
||||
$scalcdate = $calcdate->format('Y-m-d');
|
||||
$where = " aa.id > 0
|
||||
AND aa.dokument = '$doctype'
|
||||
AND greatest(aa.startdatum, aa.abgerechnetbis) < '$scalcdate'
|
||||
AND (aa.enddatum = '0000-00-00' OR aa.abgerechnetbis < aa.enddatum)";
|
||||
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS
|
||||
adr.id,
|
||||
'<img src=\"./themes/new/images/details_open.png\" class=\"details\">' as open,
|
||||
concat('<input type=\"checkbox\" name=\"selection[]\" value=\"',adr.id,'\" />') as auswahl,
|
||||
adr.kundennummer,
|
||||
adr.name,
|
||||
adr.anschreiben,
|
||||
adr.email,
|
||||
p.abkuerzung,
|
||||
GROUP_CONCAT(DATE_FORMAT(@start := GREATEST(aa.startdatum, aa.abgerechnetbis),'%d.%m.%Y') SEPARATOR '<br>') as start,
|
||||
GROUP_CONCAT(DATE_FORMAT(
|
||||
@end := CASE
|
||||
WHEN aa.preisart = 'monat' THEN
|
||||
DATE_ADD(@start, INTERVAL TIMESTAMPDIFF(MONTH, @start, IF(aa.enddatum = '0000-00-00' OR aa.enddatum > '$scalcdate', '$scalcdate', aa.enddatum))+1 MONTH)
|
||||
WHEN aa.preisart = 'jahr' THEN
|
||||
DATE_ADD(@start, INTERVAL TIMESTAMPDIFF(YEAR, @start, IF(aa.enddatum = '0000-00-00' OR aa.enddatum > '$scalcdate', '$scalcdate', aa.enddatum))+1 YEAR)
|
||||
WHEN aa.preisart = '30tage' THEN
|
||||
DATE_ADD(@start, INTERVAL (FLOOR(TIMESTAMPDIFF(DAY, @start, IF(aa.enddatum = '0000-00-00' OR aa.enddatum > '$scalcdate', '$scalcdate', aa.enddatum)) / 30)+1)*30 DAY )
|
||||
END, '%d.%m.%Y') SEPARATOR '<br>') as end,
|
||||
SUM((100-aa.rabatt)/100 * aa.preis * aa.menge *
|
||||
(CASE
|
||||
WHEN aa.preisart = 'monat' THEN
|
||||
TIMESTAMPDIFF(MONTH, @start, @end)
|
||||
WHEN aa.preisart = 'jahr' THEN
|
||||
TIMESTAMPDIFF(YEAR, @start, @end)
|
||||
WHEN aa.preisart = '30tage' THEN
|
||||
FLOOR(TIMESTAMPDIFF(DAY, @start, @end) / 30)
|
||||
END
|
||||
)
|
||||
) as amount,
|
||||
adr.id
|
||||
FROM abrechnungsartikel aa
|
||||
JOIN artikel a ON aa.artikel = a.id
|
||||
JOIN adresse adr ON aa.adresse = adr.id
|
||||
LEFT JOIN projekt p ON aa.projekt = p.id";
|
||||
|
||||
$groupby = " GROUP BY aa.adresse, aa.projekt";
|
||||
|
||||
$count = "SELECT count(aa.id)
|
||||
FROM `abrechnungsartikel` AS `aa`
|
||||
WHERE $where $groupby";
|
||||
$menucol = 10;
|
||||
$moreinfo = true;
|
||||
break;
|
||||
|
||||
case 'rechnungslauf_abos':
|
||||
$allowed['rechnungslauf'] = ['abos'];
|
||||
$heading = array(
|
||||
'Kunde',
|
||||
'Kunden Nr.',
|
||||
'Bezeichnung',
|
||||
'Nummer',
|
||||
'Abgerechnet bis',
|
||||
'Enddatum',
|
||||
'Preis',
|
||||
'Rabatt',
|
||||
'Menge',
|
||||
'Art',
|
||||
'Zahlperiode',
|
||||
'Zahlweise',
|
||||
'Dokument',
|
||||
'Menü');
|
||||
$width = ['10%','5%','15%','1','1','1','1','1','1','1','1','1','1','1'];
|
||||
|
||||
$findcols = [
|
||||
'ad.name',
|
||||
'ad.kundennummer',
|
||||
'aa.bezeichnung',
|
||||
'a.nummer',
|
||||
"DATE_FORMAT(aa.abgerechnetbis, '%d.%m.%Y')",
|
||||
'aa.enddatum',
|
||||
'aa.preis',
|
||||
'aa.rabatt',
|
||||
'aa.menge',
|
||||
'aa.preisart',
|
||||
'aa.zahlzyklus',
|
||||
'',
|
||||
'aa.dokument'
|
||||
];
|
||||
$searchsql = ['ad.name', 'aa.bezeichnung'];
|
||||
|
||||
$numbercols = [0];
|
||||
$alignright = [7];
|
||||
$datecols = [5,6];
|
||||
|
||||
$defaultorder = 1;
|
||||
$defaultorderdesc = 0;
|
||||
|
||||
$menu = "<table cellpadding=0 cellspacing=0><tr><td nowrap>"
|
||||
. "<a href=\"index.php?module=adresse&action=artikel&id=%value%\">"
|
||||
. "<img src=\"themes/{$app->Conf->WFconf['defaulttheme']}/images/forward.svg\" border=\"0\"></a>"
|
||||
. " </td></tr></table>";
|
||||
|
||||
$where = " aa.id > 0 AND (aa.enddatum = '0000-00-00' OR aa.abgerechnetbis < aa.enddatum) ";
|
||||
|
||||
$sql = "SELECT SQL_CALC_FOUND_ROWS aa.id, ad.name, ad.kundennummer,
|
||||
aa.bezeichnung, a.nummer, DATE_FORMAT(aa.abgerechnetbis, '%d.%m.%Y'),
|
||||
DATE_FORMAT(aa.enddatum, '%d.%m.%Y'),
|
||||
".$app->erp->FormatPreis('aa.preis', 2).", aa.rabatt, aa.menge,
|
||||
aa.preisart, aa.zahlzyklus, '', aa.dokument, ad.id
|
||||
FROM `abrechnungsartikel` AS `aa`
|
||||
LEFT JOIN `adresse` AS `ad` ON aa.adresse = ad.id
|
||||
LEFT JOIN `artikel` AS `a` ON aa.artikel = a.id";
|
||||
|
||||
$count = "SELECT count(aa.id)
|
||||
FROM `abrechnungsartikel` AS `aa`
|
||||
WHERE $where";
|
||||
break;
|
||||
}
|
||||
|
||||
$erg = [];
|
||||
|
||||
foreach($erlaubtevars as $k => $v) {
|
||||
if(isset($$v)) {
|
||||
$erg[$v] = $$v;
|
||||
}
|
||||
}
|
||||
|
||||
return $erg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Rechnungslauf constructor.
|
||||
*
|
||||
* @param Application $app
|
||||
* @param bool $intern
|
||||
*/
|
||||
public function __construct($app, $intern = false) {
|
||||
$this->app = $app;
|
||||
if($intern) {
|
||||
return;
|
||||
}
|
||||
$this->app->ActionHandlerInit($this);
|
||||
|
||||
// ab hier alle Action Handler definieren die das Modul hat
|
||||
$this->app->ActionHandler('list', 'ActionList');
|
||||
$this->app->ActionHandler('abos', 'ActionAbos');
|
||||
$this->app->ActionHandler('minidetail', 'ActionMinidetail');
|
||||
|
||||
$this->app->ActionHandlerListen($app);
|
||||
}
|
||||
|
||||
public function MenuList() {
|
||||
$this->app->erp->Headlines("Abolauf");
|
||||
$this->app->erp->MenuEintrag("index.php?module=rechnungslauf&action=list", "Übersicht");
|
||||
$this->app->erp->MenuEintrag("index.php?module=rechnungslauf&action=abos", "gebuchte Abos");
|
||||
$this->app->erp->MenuEintrag("index.php?module=rechnungslauf&action=einstellungen", "Einstellungen");
|
||||
}
|
||||
|
||||
public function ActionList() {
|
||||
/** @var SubscriptionModule $module */
|
||||
$this->MenuList();
|
||||
$this->app->YUI->TableSearch("TAB_INVOICES", 'rechnungslauf_invoices','show', '', '', basename(__FILE__), __CLASS__);
|
||||
$this->app->YUI->TableSearch("TAB_ORDERS", 'rechnungslauf_orders','show', '', '', basename(__FILE__), __CLASS__);
|
||||
if ($this->app->Secure->GetPOST('createInvoices') !== '') {
|
||||
$selection = $this->app->Secure->GetPOST('selection');
|
||||
/** @var SubscriptionCycleJobService $subscriptionCycleJobService */
|
||||
$subscriptionCycleJobService = $this->app->Container->get('SubscriptionCycleJobService');
|
||||
foreach ($selection as $value) {
|
||||
$subscriptionCycleJobService->deleteJobsByAddressIdAndDoctype($value, 'rechnung');
|
||||
$subscriptionCycleJobService->create($value, 'rechnung');
|
||||
$this->app->Tpl->addMessage('info', 'Die Rechnungen werden nun im Hintergrund erstellt', false, 'MESSAGE_INVOICES');
|
||||
}
|
||||
}
|
||||
else if ($this->app->Secure->GetPOST('createOrders') !== '') {
|
||||
$selection = $this->app->Secure->GetPOST('selection');
|
||||
/** @var SubscriptionCycleJobService $subscriptionCycleJobService */
|
||||
$subscriptionCycleJobService = $this->app->Container->get('SubscriptionCycleJobService');
|
||||
foreach ($selection as $value) {
|
||||
$subscriptionCycleJobService->deleteJobsByAddressIdAndDoctype($value, 'auftrag');
|
||||
$subscriptionCycleJobService->create($value, 'auftrag');
|
||||
$this->app->Tpl->addMessage('info', 'Die Aufträge werden nun im Hintergrund erstellt', false, 'MESSAGE_ORDERS');
|
||||
}
|
||||
}
|
||||
$this->app->Tpl->Parse('PAGE', 'rechnungslauf_list.tpl');
|
||||
}
|
||||
|
||||
public function ActionAbos() {
|
||||
$this->MenuList();
|
||||
$this->app->YUI->TableSearch("TAB1", 'rechnungslauf_abos', 'show', '', '', basename(__FILE__), __CLASS__);
|
||||
$this->app->Tpl->Parse('PAGE', 'rechnungslauf_abos.tpl');
|
||||
}
|
||||
|
||||
public function ActionMinidetail() {
|
||||
/** @var SubscriptionModule $module */
|
||||
$module = $this->app->Container->get('SubscriptionModule');
|
||||
$address = $this->app->Secure->GetGET('id');
|
||||
$pos = $module->GetPositions($address, 'rechnung');
|
||||
foreach ($pos as $p) {
|
||||
$row = '<tr>';
|
||||
$row .= sprintf('<td>%s</td>', $p['bezeichnung']);
|
||||
$row .= sprintf('<td>%s</td>', $p['menge']);
|
||||
$row .= sprintf('<td style="text-align: right">%s</td>',
|
||||
$this->app->erp->number_format_variable($p['preis'], 2));
|
||||
$row .= sprintf('<td>%s</td>', $p['rabatt']);
|
||||
$row .= sprintf('<td>%s</td>', $p['cycles']);
|
||||
$row .= sprintf('<td style="text-align: right">%s</td>',
|
||||
$this->app->erp->number_format_variable($p['preis']*$p['menge']*$p['cycles'], 2));
|
||||
$row .= sprintf('<td>%s</td>', $p['waehrung']);
|
||||
$row .= '</tr>';
|
||||
$this->app->Tpl->Add('INHALT', $row);
|
||||
}
|
||||
$this->app->Tpl->Set('SUBHEADING', 'Kunde');
|
||||
$this->app->Tpl->Output('rechnungslauf_minidetail.tpl');
|
||||
$this->app->ExitXentral();
|
||||
}
|
||||
}
|
@ -1,4 +1,11 @@
|
||||
<?php
|
||||
<?php
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
@ -10,8 +17,8 @@
|
||||
* to obtain the text of the corresponding license version.
|
||||
*
|
||||
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*/
|
||||
?>
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
class Shopimport
|
||||
@ -830,7 +837,7 @@ class Shopimport
|
||||
// denn fall das es kunde 1:1 schon gibt = alte Kundennummer verwenden kommt vor allem vor, wenn ein Kunde an einem Tag oefters bestellt hat
|
||||
// $adresse = $this->app->erp->KundeAnlegen($typ,$name,$abteilung,
|
||||
// $unterabteilung,$ansprechpartner,$adresszusatz,$strasse,$land,$plz,$ort,$email,$telefon,$telefax,$ustid,$partner,$projekt);
|
||||
if(strlen($warenkorb['kundennummer'])!=''){
|
||||
if(!empty($warenkorb['kundennummer'])){
|
||||
$adresse = $this->app->DB->Select("SELECT id FROM adresse WHERE kundennummer='{$warenkorb['kundennummer']}' $adresseprojekt AND geloescht!=1 LIMIT 1");
|
||||
}
|
||||
|
||||
|
436
www/pages/shopimporter_presta.php
Normal file
436
www/pages/shopimporter_presta.php
Normal file
@ -0,0 +1,436 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
class Shopimporter_Presta extends ShopimporterBase
|
||||
{
|
||||
private $app;
|
||||
private $intern;
|
||||
private $shopid;
|
||||
private $data;
|
||||
private $protocol;
|
||||
private $apiKey;
|
||||
private $shopUrl;
|
||||
private $createManufacturerAllowed = false;
|
||||
private $idsabholen;
|
||||
private $idbearbeitung;
|
||||
private $idabgeschlossen;
|
||||
|
||||
// TODO
|
||||
private $langidToIso = [3 => 'de', 1 => 'en'];
|
||||
private $taxationByDestinationCountry;
|
||||
|
||||
|
||||
public function __construct($app, $intern = false)
|
||||
{
|
||||
$this->app = $app;
|
||||
$this->intern = $intern;
|
||||
if ($intern)
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
public function EinstellungenStruktur()
|
||||
{
|
||||
return [
|
||||
'ausblenden' => ['abholmodus' => ['ab_nummer', 'zeitbereich']],
|
||||
'functions' => ['getarticlelist'],
|
||||
'felder' => [
|
||||
'protokoll' => [
|
||||
'typ' => 'checkbox',
|
||||
'bezeichnung' => '{|Protokollierung im Logfile|}:'
|
||||
],
|
||||
'textekuerzen' => [
|
||||
'typ' => 'checkbox',
|
||||
'bezeichnung' => '{|Texte bei Artikelexport auf Maximallänge kürzen|}:'
|
||||
],
|
||||
'useKeyAsParameter' => [
|
||||
'typ' => 'checkbox',
|
||||
'bezeichnung' => '{|Shop Version ist mindestens 1.6.1.1|}:'
|
||||
],
|
||||
'apikey' => [
|
||||
'typ' => 'text',
|
||||
'bezeichnung' => '{|API Key|}:',
|
||||
'size' => 40,
|
||||
],
|
||||
'shopurl' => [
|
||||
'typ' => 'text',
|
||||
'bezeichnung' => '{|Shop URL|}:',
|
||||
'size' => 40,
|
||||
],
|
||||
'shopidpresta' => [
|
||||
'typ' => 'text',
|
||||
'bezeichnung' => '{|Shop ID des Shops|}:',
|
||||
'size' => 40,
|
||||
],
|
||||
'steuergruppen' => [
|
||||
'typ' => 'text',
|
||||
'bezeichnung' => '{|Steuergruppenmapping|}:',
|
||||
'size' => 40,
|
||||
],
|
||||
'zustand' => [
|
||||
'typ' => 'text',
|
||||
'bezeichnung' => '{|Freifeld Zustand|}:',
|
||||
'size' => 40,
|
||||
],
|
||||
'abholen' => [
|
||||
'typ' => 'text',
|
||||
'bezeichnung' => '{|\'Abholen\' Status IDs|}:',
|
||||
'size' => 40,
|
||||
],
|
||||
'bearbeitung' => [
|
||||
'typ' => 'text',
|
||||
'bezeichnung' => '{|\'In Bearbeitung\' Status IDs|}:',
|
||||
'size' => 40,
|
||||
],
|
||||
'abgeschlossen' => [
|
||||
'typ' => 'text',
|
||||
'bezeichnung' => '{|\'Abgeschlossen\' Status IDs|}:',
|
||||
'size' => 40,
|
||||
],
|
||||
'autoerstellehersteller' => [
|
||||
'typ' => 'checkbox',
|
||||
'bezeichnung' => '{|Fehlende Hersteller automatisch anlegen|}:',
|
||||
'col' => 2
|
||||
],
|
||||
'zeigezustand' => [
|
||||
'typ' => 'checkbox',
|
||||
'bezeichnung' => '{|Artikelzustand im Shop anzeigen|}:',
|
||||
'col' => 2
|
||||
],
|
||||
'zeigepreis' => [
|
||||
'typ' => 'checkbox',
|
||||
'bezeichnung' => '{|Artikelpreis im Shop anzeigen|}:',
|
||||
'col' => 2
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
public function getKonfig($shopid, $data)
|
||||
{
|
||||
$this->shopid = $shopid;
|
||||
$this->data = $data;
|
||||
$importerSettings = $this->app->DB->SelectArr("SELECT `einstellungen_json` FROM `shopexport` WHERE `id` = '$shopid' LIMIT 1");
|
||||
$importerSettings = reset($importerSettings);
|
||||
|
||||
$einstellungen = [];
|
||||
if (!empty($importerSettings['einstellungen_json'])) {
|
||||
$einstellungen = json_decode($importerSettings['einstellungen_json'], true);
|
||||
}
|
||||
$this->protocol = $einstellungen['felder']['protokoll'];
|
||||
$this->apiKey = $einstellungen['felder']['apikey'];
|
||||
$this->shopUrl = rtrim($einstellungen['felder']['shopurl'], '/') . '/';
|
||||
if ($einstellungen['felder']['autoerstellehersteller'] === '1') {
|
||||
$this->createManufacturerAllowed = true;
|
||||
}
|
||||
$this->idsabholen = $einstellungen['felder']['abholen'];
|
||||
$this->idbearbeitung = $einstellungen['felder']['bearbeitung'];
|
||||
$this->idabgeschlossen = $einstellungen['felder']['abgeschlossen'];
|
||||
$query = sprintf('SELECT `steuerfreilieferlandexport` FROM `shopexport` WHERE `id` = %d', $this->shopid);
|
||||
$this->taxationByDestinationCountry = !empty($this->app->DB->Select($query));
|
||||
}
|
||||
|
||||
public function ImportAuth() {
|
||||
$ch = curl_init($this->shopUrl);
|
||||
curl_setopt($ch, CURLOPT_USERNAME, $this->apiKey);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = curl_exec($ch);
|
||||
$code = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
|
||||
if ($code == 200)
|
||||
return 'success';
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function ImportDeleteAuftrag()
|
||||
{
|
||||
$auftrag = $this->data['auftrag'];
|
||||
|
||||
$obj = $this->prestaRequest('GET', 'order_histories?schema=blank');
|
||||
$obj->order_history->id_order = $auftrag;
|
||||
$obj->order_history->id_order_state = $this->idbearbeitung;
|
||||
|
||||
$this->prestaRequest('POST', 'order_histories', $obj->asXML());
|
||||
}
|
||||
|
||||
public function ImportUpdateAuftrag()
|
||||
{
|
||||
$auftrag = $this->data['auftrag'];
|
||||
|
||||
$obj = $this->prestaRequest('GET', 'order_histories?schema=blank');
|
||||
$obj->order_history->id_order = $auftrag;
|
||||
$obj->order_history->id_order_state = $this->idabgeschlossen;
|
||||
|
||||
$this->prestaRequest('POST', 'order_histories', $obj->asXML());
|
||||
|
||||
$req = $this->prestaRequest('GET', "order_carriers?filter[id_order]=$auftrag&display=[id]");
|
||||
$orderCarrierId = strval($req->order_carriers->order_carrier[0]->id);
|
||||
$req = $this->prestaRequest('GET', "order_carriers/$orderCarrierId");
|
||||
$req->order_carrier->tracking_number = $this->data['tracking'];
|
||||
$this->prestaRequest('PUT', "order_carriers/$orderCarrierId", $req->asXML());
|
||||
}
|
||||
|
||||
public function ImportGetAuftraegeAnzahl()
|
||||
{
|
||||
$ordersToProcess = $this->getOrdersToProcess($this->getOrderSearchLimit());
|
||||
return count($ordersToProcess);
|
||||
}
|
||||
|
||||
public function ImportGetAuftrag()
|
||||
{
|
||||
$voucherArticleId = $this->app->DB->Select("SELECT s.artikelrabatt FROM `shopexport` AS `s` WHERE s.id='$this->shopid' LIMIT 1");
|
||||
$voucherArticleNumber = $this->app->DB->Select("SELECT a.nummer FROM `artikel` AS `a` WHERE a.id='$voucherArticleId' LIMIT 1");
|
||||
|
||||
if (empty($this->idsabholen)) {
|
||||
return false;
|
||||
}
|
||||
$expectOrderArray = !empty($this->data['anzgleichzeitig']) && (int)$this->data['anzgleichzeitig'] > 1;
|
||||
$expectNumber = !empty($this->data['nummer']);
|
||||
if ($expectNumber) {
|
||||
$ordersToProcess = [$this->data['nummer']];
|
||||
} elseif (!$expectOrderArray) {
|
||||
$ordersToProcess = $this->getOrdersToProcess(1);
|
||||
} else {
|
||||
$ordersToProcess = $this->getOrdersToProcess($this->getOrderSearchLimit());
|
||||
}
|
||||
|
||||
$fetchedOrders = [];
|
||||
foreach ($ordersToProcess as $currentOrderId) {
|
||||
$order = $this->prestaRequest('GET', "orders/$currentOrderId");
|
||||
$order = $order->order;
|
||||
$cart = [];
|
||||
$cart['zeitstempel'] = strval($order->date_add);
|
||||
$cart['auftrag'] = strval($order->id);
|
||||
$cart['onlinebestellnummer'] = strval($order->reference);
|
||||
$cart['gesamtsumme'] = strval($order->total_paid);
|
||||
$cart['versandkostennetto'] = strval($order->total_shipping_tax_excl);
|
||||
$cart['bestelldatum'] = strval($order->date_add);
|
||||
|
||||
$carrier = $this->prestaRequest('GET', "carriers/$order->id_carrier");
|
||||
$cart['lieferung'] = strval($carrier->carrier->name);
|
||||
|
||||
$customer = $this->prestaRequest('GET', "customers/$order->id_customer");
|
||||
$cart['email'] = strval($customer->customer->email);
|
||||
|
||||
$language = $this->prestaRequest('GET', "languages/{$customer->customer->id_lang}");
|
||||
if ($language->language->iso_code == "en") {
|
||||
$cart['kunde_sprache'] = 'englisch';
|
||||
}
|
||||
|
||||
$invoiceAddress = $this->prestaRequest('GET', "addresses/$order->id_address_invoice");
|
||||
$invoiceAddress = $invoiceAddress->address;
|
||||
$invoiceCountry = $this->prestaRequest('GET', "countries/$invoiceAddress->id_country");
|
||||
$invoiceCountry = $invoiceCountry->country;
|
||||
$cart['name'] = "$invoiceAddress->firstname $invoiceAddress->lastname";
|
||||
if (!empty(strval($invoiceAddress->company))) {
|
||||
$cart['ansprechpartner'] = $cart['name'];
|
||||
$cart['name'] = strval($invoiceAddress->company);
|
||||
}
|
||||
$cart['strasse'] = strval($invoiceAddress->address1);
|
||||
$cart['adresszusatz'] = strval($invoiceAddress->address2);
|
||||
$cart['telefon'] = strval($invoiceAddress->phone_mobile);
|
||||
if (empty($cart['telefon']))
|
||||
$cart['telefon'] = strval($invoiceAddress->phone);
|
||||
$cart['plz'] = strval($invoiceAddress->postcode);
|
||||
$cart['ort'] = strval($invoiceAddress->city);
|
||||
$cart['ustid'] = strval($invoiceAddress->vat_number);
|
||||
$cart['land'] = strval($invoiceCountry->iso_code);
|
||||
|
||||
if (strval($order->id_address_invoice) != strval($order->id_address_delivery)) {
|
||||
$deliveryAddress = $this->prestaRequest('GET', "addresses/$order->id_address_delivery");
|
||||
$deliveryAddress = $deliveryAddress->address;
|
||||
$deliveryCountry = $this->prestaRequest('GET', "countries/$deliveryAddress->id_country");
|
||||
$deliveryCountry = $deliveryCountry->country;
|
||||
$cart['abweichendelieferadresse'] = 1;
|
||||
$cart['lieferadresse_name'] = "$deliveryAddress->firstname $deliveryAddress->lastname";
|
||||
if (!empty(strval($deliveryAddress->company))) {
|
||||
$cart['lieferadresse_ansprechpartner'] = $cart['lieferadresse_name'];
|
||||
$cart['lieferadresse_name'] = strval($deliveryAddress->company);
|
||||
}
|
||||
$cart['lieferadresse_strasse'] = strval($deliveryAddress->address1);
|
||||
$cart['lieferadresse_adresszusatz'] = strval($deliveryAddress->address2);
|
||||
$cart['lieferadresse_plz'] = strval($deliveryAddress->postcode);
|
||||
$cart['lieferadresse_ort'] = strval($deliveryAddress->city);
|
||||
$cart['lieferadresse_land'] = strval($deliveryCountry->iso_code);
|
||||
}
|
||||
|
||||
//TODO
|
||||
//$cart['transaktionsnummer']
|
||||
$cart['zahlungsweise'] = strval($order->payment);
|
||||
|
||||
$taxedCountry = $cart['land'];
|
||||
if (!empty($cart['lieferadresse_land']) && $this->taxationByDestinationCountry) {
|
||||
$taxedCountry = $cart['lieferadresse_land'];
|
||||
}
|
||||
$lieferschwelle = $this->app->DB->SelectArr("SELECT * FROM lieferschwelle WHERE empfaengerland='$taxedCountry' LIMIT 1");
|
||||
if ($this->app->erp->IstEU($taxedCountry) || !empty($lieferschwelle['ueberschreitungsdatum'])) {
|
||||
$cart['ust_befreit'] = 1;
|
||||
} elseif ($this->app->erp->Export($taxedCountry)) {
|
||||
$cart['ust_befreit'] = 2;
|
||||
}
|
||||
|
||||
$taxes = [];
|
||||
$this->app->erp->RunHook('getTaxRatesFromShopOrder', 2, $taxedCountry, $taxes);
|
||||
|
||||
if (isset($taxes['normal']) && $taxes['normal'] > 0)
|
||||
$cart['steuersatz_normal'] = $taxes['normal'];
|
||||
if (isset($taxes['ermaessigt']) && $taxes['ermaessigt'] > 0)
|
||||
$cart['steuersatz_ermaessigt'] = $taxes['ermaessigt'];
|
||||
|
||||
$cart['articlelist'] = [];
|
||||
foreach ($order->associations->order_rows->order_row as $order_row) {
|
||||
|
||||
$steuersatz = (strval($order_row->unit_price_tax_incl) / strval($order_row->unit_price_tax_excl)) - 1;
|
||||
$steuersatz = round($steuersatz, 1);
|
||||
|
||||
$cart['articlelist'][] = [
|
||||
'articleid' => strval($order_row->product_reference),
|
||||
'name' => strval($order_row->product_name),
|
||||
'quantity' => strval($order_row->product_quantity),
|
||||
'price_netto' => strval($order_row->unit_price_tax_excl),
|
||||
'steuersatz' => $steuersatz
|
||||
];
|
||||
}
|
||||
|
||||
$fetchedOrders[] = [
|
||||
'id' => $cart['auftrag'],
|
||||
'sessionid' => '',
|
||||
'logdatei' => '',
|
||||
'warenkorb' => base64_encode(serialize($cart)),
|
||||
'warenkorbjson' => base64_encode(json_encode($cart)),
|
||||
];
|
||||
}
|
||||
$this->Log('Precessed order from presta', $fetchedOrders);
|
||||
|
||||
return $fetchedOrders;
|
||||
}
|
||||
|
||||
public function ImportGetArticleList()
|
||||
{
|
||||
$result = [];
|
||||
$response = $this->prestaRequest('GET', 'products?display=[reference]');
|
||||
foreach ($response->products->product as $product) {
|
||||
$result[] = $product->reference;
|
||||
}
|
||||
|
||||
array_unique($result);
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function ImportGetArticle()
|
||||
{
|
||||
$nummer = $this->data['nummer'];
|
||||
if (isset($this->data['nummerintern'])) {
|
||||
$nummer = $this->data['nummerintern'];
|
||||
}
|
||||
$nummer = trim($nummer);
|
||||
|
||||
if (empty($nummer))
|
||||
return;
|
||||
|
||||
$searchresult = $this->prestaRequest('GET', 'products?filter[reference]='.$nummer);
|
||||
if (empty($searchresult)) {
|
||||
$this->Log('No product found in Shop', $this->data);
|
||||
return;
|
||||
}
|
||||
if (count($searchresult->products->product) > 1) {
|
||||
$this->Log('Got multiple results from Shop', $this->data);
|
||||
}
|
||||
|
||||
$productid = $searchresult->products->product->attributes()->id;
|
||||
$product = $this->prestaRequest('GET', "products/$productid");
|
||||
$res = [];
|
||||
$res['nummer'] = strval($product->product->reference);
|
||||
$res['artikelnummerausshop'] = strval($product->product->reference);
|
||||
$names = $this->toMultilangArray($product->product->name->language);
|
||||
$descriptions = $this->toMultilangArray($product->product->description->language);
|
||||
$shortdescriptions = $this->toMultilangArray($product->product->description_short->language);
|
||||
$res['name'] = $names['de'];
|
||||
$res['name_en'] = $names['en'];
|
||||
$res['uebersicht_de'] = $descriptions['de'];
|
||||
$res['uebersicht_en'] = $descriptions['en'];
|
||||
$res['preis_netto'] = strval($product->product->price);
|
||||
$res['hersteller'] = strval($product->product->manufacturer_name);
|
||||
$res['ean'] = strval($product->product->ean13);
|
||||
|
||||
$images = [];
|
||||
foreach ($product->product->associations->images->image as $img) {
|
||||
$endpoint = "images/products/$productid/$img->id";
|
||||
$imgdata = $this->prestaRequest('GET', $endpoint, '', true);
|
||||
$images[] = [
|
||||
'content' => base64_encode($imgdata),
|
||||
'path' => "$img->id.jpg",
|
||||
'id' => $img->id
|
||||
];
|
||||
}
|
||||
$res['bilder'] = $images;
|
||||
return $res;
|
||||
}
|
||||
|
||||
private function toMultilangArray($xmlnode) {
|
||||
$res = [];
|
||||
foreach ($xmlnode as $item) {
|
||||
$iso = $this->langidToIso[strval($item->attributes()->id)];
|
||||
$res[$iso] = strval($item);
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
private function getOrdersToProcess(int $limit)
|
||||
{
|
||||
$states = implode('|', explode(',', $this->idsabholen));
|
||||
$response = $this->prestaRequest('GET', "orders?display=[id]&limit=$limit&filter[current_state]=[$states]");
|
||||
$result = [];
|
||||
foreach ($response->orders->order as $order) {
|
||||
$result[] = strval($order->id);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getOrderSearchLimit(): int
|
||||
{
|
||||
if(in_array($this->orderSearchLimit, ['50', '75', '100'])) {
|
||||
return (int)$this->orderSearchLimit;
|
||||
}
|
||||
|
||||
return 25;
|
||||
}
|
||||
|
||||
private function Log($message, $dump = '')
|
||||
{
|
||||
if ($this->protocol) {
|
||||
$this->app->erp->Logfile($message, print_r($dump, true));
|
||||
}
|
||||
}
|
||||
|
||||
private function prestaRequest($method, $endpoint, $data = '', $raw = false)
|
||||
{
|
||||
$url = $this->shopUrl . $endpoint;
|
||||
$url = str_replace('[', '%5b', $url);
|
||||
$url = str_replace(']', '%5d', $url);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
if (!empty($data)) {
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
|
||||
}
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);
|
||||
curl_setopt($ch, CURLOPT_USERNAME, $this->apiKey);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$response = curl_exec($ch);
|
||||
if (curl_error($ch)) {
|
||||
$this->error[] = curl_error($ch);
|
||||
}
|
||||
curl_close($ch);
|
||||
|
||||
if ($raw)
|
||||
return $response;
|
||||
|
||||
return simplexml_load_string($response);
|
||||
}
|
||||
}
|
@ -1,4 +1,11 @@
|
||||
<?php
|
||||
<?php
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022 Andreas Palm
|
||||
* SPDX-FileCopyrightText: 2019 Xentral (c) Xentral ERP Software GmbH, Fuggerstrasse 11, D-86150 Augsburg, Germany
|
||||
*
|
||||
* SPDX-License-Identifier: LicenseRef-EGPL-3.1
|
||||
*/
|
||||
|
||||
/*
|
||||
**** COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*
|
||||
@ -10,8 +17,8 @@
|
||||
* to obtain the text of the corresponding license version.
|
||||
*
|
||||
**** END OF COPYRIGHT & LICENSE NOTICE *** DO NOT REMOVE ****
|
||||
*/
|
||||
?>
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
use Xentral\Components\Http\JsonResponse;
|
||||
@ -154,7 +161,7 @@ class Steuersaetze {
|
||||
$ret = [];
|
||||
$taxes = $this->app->DB->SelectArr(
|
||||
sprintf(
|
||||
"SELECT DISTINCT `satz`
|
||||
"SELECT DISTINCT `type`, `satz`
|
||||
FROM `steuersaetze`
|
||||
WHERE `aktiv` = 1
|
||||
AND (`country_code` = '%s' OR (`bezeichnung` = '%s' AND `country_code` = ''))",
|
||||
@ -163,7 +170,7 @@ class Steuersaetze {
|
||||
);
|
||||
if(!empty($taxes)) {
|
||||
foreach($taxes as $rates) {
|
||||
$ret[] = $rates['satz'];
|
||||
$ret[$rates['type']] = $rates['satz'];
|
||||
}
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -66,7 +66,6 @@ function xentral_autoloader($class) {
|
||||
'ICS'=>__DIR__.'/www/plugins/class.ics.php',
|
||||
'USTID'=>__DIR__.'/www/lib/class.ustid.php',
|
||||
'phpprint'=>__DIR__.'/www/plugins/php-print.php',
|
||||
'DHLBusinessShipment'=>__DIR__.'/www/lib/class.intraship.php',
|
||||
'Navigation'=>__DIR__.'/www/lib/class.navigation_edit.php',
|
||||
'GoShipment'=>__DIR__.'/www/lib/class.go.php',
|
||||
'UPSShipment'=>__DIR__.'/www/lib/class.ups.php',
|
||||
|
Loading…
Reference in New Issue
Block a user