szollosil 9 mesi fa
parent
commit
b2e7dfed70
73 ha cambiato i file con 19212 aggiunte e 0 eliminazioni
  1. 24 0
      custom/nav/.editorconfig
  2. 9 0
      custom/nav/.tx/config
  3. 621 0
      custom/nav/COPYING
  4. 5 0
      custom/nav/ChangeLog.md
  5. 86 0
      custom/nav/README.md
  6. 315 0
      custom/nav/action_agenda.php
  7. 620 0
      custom/nav/action_card.php
  8. 226 0
      custom/nav/action_contact.php
  9. 261 0
      custom/nav/action_document.php
  10. 849 0
      custom/nav/action_list.php
  11. 221 0
      custom/nav/action_note.php
  12. 105 0
      custom/nav/admin/about.php
  13. 145 0
      custom/nav/admin/action_extrafields.php
  14. 587 0
      custom/nav/admin/setup.php
  15. 1322 0
      custom/nav/backport/v16/core/class/html.formsetup.class.php
  16. 11 0
      custom/nav/build/makepack-nav.conf
  17. 1097 0
      custom/nav/class/action.class.php
  18. 1097 0
      custom/nav/class/action.class.php.back
  19. 417 0
      custom/nav/class/api_nav.class.php
  20. 480 0
      custom/nav/class/nav.class.php
  21. 587 0
      custom/nav/core/modules/modNav.class.php
  22. 587 0
      custom/nav/core/modules/modNav.class.php.back
  23. 146 0
      custom/nav/core/modules/nav/mod_action_advanced.php
  24. 161 0
      custom/nav/core/modules/nav/mod_action_standard.php
  25. 194 0
      custom/nav/core/modules/nav/modules_action.php
  26. 349 0
      custom/nav/core/triggers/interface_99_modNav_NavTriggers.class.php
  27. BIN
      custom/nav/img/object_action.png
  28. BIN
      custom/nav/img/object_nav.png
  29. BIN
      custom/nav/img/object_nav_over.png
  30. 54 0
      custom/nav/langs/en_US/nav.lang
  31. 57 0
      custom/nav/lib/NavOnlineInvoice/BaseExceptionResponse.php
  32. 183 0
      custom/nav/lib/NavOnlineInvoice/BaseRequestXml.php
  33. 184 0
      custom/nav/lib/NavOnlineInvoice/Config.php
  34. 188 0
      custom/nav/lib/NavOnlineInvoice/Connector.php
  35. 25 0
      custom/nav/lib/NavOnlineInvoice/CurlError.php
  36. 11 0
      custom/nav/lib/NavOnlineInvoice/GeneralErrorResponse.php
  37. 11 0
      custom/nav/lib/NavOnlineInvoice/GeneralExceptionResponse.php
  38. 32 0
      custom/nav/lib/NavOnlineInvoice/HttpResponseError.php
  39. 216 0
      custom/nav/lib/NavOnlineInvoice/InvoiceOperations.php
  40. 24 0
      custom/nav/lib/NavOnlineInvoice/ManageAnnulmentRequestXml.php
  41. 74 0
      custom/nav/lib/NavOnlineInvoice/ManageInvoiceRequestXml.php
  42. 24 0
      custom/nav/lib/NavOnlineInvoice/QueryInvoiceChainDigestRequestXml.php
  43. 24 0
      custom/nav/lib/NavOnlineInvoice/QueryInvoiceDataRequestXml.php
  44. 29 0
      custom/nav/lib/NavOnlineInvoice/QueryInvoiceDigestRequestXml.php
  45. 17 0
      custom/nav/lib/NavOnlineInvoice/QueryTaxpayerRequestXml.php
  46. 25 0
      custom/nav/lib/NavOnlineInvoice/QueryTransactionListRequestXml.php
  47. 20 0
      custom/nav/lib/NavOnlineInvoice/QueryTransactionStatusRequestXml.php
  48. 304 0
      custom/nav/lib/NavOnlineInvoice/Reporter.php
  49. 29 0
      custom/nav/lib/NavOnlineInvoice/RequestIdGeneratorBasic.php
  50. 7 0
      custom/nav/lib/NavOnlineInvoice/RequestIdGeneratorInterface.php
  51. 10 0
      custom/nav/lib/NavOnlineInvoice/TokenExchangeRequestXml.php
  52. 62 0
      custom/nav/lib/NavOnlineInvoice/Util.php
  53. 80 0
      custom/nav/lib/NavOnlineInvoice/XmlUtil.php
  54. 36 0
      custom/nav/lib/NavOnlineInvoice/Xsd.php
  55. 40 0
      custom/nav/lib/NavOnlineInvoice/XsdValidationError.php
  56. 20 0
      custom/nav/lib/NavOnlineInvoice/autoload.php
  57. 727 0
      custom/nav/lib/NavOnlineInvoice/xsd/common.xsd
  58. 86 0
      custom/nav/lib/NavOnlineInvoice/xsd/invoiceAnnulment.xsd
  59. 2277 0
      custom/nav/lib/NavOnlineInvoice/xsd/invoiceApi.xsd
  60. 329 0
      custom/nav/lib/NavOnlineInvoice/xsd/invoiceBase.xsd
  61. 2368 0
      custom/nav/lib/NavOnlineInvoice/xsd/invoiceData.xsd
  62. 217 0
      custom/nav/lib/NavOnlineInvoice/xsd/serviceMetrics.xsd
  63. 68 0
      custom/nav/lib/nav.lib.php
  64. 110 0
      custom/nav/lib/nav_action.lib.php
  65. 3 0
      custom/nav/modulebuilder.txt
  66. 262 0
      custom/nav/navindex.php
  67. 3 0
      custom/nav/sql/dolibarr_allversions.sql
  68. 30 0
      custom/nav/sql/llx_nav_action.key.sql
  69. 39 0
      custom/nav/sql/llx_nav_action.sql
  70. 39 0
      custom/nav/sql/llx_nav_action.sql.back
  71. 19 0
      custom/nav/sql/llx_nav_action_extrafields.key.sql
  72. 23 0
      custom/nav/sql/llx_nav_action_extrafields.sql
  73. 304 0
      custom/nav/test/phpunit/NavFunctionalTest.php

+ 24 - 0
custom/nav/.editorconfig

@@ -0,0 +1,24 @@
+# EditorConfig is awesome: http://EditorConfig.org
+
+# top-most EditorConfig file
+root = true
+
+# Unix-style newlines with a newline ending every file
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+
+[*.php]
+indent_style = tab
+indent_size = 4
+trim_trailing_whitespace = true
+insert_final_newline = true
+[*.js]
+indent_style = tab
+[*.css]
+indent_style = tab
+[*.xml]
+indent_style = tab
+[*.md]
+trim_trailing_whitespace = false

+ 9 - 0
custom/nav/.tx/config

@@ -0,0 +1,9 @@
+[main]
+host = https://www.transifex.com
+lang_map = uz: uz_UZ
+
+[mymodule.mymodule]
+file_filter = langs/<lang>/mymodule.lang
+source_file = langs/en_US/mymodule.lang
+source_lang = en_US
+type = MOZILLAPROPERTIES

+ 621 - 0
custom/nav/COPYING

@@ -0,0 +1,621 @@
+                    GNU GENERAL PUBLIC LICENSE
+                       Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+  The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works.  By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.  We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors.  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+  To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights.  Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received.  You must make sure that they, too, receive
+or can get the source code.  And you must show them these terms so they
+know their rights.
+
+  Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+  For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software.  For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+  Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so.  This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software.  The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable.  Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products.  If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+  Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary.  To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                       TERMS AND CONDITIONS
+
+  0. Definitions.
+
+  "This License" refers to version 3 of the GNU General Public License.
+
+  "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+  "The Program" refers to any copyrightable work licensed under this
+License.  Each licensee is addressed as "you".  "Licensees" and
+"recipients" may be individuals or organizations.
+
+  To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy.  The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+  A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+  To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy.  Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+  To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies.  Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+  An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License.  If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+  1. Source Code.
+
+  The "source code" for a work means the preferred form of the work
+for making modifications to it.  "Object code" means any non-source
+form of a work.
+
+  A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+  The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form.  A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+  The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities.  However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work.  For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+  The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+  The Corresponding Source for a work in source code form is that
+same work.
+
+  2. Basic Permissions.
+
+  All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met.  This License explicitly affirms your unlimited
+permission to run the unmodified Program.  The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work.  This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+  You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force.  You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright.  Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+  Conveying under any other circumstances is permitted solely under
+the conditions stated below.  Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+  No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+  When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+  4. Conveying Verbatim Copies.
+
+  You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+  You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+  5. Conveying Modified Source Versions.
+
+  You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+    a) The work must carry prominent notices stating that you modified
+    it, and giving a relevant date.
+
+    b) The work must carry prominent notices stating that it is
+    released under this License and any conditions added under section
+    7.  This requirement modifies the requirement in section 4 to
+    "keep intact all notices".
+
+    c) You must license the entire work, as a whole, under this
+    License to anyone who comes into possession of a copy.  This
+    License will therefore apply, along with any applicable section 7
+    additional terms, to the whole of the work, and all its parts,
+    regardless of how they are packaged.  This License gives no
+    permission to license the work in any other way, but it does not
+    invalidate such permission if you have separately received it.
+
+    d) If the work has interactive user interfaces, each must display
+    Appropriate Legal Notices; however, if the Program has interactive
+    interfaces that do not display Appropriate Legal Notices, your
+    work need not make them do so.
+
+  A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit.  Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+  6. Conveying Non-Source Forms.
+
+  You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+    a) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by the
+    Corresponding Source fixed on a durable physical medium
+    customarily used for software interchange.
+
+    b) Convey the object code in, or embodied in, a physical product
+    (including a physical distribution medium), accompanied by a
+    written offer, valid for at least three years and valid for as
+    long as you offer spare parts or customer support for that product
+    model, to give anyone who possesses the object code either (1) a
+    copy of the Corresponding Source for all the software in the
+    product that is covered by this License, on a durable physical
+    medium customarily used for software interchange, for a price no
+    more than your reasonable cost of physically performing this
+    conveying of source, or (2) access to copy the
+    Corresponding Source from a network server at no charge.
+
+    c) Convey individual copies of the object code with a copy of the
+    written offer to provide the Corresponding Source.  This
+    alternative is allowed only occasionally and noncommercially, and
+    only if you received the object code with such an offer, in accord
+    with subsection 6b.
+
+    d) Convey the object code by offering access from a designated
+    place (gratis or for a charge), and offer equivalent access to the
+    Corresponding Source in the same way through the same place at no
+    further charge.  You need not require recipients to copy the
+    Corresponding Source along with the object code.  If the place to
+    copy the object code is a network server, the Corresponding Source
+    may be on a different server (operated by you or a third party)
+    that supports equivalent copying facilities, provided you maintain
+    clear directions next to the object code saying where to find the
+    Corresponding Source.  Regardless of what server hosts the
+    Corresponding Source, you remain obligated to ensure that it is
+    available for as long as needed to satisfy these requirements.
+
+    e) Convey the object code using peer-to-peer transmission, provided
+    you inform other peers where the object code and Corresponding
+    Source of the work are being offered to the general public at no
+    charge under subsection 6d.
+
+  A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+  A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling.  In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage.  For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product.  A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+  "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source.  The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+  If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information.  But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+  The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed.  Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+  Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+  7. Additional Terms.
+
+  "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law.  If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+  When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it.  (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.)  You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+  Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+    a) Disclaiming warranty or limiting liability differently from the
+    terms of sections 15 and 16 of this License; or
+
+    b) Requiring preservation of specified reasonable legal notices or
+    author attributions in that material or in the Appropriate Legal
+    Notices displayed by works containing it; or
+
+    c) Prohibiting misrepresentation of the origin of that material, or
+    requiring that modified versions of such material be marked in
+    reasonable ways as different from the original version; or
+
+    d) Limiting the use for publicity purposes of names of licensors or
+    authors of the material; or
+
+    e) Declining to grant rights under trademark law for use of some
+    trade names, trademarks, or service marks; or
+
+    f) Requiring indemnification of licensors and authors of that
+    material by anyone who conveys the material (or modified versions of
+    it) with contractual assumptions of liability to the recipient, for
+    any liability that these contractual assumptions directly impose on
+    those licensors and authors.
+
+  All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10.  If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term.  If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+  If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+  Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+  8. Termination.
+
+  You may not propagate or modify a covered work except as expressly
+provided under this License.  Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+  However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+  Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+  Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License.  If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+  9. Acceptance Not Required for Having Copies.
+
+  You are not required to accept this License in order to receive or
+run a copy of the Program.  Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance.  However,
+nothing other than this License grants you permission to propagate or
+modify any covered work.  These actions infringe copyright if you do
+not accept this License.  Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+  10. Automatic Licensing of Downstream Recipients.
+
+  Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License.  You are not responsible
+for enforcing compliance by third parties with this License.
+
+  An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations.  If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+  You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License.  For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+  11. Patents.
+
+  A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based.  The
+work thus licensed is called the contributor's "contributor version".
+
+  A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version.  For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+  Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+  In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement).  To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+  If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients.  "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+  If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+  A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License.  You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+  Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+  12. No Surrender of Others' Freedom.
+
+  If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all.  For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+  13. Use with the GNU Affero General Public License.
+
+  Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work.  The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+  14. Revised Versions of this License.
+
+  The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+  Each version is given a distinguishing version number.  If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation.  If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+  If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+  Later license versions may give you additional or different
+permissions.  However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+  15. Disclaimer of Warranty.
+
+  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. Limitation of Liability.
+
+  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+  17. Interpretation of Sections 15 and 16.
+
+  If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+                     END OF TERMS AND CONDITIONS

+ 5 - 0
custom/nav/ChangeLog.md

@@ -0,0 +1,5 @@
+# CHANGELOG NAV FOR [DOLIBARR ERP CRM](https://www.dolibarr.org)
+
+## 1.0
+
+Initial version

+ 86 - 0
custom/nav/README.md

@@ -0,0 +1,86 @@
+# NAV FOR [DOLIBARR ERP CRM](https://www.dolibarr.org)
+
+## Features
+
+Description of the module...
+
+<!--
+![Screenshot nav](img/screenshot_nav.png?raw=true "Nav"){imgmd}
+-->
+
+Other external modules are available on [Dolistore.com](https://www.dolistore.com).
+
+## Translations
+
+Translations can be completed manually by editing files into directories *langs*.
+
+<!--
+This module contains also a sample configuration for Transifex, under the hidden directory [.tx](.tx), so it is possible to manage translation using this service.
+
+For more informations, see the [translator's documentation](https://wiki.dolibarr.org/index.php/Translator_documentation).
+
+There is a [Transifex project](https://transifex.com/projects/p/dolibarr-module-template) for this module.
+-->
+
+<!--
+
+## Installation
+
+### From the ZIP file and GUI interface
+
+If the module is a ready to deploy zip file, so with a name module_xxx-version.zip (like when downloading it from a market place like [Dolistore](https://www.dolistore.com)),
+go into menu ```Home - Setup - Modules - Deploy external module``` and upload the zip file.
+
+Note: If this screen tell you that there is no "custom" directory, check that your setup is correct:
+
+- In your Dolibarr installation directory, edit the ```htdocs/conf/conf.php``` file and check that following lines are not commented:
+
+    ```php
+    //$dolibarr_main_url_root_alt ...
+    //$dolibarr_main_document_root_alt ...
+    ```
+
+- Uncomment them if necessary (delete the leading ```//```) and assign a sensible value according to your Dolibarr installation
+
+    For example :
+
+    - UNIX:
+        ```php
+        $dolibarr_main_url_root_alt = '/custom';
+        $dolibarr_main_document_root_alt = '/var/www/Dolibarr/htdocs/custom';
+        ```
+
+    - Windows:
+        ```php
+        $dolibarr_main_url_root_alt = '/custom';
+        $dolibarr_main_document_root_alt = 'C:/My Web Sites/Dolibarr/htdocs/custom';
+        ```
+
+### From a GIT repository
+
+Clone the repository in ```$dolibarr_main_document_root_alt/nav```
+
+```sh
+cd ....../custom
+git clone git@github.com:gitlogin/nav.git nav
+```
+
+### <a name="final_steps"></a>Final steps
+
+From your browser:
+
+  - Log into Dolibarr as a super-administrator
+  - Go to "Setup" -> "Modules"
+  - You should now be able to find and enable the module
+
+-->
+
+## Licenses
+
+### Main code
+
+GPLv3 or (at your option) any later version. See file COPYING for more information.
+
+### Documentation
+
+All texts and readmes are licensed under GFDL.

+ 315 - 0
custom/nav/action_agenda.php

@@ -0,0 +1,315 @@
+<?php
+/* Copyright (C) 2017 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2023 Deák Ferenc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ *  \file       action_agenda.php
+ *  \ingroup    nav
+ *  \brief      Tab of events on Action
+ */
+
+//if (! defined('NOREQUIREDB'))              define('NOREQUIREDB', '1');				// Do not create database handler $db
+//if (! defined('NOREQUIREUSER'))            define('NOREQUIREUSER', '1');				// Do not load object $user
+//if (! defined('NOREQUIRESOC'))             define('NOREQUIRESOC', '1');				// Do not load object $mysoc
+//if (! defined('NOREQUIRETRAN'))            define('NOREQUIRETRAN', '1');				// Do not load object $langs
+//if (! defined('NOSCANGETFORINJECTION'))    define('NOSCANGETFORINJECTION', '1');		// Do not check injection attack on GET parameters
+//if (! defined('NOSCANPOSTFORINJECTION'))   define('NOSCANPOSTFORINJECTION', '1');		// Do not check injection attack on POST parameters
+//if (! defined('NOCSRFCHECK'))              define('NOCSRFCHECK', '1');				// Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
+//if (! defined('NOTOKENRENEWAL'))           define('NOTOKENRENEWAL', '1');				// Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
+//if (! defined('NOSTYLECHECK'))             define('NOSTYLECHECK', '1');				// Do not check style html tag into posted data
+//if (! defined('NOREQUIREMENU'))            define('NOREQUIREMENU', '1');				// If there is no need to load and show top and left menu
+//if (! defined('NOREQUIREHTML'))            define('NOREQUIREHTML', '1');				// If we don't need to load the html.form.class.php
+//if (! defined('NOREQUIREAJAX'))            define('NOREQUIREAJAX', '1');       	  	// Do not load ajax.lib.php library
+//if (! defined("NOLOGIN"))                  define("NOLOGIN", '1');					// If this page is public (can be called outside logged session). This include the NOIPCHECK too.
+//if (! defined('NOIPCHECK'))                define('NOIPCHECK', '1');					// Do not check IP defined into conf $dolibarr_main_restrict_ip
+//if (! defined("MAIN_LANG_DEFAULT"))        define('MAIN_LANG_DEFAULT', 'auto');					// Force lang to a particular value
+//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule');	// Force authentication handler
+//if (! defined("NOREDIRECTBYMAINTOLOGIN"))  define('NOREDIRECTBYMAINTOLOGIN', 1);		// The main.inc.php does not make a redirect if not logged, instead show simple error message
+//if (! defined("FORCECSP"))                 define('FORCECSP', 'none');				// Disable all Content Security Policies
+//if (! defined('CSRFCHECK_WITH_TOKEN'))     define('CSRFCHECK_WITH_TOKEN', '1');		// Force use of CSRF protection with tokens even for GET
+//if (! defined('NOBROWSERNOTIF'))     		 define('NOBROWSERNOTIF', '1');				// Disable browser notification
+
+// Load Dolibarr environment
+$res = 0;
+// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+}
+// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
+$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
+	$i--; $j--;
+}
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+}
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+}
+// Try main.inc.php using relative path
+if (!$res && file_exists("../main.inc.php")) {
+	$res = @include "../main.inc.php";
+}
+if (!$res && file_exists("../../main.inc.php")) {
+	$res = @include "../../main.inc.php";
+}
+if (!$res && file_exists("../../../main.inc.php")) {
+	$res = @include "../../../main.inc.php";
+}
+if (!$res) {
+	die("Include of main fails");
+}
+
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+dol_include_once('/nav/class/action.class.php');
+dol_include_once('/nav/lib/nav_action.lib.php');
+
+
+// Load translation files required by the page
+$langs->loadLangs(array("nav@nav", "other"));
+
+// Get parameters
+$id = GETPOST('id', 'int');
+$ref = GETPOST('ref', 'alpha');
+$action = GETPOST('action', 'aZ09');
+$cancel = GETPOST('cancel', 'aZ09');
+$backtopage = GETPOST('backtopage', 'alpha');
+
+if (GETPOST('actioncode', 'array')) {
+	$actioncode = GETPOST('actioncode', 'array', 3);
+	if (!count($actioncode)) {
+		$actioncode = '0';
+	}
+} else {
+	$actioncode = GETPOST("actioncode", "alpha", 3) ? GETPOST("actioncode", "alpha", 3) : (GETPOST("actioncode") == '0' ? '0' : (empty($conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT) ? '' : $conf->global->AGENDA_DEFAULT_FILTER_TYPE_FOR_OBJECT));
+}
+$search_agenda_label = GETPOST('search_agenda_label');
+
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
+$sortfield = GETPOST('sortfield', 'aZ09comma');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
+if (empty($page) || $page == -1) {
+	$page = 0;
+}     // If $page is not defined, or '' or -1
+$offset = $limit * $page;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+if (!$sortfield) {
+	$sortfield = 'a.datep,a.id';
+}
+if (!$sortorder) {
+	$sortorder = 'DESC,DESC';
+}
+
+// Initialize technical objects
+$object = new Action($db);
+$extrafields = new ExtraFields($db);
+$diroutputmassaction = $conf->nav->dir_output.'/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('actionagenda', 'globalcard')); // Note that conf->hooks_modules contains array
+// Fetch optionals attributes and labels
+$extrafields->fetch_name_optionals_label($object->table_element);
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
+if ($id > 0 || !empty($ref)) {
+	$upload_dir = $conf->nav->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
+}
+
+// There is several ways to check permission.
+// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
+$enablepermissioncheck = 0;
+if ($enablepermissioncheck) {
+	$permissiontoread = $user->rights->nav->action->read;
+	$permissiontoadd = $user->rights->nav->action->write;
+} else {
+	$permissiontoread = 1;
+	$permissiontoadd = 1;
+}
+
+// Security check (enable the most restrictive one)
+//if ($user->socid > 0) accessforbidden();
+//if ($user->socid > 0) $socid = $user->socid;
+//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
+//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
+if (empty($conf->nav->enabled)) accessforbidden();
+if (!$permissiontoread) accessforbidden();
+
+
+/*
+ *  Actions
+ */
+
+$parameters = array('id'=>$id);
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) {
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+}
+
+if (empty($reshook)) {
+	// Cancel
+	if (GETPOST('cancel', 'alpha') && !empty($backtopage)) {
+		header("Location: ".$backtopage);
+		exit;
+	}
+
+	// Purge search criteria
+	if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
+		$actioncode = '';
+		$search_agenda_label = '';
+	}
+}
+
+
+
+/*
+ *	View
+ */
+
+$form = new Form($db);
+
+if ($object->id > 0) {
+	$title = $langs->trans("Agenda");
+	//if (! empty($conf->global->MAIN_HTML_TITLE) && preg_match('/thirdpartynameonly/',$conf->global->MAIN_HTML_TITLE) && $object->name) $title=$object->name." - ".$title;
+	$help_url = 'EN:Module_Agenda_En';
+	llxHeader('', $title, $help_url);
+
+	if (!empty($conf->notification->enabled)) {
+		$langs->load("mails");
+	}
+	$head = actionPrepareHead($object);
+
+
+	print dol_get_fiche_head($head, 'agenda', $langs->trans("Action"), -1, $object->picto);
+
+	// Object card
+	// ------------------------------------------------------------
+	$linkback = '<a href="'.dol_buildpath('/nav/action_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
+
+	$morehtmlref = '<div class="refidno">';
+	/*
+	// Ref customer
+	$morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
+	$morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
+	// Thirdparty
+	$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
+	// Project
+	if (! empty($conf->project->enabled)) {
+		$langs->load("projects");
+		$morehtmlref.='<br>'.$langs->trans('Project') . ' ';
+		if ($permissiontoadd) {
+			if ($action != 'classify') {
+				//$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
+			}
+			$morehtmlref.=' : ';
+			if ($action == 'classify') {
+				//$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+				$morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
+				$morehtmlref.='<input type="hidden" name="action" value="classin">';
+				$morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
+				$morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
+				$morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
+				$morehtmlref.='</form>';
+			} else {
+				$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+			}
+		} else {
+			if (! empty($object->fk_project)) {
+				$proj = new Project($db);
+				$proj->fetch($object->fk_project);
+				$morehtmlref .= ': '.$proj->getNomUrl();
+			} else {
+				$morehtmlref .= '';
+			}
+		}
+	}*/
+	$morehtmlref .= '</div>';
+
+
+	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
+
+	print '<div class="fichecenter">';
+	print '<div class="underbanner clearboth"></div>';
+
+	$object->info($object->id);
+	dol_print_object_info($object, 1);
+
+	print '</div>';
+
+	print dol_get_fiche_end();
+
+
+
+	// Actions buttons
+
+	$objthirdparty = $object;
+	$objcon = new stdClass();
+
+	$out = '&origin='.urlencode($object->element.'@'.$object->module).'&originid='.urlencode($object->id);
+	$urlbacktopage = $_SERVER['PHP_SELF'].'?id='.$object->id;
+	$out .= '&backtopage='.urlencode($urlbacktopage);
+	$permok = $user->rights->agenda->myactions->create;
+	if ((!empty($objthirdparty->id) || !empty($objcon->id)) && $permok) {
+		//$out.='<a href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create';
+		if (get_class($objthirdparty) == 'Societe') {
+			$out .= '&socid='.urlencode($objthirdparty->id);
+		}
+		$out .= (!empty($objcon->id) ? '&contactid='.urlencode($objcon->id) : '').'&percentage=-1';
+		//$out.=$langs->trans("AddAnAction").' ';
+		//$out.=img_picto($langs->trans("AddAnAction"),'filenew');
+		//$out.="</a>";
+	}
+
+
+	print '<div class="tabsAction">';
+
+	if (isModEnabled('agenda')) {
+		if (!empty($user->rights->agenda->myactions->create) || !empty($user->rights->agenda->allactions->create)) {
+			print '<a class="butAction" href="'.DOL_URL_ROOT.'/comm/action/card.php?action=create'.$out.'">'.$langs->trans("AddAction").'</a>';
+		} else {
+			print '<a class="butActionRefused classfortooltip" href="#">'.$langs->trans("AddAction").'</a>';
+		}
+	}
+
+	print '</div>';
+
+	if (isModEnabled('agenda') && (!empty($user->rights->agenda->myactions->read) || !empty($user->rights->agenda->allactions->read))) {
+		$param = '&id='.$object->id.(!empty($socid) ? '&socid='.$socid : '');
+		if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
+			$param .= '&contextpage='.urlencode($contextpage);
+		}
+		if ($limit > 0 && $limit != $conf->liste_limit) {
+			$param .= '&limit='.urlencode($limit);
+		}
+
+
+		//print load_fiche_titre($langs->trans("ActionsOnAction"), '', '');
+
+		// List of all actions
+		$filters = array();
+		$filters['search_agenda_label'] = $search_agenda_label;
+
+		// TODO Replace this with same code than into list.php
+		show_actions_done($conf, $langs, $db, $object, null, 0, $actioncode, '', $filters, $sortfield, $sortorder, $object->module);
+	}
+}
+
+// End of page
+llxFooter();
+$db->close();

+ 620 - 0
custom/nav/action_card.php

@@ -0,0 +1,620 @@
+<?php
+/* Copyright (C) 2017 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2023 Deák Ferenc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ *   	\file       action_card.php
+ *		\ingroup    nav
+ *		\brief      Page to create/edit/view action
+ */
+
+//if (! defined('NOREQUIREDB'))              define('NOREQUIREDB', '1');				// Do not create database handler $db
+//if (! defined('NOREQUIREUSER'))            define('NOREQUIREUSER', '1');				// Do not load object $user
+//if (! defined('NOREQUIRESOC'))             define('NOREQUIRESOC', '1');				// Do not load object $mysoc
+//if (! defined('NOREQUIRETRAN'))            define('NOREQUIRETRAN', '1');				// Do not load object $langs
+//if (! defined('NOSCANGETFORINJECTION'))    define('NOSCANGETFORINJECTION', '1');		// Do not check injection attack on GET parameters
+//if (! defined('NOSCANPOSTFORINJECTION'))   define('NOSCANPOSTFORINJECTION', '1');		// Do not check injection attack on POST parameters
+//if (! defined('NOCSRFCHECK'))              define('NOCSRFCHECK', '1');				// Do not check CSRF attack (test on referer + on token).
+//if (! defined('NOTOKENRENEWAL'))           define('NOTOKENRENEWAL', '1');				// Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
+//if (! defined('NOSTYLECHECK'))             define('NOSTYLECHECK', '1');				// Do not check style html tag into posted data
+//if (! defined('NOREQUIREMENU'))            define('NOREQUIREMENU', '1');				// If there is no need to load and show top and left menu
+//if (! defined('NOREQUIREHTML'))            define('NOREQUIREHTML', '1');				// If we don't need to load the html.form.class.php
+//if (! defined('NOREQUIREAJAX'))            define('NOREQUIREAJAX', '1');       	  	// Do not load ajax.lib.php library
+//if (! defined("NOLOGIN"))                  define("NOLOGIN", '1');					// If this page is public (can be called outside logged session). This include the NOIPCHECK too.
+//if (! defined('NOIPCHECK'))                define('NOIPCHECK', '1');					// Do not check IP defined into conf $dolibarr_main_restrict_ip
+//if (! defined("MAIN_LANG_DEFAULT"))        define('MAIN_LANG_DEFAULT', 'auto');					// Force lang to a particular value
+//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule');	// Force authentication handler
+//if (! defined("NOREDIRECTBYMAINTOLOGIN"))  define('NOREDIRECTBYMAINTOLOGIN', 1);		// The main.inc.php does not make a redirect if not logged, instead show simple error message
+//if (! defined("FORCECSP"))                 define('FORCECSP', 'none');				// Disable all Content Security Policies
+//if (! defined('CSRFCHECK_WITH_TOKEN'))     define('CSRFCHECK_WITH_TOKEN', '1');		// Force use of CSRF protection with tokens even for GET
+//if (! defined('NOBROWSERNOTIF'))     		 define('NOBROWSERNOTIF', '1');				// Disable browser notification
+//if (! defined('NOSESSION'))     		     define('NOSESSION', '1');				    // Disable session
+
+// Load Dolibarr environment
+$res = 0;
+// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+}
+// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
+$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
+	$i--; $j--;
+}
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+}
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+}
+// Try main.inc.php using relative path
+if (!$res && file_exists("../main.inc.php")) {
+	$res = @include "../main.inc.php";
+}
+if (!$res && file_exists("../../main.inc.php")) {
+	$res = @include "../../main.inc.php";
+}
+if (!$res && file_exists("../../../main.inc.php")) {
+	$res = @include "../../../main.inc.php";
+}
+if (!$res) {
+	die("Include of main fails");
+}
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formprojet.class.php';
+dol_include_once('/nav/class/action.class.php');
+dol_include_once('/nav/lib/nav_action.lib.php');
+
+// Load translation files required by the page
+$langs->loadLangs(array("nav@nav", "other"));
+
+// Get parameters
+$id = GETPOST('id', 'int');
+$ref = GETPOST('ref', 'alpha');
+$lineid   = GETPOST('lineid', 'int');
+
+$action = GETPOST('action', 'aZ09');
+$confirm = GETPOST('confirm', 'alpha');
+$cancel = GETPOST('cancel', 'aZ09');
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
+$backtopage = GETPOST('backtopage', 'alpha');
+$backtopageforcancel = GETPOST('backtopageforcancel', 'alpha');
+$dol_openinpopup = GETPOST('dol_openinpopup', 'aZ09');
+
+// Initialize technical objects
+$object = new Action($db);
+$extrafields = new ExtraFields($db);
+$diroutputmassaction = $conf->nav->dir_output.'/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('actioncard', 'globalcard')); // Note that conf->hooks_modules contains array
+
+// Fetch optionals attributes and labels
+$extrafields->fetch_name_optionals_label($object->table_element);
+
+$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
+
+// Initialize array of search criterias
+$search_all = GETPOST("search_all", 'alpha');
+$search = array();
+foreach ($object->fields as $key => $val) {
+	if (GETPOST('search_'.$key, 'alpha')) {
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
+	}
+}
+
+if (empty($action) && empty($id) && empty($ref)) {
+	$action = 'view';
+}
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once.
+
+// There is several ways to check permission.
+// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
+$enablepermissioncheck = 0;
+if ($enablepermissioncheck) {
+	$permissiontoread = $user->rights->nav->action->read;
+	$permissiontoadd = $user->rights->nav->action->write; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
+	$permissiontodelete = $user->rights->nav->action->delete || ($permissiontoadd && isset($object->status) && $object->status == $object::STATUS_DRAFT);
+	$permissionnote = $user->rights->nav->action->write; // Used by the include of actions_setnotes.inc.php
+	$permissiondellink = $user->rights->nav->action->write; // Used by the include of actions_dellink.inc.php
+} else {
+	$permissiontoread = 1;
+	$permissiontoadd = 1; // Used by the include of actions_addupdatedelete.inc.php and actions_lineupdown.inc.php
+	$permissiontodelete = 1;
+	$permissionnote = 1;
+	$permissiondellink = 1;
+}
+
+$upload_dir = $conf->nav->multidir_output[isset($object->entity) ? $object->entity : 1].'/action';
+
+// Security check (enable the most restrictive one)
+//if ($user->socid > 0) accessforbidden();
+//if ($user->socid > 0) $socid = $user->socid;
+//$isdraft = (isset($object->status) && ($object->status == $object::STATUS_DRAFT) ? 1 : 0);
+//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
+if (empty($conf->nav->enabled)) accessforbidden();
+if (!$permissiontoread) accessforbidden();
+
+
+/*
+ * Actions
+ */
+
+$parameters = array();
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) {
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+}
+
+if (empty($reshook)) {
+	$error = 0;
+
+	$backurlforlist = dol_buildpath('/nav/action_list.php', 1);
+
+	if (empty($backtopage) || ($cancel && empty($id))) {
+		if (empty($backtopage) || ($cancel && strpos($backtopage, '__ID__'))) {
+			if (empty($id) && (($action != 'add' && $action != 'create') || $cancel)) {
+				$backtopage = $backurlforlist;
+			} else {
+				$backtopage = dol_buildpath('/nav/action_card.php', 1).'?id='.((!empty($id) && $id > 0) ? $id : '__ID__');
+			}
+		}
+	}
+
+	$triggermodname = 'NAV_ACTION_MODIFY'; // Name of trigger action code to execute when we modify record
+
+	// Actions cancel, add, update, update_extras, confirm_validate, confirm_delete, confirm_deleteline, confirm_clone, confirm_close, confirm_setdraft, confirm_reopen
+	include DOL_DOCUMENT_ROOT.'/core/actions_addupdatedelete.inc.php';
+
+	// Actions when linking object each other
+	include DOL_DOCUMENT_ROOT.'/core/actions_dellink.inc.php';
+
+	// Actions when printing a doc from card
+	include DOL_DOCUMENT_ROOT.'/core/actions_printing.inc.php';
+
+	// Action to move up and down lines of object
+	//include DOL_DOCUMENT_ROOT.'/core/actions_lineupdown.inc.php';
+
+	// Action to build doc
+	include DOL_DOCUMENT_ROOT.'/core/actions_builddoc.inc.php';
+
+	if ($action == 'set_thirdparty' && $permissiontoadd) {
+		$object->setValueFrom('fk_soc', GETPOST('fk_soc', 'int'), '', '', 'date', '', $user, $triggermodname);
+	}
+	if ($action == 'classin' && $permissiontoadd) {
+		$object->setProject(GETPOST('projectid', 'int'));
+	}
+
+	// Actions to send emails
+	$triggersendname = 'NAV_ACTION_SENTBYMAIL';
+	$autocopy = 'MAIN_MAIL_AUTOCOPY_ACTION_TO';
+	$trackid = 'action'.$object->id;
+	include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php';
+}
+
+
+
+
+/*
+ * View
+ *
+ * Put here all code to build page
+ */
+
+$form = new Form($db);
+$formfile = new FormFile($db);
+$formproject = new FormProjets($db);
+
+$title = $langs->trans("Action");
+$help_url = '';
+llxHeader('', $title, $help_url);
+
+// Example : Adding jquery code
+// print '<script type="text/javascript">
+// jQuery(document).ready(function() {
+// 	function init_myfunc()
+// 	{
+// 		jQuery("#myid").removeAttr(\'disabled\');
+// 		jQuery("#myid").attr(\'disabled\',\'disabled\');
+// 	}
+// 	init_myfunc();
+// 	jQuery("#mybutton").click(function() {
+// 		init_myfunc();
+// 	});
+// });
+// </script>';
+
+
+// Part to create
+if ($action == 'create') {
+	if (empty($permissiontoadd)) {
+		accessforbidden($langs->trans('NotEnoughPermissions'), 0, 1);
+		exit;
+	}
+
+	print load_fiche_titre($langs->trans("NewObject", $langs->transnoentitiesnoconv("Action")), '', 'object_'.$object->picto);
+
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
+	print '<input type="hidden" name="token" value="'.newToken().'">';
+	print '<input type="hidden" name="action" value="add">';
+	if ($backtopage) {
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
+	}
+	if ($backtopageforcancel) {
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
+	}
+
+	print dol_get_fiche_head(array(), '');
+
+	// Set some default values
+	//if (! GETPOSTISSET('fieldname')) $_POST['fieldname'] = 'myvalue';
+
+	print '<table class="border centpercent tableforfieldcreate">'."\n";
+
+	// Common attributes
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_add.tpl.php';
+
+	// Other attributes
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_add.tpl.php';
+
+	print '</table>'."\n";
+
+	print dol_get_fiche_end();
+
+	print $form->buttonsSaveCancel("Create");
+
+	print '</form>';
+
+	//dol_set_focus('input[name="ref"]');
+}
+
+// Part to edit record
+if (($id || $ref) && $action == 'edit') {
+	print load_fiche_titre($langs->trans("Action"), '', 'object_'.$object->picto);
+
+	print '<form method="POST" action="'.$_SERVER["PHP_SELF"].'">';
+	print '<input type="hidden" name="token" value="'.newToken().'">';
+	print '<input type="hidden" name="action" value="update">';
+	print '<input type="hidden" name="id" value="'.$object->id.'">';
+	if ($backtopage) {
+		print '<input type="hidden" name="backtopage" value="'.$backtopage.'">';
+	}
+	if ($backtopageforcancel) {
+		print '<input type="hidden" name="backtopageforcancel" value="'.$backtopageforcancel.'">';
+	}
+
+	print dol_get_fiche_head();
+
+	print '<table class="border centpercent tableforfieldedit">'."\n";
+
+	// Common attributes
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_edit.tpl.php';
+
+	// Other attributes
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_edit.tpl.php';
+
+	print '</table>';
+
+	print dol_get_fiche_end();
+
+	print $form->buttonsSaveCancel();
+
+	print '</form>';
+}
+
+// Part to show record
+if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'create'))) {
+	$res = $object->fetch_optionals();
+
+	$head = actionPrepareHead($object);
+	print dol_get_fiche_head($head, 'card', $langs->trans("Action"), -1, $object->picto);
+
+	$formconfirm = '';
+
+	// Confirmation to delete
+	if ($action == 'delete') {
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('DeleteAction'), $langs->trans('ConfirmDeleteObject'), 'confirm_delete', '', 0, 1);
+	}
+	// Confirmation to delete line
+	if ($action == 'deleteline') {
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id.'&lineid='.$lineid, $langs->trans('DeleteLine'), $langs->trans('ConfirmDeleteLine'), 'confirm_deleteline', '', 0, 1);
+	}
+
+	// Clone confirmation
+	if ($action == 'clone') {
+		// Create an array for form
+		$formquestion = array();
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('ToClone'), $langs->trans('ConfirmCloneAsk', $object->ref), 'confirm_clone', $formquestion, 'yes', 1);
+	}
+
+	// Confirmation of action xxxx (You can use it for xxx = 'close', xxx = 'reopen', ...)
+	if ($action == 'xxx') {
+		$text = $langs->trans('ConfirmActionAction', $object->ref);
+		/*if (! empty($conf->notification->enabled))
+		{
+			require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
+			$notify = new Notify($db);
+			$text .= '<br>';
+			$text .= $notify->confirmMessage('ACTION_CLOSE', $object->socid, $object);
+		}*/
+
+		$formquestion = array();
+		/*
+		$forcecombo=0;
+		if ($conf->browser->name == 'ie') $forcecombo = 1;	// There is a bug in IE10 that make combo inside popup crazy
+		$formquestion = array(
+			// 'text' => $langs->trans("ConfirmClone"),
+			// array('type' => 'checkbox', 'name' => 'clone_content', 'label' => $langs->trans("CloneMainAttributes"), 'value' => 1),
+			// array('type' => 'checkbox', 'name' => 'update_prices', 'label' => $langs->trans("PuttingPricesUpToDate"), 'value' => 1),
+			// array('type' => 'other',    'name' => 'idwarehouse',   'label' => $langs->trans("SelectWarehouseForStockDecrease"), 'value' => $formproduct->selectWarehouses(GETPOST('idwarehouse')?GETPOST('idwarehouse'):'ifone', 'idwarehouse', '', 1, 0, 0, '', 0, $forcecombo))
+		);
+		*/
+		$formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?id='.$object->id, $langs->trans('XXX'), $text, 'confirm_xxx', $formquestion, 0, 1, 220);
+	}
+
+	// Call Hook formConfirm
+	$parameters = array('formConfirm' => $formconfirm, 'lineid' => $lineid);
+	$reshook = $hookmanager->executeHooks('formConfirm', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+	if (empty($reshook)) {
+		$formconfirm .= $hookmanager->resPrint;
+	} elseif ($reshook > 0) {
+		$formconfirm = $hookmanager->resPrint;
+	}
+
+	// Print form confirm
+	print $formconfirm;
+
+
+	// Object card
+	// ------------------------------------------------------------
+	$linkback = '<a href="'.dol_buildpath('/nav/action_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
+
+	$morehtmlref = '<div class="refidno">';
+	/*
+	 // Ref customer
+	 $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
+	 $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
+	 // Thirdparty
+	 $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
+	 // Project
+	 if (! empty($conf->project->enabled)) {
+	 $langs->load("projects");
+	 $morehtmlref .= '<br>'.$langs->trans('Project') . ' ';
+	 if ($permissiontoadd) {
+	 //if ($action != 'classify') $morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> ';
+	 $morehtmlref .= ' : ';
+	 if ($action == 'classify') {
+	 //$morehtmlref .= $form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+	 $morehtmlref .= '<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
+	 $morehtmlref .= '<input type="hidden" name="action" value="classin">';
+	 $morehtmlref .= '<input type="hidden" name="token" value="'.newToken().'">';
+	 $morehtmlref .= $formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
+	 $morehtmlref .= '<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
+	 $morehtmlref .= '</form>';
+	 } else {
+	 $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+	 }
+	 } else {
+	 if (! empty($object->fk_project)) {
+	 $proj = new Project($db);
+	 $proj->fetch($object->fk_project);
+	 $morehtmlref .= ': '.$proj->getNomUrl();
+	 } else {
+	 $morehtmlref .= '';
+	 }
+	 }
+	 }*/
+	$morehtmlref .= '</div>';
+
+
+	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
+
+
+	print '<div class="fichecenter">';
+	print '<div class="fichehalfleft">';
+	print '<div class="underbanner clearboth"></div>';
+	print '<table class="border centpercent tableforfield">'."\n";
+
+	// Common attributes
+	//$keyforbreak='fieldkeytoswitchonsecondcolumn';	// We change column just before this field
+	//unset($object->fields['fk_project']);				// Hide field already shown in banner
+	//unset($object->fields['fk_soc']);					// Hide field already shown in banner
+	include DOL_DOCUMENT_ROOT.'/core/tpl/commonfields_view.tpl.php';
+
+	// Other attributes. Fields from hook formObjectOptions and Extrafields.
+	include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_view.tpl.php';
+
+	print '</table>';
+	print '</div>';
+	print '</div>';
+
+	print '<div class="clearboth"></div>';
+
+	print dol_get_fiche_end();
+
+
+	/*
+	 * Lines
+	 */
+
+	if (!empty($object->table_element_line)) {
+		// Show object lines
+		$result = $object->getLinesArray();
+
+		print '	<form name="addproduct" id="addproduct" action="'.$_SERVER["PHP_SELF"].'?id='.$object->id.(($action != 'editline') ? '' : '#line_'.GETPOST('lineid', 'int')).'" method="POST">
+		<input type="hidden" name="token" value="' . newToken().'">
+		<input type="hidden" name="action" value="' . (($action != 'editline') ? 'addline' : 'updateline').'">
+		<input type="hidden" name="mode" value="">
+		<input type="hidden" name="page_y" value="">
+		<input type="hidden" name="id" value="' . $object->id.'">
+		';
+
+		if (!empty($conf->use_javascript_ajax) && $object->status == 0) {
+			include DOL_DOCUMENT_ROOT.'/core/tpl/ajaxrow.tpl.php';
+		}
+
+		print '<div class="div-table-responsive-no-min">';
+		if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
+			print '<table id="tablelines" class="noborder noshadow" width="100%">';
+		}
+
+		if (!empty($object->lines)) {
+			$object->printObjectLines($action, $mysoc, null, GETPOST('lineid', 'int'), 1);
+		}
+
+		// Form to add new line
+		if ($object->status == 0 && $permissiontoadd && $action != 'selectlines') {
+			if ($action != 'editline') {
+				// Add products/services form
+
+				$parameters = array();
+				$reshook = $hookmanager->executeHooks('formAddObjectLine', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+				if ($reshook < 0) setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+				if (empty($reshook))
+					$object->formAddObjectLine(1, $mysoc, $soc);
+			}
+		}
+
+		if (!empty($object->lines) || ($object->status == $object::STATUS_DRAFT && $permissiontoadd && $action != 'selectlines' && $action != 'editline')) {
+			print '</table>';
+		}
+		print '</div>';
+
+		print "</form>\n";
+	}
+
+
+	// Buttons for actions
+
+	if ($action != 'presend' && $action != 'editline') {
+		print '<div class="tabsAction">'."\n";
+		$parameters = array();
+		$reshook = $hookmanager->executeHooks('addMoreActionsButtons', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+		if ($reshook < 0) {
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+		}
+
+		if (empty($reshook)) {
+			// Send
+			if (empty($user->socid)) {
+				print dolGetButtonAction($langs->trans('SendMail'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=presend&mode=init&token='.newToken().'#formmailbeforetitle');
+			}
+
+			// Back to draft
+			if ($object->status == $object::STATUS_VALIDATED) {
+				print dolGetButtonAction($langs->trans('SetToDraft'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=confirm_setdraft&confirm=yes&token='.newToken(), '', $permissiontoadd);
+			}
+
+			print dolGetButtonAction($langs->trans('Modify'), '', 'default', $_SERVER["PHP_SELF"].'?id='.$object->id.'&action=edit&token='.newToken(), '', $permissiontoadd);
+
+			// Validate
+			if ($object->status == $object::STATUS_DRAFT) {
+				if (empty($object->table_element_line) || (is_array($object->lines) && count($object->lines) > 0)) {
+					print dolGetButtonAction($langs->trans('Validate'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=confirm_validate&confirm=yes&token='.newToken(), '', $permissiontoadd);
+				} else {
+					$langs->load("errors");
+					print dolGetButtonAction($langs->trans("ErrorAddAtLeastOneLineFirst"), $langs->trans("Validate"), 'default', '#', '', 0);
+				}
+			}
+
+			// Clone
+			print dolGetButtonAction($langs->trans('ToClone'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.(!empty($object->socid)?'&socid='.$object->socid:'').'&action=clone&token='.newToken(), '', $permissiontoadd);
+
+			/*
+			if ($permissiontoadd) {
+				if ($object->status == $object::STATUS_ENABLED) {
+					print dolGetButtonAction($langs->trans('Disable'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=disable&token='.newToken(), '', $permissiontoadd);
+				} else {
+					print dolGetButtonAction($langs->trans('Enable'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=enable&token='.newToken(), '', $permissiontoadd);
+				}
+			}
+			if ($permissiontoadd) {
+				if ($object->status == $object::STATUS_VALIDATED) {
+					print dolGetButtonAction($langs->trans('Cancel'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=close&token='.newToken(), '', $permissiontoadd);
+				} else {
+					print dolGetButtonAction($langs->trans('Re-Open'), '', 'default', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=reopen&token='.newToken(), '', $permissiontoadd);
+				}
+			}
+			*/
+
+			// Delete (need delete permission, or if draft, just need create/modify permission)
+			print dolGetButtonAction($langs->trans('Delete'), '', 'delete', $_SERVER['PHP_SELF'].'?id='.$object->id.'&action=delete&token='.newToken(), '', $permissiontodelete || ($object->status == $object::STATUS_DRAFT && $permissiontoadd));
+		}
+		print '</div>'."\n";
+	}
+
+
+	// Select mail models is same action as presend
+	if (GETPOST('modelselected')) {
+		$action = 'presend';
+	}
+
+	if ($action != 'presend') {
+		print '<div class="fichecenter"><div class="fichehalfleft">';
+		print '<a name="builddoc"></a>'; // ancre
+
+		$includedocgeneration = 0;
+
+		// Documents
+		if ($includedocgeneration) {
+			$objref = dol_sanitizeFileName($object->ref);
+			$relativepath = $objref.'/'.$objref.'.pdf';
+			$filedir = $conf->nav->dir_output.'/'.$object->element.'/'.$objref;
+			$urlsource = $_SERVER["PHP_SELF"]."?id=".$object->id;
+			$genallowed = $permissiontoread; // If you can read, you can build the PDF to read content
+			$delallowed = $permissiontoadd; // If you can create/edit, you can remove a file on card
+			print $formfile->showdocuments('nav:Action', $object->element.'/'.$objref, $filedir, $urlsource, $genallowed, $delallowed, $object->model_pdf, 1, 0, 0, 28, 0, '', '', '', $langs->defaultlang);
+		}
+
+		// Show links to link elements
+		$linktoelem = $form->showLinkToObjectBlock($object, null, array('action'));
+		$somethingshown = $form->showLinkedObjectBlock($object, $linktoelem);
+
+
+		print '</div><div class="fichehalfright">';
+
+		$MAXEVENT = 10;
+
+		$morehtmlcenter = dolGetButtonTitle($langs->trans('SeeAll'), '', 'fa fa-bars imgforviewmode', dol_buildpath('/nav/action_agenda.php', 1).'?id='.$object->id);
+
+		// List of actions on element
+		include_once DOL_DOCUMENT_ROOT.'/core/class/html.formactions.class.php';
+		$formactions = new FormActions($db);
+		$somethingshown = $formactions->showactions($object, $object->element.'@'.$object->module, (is_object($object->thirdparty) ? $object->thirdparty->id : 0), 1, '', $MAXEVENT, '', $morehtmlcenter);
+
+		print '</div></div>';
+	}
+
+	//Select mail models is same action as presend
+	if (GETPOST('modelselected')) {
+		$action = 'presend';
+	}
+
+	// Presend form
+	$modelmail = 'action';
+	$defaulttopic = 'InformationMessage';
+	$diroutput = $conf->nav->dir_output;
+	$trackid = 'action'.$object->id;
+
+	include DOL_DOCUMENT_ROOT.'/core/tpl/card_presend.tpl.php';
+}
+
+// End of page
+llxFooter();
+$db->close();

+ 226 - 0
custom/nav/action_contact.php

@@ -0,0 +1,226 @@
+<?php
+/* Copyright (C) 2007-2017 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2023 Deák Ferenc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ *  \file       action_contact.php
+ *  \ingroup    nav
+ *  \brief      Tab for contacts linked to Action
+ */
+
+// Load Dolibarr environment
+$res = 0;
+// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+}
+// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
+$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
+	$i--; $j--;
+}
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+}
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+}
+// Try main.inc.php using relative path
+if (!$res && file_exists("../main.inc.php")) {
+	$res = @include "../main.inc.php";
+}
+if (!$res && file_exists("../../main.inc.php")) {
+	$res = @include "../../main.inc.php";
+}
+if (!$res && file_exists("../../../main.inc.php")) {
+	$res = @include "../../../main.inc.php";
+}
+if (!$res) {
+	die("Include of main fails");
+}
+
+require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+dol_include_once('/nav/class/action.class.php');
+dol_include_once('/nav/lib/nav_action.lib.php');
+
+// Load translation files required by the page
+$langs->loadLangs(array("nav@nav", "companies", "other", "mails"));
+
+$id     = (GETPOST('id') ?GETPOST('id', 'int') : GETPOST('facid', 'int')); // For backward compatibility
+$ref    = GETPOST('ref', 'alpha');
+$lineid = GETPOST('lineid', 'int');
+$socid  = GETPOST('socid', 'int');
+$action = GETPOST('action', 'aZ09');
+
+// Initialize technical objects
+$object = new Action($db);
+$extrafields = new ExtraFields($db);
+$diroutputmassaction = $conf->nav->dir_output.'/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('actioncontact', 'globalcard')); // Note that conf->hooks_modules contains array
+// Fetch optionals attributes and labels
+$extrafields->fetch_name_optionals_label($object->table_element);
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
+
+// There is several ways to check permission.
+// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
+$enablepermissioncheck = 0;
+if ($enablepermissioncheck) {
+	$permissiontoread = $user->rights->nav->action->read;
+	$permission = $user->rights->nav->action->write;
+} else {
+	$permissiontoread = 1;
+	$permission = 1;
+}
+
+// Security check (enable the most restrictive one)
+//if ($user->socid > 0) accessforbidden();
+//if ($user->socid > 0) $socid = $user->socid;
+//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
+//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
+if (empty($conf->nav->enabled)) accessforbidden();
+if (!$permissiontoread) accessforbidden();
+
+
+/*
+ * Add a new contact
+ */
+
+if ($action == 'addcontact' && $permission) {
+	$contactid = (GETPOST('userid') ? GETPOST('userid', 'int') : GETPOST('contactid', 'int'));
+	$typeid = (GETPOST('typecontact') ? GETPOST('typecontact') : GETPOST('type'));
+	$result = $object->add_contact($contactid, $typeid, GETPOST("source", 'aZ09'));
+
+	if ($result >= 0) {
+		header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
+		exit;
+	} else {
+		if ($object->error == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
+			$langs->load("errors");
+			setEventMessages($langs->trans("ErrorThisContactIsAlreadyDefinedAsThisType"), null, 'errors');
+		} else {
+			setEventMessages($object->error, $object->errors, 'errors');
+		}
+	}
+} elseif ($action == 'swapstatut' && $permission) {
+	// Toggle the status of a contact
+	$result = $object->swapContactStatus(GETPOST('ligne', 'int'));
+} elseif ($action == 'deletecontact' && $permission) {
+	// Deletes a contact
+	$result = $object->delete_contact($lineid);
+
+	if ($result >= 0) {
+		header("Location: ".$_SERVER['PHP_SELF']."?id=".$object->id);
+		exit;
+	} else {
+		dol_print_error($db);
+	}
+}
+
+
+/*
+ * View
+ */
+
+$title = $langs->trans('Action')." - ".$langs->trans('ContactsAddresses');
+$help_url = '';
+//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
+llxHeader('', $title, $help_url);
+
+$form = new Form($db);
+$formcompany = new FormCompany($db);
+$contactstatic = new Contact($db);
+$userstatic = new User($db);
+
+
+/* *************************************************************************** */
+/*                                                                             */
+/* View and edit mode                                                         */
+/*                                                                             */
+/* *************************************************************************** */
+
+if ($object->id) {
+	/*
+	 * Show tabs
+	 */
+	$head = actionPrepareHead($object);
+
+	print dol_get_fiche_head($head, 'contact', $langs->trans("Action"), -1, $object->picto);
+
+	$linkback = '<a href="'.dol_buildpath('/nav/action_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
+
+	$morehtmlref = '<div class="refidno">';
+	/*
+	 // Ref customer
+	 $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
+	 $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
+	 // Thirdparty
+	 $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
+	 // Project
+	 if (! empty($conf->project->enabled))
+	 {
+	 $langs->load("projects");
+	 $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
+	 if ($permissiontoadd)
+	 {
+	 if ($action != 'classify')
+	 //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
+	 $morehtmlref.=' : ';
+	 if ($action == 'classify') {
+	 //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+	 $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
+	 $morehtmlref.='<input type="hidden" name="action" value="classin">';
+	 $morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
+	 $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
+	 $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
+	 $morehtmlref.='</form>';
+	 } else {
+	 $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+	 }
+	 } else {
+	 if (! empty($object->fk_project)) {
+	 $proj = new Project($db);
+	 $proj->fetch($object->fk_project);
+	 $morehtmlref .= ': '.$proj->getNomUrl();
+	 } else {
+	 $morehtmlref .= '';
+	 }
+	 }
+	 }*/
+	$morehtmlref .= '</div>';
+
+	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref, '', 0, '', '', 1);
+
+	print dol_get_fiche_end();
+
+	print '<br>';
+
+	// Contacts lines (modules that overwrite templates must declare this into descriptor)
+	$dirtpls = array_merge($conf->modules_parts['tpl'], array('/core/tpl'));
+	foreach ($dirtpls as $reldir) {
+		$res = @include dol_buildpath($reldir.'/contacts.tpl.php');
+		if ($res) {
+			break;
+		}
+	}
+}
+
+// End of page
+llxFooter();
+$db->close();

+ 261 - 0
custom/nav/action_document.php

@@ -0,0 +1,261 @@
+<?php
+/* Copyright (C) 2007-2017 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2023 Deák Ferenc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ *  \file       action_document.php
+ *  \ingroup    nav
+ *  \brief      Tab for documents linked to Action
+ */
+
+//if (! defined('NOREQUIREDB'))              define('NOREQUIREDB', '1');				// Do not create database handler $db
+//if (! defined('NOREQUIREUSER'))            define('NOREQUIREUSER', '1');				// Do not load object $user
+//if (! defined('NOREQUIRESOC'))             define('NOREQUIRESOC', '1');				// Do not load object $mysoc
+//if (! defined('NOREQUIRETRAN'))            define('NOREQUIRETRAN', '1');				// Do not load object $langs
+//if (! defined('NOSCANGETFORINJECTION'))    define('NOSCANGETFORINJECTION', '1');		// Do not check injection attack on GET parameters
+//if (! defined('NOSCANPOSTFORINJECTION'))   define('NOSCANPOSTFORINJECTION', '1');		// Do not check injection attack on POST parameters
+//if (! defined('NOCSRFCHECK'))              define('NOCSRFCHECK', '1');				// Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
+//if (! defined('NOTOKENRENEWAL'))           define('NOTOKENRENEWAL', '1');				// Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
+//if (! defined('NOSTYLECHECK'))             define('NOSTYLECHECK', '1');				// Do not check style html tag into posted data
+//if (! defined('NOREQUIREMENU'))            define('NOREQUIREMENU', '1');				// If there is no need to load and show top and left menu
+//if (! defined('NOREQUIREHTML'))            define('NOREQUIREHTML', '1');				// If we don't need to load the html.form.class.php
+//if (! defined('NOREQUIREAJAX'))            define('NOREQUIREAJAX', '1');       	  	// Do not load ajax.lib.php library
+//if (! defined("NOLOGIN"))                  define("NOLOGIN", '1');					// If this page is public (can be called outside logged session). This include the NOIPCHECK too.
+//if (! defined('NOIPCHECK'))                define('NOIPCHECK', '1');					// Do not check IP defined into conf $dolibarr_main_restrict_ip
+//if (! defined("MAIN_LANG_DEFAULT"))        define('MAIN_LANG_DEFAULT', 'auto');					// Force lang to a particular value
+//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule');	// Force authentication handler
+//if (! defined("NOREDIRECTBYMAINTOLOGIN"))  define('NOREDIRECTBYMAINTOLOGIN', 1);		// The main.inc.php does not make a redirect if not logged, instead show simple error message
+//if (! defined("FORCECSP"))                 define('FORCECSP', 'none');				// Disable all Content Security Policies
+//if (! defined('CSRFCHECK_WITH_TOKEN'))     define('CSRFCHECK_WITH_TOKEN', '1');		// Force use of CSRF protection with tokens even for GET
+//if (! defined('NOBROWSERNOTIF'))     		 define('NOBROWSERNOTIF', '1');				// Disable browser notification
+
+// Load Dolibarr environment
+$res = 0;
+// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+}
+// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
+$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
+	$i--; $j--;
+}
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+}
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+}
+// Try main.inc.php using relative path
+if (!$res && file_exists("../main.inc.php")) {
+	$res = @include "../main.inc.php";
+}
+if (!$res && file_exists("../../main.inc.php")) {
+	$res = @include "../../main.inc.php";
+}
+if (!$res && file_exists("../../../main.inc.php")) {
+	$res = @include "../../../main.inc.php";
+}
+if (!$res) {
+	die("Include of main fails");
+}
+
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
+dol_include_once('/nav/class/action.class.php');
+dol_include_once('/nav/lib/nav_action.lib.php');
+
+// Load translation files required by the page
+$langs->loadLangs(array("nav@nav", "companies", "other", "mails"));
+
+
+$action = GETPOST('action', 'aZ09');
+$confirm = GETPOST('confirm');
+$id = (GETPOST('socid', 'int') ? GETPOST('socid', 'int') : GETPOST('id', 'int'));
+$ref = GETPOST('ref', 'alpha');
+
+// Get parameters
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
+$sortfield = GETPOST('sortfield', 'aZ09comma');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
+if (empty($page) || $page == -1) {
+	$page = 0;
+}     // If $page is not defined, or '' or -1
+$offset = $limit * $page;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+if (!$sortorder) {
+	$sortorder = "ASC";
+}
+if (!$sortfield) {
+	$sortfield = "name";
+}
+//if (! $sortfield) $sortfield="position_name";
+
+// Initialize technical objects
+$object = new Action($db);
+$extrafields = new ExtraFields($db);
+$diroutputmassaction = $conf->nav->dir_output.'/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('actiondocument', 'globalcard')); // Note that conf->hooks_modules contains array
+// Fetch optionals attributes and labels
+$extrafields->fetch_name_optionals_label($object->table_element);
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
+
+if ($id > 0 || !empty($ref)) {
+	$upload_dir = $conf->nav->multidir_output[$object->entity ? $object->entity : $conf->entity]."/action/".get_exdir(0, 0, 0, 1, $object);
+}
+
+// There is several ways to check permission.
+// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
+$enablepermissioncheck = 0;
+if ($enablepermissioncheck) {
+	$permissiontoread = $user->rights->nav->action->read;
+	$permissiontoadd = $user->rights->nav->action->write; // Used by the include of actions_addupdatedelete.inc.php and actions_linkedfiles.inc.php
+} else {
+	$permissiontoread = 1;
+	$permissiontoadd = 1;
+}
+
+// Security check (enable the most restrictive one)
+//if ($user->socid > 0) accessforbidden();
+//if ($user->socid > 0) $socid = $user->socid;
+//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
+//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
+if (empty($conf->nav->enabled)) accessforbidden();
+if (!$permissiontoread) accessforbidden();
+
+
+/*
+ * Actions
+ */
+
+include DOL_DOCUMENT_ROOT.'/core/actions_linkedfiles.inc.php';
+
+
+/*
+ * View
+ */
+
+$form = new Form($db);
+
+$title = $langs->trans("Action").' - '.$langs->trans("Files");
+$help_url = '';
+//$help_url='EN:Module_Third_Parties|FR:Module_Tiers|ES:Empresas';
+llxHeader('', $title, $help_url);
+
+if ($object->id) {
+	/*
+	 * Show tabs
+	 */
+	$head = actionPrepareHead($object);
+
+	print dol_get_fiche_head($head, 'document', $langs->trans("Action"), -1, $object->picto);
+
+
+	// Build file list
+	$filearray = dol_dir_list($upload_dir, "files", 0, '', '(\.meta|_preview.*\.png)$', $sortfield, (strtolower($sortorder) == 'desc' ?SORT_DESC:SORT_ASC), 1);
+	$totalsize = 0;
+	foreach ($filearray as $key => $file) {
+		$totalsize += $file['size'];
+	}
+
+	// Object card
+	// ------------------------------------------------------------
+	$linkback = '<a href="'.dol_buildpath('/nav/action_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
+
+	$morehtmlref = '<div class="refidno">';
+	/*
+	 // Ref customer
+	 $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
+	 $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
+	 // Thirdparty
+	 $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
+	 // Project
+	 if (! empty($conf->project->enabled))
+	 {
+	 $langs->load("projects");
+	 $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
+	 if ($permissiontoadd)
+	 {
+	 if ($action != 'classify')
+	 //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
+	 $morehtmlref.=' : ';
+	 if ($action == 'classify') {
+	 //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+	 $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
+	 $morehtmlref.='<input type="hidden" name="action" value="classin">';
+	 $morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
+	 $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
+	 $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
+	 $morehtmlref.='</form>';
+	 } else {
+	 $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+	 }
+	 } else {
+	 if (! empty($object->fk_project)) {
+	 $proj = new Project($db);
+	 $proj->fetch($object->fk_project);
+	 $morehtmlref .= ': '.$proj->getNomUrl();
+	 } else {
+	 $morehtmlref .= '';
+	 }
+	 }
+	 }*/
+	$morehtmlref .= '</div>';
+
+	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
+
+	print '<div class="fichecenter">';
+
+	print '<div class="underbanner clearboth"></div>';
+	print '<table class="border centpercent tableforfield">';
+
+	// Number of files
+	print '<tr><td class="titlefield">'.$langs->trans("NbOfAttachedFiles").'</td><td colspan="3">'.count($filearray).'</td></tr>';
+
+	// Total size
+	print '<tr><td>'.$langs->trans("TotalSizeOfAttachedFiles").'</td><td colspan="3">'.$totalsize.' '.$langs->trans("bytes").'</td></tr>';
+
+	print '</table>';
+
+	print '</div>';
+
+	print dol_get_fiche_end();
+
+	$modulepart = 'nav';
+	//$permissiontoadd = $user->rights->nav->action->write;
+	$permissiontoadd = 1;
+	//$permtoedit = $user->rights->nav->action->write;
+	$permtoedit = 1;
+	$param = '&id='.$object->id;
+
+	//$relativepathwithnofile='action/' . dol_sanitizeFileName($object->id).'/';
+	$relativepathwithnofile = 'action/'.dol_sanitizeFileName($object->ref).'/';
+
+	include DOL_DOCUMENT_ROOT.'/core/tpl/document_actions_post_headers.tpl.php';
+} else {
+	accessforbidden('', 0, 1);
+}
+
+// End of page
+llxFooter();
+$db->close();

+ 849 - 0
custom/nav/action_list.php

@@ -0,0 +1,849 @@
+<?php
+/* Copyright (C) 2007-2017 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2023 Deák Ferenc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ *   	\file       action_list.php
+ *		\ingroup    nav
+ *		\brief      List page for action
+ */
+
+//if (! defined('NOREQUIREDB'))              define('NOREQUIREDB', '1');				// Do not create database handler $db
+//if (! defined('NOREQUIREUSER'))            define('NOREQUIREUSER', '1');				// Do not load object $user
+//if (! defined('NOREQUIRESOC'))             define('NOREQUIRESOC', '1');				// Do not load object $mysoc
+//if (! defined('NOREQUIRETRAN'))            define('NOREQUIRETRAN', '1');				// Do not load object $langs
+//if (! defined('NOSCANGETFORINJECTION'))    define('NOSCANGETFORINJECTION', '1');		// Do not check injection attack on GET parameters
+//if (! defined('NOSCANPOSTFORINJECTION'))   define('NOSCANPOSTFORINJECTION', '1');		// Do not check injection attack on POST parameters
+//if (! defined('NOCSRFCHECK'))              define('NOCSRFCHECK', '1');				// Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
+//if (! defined('NOTOKENRENEWAL'))           define('NOTOKENRENEWAL', '1');				// Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
+//if (! defined('NOSTYLECHECK'))             define('NOSTYLECHECK', '1');				// Do not check style html tag into posted data
+//if (! defined('NOREQUIREMENU'))            define('NOREQUIREMENU', '1');				// If there is no need to load and show top and left menu
+//if (! defined('NOREQUIREHTML'))            define('NOREQUIREHTML', '1');				// If we don't need to load the html.form.class.php
+//if (! defined('NOREQUIREAJAX'))            define('NOREQUIREAJAX', '1');       	  	// Do not load ajax.lib.php library
+//if (! defined("NOLOGIN"))                  define("NOLOGIN", '1');					// If this page is public (can be called outside logged session). This include the NOIPCHECK too.
+//if (! defined('NOIPCHECK'))                define('NOIPCHECK', '1');					// Do not check IP defined into conf $dolibarr_main_restrict_ip
+//if (! defined("MAIN_LANG_DEFAULT"))        define('MAIN_LANG_DEFAULT', 'auto');					// Force lang to a particular value
+//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule');	// Force authentication handler
+//if (! defined("NOREDIRECTBYMAINTOLOGIN"))  define('NOREDIRECTBYMAINTOLOGIN', 1);		// The main.inc.php does not make a redirect if not logged, instead show simple error message
+//if (! defined("FORCECSP"))                 define('FORCECSP', 'none');				// Disable all Content Security Policies
+//if (! defined('CSRFCHECK_WITH_TOKEN'))     define('CSRFCHECK_WITH_TOKEN', '1');		// Force use of CSRF protection with tokens even for GET
+//if (! defined('NOBROWSERNOTIF'))     		 define('NOBROWSERNOTIF', '1');				// Disable browser notification
+//if (! defined('NOSESSION'))                define('NOSESSION', '1');					// On CLI mode, no need to use web sessions
+
+// Load Dolibarr environment
+$res = 0;
+// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+}
+// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
+$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
+	$i--; $j--;
+}
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+}
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+}
+// Try main.inc.php using relative path
+if (!$res && file_exists("../main.inc.php")) {
+	$res = @include "../main.inc.php";
+}
+if (!$res && file_exists("../../main.inc.php")) {
+	$res = @include "../../main.inc.php";
+}
+if (!$res && file_exists("../../../main.inc.php")) {
+	$res = @include "../../../main.inc.php";
+}
+if (!$res) {
+	die("Include of main fails");
+}
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
+
+// load nav libraries
+require_once __DIR__.'/class/action.class.php';
+
+// for other modules
+//dol_include_once('/othermodule/class/otherobject.class.php');
+
+// Load translation files required by the page
+$langs->loadLangs(array("nav@nav", "other"));
+
+$id = GETPOST('id', 'int');
+$ref = GETPOST('ref', 'alpha');
+
+$action     = GETPOST('action', 'aZ09') ?GETPOST('action', 'aZ09') : 'view'; // The action 'add', 'create', 'edit', 'update', 'view', ...
+$massaction = GETPOST('massaction', 'alpha'); // The bulk action (combo box choice into lists)
+$show_files = GETPOST('show_files', 'int'); // Show files area generated by bulk actions ?
+$confirm    = GETPOST('confirm', 'alpha'); // Result of a confirmation
+$cancel     = GETPOST('cancel', 'alpha'); // We click on a Cancel button
+$toselect   = GETPOST('toselect', 'array'); // Array of ids of elements selected into a list
+$contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : str_replace('_', '', basename(dirname(__FILE__)).basename(__FILE__, '.php')); // To manage different context of search
+$backtopage = GETPOST('backtopage', 'alpha'); // Go back to a dedicated page
+$optioncss  = GETPOST('optioncss', 'aZ'); // Option for the css output (always '' except when 'print')
+$mode       = GETPOST('mode', 'aZ');
+
+// Load variable for pagination
+$limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit;
+$sortfield = GETPOST('sortfield', 'aZ09comma');
+$sortorder = GETPOST('sortorder', 'aZ09comma');
+$page = GETPOSTISSET('pageplusone') ? (GETPOST('pageplusone') - 1) : GETPOST("page", 'int');
+if (empty($page) || $page < 0 || GETPOST('button_search', 'alpha') || GETPOST('button_removefilter', 'alpha')) {
+	// If $page is not defined, or '' or -1 or if we click on clear filters
+	$page = 0;
+}
+$offset = $limit * $page;
+$pageprev = $page - 1;
+$pagenext = $page + 1;
+
+// Initialize technical objects
+$object = new Action($db);
+$extrafields = new ExtraFields($db);
+$diroutputmassaction = $conf->nav->dir_output.'/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('actionlist')); // Note that conf->hooks_modules contains array
+
+// Fetch optionals attributes and labels
+$extrafields->fetch_name_optionals_label($object->table_element);
+//$extrafields->fetch_name_optionals_label($object->table_element_line);
+
+$search_array_options = $extrafields->getOptionalsFromPost($object->table_element, '', 'search_');
+
+// Default sort order (if not yet defined by previous GETPOST)
+if (!$sortfield) {
+	reset($object->fields);					// Reset is required to avoid key() to return null.
+	$sortfield = "t.".key($object->fields); // Set here default search field. By default 1st field in definition.
+}
+if (!$sortorder) {
+	$sortorder = "ASC";
+}
+
+// Initialize array of search criterias
+$search_all = GETPOST('search_all', 'alphanohtml');
+$search = array();
+foreach ($object->fields as $key => $val) {
+	if (GETPOST('search_'.$key, 'alpha') !== '') {
+		$search[$key] = GETPOST('search_'.$key, 'alpha');
+	}
+	if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
+		$search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOST('search_'.$key.'_dtstartmonth', 'int'), GETPOST('search_'.$key.'_dtstartday', 'int'), GETPOST('search_'.$key.'_dtstartyear', 'int'));
+		$search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOST('search_'.$key.'_dtendmonth', 'int'), GETPOST('search_'.$key.'_dtendday', 'int'), GETPOST('search_'.$key.'_dtendyear', 'int'));
+	}
+}
+
+// List of fields to search into when doing a "search in all"
+$fieldstosearchall = array();
+foreach ($object->fields as $key => $val) {
+	if (!empty($val['searchall'])) {
+		$fieldstosearchall['t.'.$key] = $val['label'];
+	}
+}
+
+// Definition of array of fields for columns
+$arrayfields = array();
+foreach ($object->fields as $key => $val) {
+	// If $val['visible']==0, then we never show the field
+	if (!empty($val['visible'])) {
+		$visible = (int) dol_eval($val['visible'], 1);
+		$arrayfields['t.'.$key] = array(
+			'label'=>$val['label'],
+			'checked'=>(($visible < 0) ? 0 : 1),
+			'enabled'=>(abs($visible) != 3 && dol_eval($val['enabled'], 1)),
+			'position'=>$val['position'],
+			'help'=> isset($val['help']) ? $val['help'] : ''
+		);
+	}
+}
+// Extra fields
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_array_fields.tpl.php';
+
+$object->fields = dol_sort_array($object->fields, 'position');
+//$arrayfields['anotherfield'] = array('type'=>'integer', 'label'=>'AnotherField', 'checked'=>1, 'enabled'=>1, 'position'=>90, 'csslist'=>'right');
+$arrayfields = dol_sort_array($arrayfields, 'position');
+
+// There is several ways to check permission.
+// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
+$enablepermissioncheck = 0;
+if ($enablepermissioncheck) {
+	$permissiontoread = $user->rights->nav->action->read;
+	$permissiontoadd = $user->rights->nav->action->write;
+	$permissiontodelete = $user->rights->nav->action->delete;
+} else {
+	$permissiontoread = 1;
+	$permissiontoadd = 1;
+	$permissiontodelete = 1;
+}
+
+// Security check (enable the most restrictive one)
+if ($user->socid > 0) accessforbidden();
+//if ($user->socid > 0) accessforbidden();
+//$socid = 0; if ($user->socid > 0) $socid = $user->socid;
+//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
+//restrictedArea($user, $object->element, 0, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
+if (empty($conf->nav->enabled)) accessforbidden('Module not enabled');
+if (!$permissiontoread) accessforbidden();
+
+
+/*
+ * Actions
+ */
+
+if (GETPOST('cancel', 'alpha')) {
+	$action = 'list';
+	$massaction = '';
+}
+if (!GETPOST('confirmmassaction', 'alpha') && $massaction != 'presend' && $massaction != 'confirm_presend') {
+	$massaction = '';
+}
+
+$parameters = array();
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) {
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+}
+
+if (empty($reshook)) {
+	// Selection of new fields
+	include DOL_DOCUMENT_ROOT.'/core/actions_changeselectedfields.inc.php';
+
+	// Purge search criteria
+	if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { // All tests are required to be compatible with all browsers
+		foreach ($object->fields as $key => $val) {
+			$search[$key] = '';
+			if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
+				$search[$key.'_dtstart'] = '';
+				$search[$key.'_dtend'] = '';
+			}
+		}
+		$toselect = array();
+		$search_array_options = array();
+	}
+	if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')
+		|| GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) {
+		$massaction = ''; // Protection to avoid mass action if we force a new search during a mass action confirmation
+	}
+
+	// Mass actions
+	$objectclass = 'Action';
+	$objectlabel = 'Action';
+	$uploaddir = $conf->nav->dir_output;
+	include DOL_DOCUMENT_ROOT.'/core/actions_massactions.inc.php';
+}
+
+
+
+/*
+ * View
+ */
+
+$form = new Form($db);
+
+$now = dol_now();
+
+//$help_url = "EN:Module_Action|FR:Module_Action_FR|ES:Módulo_Action";
+$help_url = '';
+$title = $langs->trans("Actions");
+$morejs = array();
+$morecss = array();
+
+
+// Build and execute select
+// --------------------------------------------------------------------
+$sql = 'SELECT ';
+$sql .= $object->getFieldList('t');
+// Add fields from extrafields
+if (!empty($extrafields->attributes[$object->table_element]['label'])) {
+	foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
+		$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : '');
+	}
+}
+// Add fields from hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldListSelect', $parameters, $object); // Note that $action and $object may have been modified by hook
+$sql .= preg_replace('/^,/', '', $hookmanager->resPrint);
+$sql = preg_replace('/,\s*$/', '', $sql);
+//$sql .= ", COUNT(rc.rowid) as anotherfield";
+$sql .= " FROM ".MAIN_DB_PREFIX.$object->table_element." as t";
+//$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."anothertable as rc ON rc.parent = t.rowid";
+if (isset($extrafields->attributes[$object->table_element]['label']) && is_array($extrafields->attributes[$object->table_element]['label']) && count($extrafields->attributes[$object->table_element]['label'])) {
+	$sql .= " LEFT JOIN ".MAIN_DB_PREFIX.$object->table_element."_extrafields as ef on (t.rowid = ef.fk_object)";
+}
+// Add table from hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldListFrom', $parameters, $object); // Note that $action and $object may have been modified by hook
+$sql .= $hookmanager->resPrint;
+if ($object->ismultientitymanaged == 1) {
+	$sql .= " WHERE t.entity IN (".getEntity($object->element).")";
+} else {
+	$sql .= " WHERE 1 = 1";
+}
+foreach ($search as $key => $val) {
+	if (array_key_exists($key, $object->fields)) {
+		if ($key == 'status' && $search[$key] == -1) {
+			continue;
+		}
+		$mode_search = (($object->isInt($object->fields[$key]) || $object->isFloat($object->fields[$key])) ? 1 : 0);
+		if ((strpos($object->fields[$key]['type'], 'integer:') === 0) || (strpos($object->fields[$key]['type'], 'sellist:') === 0) || !empty($object->fields[$key]['arrayofkeyval'])) {
+			if ($search[$key] == '-1' || ($search[$key] === '0' && (empty($object->fields[$key]['arrayofkeyval']) || !array_key_exists('0', $object->fields[$key]['arrayofkeyval'])))) {
+				$search[$key] = '';
+			}
+			$mode_search = 2;
+		}
+		if ($search[$key] != '') {
+			$sql .= natural_search("t.".$db->escape($key), $search[$key], (($key == 'status') ? 2 : $mode_search));
+		}
+	} else {
+		if (preg_match('/(_dtstart|_dtend)$/', $key) && $search[$key] != '') {
+			$columnName = preg_replace('/(_dtstart|_dtend)$/', '', $key);
+			if (preg_match('/^(date|timestamp|datetime)/', $object->fields[$columnName]['type'])) {
+				if (preg_match('/_dtstart$/', $key)) {
+					$sql .= " AND t.".$db->escape($columnName)." >= '".$db->idate($search[$key])."'";
+				}
+				if (preg_match('/_dtend$/', $key)) {
+					$sql .= " AND t.".$db->escape($columnName)." <= '".$db->idate($search[$key])."'";
+				}
+			}
+		}
+	}
+}
+if ($search_all) {
+	$sql .= natural_search(array_keys($fieldstosearchall), $search_all);
+}
+//$sql.= dolSqlDateFilter("t.field", $search_xxxday, $search_xxxmonth, $search_xxxyear);
+// Add where from extra fields
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_sql.tpl.php';
+// Add where from hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $object); // Note that $action and $object may have been modified by hook
+$sql .= $hookmanager->resPrint;
+
+/* If a group by is required
+$sql .= " GROUP BY ";
+foreach($object->fields as $key => $val) {
+	$sql .= "t.".$db->escape($key).", ";
+}
+// Add fields from extrafields
+if (!empty($extrafields->attributes[$object->table_element]['label'])) {
+	foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) {
+		$sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? "ef.".$key.', ' : '');
+	}
+}
+// Add where from hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldListGroupBy', $parameters, $object);    // Note that $action and $object may have been modified by hook
+$sql .= $hookmanager->resPrint;
+$sql = preg_replace('/,\s*$/', '', $sql);
+*/
+
+// Add HAVING from hooks
+/*
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldListHaving', $parameters, $object); // Note that $action and $object may have been modified by hook
+$sql .= empty($hookmanager->resPrint) ? "" : " HAVING 1=1 ".$hookmanager->resPrint;
+*/
+
+// Count total nb of records
+$nbtotalofrecords = '';
+if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
+	/* This old and fast method to get and count full list returns all record so use a high amount of memory.
+	$resql = $db->query($sql);
+	$nbtotalofrecords = $db->num_rows($resql);
+	*/
+	/* The slow method does not consume memory on mysql (not tested on pgsql) */
+	/*$resql = $db->query($sql, 0, 'auto', 1);
+	while ($db->fetch_object($resql)) {
+		if (empty($nbtotalofrecords)) {
+			$nbtotalofrecords = 1;    // We can't make +1 because init value is ''
+		 } else {
+			 $nbtotalofrecords++;
+		 }
+	 }*/
+	/* The fast and low memory method to get and count full list converts the sql into a sql count */
+	$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(*) as nbtotalofrecords FROM', $sql);
+	$resql = $db->query($sqlforcount);
+	if ($resql) {
+		$objforcount = $db->fetch_object($resql);
+		$nbtotalofrecords = $objforcount->nbtotalofrecords;
+	} else {
+		dol_print_error($db);
+	}
+
+	if (($page * $limit) > $nbtotalofrecords) {	// if total of record found is smaller than page * limit, goto and load page 0
+		$page = 0;
+		$offset = 0;
+	}
+	$db->free($resql);
+}
+
+// Complete request and execute it with limit
+$sql .= $db->order($sortfield, $sortorder);
+if ($limit) {
+	$sql .= $db->plimit($limit + 1, $offset);
+}
+
+$resql = $db->query($sql);
+if (!$resql) {
+	dol_print_error($db);
+	exit;
+}
+
+$num = $db->num_rows($resql);
+
+
+// Direct jump if only one record found
+if ($num == 1 && !empty($conf->global->MAIN_SEARCH_DIRECT_OPEN_IF_ONLY_ONE) && $search_all && !$page) {
+	$obj = $db->fetch_object($resql);
+	$id = $obj->rowid;
+	header("Location: ".dol_buildpath('/nav/action_card.php', 1).'?id='.$id);
+	exit;
+}
+
+
+// Output page
+// --------------------------------------------------------------------
+
+llxHeader('', $title, $help_url, '', 0, 0, $morejs, $morecss, '', 'bodyforlist');
+
+// Example : Adding jquery code
+// print '<script type="text/javascript">
+// jQuery(document).ready(function() {
+// 	function init_myfunc()
+// 	{
+// 		jQuery("#myid").removeAttr(\'disabled\');
+// 		jQuery("#myid").attr(\'disabled\',\'disabled\');
+// 	}
+// 	init_myfunc();
+// 	jQuery("#mybutton").click(function() {
+// 		init_myfunc();
+// 	});
+// });
+// </script>';
+
+$arrayofselected = is_array($toselect) ? $toselect : array();
+
+$param = '';
+if (!empty($mode)) {
+	$param .= '&mode='.urlencode($mode);
+}
+if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) {
+	$param .= '&contextpage='.urlencode($contextpage);
+}
+if ($limit > 0 && $limit != $conf->liste_limit) {
+	$param .= '&limit='.urlencode($limit);
+}
+foreach ($search as $key => $val) {
+	if (is_array($search[$key])) {
+		foreach ($search[$key] as $skey) {
+			if ($skey != '') {
+				$param .= '&search_'.$key.'[]='.urlencode($skey);
+			}
+		}
+	} elseif (preg_match('/(_dtstart|_dtend)$/', $key) && !empty($val)) {
+		$param .= '&search_'.$key.'month='.((int) GETPOST('search_'.$key.'month', 'int'));
+		$param .= '&search_'.$key.'day='.((int) GETPOST('search_'.$key.'day', 'int'));
+		$param .= '&search_'.$key.'year='.((int) GETPOST('search_'.$key.'year', 'int'));
+	} elseif ($search[$key] != '') {
+		$param .= '&search_'.$key.'='.urlencode($search[$key]);
+	}
+}
+if ($optioncss != '') {
+	$param .= '&optioncss='.urlencode($optioncss);
+}
+// Add $param from extra fields
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_param.tpl.php';
+// Add $param from hooks
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldListSearchParam', $parameters, $object); // Note that $action and $object may have been modified by hook
+$param .= $hookmanager->resPrint;
+
+// List of mass actions available
+$arrayofmassactions = array(
+	//'validate'=>img_picto('', 'check', 'class="pictofixedwidth"').$langs->trans("Validate"),
+	//'generate_doc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("ReGeneratePDF"),
+	//'builddoc'=>img_picto('', 'pdf', 'class="pictofixedwidth"').$langs->trans("PDFMerge"),
+	//'presend'=>img_picto('', 'email', 'class="pictofixedwidth"').$langs->trans("SendByMail"),
+);
+if (!empty($permissiontodelete)) {
+	$arrayofmassactions['predelete'] = img_picto('', 'delete', 'class="pictofixedwidth"').$langs->trans("Delete");
+}
+if (GETPOST('nomassaction', 'int') || in_array($massaction, array('presend', 'predelete'))) {
+	$arrayofmassactions = array();
+}
+$massactionbutton = $form->selectMassAction('', $arrayofmassactions);
+
+print '<form method="POST" id="searchFormList" action="'.$_SERVER["PHP_SELF"].'">'."\n";
+if ($optioncss != '') {
+	print '<input type="hidden" name="optioncss" value="'.$optioncss.'">';
+}
+print '<input type="hidden" name="token" value="'.newToken().'">';
+print '<input type="hidden" name="formfilteraction" id="formfilteraction" value="list">';
+print '<input type="hidden" name="action" value="list">';
+print '<input type="hidden" name="sortfield" value="'.$sortfield.'">';
+print '<input type="hidden" name="sortorder" value="'.$sortorder.'">';
+print '<input type="hidden" name="page" value="'.$page.'">';
+print '<input type="hidden" name="contextpage" value="'.$contextpage.'">';
+print '<input type="hidden" name="mode" value="'.$mode.'">';
+
+
+$newcardbutton = '';
+$newcardbutton .= dolGetButtonTitle($langs->trans('ViewList'), '', 'fa fa-bars imgforviewmode', $_SERVER["PHP_SELF"].'?mode=common'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ((empty($mode) || $mode == 'common') ? 2 : 1), array('morecss'=>'reposition'));
+$newcardbutton .= dolGetButtonTitle($langs->trans('ViewKanban'), '', 'fa fa-th-list imgforviewmode', $_SERVER["PHP_SELF"].'?mode=kanban'.preg_replace('/(&|\?)*mode=[^&]+/', '', $param), '', ($mode == 'kanban' ? 2 : 1), array('morecss'=>'reposition'));
+$newcardbutton .= dolGetButtonTitleSeparator();
+$newcardbutton .= dolGetButtonTitle($langs->trans('New'), '', 'fa fa-plus-circle', dol_buildpath('/nav/action_card.php', 1).'?action=create&backtopage='.urlencode($_SERVER['PHP_SELF']), '', $permissiontoadd);
+
+print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $massactionbutton, $num, $nbtotalofrecords, 'object_'.$object->picto, 0, $newcardbutton, '', $limit, 0, 0, 1);
+
+// Add code for pre mass action (confirmation or email presend form)
+$topicmail = "SendActionRef";
+$modelmail = "action";
+$objecttmp = new Action($db);
+$trackid = 'xxxx'.$object->id;
+include DOL_DOCUMENT_ROOT.'/core/tpl/massactions_pre.tpl.php';
+
+if ($search_all) {
+	$setupstring = '';
+	foreach ($fieldstosearchall as $key => $val) {
+		$fieldstosearchall[$key] = $langs->trans($val);
+		$setupstring .= $key."=".$val.";";
+	}
+	print '<!-- Search done like if PRODUCT_QUICKSEARCH_ON_FIELDS = '.$setupstring.' -->'."\n";
+	print '<div class="divsearchfieldfilter">'.$langs->trans("FilterOnInto", $search_all).join(', ', $fieldstosearchall).'</div>'."\n";
+}
+
+$moreforfilter = '';
+/*$moreforfilter.='<div class="divsearchfield">';
+$moreforfilter.= $langs->trans('MyFilter') . ': <input type="text" name="search_myfield" value="'.dol_escape_htmltag($search_myfield).'">';
+$moreforfilter.= '</div>';*/
+
+$parameters = array();
+$reshook = $hookmanager->executeHooks('printFieldPreListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
+if (empty($reshook)) {
+	$moreforfilter .= $hookmanager->resPrint;
+} else {
+	$moreforfilter = $hookmanager->resPrint;
+}
+
+if (!empty($moreforfilter)) {
+	print '<div class="liste_titre liste_titre_bydiv centpercent">';
+	print $moreforfilter;
+	print '</div>';
+}
+
+$varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage;
+$selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage, getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN', '')); // This also change content of $arrayfields
+$selectedfields .= (count($arrayofmassactions) ? $form->showCheckAddButtons('checkforselect', 1) : '');
+
+print '<div class="div-table-responsive">'; // You can use div-table-responsive-no-min if you dont need reserved height for your table
+print '<table class="tagtable nobottomiftotal liste'.($moreforfilter ? " listwithfilterbefore" : "").'">'."\n";
+
+
+// Fields title search
+// --------------------------------------------------------------------
+print '<tr class="liste_titre">';
+// Action column
+if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+	print '<td class="liste_titre maxwidthsearch">';
+	$searchpicto = $form->showFilterButtons('left');
+	print $searchpicto;
+	print '</td>';
+}
+foreach ($object->fields as $key => $val) {
+	$searchkey = empty($search[$key]) ? '' : $search[$key];
+	$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
+	if ($key == 'status') {
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
+	} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
+	} elseif (in_array($val['type'], array('timestamp'))) {
+		$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
+	} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
+		$cssforfield .= ($cssforfield ? ' ' : '').'right';
+	}
+	if (!empty($arrayfields['t.'.$key]['checked'])) {
+		print '<td class="liste_titre'.($cssforfield ? ' '.$cssforfield : '').'">';
+		if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
+			print $form->selectarray('search_'.$key, $val['arrayofkeyval'], (isset($search[$key]) ? $search[$key] : ''), $val['notnull'], 0, 0, '', 1, 0, 0, '', 'maxwidth100', 1);
+		} elseif ((strpos($val['type'], 'integer:') === 0) || (strpos($val['type'], 'sellist:') === 0)) {
+			print $object->showInputField($val, $key, (isset($search[$key]) ? $search[$key] : ''), '', '', 'search_', $cssforfield.' maxwidth250', 1);
+		} elseif (preg_match('/^(date|timestamp|datetime)/', $val['type'])) {
+			print '<div class="nowrap">';
+			print $form->selectDate($search[$key.'_dtstart'] ? $search[$key.'_dtstart'] : '', "search_".$key."_dtstart", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
+			print '</div>';
+			print '<div class="nowrap">';
+			print $form->selectDate($search[$key.'_dtend'] ? $search[$key.'_dtend'] : '', "search_".$key."_dtend", 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
+			print '</div>';
+		} elseif ($key == 'lang') {
+			require_once DOL_DOCUMENT_ROOT.'/core/class/html.formadmin.class.php';
+			$formadmin = new FormAdmin($db);
+			print $formadmin->select_language($search[$key], 'search_lang', 0, null, 1, 0, 0, 'minwidth150 maxwidth200', 2);
+		} else {
+			print '<input type="text" class="flat maxwidth75" name="search_'.$key.'" value="'.dol_escape_htmltag(isset($search[$key]) ? $search[$key] : '').'">';
+		}
+		print '</td>';
+	}
+}
+// Extra fields
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_input.tpl.php';
+
+// Fields from hook
+$parameters = array('arrayfields'=>$arrayfields);
+$reshook = $hookmanager->executeHooks('printFieldListOption', $parameters, $object); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+/*if (!empty($arrayfields['anotherfield']['checked'])) {
+	print '<td class="liste_titre"></td>';
+}*/
+// Action column
+if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+	print '<td class="liste_titre maxwidthsearch">';
+	$searchpicto = $form->showFilterButtons();
+	print $searchpicto;
+	print '</td>';
+}
+print '</tr>'."\n";
+
+$totalarray = array();
+$totalarray['nbfield'] = 0;
+
+// Fields title label
+// --------------------------------------------------------------------
+print '<tr class="liste_titre">';
+if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+	print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
+}
+foreach ($object->fields as $key => $val) {
+	$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
+	if ($key == 'status') {
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
+	} elseif (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
+		$cssforfield .= ($cssforfield ? ' ' : '').'center';
+	} elseif (in_array($val['type'], array('timestamp'))) {
+		$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
+	} elseif (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && $key != 'rowid' && $val['label'] != 'TechnicalID' && empty($val['arrayofkeyval'])) {
+		$cssforfield .= ($cssforfield ? ' ' : '').'right';
+	}
+	$cssforfield = preg_replace('/small\s*/', '', $cssforfield);	// the 'small' css must not be used for the title label
+	if (!empty($arrayfields['t.'.$key]['checked'])) {
+		print getTitleFieldOfList($arrayfields['t.'.$key]['label'], 0, $_SERVER['PHP_SELF'], 't.'.$key, '', $param, ($cssforfield ? 'class="'.$cssforfield.'"' : ''), $sortfield, $sortorder, ($cssforfield ? $cssforfield.' ' : ''))."\n";
+		$totalarray['nbfield']++;
+	}
+}
+// Extra fields
+include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_search_title.tpl.php';
+// Hook fields
+$parameters = array('arrayfields'=>$arrayfields, 'param'=>$param, 'sortfield'=>$sortfield, 'sortorder'=>$sortorder, 'totalarray'=>&$totalarray);
+$reshook = $hookmanager->executeHooks('printFieldListTitle', $parameters, $object); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+/*if (!empty($arrayfields['anotherfield']['checked'])) {
+	print '<th class="liste_titre right">'.$langs->trans("AnotherField").'</th>';
+	$totalarray['nbfield']++;
+}*/
+// Action column
+if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+	print getTitleFieldOfList(($mode != 'kanban' ? $selectedfields : ''), 0, $_SERVER["PHP_SELF"], '', '', '', '', $sortfield, $sortorder, 'center maxwidthsearch ')."\n";
+}
+$totalarray['nbfield']++;
+print '</tr>'."\n";
+
+
+// Detect if we need a fetch on each output line
+$needToFetchEachLine = 0;
+if (isset($extrafields->attributes[$object->table_element]['computed']) && is_array($extrafields->attributes[$object->table_element]['computed']) && count($extrafields->attributes[$object->table_element]['computed']) > 0) {
+	foreach ($extrafields->attributes[$object->table_element]['computed'] as $key => $val) {
+		if (preg_match('/\$object/', $val)) {
+			$needToFetchEachLine++; // There is at least one compute field that use $object
+		}
+	}
+}
+
+
+// Loop on record
+// --------------------------------------------------------------------
+$i = 0;
+$savnbfield = $totalarray['nbfield'];
+$totalarray = array();
+$totalarray['nbfield'] = 0;
+$imaxinloop = ($limit ? min($num, $limit) : $num);
+while ($i < $imaxinloop) {
+	$obj = $db->fetch_object($resql);
+	if (empty($obj)) {
+		break; // Should not happen
+	}
+
+	// Store properties in $object
+	$object->setVarsFromFetchObj($obj);
+
+	if ($mode == 'kanban') {
+		if ($i == 0) {
+			print '<tr><td colspan="'.$savnbfield.'">';
+			print '<div class="box-flex-container">';
+		}
+		// Output Kanban
+		print $object->getKanbanView('');
+		if ($i == ($imaxinloop - 1)) {
+			print '</div>';
+			print '</td></tr>';
+		}
+	} else {
+		// Show here line of result
+		$j = 0;
+		print '<tr data-rowid="'.$object->id.'" class="oddeven">';
+		// Action column
+		if (!empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+			print '<td class="nowrap center">';
+			if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+				$selected = 0;
+				if (in_array($object->id, $arrayofselected)) {
+					$selected = 1;
+				}
+				print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
+			}
+			print '</td>';
+		}
+		foreach ($object->fields as $key => $val) {
+			$cssforfield = (empty($val['csslist']) ? (empty($val['css']) ? '' : $val['css']) : $val['csslist']);
+			if (in_array($val['type'], array('date', 'datetime', 'timestamp'))) {
+				$cssforfield .= ($cssforfield ? ' ' : '').'center';
+			} elseif ($key == 'status') {
+				$cssforfield .= ($cssforfield ? ' ' : '').'center';
+			}
+
+			if (in_array($val['type'], array('timestamp'))) {
+				$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
+			} elseif ($key == 'ref') {
+				$cssforfield .= ($cssforfield ? ' ' : '').'nowrap';
+			}
+
+			if (in_array($val['type'], array('double(24,8)', 'double(6,3)', 'integer', 'real', 'price')) && !in_array($key, array('rowid', 'status')) && empty($val['arrayofkeyval'])) {
+				$cssforfield .= ($cssforfield ? ' ' : '').'right';
+			}
+			//if (in_array($key, array('fk_soc', 'fk_user', 'fk_warehouse'))) $cssforfield = 'tdoverflowmax100';
+
+			if (!empty($arrayfields['t.'.$key]['checked'])) {
+				print '<td'.($cssforfield ? ' class="'.$cssforfield.'"' : '');
+				if (preg_match('/tdoverflow/', $cssforfield)) {
+					print ' title="'.dol_escape_htmltag($object->$key).'"';
+				}
+				print '>';
+				if ($key == 'status') {
+					print $object->getLibStatut(5);
+				} elseif ($key == 'rowid') {
+					print $object->showOutputField($val, $key, $object->id, '');
+				} else {
+					print $object->showOutputField($val, $key, $object->$key, '');
+				}
+				print '</td>';
+				if (!$i) {
+					$totalarray['nbfield']++;
+				}
+				if (!empty($val['isameasure']) && $val['isameasure'] == 1) {
+					if (!$i) {
+						$totalarray['pos'][$totalarray['nbfield']] = 't.'.$key;
+					}
+					if (!isset($totalarray['val'])) {
+						$totalarray['val'] = array();
+					}
+					if (!isset($totalarray['val']['t.'.$key])) {
+						$totalarray['val']['t.'.$key] = 0;
+					}
+					$totalarray['val']['t.'.$key] += $object->$key;
+				}
+			}
+		}
+		// Extra fields
+		include DOL_DOCUMENT_ROOT.'/core/tpl/extrafields_list_print_fields.tpl.php';
+		// Fields from hook
+		$parameters = array('arrayfields'=>$arrayfields, 'object'=>$object, 'obj'=>$obj, 'i'=>$i, 'totalarray'=>&$totalarray);
+		$reshook = $hookmanager->executeHooks('printFieldListValue', $parameters, $object); // Note that $action and $object may have been modified by hook
+		print $hookmanager->resPrint;
+		/*if (!empty($arrayfields['anotherfield']['checked'])) {
+			print '<td class="right">'.$obj->anotherfield.'</td>';
+		}*/
+		// Action column
+		if (empty($conf->global->MAIN_CHECKBOX_LEFT_COLUMN)) {
+			print '<td class="nowrap center">';
+			if ($massactionbutton || $massaction) { // If we are in select mode (massactionbutton defined) or if we have already selected and sent an action ($massaction) defined
+				$selected = 0;
+				if (in_array($object->id, $arrayofselected)) {
+					$selected = 1;
+				}
+				print '<input id="cb'.$object->id.'" class="flat checkforselect" type="checkbox" name="toselect[]" value="'.$object->id.'"'.($selected ? ' checked="checked"' : '').'>';
+			}
+			print '</td>';
+		}
+		if (!$i) {
+			$totalarray['nbfield']++;
+		}
+
+		print '</tr>'."\n";
+	}
+
+	$i++;
+}
+
+// Show total line
+include DOL_DOCUMENT_ROOT.'/core/tpl/list_print_total.tpl.php';
+
+// If no record found
+if ($num == 0) {
+	$colspan = 1;
+	foreach ($arrayfields as $key => $val) {
+		if (!empty($val['checked'])) {
+			$colspan++;
+		}
+	}
+	print '<tr><td colspan="'.$colspan.'"><span class="opacitymedium">'.$langs->trans("NoRecordFound").'</span></td></tr>';
+}
+
+
+$db->free($resql);
+
+$parameters = array('arrayfields'=>$arrayfields, 'sql'=>$sql);
+$reshook = $hookmanager->executeHooks('printFieldListFooter', $parameters, $object, $action); // Note that $action and $object may have been modified by hook
+print $hookmanager->resPrint;
+
+print '</table>'."\n";
+print '</div>'."\n";
+
+print '</form>'."\n";
+
+if (in_array('builddoc', $arrayofmassactions) && ($nbtotalofrecords === '' || $nbtotalofrecords)) {
+	$hidegeneratedfilelistifempty = 1;
+	if ($massaction == 'builddoc' || $action == 'remove_file' || $show_files) {
+		$hidegeneratedfilelistifempty = 0;
+	}
+
+	require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
+	$formfile = new FormFile($db);
+
+	// Show list of available documents
+	$urlsource = $_SERVER['PHP_SELF'].'?sortfield='.$sortfield.'&sortorder='.$sortorder;
+	$urlsource .= str_replace('&amp;', '&', $param);
+
+	$filedir = $diroutputmassaction;
+	$genallowed = $permissiontoread;
+	$delallowed = $permissiontoadd;
+
+	print $formfile->showdocuments('massfilesarea_nav', '', $filedir, $urlsource, 0, $delallowed, '', 1, 1, 0, 48, 1, $param, $title, '', '', '', null, $hidegeneratedfilelistifempty);
+}
+
+// End of page
+llxFooter();
+$db->close();

+ 221 - 0
custom/nav/action_note.php

@@ -0,0 +1,221 @@
+<?php
+/* Copyright (C) 2007-2017 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2023 Deák Ferenc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ *  \file       action_note.php
+ *  \ingroup    nav
+ *  \brief      Tab for notes on Action
+ */
+
+//if (! defined('NOREQUIREDB'))              define('NOREQUIREDB', '1');				// Do not create database handler $db
+//if (! defined('NOREQUIREUSER'))            define('NOREQUIREUSER', '1');				// Do not load object $user
+//if (! defined('NOREQUIRESOC'))             define('NOREQUIRESOC', '1');				// Do not load object $mysoc
+//if (! defined('NOREQUIRETRAN'))            define('NOREQUIRETRAN', '1');				// Do not load object $langs
+//if (! defined('NOSCANGETFORINJECTION'))    define('NOSCANGETFORINJECTION', '1');		// Do not check injection attack on GET parameters
+//if (! defined('NOSCANPOSTFORINJECTION'))   define('NOSCANPOSTFORINJECTION', '1');		// Do not check injection attack on POST parameters
+//if (! defined('NOCSRFCHECK'))              define('NOCSRFCHECK', '1');				// Do not check CSRF attack (test on referer + on token if option MAIN_SECURITY_CSRF_WITH_TOKEN is on).
+//if (! defined('NOTOKENRENEWAL'))           define('NOTOKENRENEWAL', '1');				// Do not roll the Anti CSRF token (used if MAIN_SECURITY_CSRF_WITH_TOKEN is on)
+//if (! defined('NOSTYLECHECK'))             define('NOSTYLECHECK', '1');				// Do not check style html tag into posted data
+//if (! defined('NOREQUIREMENU'))            define('NOREQUIREMENU', '1');				// If there is no need to load and show top and left menu
+//if (! defined('NOREQUIREHTML'))            define('NOREQUIREHTML', '1');				// If we don't need to load the html.form.class.php
+//if (! defined('NOREQUIREAJAX'))            define('NOREQUIREAJAX', '1');       	  	// Do not load ajax.lib.php library
+//if (! defined("NOLOGIN"))                  define("NOLOGIN", '1');					// If this page is public (can be called outside logged session). This include the NOIPCHECK too.
+//if (! defined('NOIPCHECK'))                define('NOIPCHECK', '1');					// Do not check IP defined into conf $dolibarr_main_restrict_ip
+//if (! defined("MAIN_LANG_DEFAULT"))        define('MAIN_LANG_DEFAULT', 'auto');					// Force lang to a particular value
+//if (! defined("MAIN_AUTHENTICATION_MODE")) define('MAIN_AUTHENTICATION_MODE', 'aloginmodule');	// Force authentication handler
+//if (! defined("NOREDIRECTBYMAINTOLOGIN"))  define('NOREDIRECTBYMAINTOLOGIN', 1);		// The main.inc.php does not make a redirect if not logged, instead show simple error message
+//if (! defined("FORCECSP"))                 define('FORCECSP', 'none');				// Disable all Content Security Policies
+//if (! defined('CSRFCHECK_WITH_TOKEN'))     define('CSRFCHECK_WITH_TOKEN', '1');		// Force use of CSRF protection with tokens even for GET
+//if (! defined('NOBROWSERNOTIF'))     		 define('NOBROWSERNOTIF', '1');				// Disable browser notification
+
+// Load Dolibarr environment
+$res = 0;
+// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+}
+// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
+$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
+	$i--; $j--;
+}
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+}
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+}
+// Try main.inc.php using relative path
+if (!$res && file_exists("../main.inc.php")) {
+	$res = @include "../main.inc.php";
+}
+if (!$res && file_exists("../../main.inc.php")) {
+	$res = @include "../../main.inc.php";
+}
+if (!$res && file_exists("../../../main.inc.php")) {
+	$res = @include "../../../main.inc.php";
+}
+if (!$res) {
+	die("Include of main fails");
+}
+
+dol_include_once('/nav/class/action.class.php');
+dol_include_once('/nav/lib/nav_action.lib.php');
+
+// Load translation files required by the page
+$langs->loadLangs(array("nav@nav", "companies"));
+
+// Get parameters
+$id = GETPOST('id', 'int');
+$ref        = GETPOST('ref', 'alpha');
+$action = GETPOST('action', 'aZ09');
+$cancel     = GETPOST('cancel', 'aZ09');
+$backtopage = GETPOST('backtopage', 'alpha');
+
+// Initialize technical objects
+$object = new Action($db);
+$extrafields = new ExtraFields($db);
+$diroutputmassaction = $conf->nav->dir_output.'/temp/massgeneration/'.$user->id;
+$hookmanager->initHooks(array('actionnote', 'globalcard')); // Note that conf->hooks_modules contains array
+// Fetch optionals attributes and labels
+$extrafields->fetch_name_optionals_label($object->table_element);
+
+// Load object
+include DOL_DOCUMENT_ROOT.'/core/actions_fetchobject.inc.php'; // Must be include, not include_once  // Must be include, not include_once. Include fetch and fetch_thirdparty but not fetch_optionals
+if ($id > 0 || !empty($ref)) {
+	$upload_dir = $conf->nav->multidir_output[!empty($object->entity) ? $object->entity : $conf->entity]."/".$object->id;
+}
+
+
+// There is several ways to check permission.
+// Set $enablepermissioncheck to 1 to enable a minimum low level of checks
+$enablepermissioncheck = 0;
+if ($enablepermissioncheck) {
+	$permissiontoread = $user->rights->nav->action->read;
+	$permissiontoadd = $user->rights->nav->action->write;
+	$permissionnote = $user->rights->nav->action->write; // Used by the include of actions_setnotes.inc.php
+} else {
+	$permissiontoread = 1;
+	$permissiontoadd = 1;
+	$permissionnote = 1;
+}
+
+// Security check (enable the most restrictive one)
+//if ($user->socid > 0) accessforbidden();
+//if ($user->socid > 0) $socid = $user->socid;
+//$isdraft = (($object->status == $object::STATUS_DRAFT) ? 1 : 0);
+//restrictedArea($user, $object->element, $object->id, $object->table_element, '', 'fk_soc', 'rowid', $isdraft);
+if (empty($conf->nav->enabled)) accessforbidden();
+if (!$permissiontoread) accessforbidden();
+
+
+/*
+ * Actions
+ */
+
+$parameters = array();
+$reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
+if ($reshook < 0) {
+	setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+}
+if (empty($reshook)) {
+	include DOL_DOCUMENT_ROOT.'/core/actions_setnotes.inc.php'; // Must be include, not include_once
+}
+
+
+/*
+ * View
+ */
+
+$form = new Form($db);
+
+//$help_url='EN:Customers_Orders|FR:Commandes_Clients|ES:Pedidos de clientes';
+$help_url = '';
+$title = $langs->trans('Action').' - '.$langs->trans("Notes");
+llxHeader('', $title, $help_url);
+
+if ($id > 0 || !empty($ref)) {
+	$object->fetch_thirdparty();
+
+	$head = actionPrepareHead($object);
+
+	print dol_get_fiche_head($head, 'note', $langs->trans("Action"), -1, $object->picto);
+
+	// Object card
+	// ------------------------------------------------------------
+	$linkback = '<a href="'.dol_buildpath('/nav/action_list.php', 1).'?restore_lastsearch_values=1'.(!empty($socid) ? '&socid='.$socid : '').'">'.$langs->trans("BackToList").'</a>';
+
+	$morehtmlref = '<div class="refidno">';
+	/*
+	 // Ref customer
+	 $morehtmlref.=$form->editfieldkey("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', 0, 1);
+	 $morehtmlref.=$form->editfieldval("RefCustomer", 'ref_client', $object->ref_client, $object, 0, 'string', '', null, null, '', 1);
+	 // Thirdparty
+	 $morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . (is_object($object->thirdparty) ? $object->thirdparty->getNomUrl(1) : '');
+	 // Project
+	 if (! empty($conf->project->enabled))
+	 {
+	 $langs->load("projects");
+	 $morehtmlref.='<br>'.$langs->trans('Project') . ' ';
+	 if ($permissiontoadd)
+	 {
+	 if ($action != 'classify')
+	 //$morehtmlref.='<a class="editfielda" href="' . $_SERVER['PHP_SELF'] . '?action=classify&token='.newToken().'&id=' . $object->id . '">' . img_edit($langs->transnoentitiesnoconv('SetProject')) . '</a> : ';
+	 $morehtmlref.=' : ';
+	 if ($action == 'classify') {
+	 //$morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'projectid', 0, 0, 1, 1);
+	 $morehtmlref.='<form method="post" action="'.$_SERVER['PHP_SELF'].'?id='.$object->id.'">';
+	 $morehtmlref.='<input type="hidden" name="action" value="classin">';
+	 $morehtmlref.='<input type="hidden" name="token" value="'.newToken().'">';
+	 $morehtmlref.=$formproject->select_projects($object->socid, $object->fk_project, 'projectid', $maxlength, 0, 1, 0, 1, 0, 0, '', 1);
+	 $morehtmlref.='<input type="submit" class="button valignmiddle" value="'.$langs->trans("Modify").'">';
+	 $morehtmlref.='</form>';
+	 } else {
+	 $morehtmlref.=$form->form_project($_SERVER['PHP_SELF'] . '?id=' . $object->id, $object->socid, $object->fk_project, 'none', 0, 0, 0, 1);
+	 }
+	 } else {
+	 if (! empty($object->fk_project)) {
+	 $proj = new Project($db);
+	 $proj->fetch($object->fk_project);
+	 $morehtmlref .= ': '.$proj->getNomUrl();
+	 } else {
+	 $morehtmlref .= '';
+	 }
+	 }
+	 }*/
+	 $morehtmlref .= '</div>';
+
+
+	dol_banner_tab($object, 'ref', $linkback, 1, 'ref', 'ref', $morehtmlref);
+
+
+	print '<div class="fichecenter">';
+	print '<div class="underbanner clearboth"></div>';
+
+
+	$cssclass = "titlefield";
+	include DOL_DOCUMENT_ROOT.'/core/tpl/notes.tpl.php';
+
+	print '</div>';
+
+	print dol_get_fiche_end();
+}
+
+// End of page
+llxFooter();
+$db->close();

+ 105 - 0
custom/nav/admin/about.php

@@ -0,0 +1,105 @@
+<?php
+/* Copyright (C) 2004-2017 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2022 Deák Ferenc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file    nav/admin/about.php
+ * \ingroup nav
+ * \brief   About page of module Nav.
+ */
+
+// Load Dolibarr environment
+$res = 0;
+// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+}
+// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
+$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
+	$i--; $j--;
+}
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+}
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+}
+// Try main.inc.php using relative path
+if (!$res && file_exists("../../main.inc.php")) {
+	$res = @include "../../main.inc.php";
+}
+if (!$res && file_exists("../../../main.inc.php")) {
+	$res = @include "../../../main.inc.php";
+}
+if (!$res) {
+	die("Include of main fails");
+}
+
+// Libraries
+require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
+require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+require_once '../lib/nav.lib.php';
+
+// Translations
+$langs->loadLangs(array("errors", "admin", "nav@nav"));
+
+// Access control
+if (!$user->admin) {
+	accessforbidden();
+}
+
+// Parameters
+$action = GETPOST('action', 'aZ09');
+$backtopage = GETPOST('backtopage', 'alpha');
+
+
+/*
+ * Actions
+ */
+
+// None
+
+
+/*
+ * View
+ */
+
+$form = new Form($db);
+
+$help_url = '';
+$page_name = "NavAbout";
+
+llxHeader('', $langs->trans($page_name), $help_url);
+
+// Subheader
+$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
+
+print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
+
+// Configuration header
+$head = navAdminPrepareHead();
+print dol_get_fiche_head($head, 'about', $langs->trans($page_name), 0, 'nav@nav');
+
+dol_include_once('/nav/core/modules/modNav.class.php');
+$tmpmodule = new modNav($db);
+print $tmpmodule->getDescLong();
+
+// Page end
+print dol_get_fiche_end();
+llxFooter();
+$db->close();

+ 145 - 0
custom/nav/admin/action_extrafields.php

@@ -0,0 +1,145 @@
+<?php
+/* Copyright (C) 2001-2002	Rodolphe Quiedeville	<rodolphe@quiedeville.org>
+ * Copyright (C) 2003		Jean-Louis Bergamo		<jlb@j1b.org>
+ * Copyright (C) 2004-2011	Laurent Destailleur		<eldy@users.sourceforge.net>
+ * Copyright (C) 2012		Regis Houssin			<regis.houssin@inodbox.com>
+ * Copyright (C) 2014		Florian Henry			<florian.henry@open-concept.pro>
+ * Copyright (C) 2015		Jean-François Ferry		<jfefe@aternatik.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ *      \file       admin/action_extrafields.php
+ *		\ingroup    nav
+ *		\brief      Page to setup extra fields of action
+ */
+
+// Load Dolibarr environment
+$res = 0;
+// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+}
+// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
+$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
+	$i--; $j--;
+}
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+}
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+}
+// Try main.inc.php using relative path
+if (!$res && file_exists("../../main.inc.php")) {
+	$res = @include "../../main.inc.php";
+}
+if (!$res && file_exists("../../../main.inc.php")) {
+	$res = @include "../../../main.inc.php";
+}
+if (!$res) {
+	die("Include of main fails");
+}
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+require_once '../lib/nav.lib.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array('nav@nav', 'admin'));
+
+$extrafields = new ExtraFields($db);
+$form = new Form($db);
+
+// List of supported format
+$tmptype2label = ExtraFields::$type2label;
+$type2label = array('');
+foreach ($tmptype2label as $key => $val) {
+	$type2label[$key] = $langs->transnoentitiesnoconv($val);
+}
+
+$action = GETPOST('action', 'aZ09');
+$attrname = GETPOST('attrname', 'alpha');
+$elementtype = 'nav_action'; //Must be the $table_element of the class that manage extrafield
+
+if (!$user->admin) {
+	accessforbidden();
+}
+
+
+/*
+ * Actions
+ */
+
+require DOL_DOCUMENT_ROOT.'/core/actions_extrafields.inc.php';
+
+
+
+/*
+ * View
+ */
+
+$textobject = $langs->transnoentitiesnoconv("Action");
+
+$help_url = '';
+$page_name = "NavSetup";
+
+llxHeader('', $langs->trans("NavSetup"), $help_url);
+
+
+$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
+print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
+
+
+$head = navAdminPrepareHead();
+
+print dol_get_fiche_head($head, 'action_extrafields', $langs->trans($page_name), -1, 'nav@nav');
+
+require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_view.tpl.php';
+
+print dol_get_fiche_end();
+
+
+// Buttons
+if ($action != 'create' && $action != 'edit') {
+	print '<div class="tabsAction">';
+	print '<a class="butAction reposition" href="'.$_SERVER["PHP_SELF"].'?action=create">'.$langs->trans("NewAttribute").'</a>';
+	print "</div>";
+}
+
+
+/*
+ * Creation of an optional field
+ */
+if ($action == 'create') {
+	print '<br><div id="newattrib"></div>';
+	print load_fiche_titre($langs->trans('NewAttribute'));
+
+	require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_add.tpl.php';
+}
+
+/*
+ * Edition of an optional field
+ */
+if ($action == 'edit' && !empty($attrname)) {
+	print "<br>";
+	print load_fiche_titre($langs->trans("FieldEdition", $attrname));
+
+	require DOL_DOCUMENT_ROOT.'/core/tpl/admin_extrafields_edit.tpl.php';
+}
+
+// End of page
+llxFooter();
+$db->close();

+ 587 - 0
custom/nav/admin/setup.php

@@ -0,0 +1,587 @@
+<?php
+/* Copyright (C) 2004-2017 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2022 Deák Ferenc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file    nav/admin/setup.php
+ * \ingroup nav
+ * \brief   Nav setup page.
+ */
+
+// Load Dolibarr environment
+$res = 0;
+// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+}
+// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
+$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
+	$i--; $j--;
+}
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+}
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+}
+// Try main.inc.php using relative path
+if (!$res && file_exists("../../main.inc.php")) {
+	$res = @include "../../main.inc.php";
+}
+if (!$res && file_exists("../../../main.inc.php")) {
+	$res = @include "../../../main.inc.php";
+}
+if (!$res) {
+	die("Include of main fails");
+}
+
+global $langs, $user;
+
+// Libraries
+require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
+require_once '../lib/nav.lib.php';
+//require_once "../class/myclass.class.php";
+
+// Translations
+$langs->loadLangs(array("admin", "nav@nav"));
+
+// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
+$hookmanager->initHooks(array('navsetup', 'globalsetup'));
+
+// Access control
+if (!$user->admin) {
+	accessforbidden();
+}
+
+// Parameters
+$action = GETPOST('action', 'aZ09');
+$backtopage = GETPOST('backtopage', 'alpha');
+$modulepart = GETPOST('modulepart', 'aZ09');	// Used by actions_setmoduleoptions.inc.php
+
+$value = GETPOST('value', 'alpha');
+$label = GETPOST('label', 'alpha');
+$scandir = GETPOST('scan_dir', 'alpha');
+$type = 'myobject';
+
+
+$error = 0;
+$setupnotempty = 0;
+
+// Set this to 1 to use the factory to manage constants. Warning, the generated module will be compatible with version v15+ only
+$useFormSetup = 1;
+
+if (!class_exists('FormSetup')) {
+	// For retrocompatibility Dolibarr < 16.0
+	if (floatval(DOL_VERSION) < 16.0 && !class_exists('FormSetup')) {
+		require_once __DIR__.'/../backport/v16/core/class/html.formsetup.class.php';
+	} else {
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formsetup.class.php';
+	}
+}
+
+$formSetup = new FormSetup($db);
+
+
+// Hôte
+$item = $formSetup->newItem('NO_PARAM_JUST_TEXT');
+$item->fieldOverride = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'];
+$item->cssClass = 'minwidth500';
+
+// Setup conf NAV_MYPARAM1 as a simple string input
+$item = $formSetup->newItem('NAV_MYPARAM1');
+$item->defaultFieldValue = 'default value';
+
+// Setup conf NAV_MYPARAM1 as a simple textarea input but we replace the text of field title
+$item = $formSetup->newItem('NAV_MYPARAM2');
+$item->nameText = $item->getNameText().' more html text ';
+
+// Setup conf NAV_MYPARAM3
+$item = $formSetup->newItem('NAV_MYPARAM3');
+$item->setAsThirdpartyType();
+
+// Setup conf NAV_MYPARAM4 : exemple of quick define write style
+$formSetup->newItem('NAV_MYPARAM4')->setAsYesNo();
+
+// Setup conf NAV_MYPARAM5
+$formSetup->newItem('NAV_MYPARAM5')->setAsEmailTemplate('thirdparty');
+
+// Setup conf NAV_MYPARAM6
+$formSetup->newItem('NAV_MYPARAM6')->setAsSecureKey()->enabled = 0; // disabled
+
+// Setup conf NAV_MYPARAM7
+$formSetup->newItem('NAV_MYPARAM7')->setAsProduct();
+
+$formSetup->newItem('Title')->setAsTitle();
+
+// Setup conf NAV_MYPARAM8
+$item = $formSetup->newItem('NAV_MYPARAM8');
+$TField = array(
+	'test01' => $langs->trans('test01'),
+	'test02' => $langs->trans('test02'),
+	'test03' => $langs->trans('test03'),
+	'test04' => $langs->trans('test04'),
+	'test05' => $langs->trans('test05'),
+	'test06' => $langs->trans('test06'),
+);
+$item->setAsMultiSelect($TField);
+$item->helpText = $langs->transnoentities('NAV_MYPARAM8');
+
+
+// Setup conf NAV_MYPARAM9
+$formSetup->newItem('NAV_MYPARAM9')->setAsSelect($TField);
+
+
+// Setup conf NAV_MYPARAM10
+$item = $formSetup->newItem('NAV_MYPARAM10');
+$item->setAsColor();
+$item->defaultFieldValue = '#FF0000';
+$item->nameText = $item->getNameText().' more html text ';
+$item->fieldInputOverride = '';
+$item->helpText = $langs->transnoentities('AnHelpMessage');
+//$item->fieldValue = '';
+//$item->fieldAttr = array() ; // fields attribute only for compatible fields like input text
+//$item->fieldOverride = false; // set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too
+//$item->fieldInputOverride = false; // set this var to override field input
+//$item->fieldOutputOverride = false; // set this var to override field output
+
+
+$setupnotempty =+ count($formSetup->items);
+
+
+$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
+
+
+/*
+ * Actions
+ */
+
+// For retrocompatibility Dolibarr < 15.0
+if ( versioncompare(explode('.', DOL_VERSION), array(15)) < 0 && $action == 'update' && !empty($user->admin)) {
+	$formSetup->saveConfFromPost();
+}
+
+include DOL_DOCUMENT_ROOT.'/core/actions_setmoduleoptions.inc.php';
+
+if ($action == 'updateMask') {
+	$maskconst = GETPOST('maskconst', 'alpha');
+	$maskvalue = GETPOST('maskvalue', 'alpha');
+
+	if ($maskconst) {
+		$res = dolibarr_set_const($db, $maskconst, $maskvalue, 'chaine', 0, '', $conf->entity);
+		if (!($res > 0)) {
+			$error++;
+		}
+	}
+
+	if (!$error) {
+		setEventMessages($langs->trans("SetupSaved"), null, 'mesgs');
+	} else {
+		setEventMessages($langs->trans("Error"), null, 'errors');
+	}
+} elseif ($action == 'specimen') {
+	$modele = GETPOST('module', 'alpha');
+	$tmpobjectkey = GETPOST('object');
+
+	$tmpobject = new $tmpobjectkey($db);
+	$tmpobject->initAsSpecimen();
+
+	// Search template files
+	$file = ''; $classname = ''; $filefound = 0;
+	$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
+	foreach ($dirmodels as $reldir) {
+		$file = dol_buildpath($reldir."core/modules/nav/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
+		if (file_exists($file)) {
+			$filefound = 1;
+			$classname = "pdf_".$modele."_".strtolower($tmpobjectkey);
+			break;
+		}
+	}
+
+	if ($filefound) {
+		require_once $file;
+
+		$module = new $classname($db);
+
+		if ($module->write_file($tmpobject, $langs) > 0) {
+			header("Location: ".DOL_URL_ROOT."/document.php?modulepart=nav-".strtolower($tmpobjectkey)."&file=SPECIMEN.pdf");
+			return;
+		} else {
+			setEventMessages($module->error, null, 'errors');
+			dol_syslog($module->error, LOG_ERR);
+		}
+	} else {
+		setEventMessages($langs->trans("ErrorModuleNotFound"), null, 'errors');
+		dol_syslog($langs->trans("ErrorModuleNotFound"), LOG_ERR);
+	}
+} elseif ($action == 'setmod') {
+	// TODO Check if numbering module chosen can be activated by calling method canBeActivated
+	$tmpobjectkey = GETPOST('object');
+	if (!empty($tmpobjectkey)) {
+		$constforval = 'NAV_'.strtoupper($tmpobjectkey)."_ADDON";
+		dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity);
+	}
+} elseif ($action == 'set') {
+	// Activate a model
+	$ret = addDocumentModel($value, $type, $label, $scandir);
+} elseif ($action == 'del') {
+	$ret = delDocumentModel($value, $type);
+	if ($ret > 0) {
+		$tmpobjectkey = GETPOST('object');
+		if (!empty($tmpobjectkey)) {
+			$constforval = 'NAV_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
+			if ($conf->global->$constforval == "$value") {
+				dolibarr_del_const($db, $constforval, $conf->entity);
+			}
+		}
+	}
+} elseif ($action == 'setdoc') {
+	// Set or unset default model
+	$tmpobjectkey = GETPOST('object');
+	if (!empty($tmpobjectkey)) {
+		$constforval = 'NAV_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
+		if (dolibarr_set_const($db, $constforval, $value, 'chaine', 0, '', $conf->entity)) {
+			// The constant that was read before the new set
+			// We therefore requires a variable to have a coherent view
+			$conf->global->$constforval = $value;
+		}
+
+		// We disable/enable the document template (into llx_document_model table)
+		$ret = delDocumentModel($value, $type);
+		if ($ret > 0) {
+			$ret = addDocumentModel($value, $type, $label, $scandir);
+		}
+	}
+} elseif ($action == 'unsetdoc') {
+	$tmpobjectkey = GETPOST('object');
+	if (!empty($tmpobjectkey)) {
+		$constforval = 'NAV_'.strtoupper($tmpobjectkey).'_ADDON_PDF';
+		dolibarr_del_const($db, $constforval, $conf->entity);
+	}
+}
+
+
+
+/*
+ * View
+ */
+
+$form = new Form($db);
+
+$help_url = '';
+$page_name = "NavSetup";
+
+llxHeader('', $langs->trans($page_name), $help_url);
+
+// Subheader
+$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
+
+print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
+
+// Configuration header
+$head = navAdminPrepareHead();
+print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "nav@nav");
+
+// Setup page goes here
+echo '<span class="opacitymedium">'.$langs->trans("NavSetupPage").'</span><br><br>';
+
+
+if ($action == 'edit') {
+	print $formSetup->generateOutput(true);
+	print '<br>';
+} elseif (!empty($formSetup->items)) {
+	print $formSetup->generateOutput();
+	print '<div class="tabsAction">';
+	print '<a class="butAction" href="'.$_SERVER["PHP_SELF"].'?action=edit&token='.newToken().'">'.$langs->trans("Modify").'</a>';
+	print '</div>';
+} else {
+	print '<br>'.$langs->trans("NothingToSetup");
+}
+
+
+$moduledir = 'nav';
+$myTmpObjects = array();
+$myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
+
+
+foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
+	if ($myTmpObjectKey == 'MyObject') {
+		continue;
+	}
+	if ($myTmpObjectArray['includerefgeneration']) {
+		/*
+		 * Orders Numbering model
+		 */
+		$setupnotempty++;
+
+		print load_fiche_titre($langs->trans("NumberingModules", $myTmpObjectKey), '', '');
+
+		print '<table class="noborder centpercent">';
+		print '<tr class="liste_titre">';
+		print '<td>'.$langs->trans("Name").'</td>';
+		print '<td>'.$langs->trans("Description").'</td>';
+		print '<td class="nowrap">'.$langs->trans("Example").'</td>';
+		print '<td class="center" width="60">'.$langs->trans("Status").'</td>';
+		print '<td class="center" width="16">'.$langs->trans("ShortInfo").'</td>';
+		print '</tr>'."\n";
+
+		clearstatcache();
+
+		foreach ($dirmodels as $reldir) {
+			$dir = dol_buildpath($reldir."core/modules/".$moduledir);
+
+			if (is_dir($dir)) {
+				$handle = opendir($dir);
+				if (is_resource($handle)) {
+					while (($file = readdir($handle)) !== false) {
+						if (strpos($file, 'mod_'.strtolower($myTmpObjectKey).'_') === 0 && substr($file, dol_strlen($file) - 3, 3) == 'php') {
+							$file = substr($file, 0, dol_strlen($file) - 4);
+
+							require_once $dir.'/'.$file.'.php';
+
+							$module = new $file($db);
+
+							// Show modules according to features level
+							if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
+								continue;
+							}
+							if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
+								continue;
+							}
+
+							if ($module->isEnabled()) {
+								dol_include_once('/'.$moduledir.'/class/'.strtolower($myTmpObjectKey).'.class.php');
+
+								print '<tr class="oddeven"><td>'.$module->name."</td><td>\n";
+								print $module->info();
+								print '</td>';
+
+								// Show example of numbering model
+								print '<td class="nowrap">';
+								$tmp = $module->getExample();
+								if (preg_match('/^Error/', $tmp)) {
+									$langs->load("errors");
+									print '<div class="error">'.$langs->trans($tmp).'</div>';
+								} elseif ($tmp == 'NotConfigured') {
+									print $langs->trans($tmp);
+								} else {
+									print $tmp;
+								}
+								print '</td>'."\n";
+
+								print '<td class="center">';
+								$constforvar = 'NAV_'.strtoupper($myTmpObjectKey).'_ADDON';
+								if (getDolGlobalString($constforvar) == $file) {
+									print img_picto($langs->trans("Activated"), 'switch_on');
+								} else {
+									print '<a href="'.$_SERVER["PHP_SELF"].'?action=setmod&token='.newToken().'&object='.strtolower($myTmpObjectKey).'&value='.urlencode($file).'">';
+									print img_picto($langs->trans("Disabled"), 'switch_off');
+									print '</a>';
+								}
+								print '</td>';
+
+								$mytmpinstance = new $myTmpObjectKey($db);
+								$mytmpinstance->initAsSpecimen();
+
+								// Info
+								$htmltooltip = '';
+								$htmltooltip .= ''.$langs->trans("Version").': <b>'.$module->getVersion().'</b><br>';
+
+								$nextval = $module->getNextValue($mytmpinstance);
+								if ("$nextval" != $langs->trans("NotAvailable")) {  // Keep " on nextval
+									$htmltooltip .= ''.$langs->trans("NextValue").': ';
+									if ($nextval) {
+										if (preg_match('/^Error/', $nextval) || $nextval == 'NotConfigured') {
+											$nextval = $langs->trans($nextval);
+										}
+										$htmltooltip .= $nextval.'<br>';
+									} else {
+										$htmltooltip .= $langs->trans($module->error).'<br>';
+									}
+								}
+
+								print '<td class="center">';
+								print $form->textwithpicto('', $htmltooltip, 1, 0);
+								print '</td>';
+
+								print "</tr>\n";
+							}
+						}
+					}
+					closedir($handle);
+				}
+			}
+		}
+		print "</table><br>\n";
+	}
+
+	if ($myTmpObjectArray['includedocgeneration']) {
+		/*
+		 * Document templates generators
+		 */
+		$setupnotempty++;
+		$type = strtolower($myTmpObjectKey);
+
+		print load_fiche_titre($langs->trans("DocumentModules", $myTmpObjectKey), '', '');
+
+		// Load array def with activated templates
+		$def = array();
+		$sql = "SELECT nom";
+		$sql .= " FROM ".MAIN_DB_PREFIX."document_model";
+		$sql .= " WHERE type = '".$db->escape($type)."'";
+		$sql .= " AND entity = ".$conf->entity;
+		$resql = $db->query($sql);
+		if ($resql) {
+			$i = 0;
+			$num_rows = $db->num_rows($resql);
+			while ($i < $num_rows) {
+				$array = $db->fetch_array($resql);
+				array_push($def, $array[0]);
+				$i++;
+			}
+		} else {
+			dol_print_error($db);
+		}
+
+		print "<table class=\"noborder\" width=\"100%\">\n";
+		print "<tr class=\"liste_titre\">\n";
+		print '<td>'.$langs->trans("Name").'</td>';
+		print '<td>'.$langs->trans("Description").'</td>';
+		print '<td class="center" width="60">'.$langs->trans("Status")."</td>\n";
+		print '<td class="center" width="60">'.$langs->trans("Default")."</td>\n";
+		print '<td class="center" width="38">'.$langs->trans("ShortInfo").'</td>';
+		print '<td class="center" width="38">'.$langs->trans("Preview").'</td>';
+		print "</tr>\n";
+
+		clearstatcache();
+
+		foreach ($dirmodels as $reldir) {
+			foreach (array('', '/doc') as $valdir) {
+				$realpath = $reldir."core/modules/".$moduledir.$valdir;
+				$dir = dol_buildpath($realpath);
+
+				if (is_dir($dir)) {
+					$handle = opendir($dir);
+					if (is_resource($handle)) {
+						while (($file = readdir($handle)) !== false) {
+							$filelist[] = $file;
+						}
+						closedir($handle);
+						arsort($filelist);
+
+						foreach ($filelist as $file) {
+							if (preg_match('/\.modules\.php$/i', $file) && preg_match('/^(pdf_|doc_)/', $file)) {
+								if (file_exists($dir.'/'.$file)) {
+									$name = substr($file, 4, dol_strlen($file) - 16);
+									$classname = substr($file, 0, dol_strlen($file) - 12);
+
+									require_once $dir.'/'.$file;
+									$module = new $classname($db);
+
+									$modulequalified = 1;
+									if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) {
+										$modulequalified = 0;
+									}
+									if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) {
+										$modulequalified = 0;
+									}
+
+									if ($modulequalified) {
+										print '<tr class="oddeven"><td width="100">';
+										print (empty($module->name) ? $name : $module->name);
+										print "</td><td>\n";
+										if (method_exists($module, 'info')) {
+											print $module->info($langs);
+										} else {
+											print $module->description;
+										}
+										print '</td>';
+
+										// Active
+										if (in_array($name, $def)) {
+											print '<td class="center">'."\n";
+											print '<a href="'.$_SERVER["PHP_SELF"].'?action=del&token='.newToken().'&value='.urlencode($name).'">';
+											print img_picto($langs->trans("Enabled"), 'switch_on');
+											print '</a>';
+											print '</td>';
+										} else {
+											print '<td class="center">'."\n";
+											print '<a href="'.$_SERVER["PHP_SELF"].'?action=set&token='.newToken().'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'">'.img_picto($langs->trans("Disabled"), 'switch_off').'</a>';
+											print "</td>";
+										}
+
+										// Default
+										print '<td class="center">';
+										$constforvar = 'NAV_'.strtoupper($myTmpObjectKey).'_ADDON';
+										if (getDolGlobalString($constforvar) == $name) {
+											//print img_picto($langs->trans("Default"), 'on');
+											// Even if choice is the default value, we allow to disable it. Replace this with previous line if you need to disable unset
+											print '<a href="'.$_SERVER["PHP_SELF"].'?action=unsetdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'&amp;type='.urlencode($type).'" alt="'.$langs->trans("Disable").'">'.img_picto($langs->trans("Enabled"), 'on').'</a>';
+										} else {
+											print '<a href="'.$_SERVER["PHP_SELF"].'?action=setdoc&token='.newToken().'&object='.urlencode(strtolower($myTmpObjectKey)).'&value='.urlencode($name).'&scan_dir='.urlencode($module->scandir).'&label='.urlencode($module->name).'" alt="'.$langs->trans("Default").'">'.img_picto($langs->trans("Disabled"), 'off').'</a>';
+										}
+										print '</td>';
+
+										// Info
+										$htmltooltip = ''.$langs->trans("Name").': '.$module->name;
+										$htmltooltip .= '<br>'.$langs->trans("Type").': '.($module->type ? $module->type : $langs->trans("Unknown"));
+										if ($module->type == 'pdf') {
+											$htmltooltip .= '<br>'.$langs->trans("Width").'/'.$langs->trans("Height").': '.$module->page_largeur.'/'.$module->page_hauteur;
+										}
+										$htmltooltip .= '<br>'.$langs->trans("Path").': '.preg_replace('/^\//', '', $realpath).'/'.$file;
+
+										$htmltooltip .= '<br><br><u>'.$langs->trans("FeaturesSupported").':</u>';
+										$htmltooltip .= '<br>'.$langs->trans("Logo").': '.yn($module->option_logo, 1, 1);
+										$htmltooltip .= '<br>'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang, 1, 1);
+
+										print '<td class="center">';
+										print $form->textwithpicto('', $htmltooltip, 1, 0);
+										print '</td>';
+
+										// Preview
+										print '<td class="center">';
+										if ($module->type == 'pdf') {
+											$newname = preg_replace('/_'.preg_quote(strtolower($myTmpObjectKey), '/').'/', '', $name);
+											print '<a href="'.$_SERVER["PHP_SELF"].'?action=specimen&module='.urlencode($newname).'&object='.urlencode($myTmpObjectKey).'">'.img_object($langs->trans("Preview"), 'pdf').'</a>';
+										} else {
+											print img_object($langs->trans("PreviewNotAvailable"), 'generic');
+										}
+										print '</td>';
+
+										print "</tr>\n";
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+
+		print '</table>';
+	}
+}
+
+if (empty($setupnotempty)) {
+	print '<br>'.$langs->trans("NothingToSetup");
+}
+
+// Page end
+print dol_get_fiche_end();
+
+llxFooter();
+$db->close();

+ 1322 - 0
custom/nav/backport/v16/core/class/html.formsetup.class.php

@@ -0,0 +1,1322 @@
+<?php
+/* Copyright (C) 2021  John BOTELLA    <john.botella@atm-consulting.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+
+/**
+ * This class help you create setup render
+ */
+class FormSetup
+{
+
+	/**
+	 * @var DoliDB Database handler.
+	 */
+	public $db;
+
+	/** @var FormSetupItem[]  */
+	public $items = array();
+
+	/**
+	 * @var int
+	 */
+	public $setupNotEmpty = 0;
+
+	/** @var Translate */
+	public $langs;
+
+	/** @var Form */
+	public $form;
+
+	/** @var int */
+	protected $maxItemRank;
+
+	/**
+	 * this is an html string display before output form
+	 * @var string
+	 */
+	public $htmlBeforeOutputForm = '';
+
+	/**
+	 * this is an html string display after output form
+	 * @var string
+	 */
+	public $htmlAfterOutputForm = '';
+
+	/**
+	 * this is an html string display on buttons zone
+	 * @var string
+	 */
+	public $htmlOutputMoreButton = '';
+
+
+	/**
+	 *
+	 * @var array
+	 */
+	public $formAttributes = array(
+		'action' => '', // set in __construct
+		'method' => 'POST'
+	);
+
+	/**
+	 * an list of hidden inputs used only in edit mode
+	 * @var array
+	 */
+	public $formHiddenInputs = array();
+
+
+	/**
+	 * Constructor
+	 *
+	 * @param DoliDB $db Database handler
+	 * @param Translate $outputLangs if needed can use another lang
+	 */
+	public function __construct($db, $outputLangs = false)
+	{
+		global $langs;
+		$this->db = $db;
+		$this->form = new Form($this->db);
+		$this->formAttributes['action'] = $_SERVER["PHP_SELF"];
+
+		$this->formHiddenInputs['token'] = newToken();
+		$this->formHiddenInputs['action'] = 'update';
+
+
+		if ($outputLangs) {
+			$this->langs = $outputLangs;
+		} else {
+			$this->langs = $langs;
+		}
+	}
+
+	/**
+	 * Generate an attributes string form an input array
+	 *
+	 * @param 	array 	$attributes 	an array of attributes keys and values,
+	 * @return 	string					attribute string
+	 */
+	static public function generateAttributesStringFromArray($attributes)
+	{
+		$Aattr = array();
+		if (is_array($attributes)) {
+			foreach ($attributes as $attribute => $value) {
+				if (is_array($value) || is_object($value)) {
+					continue;
+				}
+				$Aattr[] = $attribute.'="'.dol_escape_htmltag($value).'"';
+			}
+		}
+
+		return !empty($Aattr)?implode(' ', $Aattr):'';
+	}
+
+
+	/**
+	 * generateOutput
+	 *
+	 * @param 	bool 	$editMode 	true will display output on edit mod
+	 * @return 	string				html output
+	 */
+	public function generateOutput($editMode = false)
+	{
+		global $hookmanager, $action, $langs;
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
+
+		$parameters = array(
+			'editMode' => $editMode
+		);
+		$reshook = $hookmanager->executeHooks('formSetupBeforeGenerateOutput', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+		if ($reshook < 0) {
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+		}
+
+		if ($reshook > 0) {
+			return $hookmanager->resPrint;
+		} else {
+			$out = '<!-- Start generateOutput from FormSetup class  -->';
+			$out.= $this->htmlBeforeOutputForm;
+
+			if ($editMode) {
+				$out.= '<form ' . self::generateAttributesStringFromArray($this->formAttributes) . ' >';
+
+				// generate hidden values from $this->formHiddenInputs
+				if (!empty($this->formHiddenInputs) && is_array($this->formHiddenInputs)) {
+					foreach ($this->formHiddenInputs as $hiddenKey => $hiddenValue) {
+						$out.= '<input type="hidden" name="'.dol_escape_htmltag($hiddenKey).'" value="' . dol_escape_htmltag($hiddenValue) . '">';
+					}
+				}
+			}
+
+			// generate output table
+			$out .= $this->generateTableOutput($editMode);
+
+
+			$reshook = $hookmanager->executeHooks('formSetupBeforeGenerateOutputButton', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+			if ($reshook < 0) {
+				setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+			}
+
+			if ($reshook > 0) {
+				return $hookmanager->resPrint;
+			} elseif ($editMode) {
+				$out .= '<br>'; // Todo : remove this <br/> by adding style to form-setup-button-container css class in all themes
+				$out .= '<div class="form-setup-button-container center">'; // Todo : remove .center by adding style to form-setup-button-container css class in all themes
+				$out.= $this->htmlOutputMoreButton;
+				$out .= '<input class="button button-save" type="submit" value="' . $this->langs->trans("Save") . '">'; // Todo fix dolibarr style for <button and use <button instead of input
+				$out .= ' &nbsp;&nbsp; ';
+				$out .= '<a class="button button-cancel" type="submit" href="' . $this->formAttributes['action'] . '">'.$langs->trans('Cancel').'</a>';
+				$out .= '</div>';
+			}
+
+			if ($editMode) {
+				$out .= '</form>';
+			}
+
+			$out.= $this->htmlAfterOutputForm;
+
+			return $out;
+		}
+	}
+
+	/**
+	 * generateTableOutput
+	 *
+	 * @param 	bool 	$editMode 	true will display output on edit mod
+	 * @return 	string				html output
+	 */
+	public function generateTableOutput($editMode = false)
+	{
+		global $hookmanager, $action;
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.form.class.php';
+
+		$parameters = array(
+			'editMode' => $editMode
+		);
+		$reshook = $hookmanager->executeHooks('formSetupBeforeGenerateTableOutput', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+		if ($reshook < 0) {
+			setEventMessages($hookmanager->error, $hookmanager->errors, 'errors');
+		}
+
+		if ($reshook > 0) {
+			return $hookmanager->resPrint;
+		} else {
+			$out = '<table class="noborder centpercent">';
+			$out .= '<thead>';
+			$out .= '<tr class="liste_titre">';
+			$out .= '	<td>' . $this->langs->trans("Parameter") . '</td>';
+			$out .= '	<td>' . $this->langs->trans("Value") . '</td>';
+			$out .= '</tr>';
+			$out .= '</thead>';
+
+			// Sort items before render
+			$this->sortingItems();
+
+			$out .= '<tbody>';
+			foreach ($this->items as $item) {
+				$out .= $this->generateLineOutput($item, $editMode);
+			}
+			$out .= '</tbody>';
+
+			$out .= '</table>';
+			return $out;
+		}
+	}
+
+	/**
+	 * saveConfFromPost
+	 *
+	 * @param 	bool 		$noMessageInUpdate display event message on errors and success
+	 * @return	 int        -1 if KO, 1 if OK
+	 */
+	public function saveConfFromPost($noMessageInUpdate = false)
+	{
+		global $hookmanager;
+
+		$parameters = array();
+		$reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfFromPost', $parameters, $this); // Note that $action and $object may have been modified by some hooks
+		if ($reshook < 0) {
+			$this->setErrors($hookmanager->errors);
+			return -1;
+		}
+
+		if ($reshook > 0) {
+			return $reshook;
+		}
+
+
+		if (empty($this->items)) {
+			return null;
+		}
+
+		$this->db->begin();
+		$error = 0;
+		foreach ($this->items as $item) {
+			$res = $item->setValueFromPost();
+			if ($res > 0) {
+				$item->saveConfValue();
+			} elseif ($res < 0) {
+				$error++;
+				break;
+			}
+		}
+
+		if (!$error) {
+			$this->db->commit();
+			if (empty($noMessageInUpdate)) {
+				setEventMessages($this->langs->trans("SetupSaved"), null);
+			}
+			return 1;
+		} else {
+			$this->db->rollback();
+			if (empty($noMessageInUpdate)) {
+				setEventMessages($this->langs->trans("SetupNotSaved"), null, 'errors');
+			}
+			return -1;
+		}
+	}
+
+	/**
+	 * generateLineOutput
+	 *
+	 * @param 	FormSetupItem 	$item 		the setup item
+	 * @param 	bool 			$editMode 	Display as edit mod
+	 * @return 	string 						the html output for an setup item
+	 */
+	public function generateLineOutput($item, $editMode = false)
+	{
+
+		$out = '';
+		if ($item->enabled==1) {
+			$trClass = 'oddeven';
+			if ($item->getType() == 'title') {
+				$trClass = 'liste_titre';
+			}
+
+			$this->setupNotEmpty++;
+			$out.= '<tr class="'.$trClass.'">';
+
+			$out.= '<td class="col-setup-title">';
+			$out.= '<span id="helplink'.$item->confKey.'" class="spanforparamtooltip">';
+			$out.= $this->form->textwithpicto($item->getNameText(), $item->getHelpText(), 1, 'info', '', 0, 3, 'tootips'.$item->confKey);
+			$out.= '</span>';
+			$out.= '</td>';
+
+			$out.= '<td>';
+
+			if ($editMode) {
+				$out.= $item->generateInputField();
+			} else {
+				$out.= $item->generateOutputField();
+			}
+
+			if (!empty($item->errors)) {
+				// TODO : move set event message in a methode to be called by cards not by this class
+				setEventMessages(null, $item->errors, 'errors');
+			}
+
+			$out.= '</td>';
+			$out.= '</tr>';
+		}
+
+		return $out;
+	}
+
+
+	/**
+	 * Method used to test  module builder convertion to this form usage
+	 *
+	 * @param array 	$params 	an array of arrays of params from old modulBuilder params
+	 * @return null
+	 */
+	public function addItemsFromParamsArray($params)
+	{
+		if (!is_array($params) || empty($params)) { return false; }
+		foreach ($params as $confKey => $param) {
+			$this->addItemFromParams($confKey, $param); // todo manage error
+		}
+	}
+
+
+	/**
+	 * From old
+	 * Method was used to test  module builder convertion to this form usage.
+	 *
+	 * @param 	string 	$confKey 	the conf name to store
+	 * @param 	array 	$params 	an array of params from old modulBuilder params
+	 * @return 	bool
+	 */
+	public function addItemFromParams($confKey, $params)
+	{
+		if (empty($confKey) || empty($params['type'])) { return false; }
+
+		/*
+		 * Exemple from old module builder setup page
+		 * 	// 'NAV_MYPARAM1'=>array('type'=>'string', 'css'=>'minwidth500' ,'enabled'=>1),
+			// 'NAV_MYPARAM2'=>array('type'=>'textarea','enabled'=>1),
+			//'NAV_MYPARAM3'=>array('type'=>'category:'.Categorie::TYPE_CUSTOMER, 'enabled'=>1),
+			//'NAV_MYPARAM4'=>array('type'=>'emailtemplate:thirdparty', 'enabled'=>1),
+			//'NAV_MYPARAM5'=>array('type'=>'yesno', 'enabled'=>1),
+			//'NAV_MYPARAM5'=>array('type'=>'thirdparty_type', 'enabled'=>1),
+			//'NAV_MYPARAM6'=>array('type'=>'securekey', 'enabled'=>1),
+			//'NAV_MYPARAM7'=>array('type'=>'product', 'enabled'=>1),
+		 */
+
+		$item = new FormSetupItem($confKey);
+		// need to be ignored from scrutinizer setTypeFromTypeString was created as deprecated to incite developper to use object oriented usage
+		/** @scrutinizer ignore-deprecated */ $item->setTypeFromTypeString($params['type']);
+
+		if (!empty($params['enabled'])) {
+			$item->enabled = $params['enabled'];
+		}
+
+		if (!empty($params['css'])) {
+			$item->cssClass = $params['css'];
+		}
+
+		$this->items[$item->confKey] = $item;
+
+		return true;
+	}
+
+	/**
+	 * Used to export param array for /core/actions_setmoduleoptions.inc.php template
+	 * Method exists only for manage setup convertion
+	 *
+	 * @return array $arrayofparameters for /core/actions_setmoduleoptions.inc.php
+	 */
+	public function exportItemsAsParamsArray()
+	{
+		$arrayofparameters = array();
+		foreach ($this->items as $item) {
+			$arrayofparameters[$item->confKey] = array(
+				'type' => $item->getType(),
+				'enabled' => $item->enabled
+			);
+		}
+
+		return $arrayofparameters;
+	}
+
+	/**
+	 * Reload for each item default conf
+	 * note: this will override custom configuration
+	 *
+	 * @return bool
+	 */
+	public function reloadConfs()
+	{
+
+		if (!array($this->items)) { return false; }
+		foreach ($this->items as $item) {
+			$item->loadValueFromConf();
+		}
+
+		return true;
+	}
+
+
+	/**
+	 * Create a new item
+	 * the tagret is useful with hooks : that allow externals modules to add setup items on good place
+	 *
+	 * @param string	$confKey 				the conf key used in database
+	 * @param string	$targetItemKey    		target item used to place the new item beside
+	 * @param bool		$insertAfterTarget		insert before or after target item ?
+	 * @return FormSetupItem the new setup item created
+	 */
+	public function newItem($confKey, $targetItemKey = false, $insertAfterTarget = false)
+	{
+		$item = new FormSetupItem($confKey);
+
+		// set item rank if not defined as last item
+		if (empty($item->rank)) {
+			$item->rank = $this->getCurentItemMaxRank() + 1;
+			$this->setItemMaxRank($item->rank); // set new max rank if needed
+		}
+
+		// try to get rank from target column, this will override item->rank
+		if (!empty($targetItemKey)) {
+			if (isset($this->items[$targetItemKey])) {
+				$targetItem = $this->items[$targetItemKey];
+				$item->rank = $targetItem->rank; // $targetItem->rank will be increase after
+				if ($targetItem->rank >= 0 && $insertAfterTarget) {
+					$item->rank++;
+				}
+			}
+
+			// calc new rank for each item to make place for new item
+			foreach ($this->items as $fItem) {
+				if ($item->rank <= $fItem->rank) {
+					$fItem->rank = $fItem->rank + 1;
+					$this->setItemMaxRank($fItem->rank); // set new max rank if needed
+				}
+			}
+		}
+
+		$this->items[$item->confKey] = $item;
+		return $this->items[$item->confKey];
+	}
+
+	/**
+	 * Sort items according to rank
+	 *
+	 * @return bool
+	 */
+	public function sortingItems()
+	{
+		// Sorting
+		return uasort($this->items, array($this, 'itemSort'));
+	}
+
+	/**
+	 * getCurentItemMaxRank
+	 *
+	 * @param bool $cache To use cache or not
+	 * @return int
+	 */
+	public function getCurentItemMaxRank($cache = true)
+	{
+		if (empty($this->items)) {
+			return 0;
+		}
+
+		if ($cache && $this->maxItemRank > 0) {
+			return $this->maxItemRank;
+		}
+
+		$this->maxItemRank = 0;
+		foreach ($this->items as $item) {
+			$this->maxItemRank = max($this->maxItemRank, $item->rank);
+		}
+
+		return $this->maxItemRank;
+	}
+
+
+	/**
+	 * set new max rank if needed
+	 *
+	 * @param 	int 		$rank 	the item rank
+	 * @return 	int|void			new max rank
+	 */
+	public function setItemMaxRank($rank)
+	{
+		$this->maxItemRank = max($this->maxItemRank, $rank);
+	}
+
+
+	/**
+	 * get item position rank from item key
+	 *
+	 * @param	string		$itemKey    	the item key
+	 * @return	int         				rank on success and -1 on error
+	 */
+	public function getLineRank($itemKey)
+	{
+		if (!isset($this->items[$itemKey]->rank)) {
+			return -1;
+		}
+		return  $this->items[$itemKey]->rank;
+	}
+
+
+	/**
+	 *  uasort callback function to Sort params items
+	 *
+	 *  @param	FormSetupItem	$a  formSetup item
+	 *  @param	FormSetupItem	$b  formSetup item
+	 *  @return	int					Return compare result
+	 */
+	public function itemSort(FormSetupItem $a, FormSetupItem $b)
+	{
+		if (empty($a->rank)) {
+			$a->rank = 0;
+		}
+		if (empty($b->rank)) {
+			$b->rank = 0;
+		}
+		if ($a->rank == $b->rank) {
+			return 0;
+		}
+		return ($a->rank < $b->rank) ? -1 : 1;
+	}
+}
+
+/**
+ * This class help to create item for class formSetup
+ */
+class FormSetupItem
+{
+	/**
+	 * @var DoliDB Database handler.
+	 */
+	public $db;
+
+	/** @var Translate */
+	public $langs;
+
+	/** @var int */
+	public $entity;
+
+	/** @var Form */
+	public $form;
+
+	/** @var string $confKey the conf key used in database */
+	public $confKey;
+
+	/** @var string|false $nameText  */
+	public $nameText = false;
+
+	/** @var string $helpText  */
+	public $helpText = '';
+
+	/** @var string $fieldValue  */
+	public $fieldValue;
+
+	/** @var string $defaultFieldValue  */
+	public $defaultFieldValue = null;
+
+	/** @var array $fieldAttr  fields attribute only for compatible fields like input text */
+	public $fieldAttr = array();
+
+	/** @var bool|string set this var to override field output will override $fieldInputOverride and $fieldOutputOverride too */
+	public $fieldOverride = false;
+
+	/** @var bool|string set this var to override field input */
+	public $fieldInputOverride = false;
+
+	/** @var bool|string set this var to override field output */
+	public $fieldOutputOverride = false;
+
+	/** @var int $rank  */
+	public $rank = 0;
+
+	/** @var array set this var for options on select and multiselect items   */
+	public $fieldOptions = array();
+
+	/** @var callable $saveCallBack  */
+	public $saveCallBack;
+
+	/** @var callable $setValueFromPostCallBack  */
+	public $setValueFromPostCallBack;
+
+	/**
+	 * @var string $errors
+	 */
+	public $errors = array();
+
+	/**
+	 * TODO each type must have setAs{type} method to help configuration
+	 *   And set var as protected when its done configuration must be done by method
+	 *   this is important for retrocompatibility of futures versions
+	 * @var string $type  'string', 'textarea', 'category:'.Categorie::TYPE_CUSTOMER', 'emailtemplate', 'thirdparty_type'
+	 */
+	protected $type = 'string';
+
+	public $enabled = 1;
+
+	public $cssClass = '';
+
+	/**
+	 * Constructor
+	 *
+	 * @param string $confKey the conf key used in database
+	 */
+	public function __construct($confKey)
+	{
+		global $langs, $db, $conf, $form;
+		$this->db = $db;
+
+		if (!empty($form) && is_object($form) && get_class($form) == 'Form') { // the form class has a cache inside so I am using it to optimize
+			$this->form = $form;
+		} else {
+			$this->form = new Form($this->db);
+		}
+
+		$this->langs = $langs;
+		$this->entity = $conf->entity;
+
+		$this->confKey = $confKey;
+		$this->loadValueFromConf();
+	}
+
+	/**
+	 * load conf value from databases
+	 * @return bool
+	 */
+	public function loadValueFromConf()
+	{
+		global $conf;
+		if (isset($conf->global->{$this->confKey})) {
+			$this->fieldValue = $conf->global->{$this->confKey};
+			return true;
+		} else {
+			$this->fieldValue = null;
+			return false;
+		}
+	}
+
+	/**
+	 * reload conf value from databases is an aliase of loadValueFromConf
+	 * @deprecated
+	 * @return bool
+	 */
+	public function reloadValueFromConf()
+	{
+		return $this->loadValueFromConf();
+	}
+
+
+	/**
+	 * Save const value based on htdocs/core/actions_setmoduleoptions.inc.php
+	 *	@return     int         			-1 if KO, 1 if OK
+	 */
+	public function saveConfValue()
+	{
+		global $hookmanager;
+
+		$parameters = array();
+		$reshook = $hookmanager->executeHooks('formSetupBeforeSaveConfValue', $parameters, $this); // Note that $action and $object may have been modified by some hooks
+		if ($reshook < 0) {
+			$this->setErrors($hookmanager->errors);
+			return -1;
+		}
+
+		if ($reshook > 0) {
+			return $reshook;
+		}
+
+
+		if (!empty($this->saveCallBack) && is_callable($this->saveCallBack)) {
+			return call_user_func($this->saveCallBack, $this);
+		}
+
+		// Modify constant only if key was posted (avoid resetting key to the null value)
+		if ($this->type != 'title') {
+			$result = dolibarr_set_const($this->db, $this->confKey, $this->fieldValue, 'chaine', 0, '', $this->entity);
+			if ($result < 0) {
+				return -1;
+			} else {
+				return 1;
+			}
+		}
+	}
+
+	/**
+	 * Set an override function for saving data
+	 * @param callable $callBack a callable function
+	 * @return void
+	 */
+	public function setSaveCallBack(callable $callBack)
+	{
+		$this->saveCallBack = $callBack;
+	}
+
+	/**
+	 * Set an override function for get data from post
+	 * @param callable $callBack a callable function
+	 * @return void
+	 */
+	public function setValueFromPostCallBack(callable $callBack)
+	{
+		$this->setValueFromPostCallBack = $callBack;
+	}
+
+	/**
+	 * Save const value based on htdocs/core/actions_setmoduleoptions.inc.php
+	 *	@return     int         			-1 if KO, 0  nothing to do , 1 if OK
+	 */
+	public function setValueFromPost()
+	{
+		if (!empty($this->setValueFromPostCallBack) && is_callable($this->setValueFromPostCallBack)) {
+			return call_user_func($this->setValueFromPostCallBack);
+		}
+
+		// Modify constant only if key was posted (avoid resetting key to the null value)
+		if ($this->type != 'title') {
+			if (preg_match('/category:/', $this->type)) {
+				if (GETPOST($this->confKey, 'int') == '-1') {
+					$val_const = '';
+				} else {
+					$val_const = GETPOST($this->confKey, 'int');
+				}
+			} elseif ($this->type == 'multiselect') {
+				$val = GETPOST($this->confKey, 'array');
+				if ($val && is_array($val)) {
+					$val_const = implode(',', $val);
+				}
+			} elseif ($this->type == 'html') {
+				$val_const = GETPOST($this->confKey, 'restricthtml');
+			} else {
+				$val_const = GETPOST($this->confKey, 'alpha');
+			}
+
+			// TODO add value check with class validate
+			$this->fieldValue = $val_const;
+
+			return 1;
+		}
+
+		return 0;
+	}
+
+	/**
+	 * Get help text or generate it
+	 * @return int|string
+	 */
+	public function getHelpText()
+	{
+		if (!empty($this->helpText)) { return $this->helpText; }
+		return (($this->langs->trans($this->confKey . 'Tooltip') != $this->confKey . 'Tooltip') ? $this->langs->trans($this->confKey . 'Tooltip') : '');
+	}
+
+	/**
+	 * Get field name text or generate it
+	 * @return false|int|string
+	 */
+	public function getNameText()
+	{
+		if (!empty($this->nameText)) { return $this->nameText; }
+		return (($this->langs->trans($this->confKey) != $this->confKey) ? $this->langs->trans($this->confKey) : $this->langs->trans('MissingTranslationForConfKey', $this->confKey));
+	}
+
+	/**
+	 * generate input field
+	 * @return bool|string
+	 */
+	public function generateInputField()
+	{
+		global $conf;
+
+		if (!empty($this->fieldOverride)) {
+			return $this->fieldOverride;
+		}
+
+		if (!empty($this->fieldInputOverride)) {
+			return $this->fieldInputOverride;
+		}
+
+		// Set default value
+		if (is_null($this->fieldValue)) {
+			$this->fieldValue = $this->defaultFieldValue;
+		}
+
+
+		$this->fieldAttr['name'] = $this->confKey;
+		$this->fieldAttr['id'] = 'setup-'.$this->confKey;
+		$this->fieldAttr['value'] = $this->fieldValue;
+
+		$out = '';
+
+		if ($this->type == 'title') {
+			$out.= $this->generateOutputField(); // title have no input
+		} elseif ($this->type == 'multiselect') {
+			$out.= $this->generateInputFieldMultiSelect();
+		} elseif ($this->type == 'select') {
+			$out.= $this->generateInputFieldSelect();
+		} elseif ($this->type == 'textarea') {
+			$out.= $this->generateInputFieldTextarea();
+		} elseif ($this->type== 'html') {
+			$out.= $this->generateInputFieldHtml();
+		} elseif ($this->type== 'color') {
+			$out.=  $this->generateInputFieldColor();
+		} elseif ($this->type == 'yesno') {
+			$out.= $this->form->selectyesno($this->confKey, $this->fieldValue, 1);
+		} elseif (preg_match('/emailtemplate:/', $this->type)) {
+			$out.= $this->generateInputFieldEmailTemplate();
+		} elseif (preg_match('/category:/', $this->type)) {
+			$out.=$this->generateInputFieldCategories();
+		} elseif (preg_match('/thirdparty_type/', $this->type)) {
+			require_once DOL_DOCUMENT_ROOT.'/core/class/html.formcompany.class.php';
+			$formcompany = new FormCompany($this->db);
+			$out.= $formcompany->selectProspectCustomerType($this->fieldValue, $this->confKey);
+		} elseif ($this->type == 'securekey') {
+			$out.= $this->generateInputFieldSecureKey();
+		} elseif ($this->type == 'product') {
+			if (!empty($conf->product->enabled) || !empty($conf->service->enabled)) {
+				$selected = (empty($this->fieldValue) ? '' : $this->fieldValue);
+				$out.= $this->form->select_produits($selected, $this->confKey, '', 0, 0, 1, 2, '', 0, array(), 0, '1', 0, $this->cssClass, 0, '', null, 1);
+			}
+		} else {
+			$out.= $this->generateInputFieldText();
+		}
+
+		return $out;
+	}
+
+	/**
+	 * generatec default input field
+	 * @return string
+	 */
+	public function generateInputFieldText()
+	{
+		if (empty($this->fieldAttr)) { $this->fieldAttr['class'] = 'flat '.(empty($this->cssClass) ? 'minwidth200' : $this->cssClass); }
+		return '<input '.FormSetup::generateAttributesStringFromArray($this->fieldAttr).' />';
+	}
+
+	/**
+	 * generate input field for textarea
+	 * @return string
+	 */
+	public function generateInputFieldTextarea()
+	{
+		$out = '<textarea class="flat" name="'.$this->confKey.'" id="'.$this->confKey.'" cols="50" rows="5" wrap="soft">' . "\n";
+		$out.= dol_htmlentities($this->fieldValue);
+		$out.= "</textarea>\n";
+		return $out;
+	}
+
+	/**
+	 * generate input field for html
+	 * @return string
+	 */
+	public function generateInputFieldHtml()
+	{
+		global $conf;
+		require_once DOL_DOCUMENT_ROOT . '/core/class/doleditor.class.php';
+		$doleditor = new DolEditor($this->confKey, $this->fieldValue, '', 160, 'dolibarr_notes', '', false, false, $conf->fckeditor->enabled, ROWS_5, '90%');
+		return $doleditor->Create(1);
+	}
+
+	/**
+	 * generate input field for categories
+	 * @return string
+	 */
+	public function generateInputFieldCategories()
+	{
+		global $conf;
+		require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+		require_once DOL_DOCUMENT_ROOT.'/core/class/html.formother.class.php';
+		$formother = new FormOther($this->db);
+
+		$tmp = explode(':', $this->type);
+		$out= img_picto('', 'category', 'class="pictofixedwidth"');
+		$out.= $formother->select_categories($tmp[1],  $this->fieldValue, $this->confKey, 0, $this->langs->trans('CustomersProspectsCategoriesShort'));
+		return $out;
+	}
+
+	/**
+	 * generate input field for email template selector
+	 * @return string
+	 */
+	public function generateInputFieldEmailTemplate()
+	{
+		global $conf, $user;
+		$out = '';
+		if (preg_match('/emailtemplate:/', $this->type)) {
+			include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
+			$formmail = new FormMail($this->db);
+
+			$tmp = explode(':', $this->type);
+			$nboftemplates = $formmail->fetchAllEMailTemplate($tmp[1], $user, null, 1); // We set lang=null to get in priority record with no lang
+			$arrayOfMessageName = array();
+			if (is_array($formmail->lines_model)) {
+				foreach ($formmail->lines_model as $modelMail) {
+					$moreonlabel = '';
+					if (!empty($arrayOfMessageName[$modelMail->label])) {
+						$moreonlabel = ' <span class="opacitymedium">(' . $this->langs->trans("SeveralLangugeVariatFound") . ')</span>';
+					}
+					// The 'label' is the key that is unique if we exclude the language
+					$arrayOfMessageName[$modelMail->id] = $this->langs->trans(preg_replace('/\(|\)/', '', $modelMail->label)) . $moreonlabel;
+				}
+			}
+			$out .= $this->form->selectarray($this->confKey, $arrayOfMessageName, $this->fieldValue, 'None', 0, 0, '', 0, 0, 0, '', '', 1);
+		}
+
+		return $out;
+	}
+
+
+	/**
+	 * generate input field for secure key
+	 * @return string
+	 */
+	public function generateInputFieldSecureKey()
+	{
+		global $conf;
+		$out = '<input required="required" type="text" class="flat" id="'.$this->confKey.'" name="'.$this->confKey.'" value="'.(GETPOST($this->confKey, 'alpha') ?GETPOST($this->confKey, 'alpha') : $this->fieldValue).'" size="40">';
+		if (!empty($conf->use_javascript_ajax)) {
+			$out.= '&nbsp;'.img_picto($this->langs->trans('Generate'), 'refresh', 'id="generate_token'.$this->confKey.'" class="linkobject"');
+		}
+		if (!empty($conf->use_javascript_ajax)) {
+			$out .= "\n" . '<script type="text/javascript">';
+			$out .= '$(document).ready(function () {
+                        $("#generate_token' . $this->confKey . '").click(function() {
+                	        $.get( "' . DOL_URL_ROOT . '/core/ajax/security.php", {
+                		      action: \'getrandompassword\',
+                		      generic: true
+    				        },
+    				        function(token) {
+    					       $("#' . $this->confKey . '").val(token);
+            				});
+                         });
+                    });';
+			$out .= '</script>';
+		}
+		return $out;
+	}
+
+
+	/**
+	 * @return string
+	 */
+	public function generateInputFieldMultiSelect()
+	{
+		$TSelected = array();
+		if ($this->fieldValue) {
+			$TSelected = explode(',', $this->fieldValue);
+		}
+
+		return $this->form->multiselectarray($this->confKey, $this->fieldOptions, $TSelected, 0, 0, '', 0, 0, 'style="min-width:100px"');
+	}
+
+
+	/**
+	 * @return string
+	 */
+	public function generateInputFieldSelect()
+	{
+		return $this->form->selectarray($this->confKey, $this->fieldOptions, $this->fieldValue);
+	}
+
+	/**
+	 * get the type : used for old module builder setup conf style conversion and tests
+	 * because this two class will quickly evolve it's important to not set or get directly $this->type (will be protected) so this method exist
+	 * to be sure we can manage evolution easily
+	 *
+	 * @return string
+	 */
+	public function getType()
+	{
+		return $this->type;
+	}
+
+	/**
+	 * set the type from string : used for old module builder setup conf style conversion and tests
+	 * because this two class will quickly evolve it's important to not set directly $this->type (will be protected) so this method exist
+	 * to be sure we can manage evolution easily
+	 * @param string $type possible values based on old module builder setup : 'string', 'textarea', 'category:'.Categorie::TYPE_CUSTOMER', 'emailtemplate', 'thirdparty_type'
+	 * @deprecated yes this setTypeFromTypeString came deprecated because it exists only for manage setup convertion
+	 * @return bool
+	 */
+	public function setTypeFromTypeString($type)
+	{
+		$this->type = $type;
+		return true;
+	}
+
+	/**
+	 * Add error
+	 * @param array|string $errors the error text
+	 * @return null
+	 */
+	public function setErrors($errors)
+	{
+		if (is_array($errors)) {
+			if (!empty($errors)) {
+				foreach ($errors as $error) {
+					$this->setErrors($error);
+				}
+			}
+		} elseif (!empty($errors)) {
+			$this->errors[] = $errors;
+		}
+	}
+
+	/**
+	 * @return bool|string Generate the output html for this item
+	 */
+	public function generateOutputField()
+	{
+		global $conf, $user;
+
+		if (!empty($this->fieldOverride)) {
+			return $this->fieldOverride;
+		}
+
+		if (!empty($this->fieldOutputOverride)) {
+			return $this->fieldOutputOverride;
+		}
+
+		$out = '';
+
+		if ($this->type == 'title') {
+			// nothing to do
+		} elseif ($this->type == 'textarea') {
+			$out.= dol_nl2br($this->fieldValue);
+		} elseif ($this->type == 'multiselect') {
+			$out.= $this->generateOutputFieldMultiSelect();
+		} elseif ($this->type == 'select') {
+			$out.= $this->generateOutputFieldSelect();
+		} elseif ($this->type== 'html') {
+			$out.=  $this->fieldValue;
+		} elseif ($this->type== 'color') {
+			$out.=  $this->generateOutputFieldColor();
+		} elseif ($this->type == 'yesno') {
+			$out.= ajax_constantonoff($this->confKey);
+		} elseif (preg_match('/emailtemplate:/', $this->type)) {
+			include_once DOL_DOCUMENT_ROOT . '/core/class/html.formmail.class.php';
+			$formmail = new FormMail($this->db);
+
+			$tmp = explode(':', $this->type);
+
+			$template = $formmail->getEMailTemplate($this->db, $tmp[1], $user, $this->langs, $this->fieldValue);
+			if ($template<0) {
+				$this->setErrors($formmail->errors);
+			}
+			$out.= $this->langs->trans($template->label);
+		} elseif (preg_match('/category:/', $this->type)) {
+			require_once DOL_DOCUMENT_ROOT.'/categories/class/categorie.class.php';
+			$c = new Categorie($this->db);
+			$result = $c->fetch($this->fieldValue);
+			if ($result < 0) {
+				$this->setErrors($c->errors);
+			}
+			$ways = $c->print_all_ways(' &gt;&gt; ', 'none', 0, 1); // $ways[0] = "ccc2 >> ccc2a >> ccc2a1" with html formated text
+			$toprint = array();
+			foreach ($ways as $way) {
+				$toprint[] = '<li class="select2-search-choice-dolibarr noborderoncategories"' . ($c->color ? ' style="background: #' . $c->color . ';"' : ' style="background: #bbb"') . '>' . $way . '</li>';
+			}
+			$out.='<div class="select2-container-multi-dolibarr" style="width: 90%;"><ul class="select2-choices-dolibarr">' . implode(' ', $toprint) . '</ul></div>';
+		} elseif (preg_match('/thirdparty_type/', $this->type)) {
+			if ($this->fieldValue==2) {
+				$out.= $this->langs->trans("Prospect");
+			} elseif ($this->fieldValue==3) {
+				$out.= $this->langs->trans("ProspectCustomer");
+			} elseif ($this->fieldValue==1) {
+				$out.= $this->langs->trans("Customer");
+			} elseif ($this->fieldValue==0) {
+				$out.= $this->langs->trans("NorProspectNorCustomer");
+			}
+		} elseif ($this->type == 'product') {
+			$product = new Product($this->db);
+			$resprod = $product->fetch($this->fieldValue);
+			if ($resprod > 0) {
+				$out.= $product->ref;
+			} elseif ($resprod < 0) {
+				$this->setErrors($product->errors);
+			}
+		} else {
+			$out.= $this->fieldValue;
+		}
+
+		return $out;
+	}
+
+
+	/**
+	 * @return string
+	 */
+	public function generateOutputFieldMultiSelect()
+	{
+		$outPut = '';
+		$TSelected = array();
+		if (!empty($this->fieldValue)) {
+			$TSelected = explode(',', $this->fieldValue);
+		}
+
+		if (!empty($TSelected)) {
+			foreach ($TSelected as $selected) {
+				if (!empty($this->fieldOptions[$selected])) {
+					$outPut.= dolGetBadge('', $this->fieldOptions[$selected], 'info').' ';
+				}
+			}
+		}
+		return $outPut;
+	}
+
+	/**
+	 * @return string
+	 */
+	public function generateOutputFieldColor()
+	{
+		$this->fieldAttr['disabled']=null;
+		return $this->generateInputField();
+	}
+	/**
+	 * @return string
+	 */
+	public function generateInputFieldColor()
+	{
+		$this->fieldAttr['type']= 'color';
+		return $this->generateInputFieldText();
+	}
+
+	/**
+	 * @return string
+	 */
+	public function generateOutputFieldSelect()
+	{
+		$outPut = '';
+		if (!empty($this->fieldOptions[$this->fieldValue])) {
+			$outPut = $this->fieldOptions[$this->fieldValue];
+		}
+
+		return $outPut;
+	}
+
+	/*
+	 * METHODS FOR SETTING DISPLAY TYPE
+	 */
+
+	/**
+	 * Set type of input as string
+	 * @return self
+	 */
+	public function setAsString()
+	{
+		$this->type = 'string';
+		return $this;
+	}
+
+	/**
+	 * Set type of input as color
+	 * @return self
+	 */
+	public function setAsColor()
+	{
+		$this->type = 'color';
+		return $this;
+	}
+
+	/**
+	 * Set type of input as textarea
+	 * @return self
+	 */
+	public function setAsTextarea()
+	{
+		$this->type = 'textarea';
+		return $this;
+	}
+
+	/**
+	 * Set type of input as html editor
+	 * @return self
+	 */
+	public function setAsHtml()
+	{
+		$this->type = 'html';
+		return $this;
+	}
+
+	/**
+	 * Set type of input as emailtemplate selector
+	 * @param string $templateType email template type
+	 * @return self
+	 */
+	public function setAsEmailTemplate($templateType)
+	{
+		$this->type = 'emailtemplate:'.$templateType;
+		return $this;
+	}
+
+	/**
+	 * Set type of input as thirdparty_type selector
+	 * @return self
+	 */
+	public function setAsThirdpartyType()
+	{
+		$this->type = 'thirdparty_type';
+		return $this;
+	}
+
+	/**
+	 * Set type of input as Yes
+	 * @return self
+	 */
+	public function setAsYesNo()
+	{
+		$this->type = 'yesno';
+		return $this;
+	}
+
+	/**
+	 * Set type of input as secure key
+	 * @return self
+	 */
+	public function setAsSecureKey()
+	{
+		$this->type = 'securekey';
+		return $this;
+	}
+
+	/**
+	 * Set type of input as product
+	 * @return self
+	 */
+	public function setAsProduct()
+	{
+		$this->type = 'product';
+		return $this;
+	}
+
+	/**
+	 * Set type of input as a category selector
+	 * TODO add default value
+	 * @param	int		$catType		Type of category ('customer', 'supplier', 'contact', 'product', 'member'). Old mode (0, 1, 2, ...) is deprecated.
+	 * @return self
+	 */
+	public function setAsCategory($catType)
+	{
+		$this->type = 'category:'.$catType;
+		return $this;
+	}
+
+	/**
+	 * Set type of input as a simple title
+	 * no data to store
+	 * @return self
+	 */
+	public function setAsTitle()
+	{
+		$this->type = 'title';
+		return $this;
+	}
+
+
+	/**
+	 * Set type of input as a simple title
+	 * no data to store
+	 * @param array $fieldOptions A table of field options
+	 * @return self
+	 */
+	public function setAsMultiSelect($fieldOptions)
+	{
+		if (is_array($fieldOptions)) {
+			$this->fieldOptions = $fieldOptions;
+		}
+
+		$this->type = 'multiselect';
+		return $this;
+	}
+
+	/**
+	 * Set type of input as a simple title
+	 * no data to store
+	 * @param array $fieldOptions  A table of field options
+	 * @return self
+	 */
+	public function setAsSelect($fieldOptions)
+	{
+		if (is_array($fieldOptions)) {
+			$this->fieldOptions = $fieldOptions;
+		}
+
+		$this->type = 'select';
+		return $this;
+	}
+}

+ 11 - 0
custom/nav/build/makepack-nav.conf

@@ -0,0 +1,11 @@
+# Your module name here
+#
+# Goal:    Goal of module
+# Version: <version>
+# Author:  Copyright <year> - <name of author>
+# License: GPLv3
+# Install: Just unpack content of module package in Dolibarr directory.
+# Setup:   Go on Dolibarr setup - modules to enable module.
+#
+# Files in module
+mymodule/

+ 1097 - 0
custom/nav/class/action.class.php

@@ -0,0 +1,1097 @@
+<?php
+/* Copyright (C) 2017  Laurent Destailleur <eldy@users.sourceforge.net>
+ * Copyright (C) 2023 Deák Ferenc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file        class/action.class.php
+ * \ingroup     nav
+ * \brief       This file is a CRUD class file for Action (Create/Read/Update/Delete)
+ */
+
+// Put here all includes required by your class file
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
+//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
+//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
+
+/**
+ * Class for Action
+ */
+class Action extends CommonObject
+{
+	/**
+	 * @var string ID of module.
+	 */
+	public $module = 'nav';
+
+	/**
+	 * @var string ID to identify managed object.
+	 */
+	public $element = 'action';
+
+	/**
+	 * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management.
+	 */
+	public $table_element = 'nav_action';
+
+	/**
+	 * @var int  Does this object support multicompany module ?
+	 * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table
+	 */
+	public $ismultientitymanaged = 0;
+
+	/**
+	 * @var int  Does object support extrafields ? 0=No, 1=Yes
+	 */
+	public $isextrafieldmanaged = 1;
+
+	/**
+	 * @var string String with name of icon for action. Must be a 'fa-xxx' fontawesome code (or 'fa-xxx_fa_color_size') or 'action@nav' if picto is file 'img/object_action.png'.
+	 */
+	public $picto = 'fa-file';
+
+
+	const STATUS_DRAFT = 0;
+	const STATUS_VALIDATED = 1;
+	const STATUS_CANCELED = 9;
+
+
+	/**
+	 *  'type' field format:
+	 *  	'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',
+	 *  	'select' (list of values are in 'options'),
+	 *  	'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]',
+	 *  	'chkbxlst:...',
+	 *  	'varchar(x)',
+	 *  	'text', 'text:none', 'html',
+	 *   	'double(24,8)', 'real', 'price',
+	 *  	'date', 'datetime', 'timestamp', 'duration',
+	 *  	'boolean', 'checkbox', 'radio', 'array',
+	 *  	'mail', 'phone', 'url', 'password', 'ip'
+	 *		Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
+	 *  'label' the translation key.
+	 *  'picto' is code of a picto to show before value in forms
+	 *  'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...)
+	 *  'position' is the sort order of field.
+	 *  'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
+	 *  'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
+	 *  'noteditable' says if field is not editable (1 or 0)
+	 *  'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
+	 *  'index' if we want an index in database.
+	 *  'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
+	 *  'searchall' is 1 if we want to search in this field when making a search from the quick search button.
+	 *  'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage)
+	 *  'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200'
+	 *  'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
+	 *  'showoncombobox' if value of the field must be visible into the label of the combobox that list record
+	 *  'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
+	 *  'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar'
+	 *  'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1.
+	 *  'comment' is not used. You can store here any text of your choice. It is not used by application.
+	 *	'validate' is 1 if need to validate with $this->validateField()
+	 *  'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value)
+	 *
+	 *  Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
+	 */
+
+	// BEGIN MODULEBUILDER PROPERTIES
+	/**
+	 * @var array  Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
+	 */
+	public $fields=array(
+		'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
+		'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>0, 'default'=>'1', 'index'=>1,),
+		'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'validate'=>'1', 'comment'=>"Reference of object"),
+		'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1',),
+		'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"Help text for amount", 'validate'=>'1',),
+		'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>'1', 'position'=>45, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'css'=>'maxwidth75imp', 'help'=>"Help text for quantity", 'validate'=>'1',),
+		'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'help'=>"OrganizationEventLinkToThirdParty", 'validate'=>'1',),
+		'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'validate'=>'1',),
+		'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',),
+		'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',),
+		'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',),
+		'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
+		'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,),
+		'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'picto'=>'user', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',),
+		'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'picto'=>'user', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
+		'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>0,),
+		'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
+		'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
+		'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>2000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Cancelled'), 'validate'=>'1',),
+	);
+	public $rowid;
+	public $entity;
+	public $ref;
+	public $label;
+	public $amount;
+	public $qty;
+	public $fk_soc;
+	public $fk_project;
+	public $description;
+	public $note_public;
+	public $note_private;
+	public $date_creation;
+	public $tms;
+	public $fk_user_creat;
+	public $fk_user_modif;
+	public $last_main_doc;
+	public $import_key;
+	public $model_pdf;
+	public $status;
+	// END MODULEBUILDER PROPERTIES
+
+
+	// If this object has a subtable with lines
+
+	// /**
+	//  * @var string    Name of subtable line
+	//  */
+	// public $table_element_line = 'nav_actionline';
+
+	// /**
+	//  * @var string    Field with ID of parent key if this object has a parent
+	//  */
+	// public $fk_element = 'fk_action';
+
+	// /**
+	//  * @var string    Name of subtable class that manage subtable lines
+	//  */
+	// public $class_element_line = 'Actionline';
+
+	// /**
+	//  * @var array	List of child tables. To test if we can delete object.
+	//  */
+	// protected $childtables = array();
+
+	// /**
+	//  * @var array    List of child tables. To know object to delete on cascade.
+	//  *               If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will
+	//  *               call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object
+	//  */
+	// protected $childtablesoncascade = array('nav_actiondet');
+
+	// /**
+	//  * @var ActionLine[]     Array of subtable lines
+	//  */
+	// public $lines = array();
+
+
+
+	/**
+	 * Constructor
+	 *
+	 * @param DoliDb $db Database handler
+	 */
+	public function __construct(DoliDB $db)
+	{
+		global $conf, $langs;
+
+		$this->db = $db;
+
+		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid']) && !empty($this->fields['ref'])) {
+			$this->fields['rowid']['visible'] = 0;
+		}
+		if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
+			$this->fields['entity']['enabled'] = 0;
+		}
+
+		// Example to show how to set values of fields definition dynamically
+		/*if ($user->rights->nav->action->read) {
+			$this->fields['myfield']['visible'] = 1;
+			$this->fields['myfield']['noteditable'] = 0;
+		}*/
+
+		// Unset fields that are disabled
+		foreach ($this->fields as $key => $val) {
+			if (isset($val['enabled']) && empty($val['enabled'])) {
+				unset($this->fields[$key]);
+			}
+		}
+
+		// Translate some data of arrayofkeyval
+		if (is_object($langs)) {
+			foreach ($this->fields as $key => $val) {
+				if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
+					foreach ($val['arrayofkeyval'] as $key2 => $val2) {
+						$this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Create object into database
+	 *
+	 * @param  User $user      User that creates
+	 * @param  bool $notrigger false=launch triggers after, true=disable triggers
+	 * @return int             <0 if KO, Id of created object if OK
+	 */
+	public function create(User $user, $notrigger = false)
+	{
+		$resultcreate = $this->createCommon($user, $notrigger);
+
+		//$resultvalidate = $this->validate($user, $notrigger);
+
+		return $resultcreate;
+	}
+
+	/**
+	 * Clone an object into another one
+	 *
+	 * @param  	User 	$user      	User that creates
+	 * @param  	int 	$fromid     Id of object to clone
+	 * @return 	mixed 				New object created, <0 if KO
+	 */
+	public function createFromClone(User $user, $fromid)
+	{
+		global $langs, $extrafields;
+		$error = 0;
+
+		dol_syslog(__METHOD__, LOG_DEBUG);
+
+		$object = new self($this->db);
+
+		$this->db->begin();
+
+		// Load source object
+		$result = $object->fetchCommon($fromid);
+		if ($result > 0 && !empty($object->table_element_line)) {
+			$object->fetchLines();
+		}
+
+		// get lines so they will be clone
+		//foreach($this->lines as $line)
+		//	$line->fetch_optionals();
+
+		// Reset some properties
+		unset($object->id);
+		unset($object->fk_user_creat);
+		unset($object->import_key);
+
+		// Clear fields
+		if (property_exists($object, 'ref')) {
+			$object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
+		}
+		if (property_exists($object, 'label')) {
+			$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
+		}
+		if (property_exists($object, 'status')) {
+			$object->status = self::STATUS_DRAFT;
+		}
+		if (property_exists($object, 'date_creation')) {
+			$object->date_creation = dol_now();
+		}
+		if (property_exists($object, 'date_modification')) {
+			$object->date_modification = null;
+		}
+		// ...
+		// Clear extrafields that are unique
+		if (is_array($object->array_options) && count($object->array_options) > 0) {
+			$extrafields->fetch_name_optionals_label($this->table_element);
+			foreach ($object->array_options as $key => $option) {
+				$shortkey = preg_replace('/options_/', '', $key);
+				if (!empty($extrafields->attributes[$this->table_element]['unique'][$shortkey])) {
+					//var_dump($key);
+					//var_dump($clonedObj->array_options[$key]); exit;
+					unset($object->array_options[$key]);
+				}
+			}
+		}
+
+		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
+		$result = $object->createCommon($user);
+		if ($result < 0) {
+			$error++;
+			$this->error = $object->error;
+			$this->errors = $object->errors;
+		}
+
+		if (!$error) {
+			// copy internal contacts
+			if ($this->copy_linked_contact($object, 'internal') < 0) {
+				$error++;
+			}
+		}
+
+		if (!$error) {
+			// copy external contacts if same company
+			if (!empty($object->socid) && property_exists($this, 'fk_soc') && $this->fk_soc == $object->socid) {
+				if ($this->copy_linked_contact($object, 'external') < 0) {
+					$error++;
+				}
+			}
+		}
+
+		unset($object->context['createfromclone']);
+
+		// End
+		if (!$error) {
+			$this->db->commit();
+			return $object;
+		} else {
+			$this->db->rollback();
+			return -1;
+		}
+	}
+
+	/**
+	 * Load object in memory from the database
+	 *
+	 * @param int    $id   Id object
+	 * @param string $ref  Ref
+	 * @return int         <0 if KO, 0 if not found, >0 if OK
+	 */
+	public function fetch($id, $ref = null)
+	{
+		$result = $this->fetchCommon($id, $ref);
+		if ($result > 0 && !empty($this->table_element_line)) {
+			$this->fetchLines();
+		}
+		return $result;
+	}
+
+	/**
+	 * Load object lines in memory from the database
+	 *
+	 * @return int         <0 if KO, 0 if not found, >0 if OK
+	 */
+	public function fetchLines()
+	{
+		$this->lines = array();
+
+		$result = $this->fetchLinesCommon();
+		return $result;
+	}
+
+
+	/**
+	 * Load list of objects in memory from the database.
+	 *
+	 * @param  string      $sortorder    Sort Order
+	 * @param  string      $sortfield    Sort field
+	 * @param  int         $limit        limit
+	 * @param  int         $offset       Offset
+	 * @param  array       $filter       Filter array. Example array('field'=>'valueforlike', 'customurl'=>...)
+	 * @param  string      $filtermode   Filter mode (AND or OR)
+	 * @return array|int                 int <0 if KO, array of pages if OK
+	 */
+	public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
+	{
+		global $conf;
+
+		dol_syslog(__METHOD__, LOG_DEBUG);
+
+		$records = array();
+
+		$sql = "SELECT ";
+		$sql .= $this->getFieldList('t');
+		$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
+		if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
+			$sql .= " WHERE t.entity IN (".getEntity($this->element).")";
+		} else {
+			$sql .= " WHERE 1 = 1";
+		}
+		// Manage filter
+		$sqlwhere = array();
+		if (count($filter) > 0) {
+			foreach ($filter as $key => $value) {
+				if ($key == 't.rowid') {
+					$sqlwhere[] = $key." = ".((int) $value);
+				} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
+					$sqlwhere[] = $key." = '".$this->db->idate($value)."'";
+				} elseif ($key == 'customsql') {
+					$sqlwhere[] = $value;
+				} elseif (strpos($value, '%') === false) {
+					$sqlwhere[] = $key." IN (".$this->db->sanitize($this->db->escape($value)).")";
+				} else {
+					$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
+				}
+			}
+		}
+		if (count($sqlwhere) > 0) {
+			$sql .= " AND (".implode(" ".$filtermode." ", $sqlwhere).")";
+		}
+
+		if (!empty($sortfield)) {
+			$sql .= $this->db->order($sortfield, $sortorder);
+		}
+		if (!empty($limit)) {
+			$sql .= $this->db->plimit($limit, $offset);
+		}
+
+		$resql = $this->db->query($sql);
+		if ($resql) {
+			$num = $this->db->num_rows($resql);
+			$i = 0;
+			while ($i < ($limit ? min($limit, $num) : $num)) {
+				$obj = $this->db->fetch_object($resql);
+
+				$record = new self($this->db);
+				$record->setVarsFromFetchObj($obj);
+
+				$records[$record->id] = $record;
+
+				$i++;
+			}
+			$this->db->free($resql);
+
+			return $records;
+		} else {
+			$this->errors[] = 'Error '.$this->db->lasterror();
+			dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
+
+			return -1;
+		}
+	}
+
+	/**
+	 * Update object into database
+	 *
+	 * @param  User $user      User that modifies
+	 * @param  bool $notrigger false=launch triggers after, true=disable triggers
+	 * @return int             <0 if KO, >0 if OK
+	 */
+	public function update(User $user, $notrigger = false)
+	{
+		return $this->updateCommon($user, $notrigger);
+	}
+
+	/**
+	 * Delete object in database
+	 *
+	 * @param User $user       User that deletes
+	 * @param bool $notrigger  false=launch triggers after, true=disable triggers
+	 * @return int             <0 if KO, >0 if OK
+	 */
+	public function delete(User $user, $notrigger = false)
+	{
+		return $this->deleteCommon($user, $notrigger);
+		//return $this->deleteCommon($user, $notrigger, 1);
+	}
+
+	/**
+	 *  Delete a line of object in database
+	 *
+	 *	@param  User	$user       User that delete
+	 *  @param	int		$idline		Id of line to delete
+	 *  @param 	bool 	$notrigger  false=launch triggers after, true=disable triggers
+	 *  @return int         		>0 if OK, <0 if KO
+	 */
+	public function deleteLine(User $user, $idline, $notrigger = false)
+	{
+		if ($this->status < 0) {
+			$this->error = 'ErrorDeleteLineNotAllowedByObjectStatus';
+			return -2;
+		}
+
+		return $this->deleteLineCommon($user, $idline, $notrigger);
+	}
+
+
+	/**
+	 *	Validate object
+	 *
+	 *	@param		User	$user     		User making status change
+	 *  @param		int		$notrigger		1=Does not execute triggers, 0= execute triggers
+	 *	@return  	int						<=0 if OK, 0=Nothing done, >0 if KO
+	 */
+	public function validate($user, $notrigger = 0)
+	{
+		global $conf, $langs;
+
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+
+		$error = 0;
+
+		// Protection
+		if ($this->status == self::STATUS_VALIDATED) {
+			dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
+			return 0;
+		}
+
+		/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->action->write))
+		 || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->action->action_advance->validate))))
+		 {
+		 $this->error='NotEnoughPermissions';
+		 dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
+		 return -1;
+		 }*/
+
+		$now = dol_now();
+
+		$this->db->begin();
+
+		// Define new ref
+		if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
+			$num = $this->getNextNumRef();
+		} else {
+			$num = $this->ref;
+		}
+		$this->newref = $num;
+
+		if (!empty($num)) {
+			// Validate
+			$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
+			$sql .= " SET ref = '".$this->db->escape($num)."',";
+			$sql .= " status = ".self::STATUS_VALIDATED;
+			if (!empty($this->fields['date_validation'])) {
+				$sql .= ", date_validation = '".$this->db->idate($now)."'";
+			}
+			if (!empty($this->fields['fk_user_valid'])) {
+				$sql .= ", fk_user_valid = ".((int) $user->id);
+			}
+			$sql .= " WHERE rowid = ".((int) $this->id);
+
+			dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
+			$resql = $this->db->query($sql);
+			if (!$resql) {
+				dol_print_error($this->db);
+				$this->error = $this->db->lasterror();
+				$error++;
+			}
+
+			if (!$error && !$notrigger) {
+				// Call trigger
+				$result = $this->call_trigger('ACTION_VALIDATE', $user);
+				if ($result < 0) {
+					$error++;
+				}
+				// End call triggers
+			}
+		}
+
+		if (!$error) {
+			$this->oldref = $this->ref;
+
+			// Rename directory if dir was a temporary ref
+			if (preg_match('/^[\(]?PROV/i', $this->ref)) {
+				// Now we rename also files into index
+				$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'action/".$this->db->escape($this->newref)."'";
+				$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'action/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
+				$resql = $this->db->query($sql);
+				if (!$resql) {
+					$error++; $this->error = $this->db->lasterror();
+				}
+
+				// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
+				$oldref = dol_sanitizeFileName($this->ref);
+				$newref = dol_sanitizeFileName($num);
+				$dirsource = $conf->nav->dir_output.'/action/'.$oldref;
+				$dirdest = $conf->nav->dir_output.'/action/'.$newref;
+				if (!$error && file_exists($dirsource)) {
+					dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest);
+
+					if (@rename($dirsource, $dirdest)) {
+						dol_syslog("Rename ok");
+						// Rename docs starting with $oldref with $newref
+						$listoffiles = dol_dir_list($conf->nav->dir_output.'/action/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
+						foreach ($listoffiles as $fileentry) {
+							$dirsource = $fileentry['name'];
+							$dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
+							$dirsource = $fileentry['path'].'/'.$dirsource;
+							$dirdest = $fileentry['path'].'/'.$dirdest;
+							@rename($dirsource, $dirdest);
+						}
+					}
+				}
+			}
+		}
+
+		// Set new ref and current status
+		if (!$error) {
+			$this->ref = $num;
+			$this->status = self::STATUS_VALIDATED;
+		}
+
+		if (!$error) {
+			$this->db->commit();
+			return 1;
+		} else {
+			$this->db->rollback();
+			return -1;
+		}
+	}
+
+
+	/**
+	 *	Set draft status
+	 *
+	 *	@param	User	$user			Object user that modify
+	 *  @param	int		$notrigger		1=Does not execute triggers, 0=Execute triggers
+	 *	@return	int						<0 if KO, >0 if OK
+	 */
+	public function setDraft($user, $notrigger = 0)
+	{
+		// Protection
+		if ($this->status <= self::STATUS_DRAFT) {
+			return 0;
+		}
+
+		/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->write))
+		 || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->nav_advance->validate))))
+		 {
+		 $this->error='Permission denied';
+		 return -1;
+		 }*/
+
+		return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'ACTION_UNVALIDATE');
+	}
+
+	/**
+	 *	Set cancel status
+	 *
+	 *	@param	User	$user			Object user that modify
+	 *  @param	int		$notrigger		1=Does not execute triggers, 0=Execute triggers
+	 *	@return	int						<0 if KO, 0=Nothing done, >0 if OK
+	 */
+	public function cancel($user, $notrigger = 0)
+	{
+		// Protection
+		if ($this->status != self::STATUS_VALIDATED) {
+			return 0;
+		}
+
+		/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->write))
+		 || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->nav_advance->validate))))
+		 {
+		 $this->error='Permission denied';
+		 return -1;
+		 }*/
+
+		return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'ACTION_CANCEL');
+	}
+
+	/**
+	 *	Set back to validated status
+	 *
+	 *	@param	User	$user			Object user that modify
+	 *  @param	int		$notrigger		1=Does not execute triggers, 0=Execute triggers
+	 *	@return	int						<0 if KO, 0=Nothing done, >0 if OK
+	 */
+	public function reopen($user, $notrigger = 0)
+	{
+		// Protection
+		if ($this->status != self::STATUS_CANCELED) {
+			return 0;
+		}
+
+		/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->write))
+		 || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->nav_advance->validate))))
+		 {
+		 $this->error='Permission denied';
+		 return -1;
+		 }*/
+
+		return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'ACTION_REOPEN');
+	}
+
+	/**
+	 *  Return a link to the object card (with optionaly the picto)
+	 *
+	 *  @param  int     $withpicto                  Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
+	 *  @param  string  $option                     On what the link point to ('nolink', ...)
+	 *  @param  int     $notooltip                  1=Disable tooltip
+	 *  @param  string  $morecss                    Add more css on link
+	 *  @param  int     $save_lastsearch_value      -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+	 *  @return	string                              String with URL
+	 */
+	public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
+	{
+		global $conf, $langs, $hookmanager;
+
+		if (!empty($conf->dol_no_mouse_hover)) {
+			$notooltip = 1; // Force disable tooltips
+		}
+
+		$result = '';
+
+		$label = img_picto('', $this->picto).' <u>'.$langs->trans("Action").'</u>';
+		if (isset($this->status)) {
+			$label .= ' '.$this->getLibStatut(5);
+		}
+		$label .= '<br>';
+		$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
+
+		$url = dol_buildpath('/nav/action_card.php', 1).'?id='.$this->id;
+
+		if ($option != 'nolink') {
+			// Add param to save lastsearch_values or not
+			$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
+			if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
+				$add_save_lastsearch_values = 1;
+			}
+			if ($url && $add_save_lastsearch_values) {
+				$url .= '&save_lastsearch_values=1';
+			}
+		}
+
+		$linkclose = '';
+		if (empty($notooltip)) {
+			if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+				$label = $langs->trans("ShowAction");
+				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
+			}
+			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
+			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+		} else {
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
+		}
+
+		if ($option == 'nolink' || empty($url)) {
+			$linkstart = '<span';
+		} else {
+			$linkstart = '<a href="'.$url.'"';
+		}
+		$linkstart .= $linkclose.'>';
+		if ($option == 'nolink' || empty($url)) {
+			$linkend = '</span>';
+		} else {
+			$linkend = '</a>';
+		}
+
+		$result .= $linkstart;
+
+		if (empty($this->showphoto_on_popup)) {
+			if ($withpicto) {
+				$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+			}
+		} else {
+			if ($withpicto) {
+				require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+
+				list($class, $module) = explode('@', $this->picto);
+				$upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref);
+				$filearray = dol_dir_list($upload_dir, "files");
+				$filename = $filearray[0]['name'];
+				if (!empty($filename)) {
+					$pospoint = strpos($filearray[0]['name'], '.');
+
+					$pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
+					if (empty($conf->global->{strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS'})) {
+						$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.'" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div></div>';
+					} else {
+						$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div>';
+					}
+
+					$result .= '</div>';
+				} else {
+					$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+				}
+			}
+		}
+
+		if ($withpicto != 2) {
+			$result .= $this->ref;
+		}
+
+		$result .= $linkend;
+		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
+
+		global $action, $hookmanager;
+		$hookmanager->initHooks(array('actiondao'));
+		$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
+		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+		if ($reshook > 0) {
+			$result = $hookmanager->resPrint;
+		} else {
+			$result .= $hookmanager->resPrint;
+		}
+
+		return $result;
+	}
+
+	/**
+	 *  Return the label of the status
+	 *
+	 *  @param  int		$mode          0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+	 *  @return	string 			       Label of status
+	 */
+	public function getLabelStatus($mode = 0)
+	{
+		return $this->LibStatut($this->status, $mode);
+	}
+
+	/**
+	 *  Return the label of the status
+	 *
+	 *  @param  int		$mode          0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+	 *  @return	string 			       Label of status
+	 */
+	public function getLibStatut($mode = 0)
+	{
+		return $this->LibStatut($this->status, $mode);
+	}
+
+	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+	/**
+	 *  Return the status
+	 *
+	 *  @param	int		$status        Id status
+	 *  @param  int		$mode          0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+	 *  @return string 			       Label of status
+	 */
+	public function LibStatut($status, $mode = 0)
+	{
+		// phpcs:enable
+		if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
+			global $langs;
+			//$langs->load("nav@nav");
+			$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
+			$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
+			$this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
+			$this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
+			$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
+			$this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
+		}
+
+		$statusType = 'status'.$status;
+		//if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
+		if ($status == self::STATUS_CANCELED) {
+			$statusType = 'status6';
+		}
+
+		return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
+	}
+
+	/**
+	 *	Load the info information in the object
+	 *
+	 *	@param  int		$id       Id of object
+	 *	@return	void
+	 */
+	public function info($id)
+	{
+		$sql = "SELECT rowid,";
+		$sql .= " date_creation as datec, tms as datem,";
+		$sql .= " fk_user_creat, fk_user_modif";
+		$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
+		$sql .= " WHERE t.rowid = ".((int) $id);
+
+		$result = $this->db->query($sql);
+		if ($result) {
+			if ($this->db->num_rows($result)) {
+				$obj = $this->db->fetch_object($result);
+
+				$this->id = $obj->rowid;
+
+				$this->user_creation_id = $obj->fk_user_creat;
+				$this->user_modification_id = $obj->fk_user_modif;
+				if (!empty($obj->fk_user_valid)) {
+					$this->user_validation_id = $obj->fk_user_valid;
+				}
+				$this->date_creation     = $this->db->jdate($obj->datec);
+				$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
+				if (!empty($obj->datev)) {
+					$this->date_validation   = empty($obj->datev) ? '' : $this->db->jdate($obj->datev);
+				}
+			}
+
+			$this->db->free($result);
+		} else {
+			dol_print_error($this->db);
+		}
+	}
+
+	/**
+	 * Initialise object with example values
+	 * Id must be 0 if object instance is a specimen
+	 *
+	 * @return void
+	 */
+	public function initAsSpecimen()
+	{
+		// Set here init that are not commonf fields
+		// $this->property1 = ...
+		// $this->property2 = ...
+
+		$this->initAsSpecimenCommon();
+	}
+
+	/**
+	 * 	Create an array of lines
+	 *
+	 * 	@return array|int		array of lines if OK, <0 if KO
+	 */
+	public function getLinesArray()
+	{
+		$this->lines = array();
+
+		$objectline = new ActionLine($this->db);
+		$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_action = '.((int) $this->id)));
+
+		if (is_numeric($result)) {
+			$this->error = $objectline->error;
+			$this->errors = $objectline->errors;
+			return $result;
+		} else {
+			$this->lines = $result;
+			return $this->lines;
+		}
+	}
+
+	/**
+	 *  Returns the reference to the following non used object depending on the active numbering module.
+	 *
+	 *  @return string      		Object free reference
+	 */
+	public function getNextNumRef()
+	{
+		global $langs, $conf;
+		$langs->load("nav@nav");
+
+		if (empty($conf->global->NAV_ACTION_ADDON)) {
+			$conf->global->NAV_ACTION_ADDON = 'mod_action_standard';
+		}
+
+		if (!empty($conf->global->NAV_ACTION_ADDON)) {
+			$mybool = false;
+
+			$file = $conf->global->NAV_ACTION_ADDON.".php";
+			$classname = $conf->global->NAV_ACTION_ADDON;
+
+			// Include file with class
+			$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
+			foreach ($dirmodels as $reldir) {
+				$dir = dol_buildpath($reldir."core/modules/nav/");
+
+				// Load file with numbering class (if found)
+				$mybool |= @include_once $dir.$file;
+			}
+
+			if ($mybool === false) {
+				dol_print_error('', "Failed to include file ".$file);
+				return '';
+			}
+
+			if (class_exists($classname)) {
+				$obj = new $classname();
+				$numref = $obj->getNextValue($this);
+
+				if ($numref != '' && $numref != '-1') {
+					return $numref;
+				} else {
+					$this->error = $obj->error;
+					//dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
+					return "";
+				}
+			} else {
+				print $langs->trans("Error")." ".$langs->trans("ClassNotFound").' '.$classname;
+				return "";
+			}
+		} else {
+			print $langs->trans("ErrorNumberingModuleNotSetup", $this->element);
+			return "";
+		}
+	}
+
+	/**
+	 *  Create a document onto disk according to template module.
+	 *
+	 *  @param	    string		$modele			Force template to use ('' to not force)
+	 *  @param		Translate	$outputlangs	objet lang a utiliser pour traduction
+	 *  @param      int			$hidedetails    Hide details of lines
+	 *  @param      int			$hidedesc       Hide description
+	 *  @param      int			$hideref        Hide ref
+	 *  @param      null|array  $moreparams     Array to provide more information
+	 *  @return     int         				0 if KO, 1 if OK
+	 */
+	public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
+	{
+		global $conf, $langs;
+
+		$result = 0;
+		$includedocgeneration = 0;
+
+		$langs->load("nav@nav");
+
+		if (!dol_strlen($modele)) {
+			$modele = 'standard_action';
+
+			if (!empty($this->model_pdf)) {
+				$modele = $this->model_pdf;
+			} elseif (!empty($conf->global->ACTION_ADDON_PDF)) {
+				$modele = $conf->global->ACTION_ADDON_PDF;
+			}
+		}
+
+		$modelpath = "core/modules/nav/doc/";
+
+		if ($includedocgeneration && !empty($modele)) {
+			$result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
+		}
+
+		return $result;
+	}
+
+	/**
+	 * Action executed by scheduler
+	 * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters'
+	 * Use public function doScheduledJob($param1, $param2, ...) to get parameters
+	 *
+	 * @return	int			0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
+	 */
+	public function doScheduledJob()
+	{
+		global $conf, $langs;
+
+		//$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
+
+		$error = 0;
+		$this->output = '';
+		$this->error = '';
+
+		dol_syslog(__METHOD__, LOG_DEBUG);
+
+		$now = dol_now();
+
+		$this->db->begin();
+
+		// ...
+
+		$this->db->commit();
+
+		return $error;
+	}
+}
+
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
+
+/**
+ * Class ActionLine. You can also remove this and generate a CRUD class for lines objects.
+ */
+class ActionLine extends CommonObjectLine
+{
+	// To complete with content of an object ActionLine
+	// We should have a field rowid, fk_action and position
+
+	/**
+	 * @var int  Does object support extrafields ? 0=No, 1=Yes
+	 */
+	public $isextrafieldmanaged = 0;
+
+	/**
+	 * Constructor
+	 *
+	 * @param DoliDb $db Database handler
+	 */
+	public function __construct(DoliDB $db)
+	{
+		$this->db = $db;
+	}
+}

+ 1097 - 0
custom/nav/class/action.class.php.back

@@ -0,0 +1,1097 @@
+<?php
+/* Copyright (C) 2017  Laurent Destailleur <eldy@users.sourceforge.net>
+ * Copyright (C) 2023 Deák Ferenc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file        class/action.class.php
+ * \ingroup     nav
+ * \brief       This file is a CRUD class file for Action (Create/Read/Update/Delete)
+ */
+
+// Put here all includes required by your class file
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php';
+//require_once DOL_DOCUMENT_ROOT . '/societe/class/societe.class.php';
+//require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';
+
+/**
+ * Class for Action
+ */
+class Action extends CommonObject
+{
+	/**
+	 * @var string ID of module.
+	 */
+	public $module = 'nav';
+
+	/**
+	 * @var string ID to identify managed object.
+	 */
+	public $element = 'action';
+
+	/**
+	 * @var string Name of table without prefix where object is stored. This is also the key used for extrafields management.
+	 */
+	public $table_element = 'nav_action';
+
+	/**
+	 * @var int  Does this object support multicompany module ?
+	 * 0=No test on entity, 1=Test with field entity, 'field@table'=Test with link by field@table
+	 */
+	public $ismultientitymanaged = 0;
+
+	/**
+	 * @var int  Does object support extrafields ? 0=No, 1=Yes
+	 */
+	public $isextrafieldmanaged = 1;
+
+	/**
+	 * @var string String with name of icon for action. Must be a 'fa-xxx' fontawesome code (or 'fa-xxx_fa_color_size') or 'action@nav' if picto is file 'img/object_action.png'.
+	 */
+	public $picto = 'fa-file';
+
+
+	const STATUS_DRAFT = 0;
+	const STATUS_VALIDATED = 1;
+	const STATUS_CANCELED = 9;
+
+
+	/**
+	 *  'type' field format:
+	 *  	'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',
+	 *  	'select' (list of values are in 'options'),
+	 *  	'sellist:TableName:LabelFieldName[:KeyFieldName[:KeyFieldParent[:Filter[:Sortfield]]]]',
+	 *  	'chkbxlst:...',
+	 *  	'varchar(x)',
+	 *  	'text', 'text:none', 'html',
+	 *   	'double(24,8)', 'real', 'price',
+	 *  	'date', 'datetime', 'timestamp', 'duration',
+	 *  	'boolean', 'checkbox', 'radio', 'array',
+	 *  	'mail', 'phone', 'url', 'password', 'ip'
+	 *		Note: Filter can be a string like "(t.ref:like:'SO-%') or (t.date_creation:<:'20160101') or (t.nature:is:NULL)"
+	 *  'label' the translation key.
+	 *  'picto' is code of a picto to show before value in forms
+	 *  'enabled' is a condition when the field must be managed (Example: 1 or '$conf->global->MY_SETUP_PARAM' or '!empty($conf->multicurrency->enabled)' ...)
+	 *  'position' is the sort order of field.
+	 *  'notnull' is set to 1 if not null in database. Set to -1 if we must set data to null if empty ('' or 0).
+	 *  'visible' says if field is visible in list (Examples: 0=Not visible, 1=Visible on list and create/update/view forms, 2=Visible on list only, 3=Visible on create/update/view form only (not list), 4=Visible on list and update/view form only (not create). 5=Visible on list and view only (not create/not update). Using a negative value means field is not shown by default on list but can be selected for viewing)
+	 *  'noteditable' says if field is not editable (1 or 0)
+	 *  'default' is a default value for creation (can still be overwrote by the Setup of Default Values if field is editable in creation form). Note: If default is set to '(PROV)' and field is 'ref', the default value will be set to '(PROVid)' where id is rowid when a new record is created.
+	 *  'index' if we want an index in database.
+	 *  'foreignkey'=>'tablename.field' if the field is a foreign key (it is recommanded to name the field fk_...).
+	 *  'searchall' is 1 if we want to search in this field when making a search from the quick search button.
+	 *  'isameasure' must be set to 1 or 2 if field can be used for measure. Field type must be summable like integer or double(24,8). Use 1 in most cases, or 2 if you don't want to see the column total into list (for example for percentage)
+	 *  'css' and 'cssview' and 'csslist' is the CSS style to use on field. 'css' is used in creation and update. 'cssview' is used in view mode. 'csslist' is used for columns in lists. For example: 'css'=>'minwidth300 maxwidth500 widthcentpercentminusx', 'cssview'=>'wordbreak', 'csslist'=>'tdoverflowmax200'
+	 *  'help' is a 'TranslationString' to use to show a tooltip on field. You can also use 'TranslationString:keyfortooltiponlick' for a tooltip on click.
+	 *  'showoncombobox' if value of the field must be visible into the label of the combobox that list record
+	 *  'disabled' is 1 if we want to have the field locked by a 'disabled' attribute. In most cases, this is never set into the definition of $fields into class, but is set dynamically by some part of code.
+	 *  'arrayofkeyval' to set a list of values if type is a list of predefined values. For example: array("0"=>"Draft","1"=>"Active","-1"=>"Cancel"). Note that type can be 'integer' or 'varchar'
+	 *  'autofocusoncreate' to have field having the focus on a create form. Only 1 field should have this property set to 1.
+	 *  'comment' is not used. You can store here any text of your choice. It is not used by application.
+	 *	'validate' is 1 if need to validate with $this->validateField()
+	 *  'copytoclipboard' is 1 or 2 to allow to add a picto to copy value into clipboard (1=picto after label, 2=picto after value)
+	 *
+	 *  Note: To have value dynamic, you can set value to 0 in definition and edit the value on the fly into the constructor.
+	 */
+
+	// BEGIN MODULEBUILDER PROPERTIES
+	/**
+	 * @var array  Array with all fields and their property. Do not use it as a static var. It may be modified by constructor.
+	 */
+	public $fields=array(
+		'rowid' => array('type'=>'integer', 'label'=>'TechnicalID', 'enabled'=>'1', 'position'=>1, 'notnull'=>1, 'visible'=>0, 'noteditable'=>'1', 'index'=>1, 'css'=>'left', 'comment'=>"Id"),
+		'entity' => array('type'=>'integer', 'label'=>'Entity', 'enabled'=>'1', 'position'=>10, 'notnull'=>1, 'visible'=>0, 'default'=>'1', 'index'=>1,),
+		'ref' => array('type'=>'varchar(128)', 'label'=>'Ref', 'enabled'=>'1', 'position'=>20, 'notnull'=>1, 'visible'=>4, 'noteditable'=>'1', 'default'=>'(PROV)', 'index'=>1, 'searchall'=>1, 'showoncombobox'=>'1', 'validate'=>'1', 'comment'=>"Reference of object"),
+		'label' => array('type'=>'varchar(255)', 'label'=>'Label', 'enabled'=>'1', 'position'=>30, 'notnull'=>0, 'visible'=>1, 'searchall'=>1, 'css'=>'minwidth300', 'cssview'=>'wordbreak', 'help'=>"Help text", 'showoncombobox'=>'2', 'validate'=>'1',),
+		'amount' => array('type'=>'price', 'label'=>'Amount', 'enabled'=>'1', 'position'=>40, 'notnull'=>0, 'visible'=>1, 'default'=>'null', 'isameasure'=>'1', 'help'=>"Help text for amount", 'validate'=>'1',),
+		'qty' => array('type'=>'real', 'label'=>'Qty', 'enabled'=>'1', 'position'=>45, 'notnull'=>0, 'visible'=>1, 'default'=>'0', 'isameasure'=>'1', 'css'=>'maxwidth75imp', 'help'=>"Help text for quantity", 'validate'=>'1',),
+		'fk_soc' => array('type'=>'integer:Societe:societe/class/societe.class.php:1:status=1 AND entity IN (__SHARED_ENTITIES__)', 'label'=>'ThirdParty', 'picto'=>'company', 'enabled'=>'$conf->societe->enabled', 'position'=>50, 'notnull'=>-1, 'visible'=>1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'help'=>"OrganizationEventLinkToThirdParty", 'validate'=>'1',),
+		'fk_project' => array('type'=>'integer:Project:projet/class/project.class.php:1', 'label'=>'Project', 'picto'=>'project', 'enabled'=>'$conf->project->enabled', 'position'=>52, 'notnull'=>-1, 'visible'=>-1, 'index'=>1, 'css'=>'maxwidth500 widthcentpercentminusxx', 'validate'=>'1',),
+		'description' => array('type'=>'text', 'label'=>'Description', 'enabled'=>'1', 'position'=>60, 'notnull'=>0, 'visible'=>3, 'validate'=>'1',),
+		'note_public' => array('type'=>'html', 'label'=>'NotePublic', 'enabled'=>'1', 'position'=>61, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',),
+		'note_private' => array('type'=>'html', 'label'=>'NotePrivate', 'enabled'=>'1', 'position'=>62, 'notnull'=>0, 'visible'=>0, 'cssview'=>'wordbreak', 'validate'=>'1',),
+		'date_creation' => array('type'=>'datetime', 'label'=>'DateCreation', 'enabled'=>'1', 'position'=>500, 'notnull'=>1, 'visible'=>-2,),
+		'tms' => array('type'=>'timestamp', 'label'=>'DateModification', 'enabled'=>'1', 'position'=>501, 'notnull'=>0, 'visible'=>-2,),
+		'fk_user_creat' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserAuthor', 'picto'=>'user', 'enabled'=>'1', 'position'=>510, 'notnull'=>1, 'visible'=>-2, 'foreignkey'=>'user.rowid',),
+		'fk_user_modif' => array('type'=>'integer:User:user/class/user.class.php', 'label'=>'UserModif', 'picto'=>'user', 'enabled'=>'1', 'position'=>511, 'notnull'=>-1, 'visible'=>-2,),
+		'last_main_doc' => array('type'=>'varchar(255)', 'label'=>'LastMainDoc', 'enabled'=>'1', 'position'=>600, 'notnull'=>0, 'visible'=>0,),
+		'import_key' => array('type'=>'varchar(14)', 'label'=>'ImportId', 'enabled'=>'1', 'position'=>1000, 'notnull'=>-1, 'visible'=>-2,),
+		'model_pdf' => array('type'=>'varchar(255)', 'label'=>'Model pdf', 'enabled'=>'1', 'position'=>1010, 'notnull'=>-1, 'visible'=>0,),
+		'status' => array('type'=>'integer', 'label'=>'Status', 'enabled'=>'1', 'position'=>2000, 'notnull'=>1, 'visible'=>1, 'index'=>1, 'arrayofkeyval'=>array('0'=>'Draft', '1'=>'Validated', '9'=>'Cancelled'), 'validate'=>'1',),
+	);
+	public $rowid;
+	public $entity;
+	public $ref;
+	public $label;
+	public $amount;
+	public $qty;
+	public $fk_soc;
+	public $fk_project;
+	public $description;
+	public $note_public;
+	public $note_private;
+	public $date_creation;
+	public $tms;
+	public $fk_user_creat;
+	public $fk_user_modif;
+	public $last_main_doc;
+	public $import_key;
+	public $model_pdf;
+	public $status;
+	// END MODULEBUILDER PROPERTIES
+
+
+	// If this object has a subtable with lines
+
+	// /**
+	//  * @var string    Name of subtable line
+	//  */
+	// public $table_element_line = 'nav_actionline';
+
+	// /**
+	//  * @var string    Field with ID of parent key if this object has a parent
+	//  */
+	// public $fk_element = 'fk_action';
+
+	// /**
+	//  * @var string    Name of subtable class that manage subtable lines
+	//  */
+	// public $class_element_line = 'Actionline';
+
+	// /**
+	//  * @var array	List of child tables. To test if we can delete object.
+	//  */
+	// protected $childtables = array();
+
+	// /**
+	//  * @var array    List of child tables. To know object to delete on cascade.
+	//  *               If name matches '@ClassNAme:FilePathClass;ParentFkFieldName' it will
+	//  *               call method deleteByParentField(parentId, ParentFkFieldName) to fetch and delete child object
+	//  */
+	// protected $childtablesoncascade = array('nav_actiondet');
+
+	// /**
+	//  * @var ActionLine[]     Array of subtable lines
+	//  */
+	// public $lines = array();
+
+
+
+	/**
+	 * Constructor
+	 *
+	 * @param DoliDb $db Database handler
+	 */
+	public function __construct(DoliDB $db)
+	{
+		global $conf, $langs;
+
+		$this->db = $db;
+
+		if (empty($conf->global->MAIN_SHOW_TECHNICAL_ID) && isset($this->fields['rowid']) && !empty($this->fields['ref'])) {
+			$this->fields['rowid']['visible'] = 0;
+		}
+		if (empty($conf->multicompany->enabled) && isset($this->fields['entity'])) {
+			$this->fields['entity']['enabled'] = 0;
+		}
+
+		// Example to show how to set values of fields definition dynamically
+		/*if ($user->rights->nav->action->read) {
+			$this->fields['myfield']['visible'] = 1;
+			$this->fields['myfield']['noteditable'] = 0;
+		}*/
+
+		// Unset fields that are disabled
+		foreach ($this->fields as $key => $val) {
+			if (isset($val['enabled']) && empty($val['enabled'])) {
+				unset($this->fields[$key]);
+			}
+		}
+
+		// Translate some data of arrayofkeyval
+		if (is_object($langs)) {
+			foreach ($this->fields as $key => $val) {
+				if (!empty($val['arrayofkeyval']) && is_array($val['arrayofkeyval'])) {
+					foreach ($val['arrayofkeyval'] as $key2 => $val2) {
+						$this->fields[$key]['arrayofkeyval'][$key2] = $langs->trans($val2);
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * Create object into database
+	 *
+	 * @param  User $user      User that creates
+	 * @param  bool $notrigger false=launch triggers after, true=disable triggers
+	 * @return int             <0 if KO, Id of created object if OK
+	 */
+	public function create(User $user, $notrigger = false)
+	{
+		$resultcreate = $this->createCommon($user, $notrigger);
+
+		//$resultvalidate = $this->validate($user, $notrigger);
+
+		return $resultcreate;
+	}
+
+	/**
+	 * Clone an object into another one
+	 *
+	 * @param  	User 	$user      	User that creates
+	 * @param  	int 	$fromid     Id of object to clone
+	 * @return 	mixed 				New object created, <0 if KO
+	 */
+	public function createFromClone(User $user, $fromid)
+	{
+		global $langs, $extrafields;
+		$error = 0;
+
+		dol_syslog(__METHOD__, LOG_DEBUG);
+
+		$object = new self($this->db);
+
+		$this->db->begin();
+
+		// Load source object
+		$result = $object->fetchCommon($fromid);
+		if ($result > 0 && !empty($object->table_element_line)) {
+			$object->fetchLines();
+		}
+
+		// get lines so they will be clone
+		//foreach($this->lines as $line)
+		//	$line->fetch_optionals();
+
+		// Reset some properties
+		unset($object->id);
+		unset($object->fk_user_creat);
+		unset($object->import_key);
+
+		// Clear fields
+		if (property_exists($object, 'ref')) {
+			$object->ref = empty($this->fields['ref']['default']) ? "Copy_Of_".$object->ref : $this->fields['ref']['default'];
+		}
+		if (property_exists($object, 'label')) {
+			$object->label = empty($this->fields['label']['default']) ? $langs->trans("CopyOf")." ".$object->label : $this->fields['label']['default'];
+		}
+		if (property_exists($object, 'status')) {
+			$object->status = self::STATUS_DRAFT;
+		}
+		if (property_exists($object, 'date_creation')) {
+			$object->date_creation = dol_now();
+		}
+		if (property_exists($object, 'date_modification')) {
+			$object->date_modification = null;
+		}
+		// ...
+		// Clear extrafields that are unique
+		if (is_array($object->array_options) && count($object->array_options) > 0) {
+			$extrafields->fetch_name_optionals_label($this->table_element);
+			foreach ($object->array_options as $key => $option) {
+				$shortkey = preg_replace('/options_/', '', $key);
+				if (!empty($extrafields->attributes[$this->table_element]['unique'][$shortkey])) {
+					//var_dump($key);
+					//var_dump($clonedObj->array_options[$key]); exit;
+					unset($object->array_options[$key]);
+				}
+			}
+		}
+
+		// Create clone
+		$object->context['createfromclone'] = 'createfromclone';
+		$result = $object->createCommon($user);
+		if ($result < 0) {
+			$error++;
+			$this->error = $object->error;
+			$this->errors = $object->errors;
+		}
+
+		if (!$error) {
+			// copy internal contacts
+			if ($this->copy_linked_contact($object, 'internal') < 0) {
+				$error++;
+			}
+		}
+
+		if (!$error) {
+			// copy external contacts if same company
+			if (!empty($object->socid) && property_exists($this, 'fk_soc') && $this->fk_soc == $object->socid) {
+				if ($this->copy_linked_contact($object, 'external') < 0) {
+					$error++;
+				}
+			}
+		}
+
+		unset($object->context['createfromclone']);
+
+		// End
+		if (!$error) {
+			$this->db->commit();
+			return $object;
+		} else {
+			$this->db->rollback();
+			return -1;
+		}
+	}
+
+	/**
+	 * Load object in memory from the database
+	 *
+	 * @param int    $id   Id object
+	 * @param string $ref  Ref
+	 * @return int         <0 if KO, 0 if not found, >0 if OK
+	 */
+	public function fetch($id, $ref = null)
+	{
+		$result = $this->fetchCommon($id, $ref);
+		if ($result > 0 && !empty($this->table_element_line)) {
+			$this->fetchLines();
+		}
+		return $result;
+	}
+
+	/**
+	 * Load object lines in memory from the database
+	 *
+	 * @return int         <0 if KO, 0 if not found, >0 if OK
+	 */
+	public function fetchLines()
+	{
+		$this->lines = array();
+
+		$result = $this->fetchLinesCommon();
+		return $result;
+	}
+
+
+	/**
+	 * Load list of objects in memory from the database.
+	 *
+	 * @param  string      $sortorder    Sort Order
+	 * @param  string      $sortfield    Sort field
+	 * @param  int         $limit        limit
+	 * @param  int         $offset       Offset
+	 * @param  array       $filter       Filter array. Example array('field'=>'valueforlike', 'customurl'=>...)
+	 * @param  string      $filtermode   Filter mode (AND or OR)
+	 * @return array|int                 int <0 if KO, array of pages if OK
+	 */
+	public function fetchAll($sortorder = '', $sortfield = '', $limit = 0, $offset = 0, array $filter = array(), $filtermode = 'AND')
+	{
+		global $conf;
+
+		dol_syslog(__METHOD__, LOG_DEBUG);
+
+		$records = array();
+
+		$sql = "SELECT ";
+		$sql .= $this->getFieldList('t');
+		$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
+		if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
+			$sql .= " WHERE t.entity IN (".getEntity($this->element).")";
+		} else {
+			$sql .= " WHERE 1 = 1";
+		}
+		// Manage filter
+		$sqlwhere = array();
+		if (count($filter) > 0) {
+			foreach ($filter as $key => $value) {
+				if ($key == 't.rowid') {
+					$sqlwhere[] = $key." = ".((int) $value);
+				} elseif (in_array($this->fields[$key]['type'], array('date', 'datetime', 'timestamp'))) {
+					$sqlwhere[] = $key." = '".$this->db->idate($value)."'";
+				} elseif ($key == 'customsql') {
+					$sqlwhere[] = $value;
+				} elseif (strpos($value, '%') === false) {
+					$sqlwhere[] = $key." IN (".$this->db->sanitize($this->db->escape($value)).")";
+				} else {
+					$sqlwhere[] = $key." LIKE '%".$this->db->escape($value)."%'";
+				}
+			}
+		}
+		if (count($sqlwhere) > 0) {
+			$sql .= " AND (".implode(" ".$filtermode." ", $sqlwhere).")";
+		}
+
+		if (!empty($sortfield)) {
+			$sql .= $this->db->order($sortfield, $sortorder);
+		}
+		if (!empty($limit)) {
+			$sql .= $this->db->plimit($limit, $offset);
+		}
+
+		$resql = $this->db->query($sql);
+		if ($resql) {
+			$num = $this->db->num_rows($resql);
+			$i = 0;
+			while ($i < ($limit ? min($limit, $num) : $num)) {
+				$obj = $this->db->fetch_object($resql);
+
+				$record = new self($this->db);
+				$record->setVarsFromFetchObj($obj);
+
+				$records[$record->id] = $record;
+
+				$i++;
+			}
+			$this->db->free($resql);
+
+			return $records;
+		} else {
+			$this->errors[] = 'Error '.$this->db->lasterror();
+			dol_syslog(__METHOD__.' '.join(',', $this->errors), LOG_ERR);
+
+			return -1;
+		}
+	}
+
+	/**
+	 * Update object into database
+	 *
+	 * @param  User $user      User that modifies
+	 * @param  bool $notrigger false=launch triggers after, true=disable triggers
+	 * @return int             <0 if KO, >0 if OK
+	 */
+	public function update(User $user, $notrigger = false)
+	{
+		return $this->updateCommon($user, $notrigger);
+	}
+
+	/**
+	 * Delete object in database
+	 *
+	 * @param User $user       User that deletes
+	 * @param bool $notrigger  false=launch triggers after, true=disable triggers
+	 * @return int             <0 if KO, >0 if OK
+	 */
+	public function delete(User $user, $notrigger = false)
+	{
+		return $this->deleteCommon($user, $notrigger);
+		//return $this->deleteCommon($user, $notrigger, 1);
+	}
+
+	/**
+	 *  Delete a line of object in database
+	 *
+	 *	@param  User	$user       User that delete
+	 *  @param	int		$idline		Id of line to delete
+	 *  @param 	bool 	$notrigger  false=launch triggers after, true=disable triggers
+	 *  @return int         		>0 if OK, <0 if KO
+	 */
+	public function deleteLine(User $user, $idline, $notrigger = false)
+	{
+		if ($this->status < 0) {
+			$this->error = 'ErrorDeleteLineNotAllowedByObjectStatus';
+			return -2;
+		}
+
+		return $this->deleteLineCommon($user, $idline, $notrigger);
+	}
+
+
+	/**
+	 *	Validate object
+	 *
+	 *	@param		User	$user     		User making status change
+	 *  @param		int		$notrigger		1=Does not execute triggers, 0= execute triggers
+	 *	@return  	int						<=0 if OK, 0=Nothing done, >0 if KO
+	 */
+	public function validate($user, $notrigger = 0)
+	{
+		global $conf, $langs;
+
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+
+		$error = 0;
+
+		// Protection
+		if ($this->status == self::STATUS_VALIDATED) {
+			dol_syslog(get_class($this)."::validate action abandonned: already validated", LOG_WARNING);
+			return 0;
+		}
+
+		/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->action->write))
+		 || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->action->action_advance->validate))))
+		 {
+		 $this->error='NotEnoughPermissions';
+		 dol_syslog(get_class($this)."::valid ".$this->error, LOG_ERR);
+		 return -1;
+		 }*/
+
+		$now = dol_now();
+
+		$this->db->begin();
+
+		// Define new ref
+		if (!$error && (preg_match('/^[\(]?PROV/i', $this->ref) || empty($this->ref))) { // empty should not happened, but when it occurs, the test save life
+			$num = $this->getNextNumRef();
+		} else {
+			$num = $this->ref;
+		}
+		$this->newref = $num;
+
+		if (!empty($num)) {
+			// Validate
+			$sql = "UPDATE ".MAIN_DB_PREFIX.$this->table_element;
+			$sql .= " SET ref = '".$this->db->escape($num)."',";
+			$sql .= " status = ".self::STATUS_VALIDATED;
+			if (!empty($this->fields['date_validation'])) {
+				$sql .= ", date_validation = '".$this->db->idate($now)."'";
+			}
+			if (!empty($this->fields['fk_user_valid'])) {
+				$sql .= ", fk_user_valid = ".((int) $user->id);
+			}
+			$sql .= " WHERE rowid = ".((int) $this->id);
+
+			dol_syslog(get_class($this)."::validate()", LOG_DEBUG);
+			$resql = $this->db->query($sql);
+			if (!$resql) {
+				dol_print_error($this->db);
+				$this->error = $this->db->lasterror();
+				$error++;
+			}
+
+			if (!$error && !$notrigger) {
+				// Call trigger
+				$result = $this->call_trigger('ACTION_VALIDATE', $user);
+				if ($result < 0) {
+					$error++;
+				}
+				// End call triggers
+			}
+		}
+
+		if (!$error) {
+			$this->oldref = $this->ref;
+
+			// Rename directory if dir was a temporary ref
+			if (preg_match('/^[\(]?PROV/i', $this->ref)) {
+				// Now we rename also files into index
+				$sql = 'UPDATE '.MAIN_DB_PREFIX."ecm_files set filename = CONCAT('".$this->db->escape($this->newref)."', SUBSTR(filename, ".(strlen($this->ref) + 1).")), filepath = 'action/".$this->db->escape($this->newref)."'";
+				$sql .= " WHERE filename LIKE '".$this->db->escape($this->ref)."%' AND filepath = 'action/".$this->db->escape($this->ref)."' and entity = ".$conf->entity;
+				$resql = $this->db->query($sql);
+				if (!$resql) {
+					$error++; $this->error = $this->db->lasterror();
+				}
+
+				// We rename directory ($this->ref = old ref, $num = new ref) in order not to lose the attachments
+				$oldref = dol_sanitizeFileName($this->ref);
+				$newref = dol_sanitizeFileName($num);
+				$dirsource = $conf->nav->dir_output.'/action/'.$oldref;
+				$dirdest = $conf->nav->dir_output.'/action/'.$newref;
+				if (!$error && file_exists($dirsource)) {
+					dol_syslog(get_class($this)."::validate() rename dir ".$dirsource." into ".$dirdest);
+
+					if (@rename($dirsource, $dirdest)) {
+						dol_syslog("Rename ok");
+						// Rename docs starting with $oldref with $newref
+						$listoffiles = dol_dir_list($conf->nav->dir_output.'/action/'.$newref, 'files', 1, '^'.preg_quote($oldref, '/'));
+						foreach ($listoffiles as $fileentry) {
+							$dirsource = $fileentry['name'];
+							$dirdest = preg_replace('/^'.preg_quote($oldref, '/').'/', $newref, $dirsource);
+							$dirsource = $fileentry['path'].'/'.$dirsource;
+							$dirdest = $fileentry['path'].'/'.$dirdest;
+							@rename($dirsource, $dirdest);
+						}
+					}
+				}
+			}
+		}
+
+		// Set new ref and current status
+		if (!$error) {
+			$this->ref = $num;
+			$this->status = self::STATUS_VALIDATED;
+		}
+
+		if (!$error) {
+			$this->db->commit();
+			return 1;
+		} else {
+			$this->db->rollback();
+			return -1;
+		}
+	}
+
+
+	/**
+	 *	Set draft status
+	 *
+	 *	@param	User	$user			Object user that modify
+	 *  @param	int		$notrigger		1=Does not execute triggers, 0=Execute triggers
+	 *	@return	int						<0 if KO, >0 if OK
+	 */
+	public function setDraft($user, $notrigger = 0)
+	{
+		// Protection
+		if ($this->status <= self::STATUS_DRAFT) {
+			return 0;
+		}
+
+		/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->write))
+		 || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->nav_advance->validate))))
+		 {
+		 $this->error='Permission denied';
+		 return -1;
+		 }*/
+
+		return $this->setStatusCommon($user, self::STATUS_DRAFT, $notrigger, 'ACTION_UNVALIDATE');
+	}
+
+	/**
+	 *	Set cancel status
+	 *
+	 *	@param	User	$user			Object user that modify
+	 *  @param	int		$notrigger		1=Does not execute triggers, 0=Execute triggers
+	 *	@return	int						<0 if KO, 0=Nothing done, >0 if OK
+	 */
+	public function cancel($user, $notrigger = 0)
+	{
+		// Protection
+		if ($this->status != self::STATUS_VALIDATED) {
+			return 0;
+		}
+
+		/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->write))
+		 || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->nav_advance->validate))))
+		 {
+		 $this->error='Permission denied';
+		 return -1;
+		 }*/
+
+		return $this->setStatusCommon($user, self::STATUS_CANCELED, $notrigger, 'ACTION_CANCEL');
+	}
+
+	/**
+	 *	Set back to validated status
+	 *
+	 *	@param	User	$user			Object user that modify
+	 *  @param	int		$notrigger		1=Does not execute triggers, 0=Execute triggers
+	 *	@return	int						<0 if KO, 0=Nothing done, >0 if OK
+	 */
+	public function reopen($user, $notrigger = 0)
+	{
+		// Protection
+		if ($this->status != self::STATUS_CANCELED) {
+			return 0;
+		}
+
+		/*if (! ((empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->write))
+		 || (! empty($conf->global->MAIN_USE_ADVANCED_PERMS) && ! empty($user->rights->nav->nav_advance->validate))))
+		 {
+		 $this->error='Permission denied';
+		 return -1;
+		 }*/
+
+		return $this->setStatusCommon($user, self::STATUS_VALIDATED, $notrigger, 'ACTION_REOPEN');
+	}
+
+	/**
+	 *  Return a link to the object card (with optionaly the picto)
+	 *
+	 *  @param  int     $withpicto                  Include picto in link (0=No picto, 1=Include picto into link, 2=Only picto)
+	 *  @param  string  $option                     On what the link point to ('nolink', ...)
+	 *  @param  int     $notooltip                  1=Disable tooltip
+	 *  @param  string  $morecss                    Add more css on link
+	 *  @param  int     $save_lastsearch_value      -1=Auto, 0=No save of lastsearch_values when clicking, 1=Save lastsearch_values whenclicking
+	 *  @return	string                              String with URL
+	 */
+	public function getNomUrl($withpicto = 0, $option = '', $notooltip = 0, $morecss = '', $save_lastsearch_value = -1)
+	{
+		global $conf, $langs, $hookmanager;
+
+		if (!empty($conf->dol_no_mouse_hover)) {
+			$notooltip = 1; // Force disable tooltips
+		}
+
+		$result = '';
+
+		$label = img_picto('', $this->picto).' <u>'.$langs->trans("Action").'</u>';
+		if (isset($this->status)) {
+			$label .= ' '.$this->getLibStatut(5);
+		}
+		$label .= '<br>';
+		$label .= '<b>'.$langs->trans('Ref').':</b> '.$this->ref;
+
+		$url = dol_buildpath('/nav/action_card.php', 1).'?id='.$this->id;
+
+		if ($option != 'nolink') {
+			// Add param to save lastsearch_values or not
+			$add_save_lastsearch_values = ($save_lastsearch_value == 1 ? 1 : 0);
+			if ($save_lastsearch_value == -1 && preg_match('/list\.php/', $_SERVER["PHP_SELF"])) {
+				$add_save_lastsearch_values = 1;
+			}
+			if ($url && $add_save_lastsearch_values) {
+				$url .= '&save_lastsearch_values=1';
+			}
+		}
+
+		$linkclose = '';
+		if (empty($notooltip)) {
+			if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
+				$label = $langs->trans("ShowAction");
+				$linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
+			}
+			$linkclose .= ' title="'.dol_escape_htmltag($label, 1).'"';
+			$linkclose .= ' class="classfortooltip'.($morecss ? ' '.$morecss : '').'"';
+		} else {
+			$linkclose = ($morecss ? ' class="'.$morecss.'"' : '');
+		}
+
+		if ($option == 'nolink' || empty($url)) {
+			$linkstart = '<span';
+		} else {
+			$linkstart = '<a href="'.$url.'"';
+		}
+		$linkstart .= $linkclose.'>';
+		if ($option == 'nolink' || empty($url)) {
+			$linkend = '</span>';
+		} else {
+			$linkend = '</a>';
+		}
+
+		$result .= $linkstart;
+
+		if (empty($this->showphoto_on_popup)) {
+			if ($withpicto) {
+				$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+			}
+		} else {
+			if ($withpicto) {
+				require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+
+				list($class, $module) = explode('@', $this->picto);
+				$upload_dir = $conf->$module->multidir_output[$conf->entity]."/$class/".dol_sanitizeFileName($this->ref);
+				$filearray = dol_dir_list($upload_dir, "files");
+				$filename = $filearray[0]['name'];
+				if (!empty($filename)) {
+					$pospoint = strpos($filearray[0]['name'], '.');
+
+					$pathtophoto = $class.'/'.$this->ref.'/thumbs/'.substr($filename, 0, $pospoint).'_mini'.substr($filename, $pospoint);
+					if (empty($conf->global->{strtoupper($module.'_'.$class).'_FORMATLISTPHOTOSASUSERS'})) {
+						$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><div class="photoref"><img class="photo'.$module.'" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div></div>';
+					} else {
+						$result .= '<div class="floatleft inline-block valignmiddle divphotoref"><img class="photouserphoto userphoto" alt="No photo" border="0" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$module.'&entity='.$conf->entity.'&file='.urlencode($pathtophoto).'"></div>';
+					}
+
+					$result .= '</div>';
+				} else {
+					$result .= img_object(($notooltip ? '' : $label), ($this->picto ? $this->picto : 'generic'), ($notooltip ? (($withpicto != 2) ? 'class="paddingright"' : '') : 'class="'.(($withpicto != 2) ? 'paddingright ' : '').'classfortooltip"'), 0, 0, $notooltip ? 0 : 1);
+				}
+			}
+		}
+
+		if ($withpicto != 2) {
+			$result .= $this->ref;
+		}
+
+		$result .= $linkend;
+		//if ($withpicto != 2) $result.=(($addlabel && $this->label) ? $sep . dol_trunc($this->label, ($addlabel > 1 ? $addlabel : 0)) : '');
+
+		global $action, $hookmanager;
+		$hookmanager->initHooks(array('actiondao'));
+		$parameters = array('id'=>$this->id, 'getnomurl' => &$result);
+		$reshook = $hookmanager->executeHooks('getNomUrl', $parameters, $this, $action); // Note that $action and $object may have been modified by some hooks
+		if ($reshook > 0) {
+			$result = $hookmanager->resPrint;
+		} else {
+			$result .= $hookmanager->resPrint;
+		}
+
+		return $result;
+	}
+
+	/**
+	 *  Return the label of the status
+	 *
+	 *  @param  int		$mode          0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+	 *  @return	string 			       Label of status
+	 */
+	public function getLabelStatus($mode = 0)
+	{
+		return $this->LibStatut($this->status, $mode);
+	}
+
+	/**
+	 *  Return the label of the status
+	 *
+	 *  @param  int		$mode          0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+	 *  @return	string 			       Label of status
+	 */
+	public function getLibStatut($mode = 0)
+	{
+		return $this->LibStatut($this->status, $mode);
+	}
+
+	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+	/**
+	 *  Return the status
+	 *
+	 *  @param	int		$status        Id status
+	 *  @param  int		$mode          0=long label, 1=short label, 2=Picto + short label, 3=Picto, 4=Picto + long label, 5=Short label + Picto, 6=Long label + Picto
+	 *  @return string 			       Label of status
+	 */
+	public function LibStatut($status, $mode = 0)
+	{
+		// phpcs:enable
+		if (empty($this->labelStatus) || empty($this->labelStatusShort)) {
+			global $langs;
+			//$langs->load("nav@nav");
+			$this->labelStatus[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
+			$this->labelStatus[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
+			$this->labelStatus[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
+			$this->labelStatusShort[self::STATUS_DRAFT] = $langs->transnoentitiesnoconv('Draft');
+			$this->labelStatusShort[self::STATUS_VALIDATED] = $langs->transnoentitiesnoconv('Enabled');
+			$this->labelStatusShort[self::STATUS_CANCELED] = $langs->transnoentitiesnoconv('Disabled');
+		}
+
+		$statusType = 'status'.$status;
+		//if ($status == self::STATUS_VALIDATED) $statusType = 'status1';
+		if ($status == self::STATUS_CANCELED) {
+			$statusType = 'status6';
+		}
+
+		return dolGetStatus($this->labelStatus[$status], $this->labelStatusShort[$status], '', $statusType, $mode);
+	}
+
+	/**
+	 *	Load the info information in the object
+	 *
+	 *	@param  int		$id       Id of object
+	 *	@return	void
+	 */
+	public function info($id)
+	{
+		$sql = "SELECT rowid,";
+		$sql .= " date_creation as datec, tms as datem,";
+		$sql .= " fk_user_creat, fk_user_modif";
+		$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." as t";
+		$sql .= " WHERE t.rowid = ".((int) $id);
+
+		$result = $this->db->query($sql);
+		if ($result) {
+			if ($this->db->num_rows($result)) {
+				$obj = $this->db->fetch_object($result);
+
+				$this->id = $obj->rowid;
+
+				$this->user_creation_id = $obj->fk_user_creat;
+				$this->user_modification_id = $obj->fk_user_modif;
+				if (!empty($obj->fk_user_valid)) {
+					$this->user_validation_id = $obj->fk_user_valid;
+				}
+				$this->date_creation     = $this->db->jdate($obj->datec);
+				$this->date_modification = empty($obj->datem) ? '' : $this->db->jdate($obj->datem);
+				if (!empty($obj->datev)) {
+					$this->date_validation   = empty($obj->datev) ? '' : $this->db->jdate($obj->datev);
+				}
+			}
+
+			$this->db->free($result);
+		} else {
+			dol_print_error($this->db);
+		}
+	}
+
+	/**
+	 * Initialise object with example values
+	 * Id must be 0 if object instance is a specimen
+	 *
+	 * @return void
+	 */
+	public function initAsSpecimen()
+	{
+		// Set here init that are not commonf fields
+		// $this->property1 = ...
+		// $this->property2 = ...
+
+		$this->initAsSpecimenCommon();
+	}
+
+	/**
+	 * 	Create an array of lines
+	 *
+	 * 	@return array|int		array of lines if OK, <0 if KO
+	 */
+	public function getLinesArray()
+	{
+		$this->lines = array();
+
+		$objectline = new ActionLine($this->db);
+		$result = $objectline->fetchAll('ASC', 'position', 0, 0, array('customsql'=>'fk_action = '.((int) $this->id)));
+
+		if (is_numeric($result)) {
+			$this->error = $objectline->error;
+			$this->errors = $objectline->errors;
+			return $result;
+		} else {
+			$this->lines = $result;
+			return $this->lines;
+		}
+	}
+
+	/**
+	 *  Returns the reference to the following non used object depending on the active numbering module.
+	 *
+	 *  @return string      		Object free reference
+	 */
+	public function getNextNumRef()
+	{
+		global $langs, $conf;
+		$langs->load("nav@nav");
+
+		if (empty($conf->global->NAV_ACTION_ADDON)) {
+			$conf->global->NAV_ACTION_ADDON = 'mod_action_standard';
+		}
+
+		if (!empty($conf->global->NAV_ACTION_ADDON)) {
+			$mybool = false;
+
+			$file = $conf->global->NAV_ACTION_ADDON.".php";
+			$classname = $conf->global->NAV_ACTION_ADDON;
+
+			// Include file with class
+			$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
+			foreach ($dirmodels as $reldir) {
+				$dir = dol_buildpath($reldir."core/modules/nav/");
+
+				// Load file with numbering class (if found)
+				$mybool |= @include_once $dir.$file;
+			}
+
+			if ($mybool === false) {
+				dol_print_error('', "Failed to include file ".$file);
+				return '';
+			}
+
+			if (class_exists($classname)) {
+				$obj = new $classname();
+				$numref = $obj->getNextValue($this);
+
+				if ($numref != '' && $numref != '-1') {
+					return $numref;
+				} else {
+					$this->error = $obj->error;
+					//dol_print_error($this->db,get_class($this)."::getNextNumRef ".$obj->error);
+					return "";
+				}
+			} else {
+				print $langs->trans("Error")." ".$langs->trans("ClassNotFound").' '.$classname;
+				return "";
+			}
+		} else {
+			print $langs->trans("ErrorNumberingModuleNotSetup", $this->element);
+			return "";
+		}
+	}
+
+	/**
+	 *  Create a document onto disk according to template module.
+	 *
+	 *  @param	    string		$modele			Force template to use ('' to not force)
+	 *  @param		Translate	$outputlangs	objet lang a utiliser pour traduction
+	 *  @param      int			$hidedetails    Hide details of lines
+	 *  @param      int			$hidedesc       Hide description
+	 *  @param      int			$hideref        Hide ref
+	 *  @param      null|array  $moreparams     Array to provide more information
+	 *  @return     int         				0 if KO, 1 if OK
+	 */
+	public function generateDocument($modele, $outputlangs, $hidedetails = 0, $hidedesc = 0, $hideref = 0, $moreparams = null)
+	{
+		global $conf, $langs;
+
+		$result = 0;
+		$includedocgeneration = 0;
+
+		$langs->load("nav@nav");
+
+		if (!dol_strlen($modele)) {
+			$modele = 'standard_action';
+
+			if (!empty($this->model_pdf)) {
+				$modele = $this->model_pdf;
+			} elseif (!empty($conf->global->ACTION_ADDON_PDF)) {
+				$modele = $conf->global->ACTION_ADDON_PDF;
+			}
+		}
+
+		$modelpath = "core/modules/nav/doc/";
+
+		if ($includedocgeneration && !empty($modele)) {
+			$result = $this->commonGenerateDocument($modelpath, $modele, $outputlangs, $hidedetails, $hidedesc, $hideref, $moreparams);
+		}
+
+		return $result;
+	}
+
+	/**
+	 * Action executed by scheduler
+	 * CAN BE A CRON TASK. In such a case, parameters come from the schedule job setup field 'Parameters'
+	 * Use public function doScheduledJob($param1, $param2, ...) to get parameters
+	 *
+	 * @return	int			0 if OK, <>0 if KO (this function is used also by cron so only 0 is OK)
+	 */
+	public function doScheduledJob()
+	{
+		global $conf, $langs;
+
+		//$conf->global->SYSLOG_FILE = 'DOL_DATA_ROOT/dolibarr_mydedicatedlofile.log';
+
+		$error = 0;
+		$this->output = '';
+		$this->error = '';
+
+		dol_syslog(__METHOD__, LOG_DEBUG);
+
+		$now = dol_now();
+
+		$this->db->begin();
+
+		// ...
+
+		$this->db->commit();
+
+		return $error;
+	}
+}
+
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php';
+
+/**
+ * Class ActionLine. You can also remove this and generate a CRUD class for lines objects.
+ */
+class ActionLine extends CommonObjectLine
+{
+	// To complete with content of an object ActionLine
+	// We should have a field rowid, fk_action and position
+
+	/**
+	 * @var int  Does object support extrafields ? 0=No, 1=Yes
+	 */
+	public $isextrafieldmanaged = 0;
+
+	/**
+	 * Constructor
+	 *
+	 * @param DoliDb $db Database handler
+	 */
+	public function __construct(DoliDB $db)
+	{
+		$this->db = $db;
+	}
+}

+ 417 - 0
custom/nav/class/api_nav.class.php

@@ -0,0 +1,417 @@
+<?php
+/* Copyright (C) 2015   Jean-François Ferry     <jfefe@aternatik.fr>
+ * Copyright (C) 2023 Deák Ferenc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+use Luracast\Restler\RestException;
+
+dol_include_once('/nav/class/action.class.php');
+
+
+
+/**
+ * \file    nav/class/api_nav.class.php
+ * \ingroup nav
+ * \brief   File for API management of action.
+ */
+
+/**
+ * API class for nav action
+ *
+ * @access protected
+ * @class  DolibarrApiAccess {@requires user,external}
+ */
+class NavApi extends DolibarrApi
+{
+	/**
+	 * @var Action $action {@type Action}
+	 */
+	public $action;
+
+	/**
+	 * Constructor
+	 *
+	 * @url     GET /
+	 *
+	 */
+	public function __construct()
+	{
+		global $db;
+		$this->db = $db;
+		$this->action = new Action($this->db);
+	}
+
+	/**
+	 * ...
+	 *
+	 * Return an array with product information.
+	 *
+	 *
+	 * @param 	int 	$limit ...
+	 * @return array|mixed Data without useless information
+	 *
+	 * @url GET syncNAV
+	 *
+	 * @throws RestException 401
+	 * @throws RestException 403
+	 * @throws RestException 404
+	 */
+	public function syncNAV($limit=100)
+	{
+		require_once(DOL_DOCUMENT_ROOT.'/custom/nav/class/nav.class.php');
+		$nav = new Nav($this->db);
+		$nav->syncNAV($limit);
+		return [$nav->output,$nav->error];
+	}
+
+	/**
+	 * Get properties of a action object
+	 *
+	 * Return an array with action informations
+	 *
+	 * @param 	int 	$id ID of action
+	 * @return 	array|mixed data without useless information
+	 *
+	 * @url	GET actions/{id}
+	 *
+	 * @throws RestException 401 Not allowed
+	 * @throws RestException 404 Not found
+	 */
+	public function get($id)
+	{
+		if (!DolibarrApiAccess::$user->rights->nav->action->read) {
+			throw new RestException(401);
+		}
+
+		$result = $this->action->fetch($id);
+		if (!$result) {
+			throw new RestException(404, 'Action not found');
+		}
+
+		if (!DolibarrApi::_checkAccessToResource('action', $this->action->id, 'nav_action')) {
+			throw new RestException(401, 'Access to instance id='.$this->action->id.' of object not allowed for login '.DolibarrApiAccess::$user->login);
+		}
+
+		return $this->_cleanObjectDatas($this->action);
+	}
+
+
+	/**
+	 * List actions
+	 *
+	 * Get a list of actions
+	 *
+	 * @param string	       $sortfield	        Sort field
+	 * @param string	       $sortorder	        Sort order
+	 * @param int		       $limit		        Limit for list
+	 * @param int		       $page		        Page number
+	 * @param string           $sqlfilters          Other criteria to filter answers separated by a comma. Syntax example "(t.ref:like:'SO-%') and (t.date_creation:<:'20160101')"
+	 * @return  array                               Array of order objects
+	 *
+	 * @throws RestException
+	 *
+	 * @url	GET /actions/
+	 */
+	public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '')
+	{
+		global $db, $conf;
+
+		$obj_ret = array();
+		$tmpobject = new Action($this->db);
+
+		if (!DolibarrApiAccess::$user->rights->nav->action->read) {
+			throw new RestException(401);
+		}
+
+		$socid = DolibarrApiAccess::$user->socid ? DolibarrApiAccess::$user->socid : '';
+
+		$restrictonsocid = 0; // Set to 1 if there is a field socid in table of object
+
+		// If the internal user must only see his customers, force searching by him
+		$search_sale = 0;
+		if ($restrictonsocid && !DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) {
+			$search_sale = DolibarrApiAccess::$user->id;
+		}
+
+		$sql = "SELECT t.rowid";
+		if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) {
+			$sql .= ", sc.fk_soc, sc.fk_user"; // We need these fields in order to filter by sale (including the case where the user can only see his prospects)
+		}
+		$sql .= " FROM ".MAIN_DB_PREFIX.$tmpobject->table_element." as t";
+
+		if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) {
+			$sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We need this table joined to the select in order to filter by sale
+		}
+		$sql .= " WHERE 1 = 1";
+
+		// Example of use $mode
+		//if ($mode == 1) $sql.= " AND s.client IN (1, 3)";
+		//if ($mode == 2) $sql.= " AND s.client IN (2, 3)";
+
+		if ($tmpobject->ismultientitymanaged) {
+			$sql .= ' AND t.entity IN ('.getEntity($tmpobject->element).')';
+		}
+		if ($restrictonsocid && (!DolibarrApiAccess::$user->rights->societe->client->voir && !$socid) || $search_sale > 0) {
+			$sql .= " AND t.fk_soc = sc.fk_soc";
+		}
+		if ($restrictonsocid && $socid) {
+			$sql .= " AND t.fk_soc = ".((int) $socid);
+		}
+		if ($restrictonsocid && $search_sale > 0) {
+			$sql .= " AND t.rowid = sc.fk_soc"; // Join for the needed table to filter by sale
+		}
+		// Insert sale filter
+		if ($restrictonsocid && $search_sale > 0) {
+			$sql .= " AND sc.fk_user = ".((int) $search_sale);
+		}
+		if ($sqlfilters) {
+			$errormessage = '';
+			if (!DolibarrApi::_checkFilters($sqlfilters, $errormessage)) {
+				throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage);
+			}
+			$regexstring = '\(([^:\'\(\)]+:[^:\'\(\)]+:[^\(\)]+)\)';
+			$sql .= " AND (".preg_replace_callback('/'.$regexstring.'/', 'DolibarrApi::_forge_criteria_callback', $sqlfilters).")";
+		}
+
+		$sql .= $this->db->order($sortfield, $sortorder);
+		if ($limit) {
+			if ($page < 0) {
+				$page = 0;
+			}
+			$offset = $limit * $page;
+
+			$sql .= $this->db->plimit($limit + 1, $offset);
+		}
+
+		$result = $this->db->query($sql);
+		$i = 0;
+		if ($result) {
+			$num = $this->db->num_rows($result);
+			while ($i < $num) {
+				$obj = $this->db->fetch_object($result);
+				$tmp_object = new Action($this->db);
+				if ($tmp_object->fetch($obj->rowid)) {
+					$obj_ret[] = $this->_cleanObjectDatas($tmp_object);
+				}
+				$i++;
+			}
+		} else {
+			throw new RestException(503, 'Error when retrieving action list: '.$this->db->lasterror());
+		}
+		if (!count($obj_ret)) {
+			throw new RestException(404, 'No action found');
+		}
+		return $obj_ret;
+	}
+
+	/**
+	 * Create action object
+	 *
+	 * @param array $request_data   Request datas
+	 * @return int  ID of action
+	 *
+	 * @throws RestException
+	 *
+	 * @url	POST actions/
+	 */
+	public function post($request_data = null)
+	{
+		if (!DolibarrApiAccess::$user->rights->nav->action->write) {
+			throw new RestException(401);
+		}
+
+		// Check mandatory fields
+		$result = $this->_validate($request_data);
+
+		foreach ($request_data as $field => $value) {
+			$this->action->$field = $this->_checkValForAPI($field, $value, $this->action);
+		}
+
+		// Clean data
+		// $this->action->abc = sanitizeVal($this->action->abc, 'alphanohtml');
+
+		if ($this->action->create(DolibarrApiAccess::$user)<0) {
+			throw new RestException(500, "Error creating Action", array_merge(array($this->action->error), $this->action->errors));
+		}
+		return $this->action->id;
+	}
+
+	/**
+	 * Update action
+	 *
+	 * @param int   $id             Id of action to update
+	 * @param array $request_data   Datas
+	 * @return int
+	 *
+	 * @throws RestException
+	 *
+	 * @url	PUT actions/{id}
+	 */
+	public function put($id, $request_data = null)
+	{
+		if (!DolibarrApiAccess::$user->rights->nav->action->write) {
+			throw new RestException(401);
+		}
+
+		$result = $this->action->fetch($id);
+		if (!$result) {
+			throw new RestException(404, 'Action not found');
+		}
+
+		if (!DolibarrApi::_checkAccessToResource('action', $this->action->id, 'nav_action')) {
+			throw new RestException(401, 'Access to instance id='.$this->action->id.' of object not allowed for login '.DolibarrApiAccess::$user->login);
+		}
+
+		foreach ($request_data as $field => $value) {
+			if ($field == 'id') {
+				continue;
+			}
+			$this->action->$field = $this->_checkValForAPI($field, $value, $this->action);
+		}
+
+		// Clean data
+		// $this->action->abc = sanitizeVal($this->action->abc, 'alphanohtml');
+
+		if ($this->action->update(DolibarrApiAccess::$user, false) > 0) {
+			return $this->get($id);
+		} else {
+			throw new RestException(500, $this->action->error);
+		}
+	}
+
+	/**
+	 * Delete action
+	 *
+	 * @param   int     $id   Action ID
+	 * @return  array
+	 *
+	 * @throws RestException
+	 *
+	 * @url	DELETE actions/{id}
+	 */
+	public function delete($id)
+	{
+		if (!DolibarrApiAccess::$user->rights->nav->action->delete) {
+			throw new RestException(401);
+		}
+		$result = $this->action->fetch($id);
+		if (!$result) {
+			throw new RestException(404, 'Action not found');
+		}
+
+		if (!DolibarrApi::_checkAccessToResource('action', $this->action->id, 'nav_action')) {
+			throw new RestException(401, 'Access to instance id='.$this->action->id.' of object not allowed for login '.DolibarrApiAccess::$user->login);
+		}
+
+		if (!$this->action->delete(DolibarrApiAccess::$user)) {
+			throw new RestException(500, 'Error when deleting Action : '.$this->action->error);
+		}
+
+		return array(
+			'success' => array(
+				'code' => 200,
+				'message' => 'Action deleted'
+			)
+		);
+	}
+
+
+	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.PublicUnderscore
+	/**
+	 * Clean sensible object datas
+	 *
+	 * @param   Object  $object     Object to clean
+	 * @return  Object              Object with cleaned properties
+	 */
+	protected function _cleanObjectDatas($object)
+	{
+		// phpcs:enable
+		$object = parent::_cleanObjectDatas($object);
+
+		unset($object->rowid);
+		unset($object->canvas);
+
+		/*unset($object->name);
+		unset($object->lastname);
+		unset($object->firstname);
+		unset($object->civility_id);
+		unset($object->statut);
+		unset($object->state);
+		unset($object->state_id);
+		unset($object->state_code);
+		unset($object->region);
+		unset($object->region_code);
+		unset($object->country);
+		unset($object->country_id);
+		unset($object->country_code);
+		unset($object->barcode_type);
+		unset($object->barcode_type_code);
+		unset($object->barcode_type_label);
+		unset($object->barcode_type_coder);
+		unset($object->total_ht);
+		unset($object->total_tva);
+		unset($object->total_localtax1);
+		unset($object->total_localtax2);
+		unset($object->total_ttc);
+		unset($object->fk_account);
+		unset($object->comments);
+		unset($object->note);
+		unset($object->mode_reglement_id);
+		unset($object->cond_reglement_id);
+		unset($object->cond_reglement);
+		unset($object->shipping_method_id);
+		unset($object->fk_incoterms);
+		unset($object->label_incoterms);
+		unset($object->location_incoterms);
+		*/
+
+		// If object has lines, remove $db property
+		if (isset($object->lines) && is_array($object->lines) && count($object->lines) > 0) {
+			$nboflines = count($object->lines);
+			for ($i = 0; $i < $nboflines; $i++) {
+				$this->_cleanObjectDatas($object->lines[$i]);
+
+				unset($object->lines[$i]->lines);
+				unset($object->lines[$i]->note);
+			}
+		}
+
+		return $object;
+	}
+
+	/**
+	 * Validate fields before create or update object
+	 *
+	 * @param	array		$data   Array of data to validate
+	 * @return	array
+	 *
+	 * @throws	RestException
+	 */
+	private function _validate($data)
+	{
+		$action = array();
+		foreach ($this->action->fields as $field => $propfield) {
+			if (in_array($field, array('rowid', 'entity', 'date_creation', 'tms', 'fk_user_creat')) || $propfield['notnull'] != 1) {
+				continue; // Not a mandatory field
+			}
+			if (!isset($data[$field])) {
+				throw new RestException(400, "$field field missing");
+			}
+			$action[$field] = $data[$field];
+		}
+		return $action;
+	}
+}

+ 480 - 0
custom/nav/class/nav.class.php

@@ -0,0 +1,480 @@
+<?php
+
+class Nav
+{
+	public $NavReporter = [];
+	protected $navEntity = [];
+
+	public function __construct($db)
+	{
+		$this->db = $db;
+		$this->navEntites();
+		$this->init();
+	}
+
+
+
+	public function init()
+	{
+		global $conf, $langs, $mysoc;
+		$files = [
+			'Config.php',
+			'BaseRequestXml.php',
+			'ManageInvoiceRequestXml.php',
+			'XmlUtil.php',
+			'Util.php',
+			'BaseRequestXml.php',
+			'TokenExchangeRequestXml.php',
+			'XsdValidationError.php',
+			'Xsd.php',
+			'InvoiceOperations.php',
+			'Connector.php',
+			'RequestIdGeneratorInterface.php',
+			'RequestIdGeneratorBasic.php',
+			'Reporter.php',
+			'BaseExceptionResponse.php',
+			'GeneralErrorResponse.php'
+		];
+		foreach ($files as $k => $v) {
+			require_once DOL_DOCUMENT_ROOT . '/custom/nav/lib/NavOnlineInvoice/' . $v;
+		}
+		// $vatID = explode("-",$conf->global->MAIN_INFO_TVAINTRA);
+		$envDEF = [
+			// 'NAV_USER' => 'xrybkjhakidbl5a',
+			// 'NAV_PASS' => 'eZPDV9Jx6biQHfi',
+			// 'NAV_VAT_NUMBER' => '26646970',
+			// 'NAV_VAT_CODE' => '2',
+			// 'NAV_VAT_COUNTYCODE' => '13',
+			// 'NAV_SIGN_KEY' => '34-b7c5-8f436e541dc33ZQFSD2GZI0E',
+			// 'NAV_EXCHANGE_KEY' => '5b603ZQFSD2G1W1N',
+
+			// 'NAV_USER' => 'xrybkjhakidbl5a',
+			// 'NAV_PASS' => 'eZPDV9Jx6biQHfi!!+',
+			// 'NAV_VAT_NUMBER' => (isset($vatID[0]))?$vatID[0]:'',
+			// 'NAV_VAT_CODE' => (isset($vatID[1]))?$vatID[1]:'',
+			// 'NAV_VAT_COUNTYCODE' => (isset($vatID[2]))?$vatID[2]:'',
+			// 'NAV_SIGN_KEY' => '34-b7c5-8f436e541dc33ZQFSD2GZI0E',
+			// 'NAV_EXCHANGE_KEY' => '5b603ZQFSD2G1W1N',
+
+			// 'NAV_SOFTWARE_ID' => 'Dolibarr-NAV-v0.01',
+			'NAV_SOFTWARE_ID' => 'DOLIBARR-NAV-V0001',
+			'NAV_SOFTWARE_NAME' => 'Dolibarr',
+			'NAV_SOFTWARE_OPERATION' => 'ONLINE_SERVICE',
+			'NAV_SOFTWARE_MAIN_VERSION' => 'v16.0.1', //$conf->global->MAIN_VERSION_LAST_UPGRADE
+			'NAV_SOFTWARE_DEVELOPER_CONTACT' => 'dolibarr.hu',
+			'NAV_SOFTWARE_DEVELOPER_NAME' => '-',
+			'NAV_SOFTWARE_DEVELOPER_COUNTRY_CODE' => 'HU',
+			'NAV_SOFTWARE_DEVELOPER_TAX_NUMBER' => '-',
+
+
+			//'NAV_URL' => "https://api-test.onlineszamla.nav.gov.hu/invoiceService/v3", // teszt
+
+			// 'NAV_URL' => "https://api.onlineszamla.nav.gov.hu/invoiceService/v3", // éles
+		];
+
+
+		//!!!
+		// $vat = explode("-",$mysoc->tva_intra);
+		// $_ENV['NAV_VAT_NUMBER'] = $vat[0];
+		// $_ENV['NAV_VAT_CODE'] = $vat[1];
+		// $_ENV['NAV_VAT_COUNTYCODE'] = $vat[2];
+
+		foreach ($envDEF as $k => $v) {
+			if (isset($conf->global) && isset($conf->global->$k)) {
+				$_ENV[$k] = $conf->global->$k;
+			} else {
+				$_ENV[$k] = (isset($_ENV[$k])) ? $_ENV[$k] : $v;
+			}
+		}
+
+		// $this->userData = array(
+		// "login" => $_ENV['NAV_USER'],
+		// "password" => $_ENV['NAV_PASS'],
+		// //"passwordHash" => "...", // Opcionális, a jelszó már SHA512 hashelt változata. Amennyiben létezik ez a változó, akkor az authentikáció során ezt használja
+		// "taxNumber" => $_ENV['NAV_VAT_NUMBER'], //"12345678",
+		// "signKey" => $_ENV['NAV_SIGN_KEY'], //"sign-key",
+		// "exchangeKey" => $_ENV['NAV_EXCHANGE_KEY'], // "exchange-key",
+		// );
+
+		$this->softwareData = array(
+			"softwareId" => "" . $_ENV['NAV_SOFTWARE_ID'],
+			"softwareName" => $_ENV['NAV_SOFTWARE_NAME'],
+			"softwareOperation" =>  $_ENV['NAV_SOFTWARE_OPERATION'], //"ONLINE_SERVICE",
+			"softwareMainVersion" =>  $_ENV['NAV_SOFTWARE_MAIN_VERSION'], //"string",
+			"softwareDevName" =>  $_ENV['NAV_SOFTWARE_DEVELOPER_NAME'], //"string",
+			"softwareDevContact" =>  $_ENV['NAV_SOFTWARE_DEVELOPER_CONTACT'], //"string",
+			"softwareDevCountryCode" =>  $_ENV['NAV_SOFTWARE_DEVELOPER_COUNTRY_CODE'], //"HU",
+			"softwareDevTaxNumber" =>  $_ENV['NAV_SOFTWARE_DEVELOPER_TAX_NUMBER'], //"string",
+		);
+		foreach ($this->navEntity as $k => $v) {
+			$this->apiUrl = $v['NAV_URL'];
+			if (strpos($this->apiUrl, "api-test") !== false) {
+				$this->userData = array(
+					"login" => 'xrybkjhakidbl5a', 					//UMS technikai felhasználó teszthez
+					"password" => 'eZPDV9Jx6biQHfi!!+',				//UMS technikai felhasználó teszthez
+					"taxNumber" => '26646970', 						//UMS technikai felhasználó teszthez
+					"signKey" => '34-b7c5-8f436e541dc33ZQFSD2GZI0E', //UMS technikai felhasználó teszthez
+					"exchangeKey" => '5b603ZQFSD2G1W1N', 			//UMS technikai felhasználó teszthez
+				);
+			} else {
+				$this->userData = array(
+					"login" => $v['NAV_USER'],
+					"password" => $v['NAV_PASS'],
+					//"passwordHash" => "...", // Opcionális, a jelszó már SHA512 hashelt változata. Amennyiben létezik ez a változó, akkor az authentikáció során ezt használja
+					"taxNumber" => $v['NAV_VAT_NUMBER'], //"12345678",
+					"signKey" => $v['NAV_SIGN_KEY'], //"sign-key",
+					"exchangeKey" => $v['NAV_EXCHANGE_KEY'], // "exchange-key",
+				);
+			}
+			$config = new NavOnlineInvoice\Config($this->apiUrl, $this->userData, $this->softwareData);
+			$config->setCurlTimeout(70); // 70 másodperces cURL timeout (NAV szerver hívásnál), opcionális
+			$this->NavReporter[$k] = new NavOnlineInvoice\Reporter($config);
+		}
+
+
+		// "Connection error. CURL error code: 60" hiba esetén add hozzá a következő sort:
+		// $config->verifySSL = false;
+
+
+	}
+
+	public function invoiceXML($invoice)
+	{
+		//print_r($invoice);exit;
+		global $conf, $langs;
+		$xmlstr = '<?xml version="1.0" encoding="UTF-8"?><InvoiceData 
+			xmlns="http://schemas.nav.gov.hu/OSA/3.0/data" 
+			xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+			xmlns:base="http://schemas.nav.gov.hu/OSA/3.0/base" 
+			xmlns:common="http://schemas.nav.gov.hu/NTCA/1.0/common" 
+			xsi:schemaLocation="http://schemas.nav.gov.hu/OSA/3.0/data invoiceData.xsd" >';
+		$xmlstr .= '';
+		$xmlstr .= '</InvoiceData>';
+
+		$xml = new SimpleXMLElement($xmlstr);
+		// $ns = $xml->getNamespaces(true);
+		// print_r($ns);exit;
+		// $xml->addAttribute('invoiceNumber',$invoice->newref);
+		if (!isset($invoice->newref) || !$invoice->newref) {
+			$xml->addChild('invoiceNumber', $invoice->ref);
+		} else {
+			$xml->addChild('invoiceNumber', $invoice->newref);
+		}
+
+		// $xml->addChild('invoiceIssueDate',date("Y-m-d",$invoice->date_modification));
+		$xml->addChild('invoiceIssueDate', date("Y-m-d"));
+		$xml->addChild('completenessIndicator', 'false');
+
+		$invoiceMain = $xml->addChild('invoiceMain');
+		// $invoiceMain->addAttribute('',$invoice[]);
+		$invoiceXml = $invoiceMain->addChild('invoice');
+		if ($invoice->fk_facture_source != '' && $invoice->type == 2) {
+			$invoiceReference = $invoiceXml->addChild('invoiceReference');
+			$invoiceReference->addChild('originalInvoiceNumber', $this->getSourceRef($invoice->fk_facture_source));
+			$invoiceReference->addChild('modifyWithoutMaster', 'false');
+			$invoiceReference->addChild('modificationIndex', 1);
+		}
+		// $invoice->addAttribute('',$invoice[]);
+		$invoiceHead = $invoiceXml->addChild('invoiceHead');
+		$supplierInfo = $invoiceHead->addChild('supplierInfo');
+		$supplierInfo->addChild('supplierTaxNumber');
+		//$supplierInfo->supplierTaxNumber[0]->addChild('base:taxpayerId',$_ENV['NAV_VAT_NUMBER'],"http://schemas.nav.gov.hu/OSA/3.0/base");
+		//$supplierInfo->supplierTaxNumber[0]->addChild('base:vatCode',$_ENV['NAV_VAT_CODE'],"http://schemas.nav.gov.hu/OSA/3.0/base");
+		//$supplierInfo->supplierTaxNumber[0]->addChild('base:countyCode',$_ENV['NAV_VAT_COUNTYCODE'],"http://schemas.nav.gov.hu/OSA/3.0/base");
+		$supplierInfo->supplierTaxNumber[0]->addChild('base:taxpayerId', $this->navEntity['e_' . $invoice->entity]['NAV_VAT_NUMBER'], "http://schemas.nav.gov.hu/OSA/3.0/base");
+		$supplierInfo->supplierTaxNumber[0]->addChild('base:vatCode', $this->navEntity['e_' . $invoice->entity]['NAV_VAT_CODE'], "http://schemas.nav.gov.hu/OSA/3.0/base");
+		$supplierInfo->supplierTaxNumber[0]->addChild('base:countyCode', $this->navEntity['e_' . $invoice->entity]['NAV_VAT_COUNTYCODE'], "http://schemas.nav.gov.hu/OSA/3.0/base");
+		$supplierInfo->addChild('supplierName', $this->navEntity['e_' . $invoice->entity]['MAIN_INFO_SOCIETE_NOM']);
+		$supplierInfo->addChild('supplierAddress');
+		$simpleAddress = $supplierInfo->supplierAddress[0]->addChild('base:simpleAddress', null, "http://schemas.nav.gov.hu/OSA/3.0/base");
+		$simpleAddress->addChild('base:countryCode', 'HU', "http://schemas.nav.gov.hu/OSA/3.0/base");
+		$simpleAddress->addChild('base:postalCode', $this->navEntity['e_' . $invoice->entity]['MAIN_INFO_SOCIETE_ZIP'], "http://schemas.nav.gov.hu/OSA/3.0/base");
+		$simpleAddress->addChild('base:city', $this->navEntity['e_' . $invoice->entity]['MAIN_INFO_SOCIETE_TOWN'], "http://schemas.nav.gov.hu/OSA/3.0/base");
+		$simpleAddress->addChild('base:additionalAddressDetail', $this->navEntity['e_' . $invoice->entity]['MAIN_INFO_SOCIETE_ADDRESS'], "http://schemas.nav.gov.hu/OSA/3.0/base");
+
+		$customerInfo = $invoiceHead->addChild('customerInfo');
+		$customerInfo->addChild('customerVatStatus', 'DOMESTIC'); //... !!!
+		$customerInfo->addChild('customerVatData');
+		$customerInfo->customerVatData[0]->addChild('customerTaxNumber');
+		$customerInfo->customerVatData[0]->customerTaxNumber[0]->addChild('base:taxpayerId', '12345678', "http://schemas.nav.gov.hu/OSA/3.0/base");
+		// $customerInfo->customerVatData[0]->customerTaxNumber[0]->addChild('base:taxpayerId',$invoice->thirdparty->,"http://schemas.nav.gov.hu/OSA/3.0/base");
+
+		$customerInfo->addChild('customerName', $invoice->thirdparty->name);
+		$customerInfo->addChild('customerAddress');
+		$simpleAddress2 = $customerInfo->customerAddress[0]->addChild('base:simpleAddress', null, "http://schemas.nav.gov.hu/OSA/3.0/base");
+		$simpleAddress2->addChild('base:countryCode', $invoice->thirdparty->country_code, "http://schemas.nav.gov.hu/OSA/3.0/base");
+		$simpleAddress2->addChild('base:postalCode', $invoice->thirdparty->zip, "http://schemas.nav.gov.hu/OSA/3.0/base");
+		$simpleAddress2->addChild('base:city', $invoice->thirdparty->town, "http://schemas.nav.gov.hu/OSA/3.0/base");
+		$simpleAddress2->addChild('base:additionalAddressDetail', $invoice->thirdparty->address, "http://schemas.nav.gov.hu/OSA/3.0/base");
+
+		$invoiceDetail = $invoiceHead->addChild('invoiceDetail');
+		//...!!!
+		$invoiceDetail->addChild('invoiceCategory', 'NORMAL');
+		$invoiceDetail->addChild('invoiceDeliveryDate', ($invoice->delivery_date) ? date('Y-m-d', $invoice->delivery_date) : date('Y-m-d'));
+		$invoiceDetail->addChild('currencyCode', $invoice->multicurrency_code);
+		$multicurrency_tx = $invoice->multicurrency_code == 'HUF' ? '1' : number_format(1 / $invoice->multicurrency_tx, 6, '.', '');
+		$invoiceDetail->addChild('exchangeRate', $multicurrency_tx);
+		$paymentMethod = $this->getPaymentMethod($invoice->mode_reglement_code);
+		$invoiceDetail->addChild('paymentMethod', $paymentMethod);
+		$invoiceDetail->addChild('paymentDate', date('Y-m-d', (int)$invoice->date_lim_reglement));
+		$invoiceDetail->addChild('invoiceAppearance', 'PAPER');
+		$invoiceLines = $invoiceXml->addChild('invoiceLines');
+		$invoiceLine = [];
+		$vatrateArray = [];
+		$invoiceLines->addChild('mergedItemIndicator', 'false');
+		foreach ($invoice->lines as $k => $line) {
+			$invoiceLine[$k] = $invoiceLines->addChild('line');
+			$invoiceLine[$k]->addChild('lineNumber', $k + 1);
+			if ($invoice->fk_facture_source != '' && $invoice->type == 2) {
+				$lineModificationReference = $invoiceLine[$k]->addChild('lineModificationReference');
+				$lineModificationReference->addChild('lineNumberReference', $line->rowid);
+				$lineModificationReference->addChild('lineOperation', 'CREATE');
+			}
+			$invoiceLine[$k]->addChild('productCodes');
+			$invoiceLine[$k]->productCodes[0]->addChild('productCode');
+			$invoiceLine[$k]->productCodes[0]->productCode[0]->addChild('productCodeCategory', 'OWN');
+			$invoiceLine[$k]->productCodes[0]->productCode[0]->addChild('productCodeValue', '137');
+			$invoiceLine[$k]->addChild('lineExpressionIndicator', 'true');
+			$type = 'SERVICE';
+			// $desc = $line->desc;
+			$desc = ($line->libelle) ? $line->libelle : $desc;
+			if ($line->product_type == 0) {
+				$type = 'PRODUCT';
+				// $desc = $line->product_label;
+			}
+
+			if ($desc == '') {
+				$desc = '__';
+			}
+			$desc = str_replace('&', '&amp;', $desc);
+			// elseif($desc = $line->desc){}
+			$invoiceLine[$k]->addChild('lineNatureIndicator', $type);
+			$invoiceLine[$k]->addChild('lineDescription', $desc);
+			$invoiceLine[$k]->addChild('quantity', $line->qty);
+			$invoiceLine[$k]->addChild('unitOfMeasure', 'PIECE');
+			$invoiceLine[$k]->addChild('unitPrice', $line->subprice);
+			$invoiceLine[$k]->addChild('unitPriceHUF', $line->total_ht);
+			$invoiceLine[$k]->addChild('lineAmountsNormal');
+			$invoiceLine[$k]->lineAmountsNormal[0]->addChild('lineNetAmountData');
+			$invoiceLine[$k]->lineAmountsNormal[0]->lineNetAmountData[0]->addChild('lineNetAmount', round($line->multicurrency_total_ht, 2));
+			$vatrateArray[number_format($line->tva_tx, 0)]['m_ht'] += $line->multicurrency_total_ht;
+			$invoiceLine[$k]->lineAmountsNormal[0]->lineNetAmountData[0]->addChild('lineNetAmountHUF', round($line->total_ht, 2));
+			$vatrateArray[number_format($line->tva_tx, 0)]['ht'] += $line->total_ht;
+
+			$invoiceLine[$k]->lineAmountsNormal[0]->addChild('lineVatRate');
+			$invoiceLine[$k]->lineAmountsNormal[0]->lineVatRate[0]->addChild('vatPercentage', round((float)$line->tva_tx / 100, 2));
+
+			$invoiceLine[$k]->lineAmountsNormal[0]->addChild('lineVatData');
+			$invoiceLine[$k]->lineAmountsNormal[0]->lineVatData[0]->addChild('lineVatAmount', round($line->multicurrency_total_tva, 2));
+			$vatrateArray[number_format($line->tva_tx, 0)]['m_tva'] += $line->multicurrency_total_tva;
+			$invoiceLine[$k]->lineAmountsNormal[0]->lineVatData[0]->addChild('lineVatAmountHUF', round($line->total_tva, 2));
+			$vatrateArray[number_format($line->tva_tx, 0)]['tva'] += $line->total_tva;
+
+			$invoiceLine[$k]->lineAmountsNormal[0]->addChild('lineGrossAmountData');
+			$invoiceLine[$k]->lineAmountsNormal[0]->lineGrossAmountData[0]->addChild('lineGrossAmountNormal', round($line->multicurrency_total_ttc, 2));
+			$invoiceLine[$k]->lineAmountsNormal[0]->lineGrossAmountData[0]->addChild('lineGrossAmountNormalHUF', round($line->total_ttc, 2));
+		}
+
+		//print_r($vatrateArray);exit;
+
+		$invoiceSummary = $invoiceXml->addChild('invoiceSummary');
+		$summaryNormal = $invoiceSummary->addChild('summaryNormal');
+
+		$i = 1;
+		foreach ($vatrateArray as $vatKey => $vatValue) {
+			$percentage = strlen((string) $vatKey) > 1 ? '0.' . $vatKey : '0.0' . $vatKey;
+			${"summaryByVatRate" . $i} = $summaryNormal->addChild('summaryByVatRate');
+			${"vatRate" . $i} = ${"summaryByVatRate" . $i}->addChild('vatRate');
+			${"vatRate" . $i}->addChild('vatPercentage', $percentage);
+
+			${"vatRateNetData" . $i} = ${"summaryByVatRate" . $i}->addChild('vatRateNetData');
+			${"vatRateNetData" . $i}->addChild('vatRateNetAmount', round($vatValue['m_ht'], 2));
+			${"vatRateNetData" . $i}->addChild('vatRateNetAmountHUF', round($vatValue['ht'], 2));
+
+			${"vatRateVatData" . $i} = ${"summaryByVatRate" . $i}->addChild('vatRateVatData');
+			${"vatRateVatData" . $i}->addChild('vatRateVatAmount', round($vatValue['m_tva'], 2));
+			${"vatRateVatData" . $i}->addChild('vatRateVatAmountHUF', round($vatValue['tva'], 2));
+
+			${"vatRateGrossData" . $i} = ${"summaryByVatRate" . $i}->addChild('vatRateGrossData');
+			${"vatRateGrossData" . $i}->addChild('vatRateGrossAmount', round($vatValue['m_ht'] + $vatValue['m_tva'], 2));
+			${"vatRateGrossData" . $i}->addChild('vatRateGrossAmountHUF', round($vatValue['ht'] + $vatValue['tva'], 2));
+			$i++;
+		}
+
+		$summaryNormal->addChild('invoiceNetAmount', round($invoice->multicurrency_total_ht, 2));
+		$summaryNormal->addChild('invoiceNetAmountHUF', round($invoice->total_ht, 2));
+		$summaryNormal->addChild('invoiceVatAmount', round($invoice->multicurrency_total_tva, 2));
+		$summaryNormal->addChild('invoiceVatAmountHUF', round($invoice->total_tva, 2));
+
+		$summaryGrossData = $invoiceSummary->addChild('summaryGrossData');
+		$summaryGrossData->addChild('invoiceGrossAmount', number_format($invoice->multicurrency_total_ttc, 2, '.', ''));
+		$summaryGrossData->addChild('invoiceGrossAmountHUF', number_format($invoice->total_ttc, 2, '.', ''));
+
+		//print_r($summaryNormal);exit;
+		//echo $xml->asXML();exit;
+		return $xml;
+	}
+
+	private function getPaymentMethod($paymentMethod)
+	{
+		switch ($paymentMethod) {
+			case "LIQ":
+				return "CASH";
+			case "CB":
+				return "CARD";
+			case "VIR":
+				return "TRANSFER";
+		}
+	}
+
+	private function getSourceRef($rowid)
+	{
+		global $db;
+		$sql = "SELECT ref FROM llx_facture WHERE rowid = {$rowid}";
+		$result = $db->query($sql);
+		if (pg_num_rows($result) > 0) {
+			$row = pg_fetch_all($result);
+			return $row[0]['ref'];
+		}
+	}
+
+	public function test()
+	{
+		try {
+			$token = $this->NavReporter["e_..."]->tokenExchange();
+			print "Token: " . $token;
+		} catch (Exception $ex) {
+			print get_class($ex) . ": " . $ex->getMessage();
+		}
+	}
+	public function vat($number)
+	{
+		try {
+			$result = $this->NavReporter["e_1"]->queryTaxpayer($number);
+			if ($result) {
+				print "Az adószám valid.\n";
+				// print "Az adószámhoz tartozó név: $result->taxpayerName\n";
+				// print "További lehetséges információk az adózóról:\n";
+				print_r($result);
+				// print_r($result->taxpayerShortName);
+				// print_r($result->taxNumberDetail);
+				// print_r($result->vatGroupMembership);
+				// print_r($result->taxpayerAddressList);
+			} else {
+				print "Az adószám nem valid.";
+			}
+		} catch (Exception $ex) {
+			print get_class($ex) . ": " . $ex->getMessage();
+		}
+	}
+
+
+
+	public function syncNAV($limit = 10)
+	{
+		global $user;
+
+		// if (!DolibarrApiAccess::$user->rights->produit->lire) {
+		// throw new RestException(403);
+		// }
+		// require_once(DOL_DOCUMENT_ROOT.'/custom/nav/class/nav.class.php');
+
+		require_once DOL_DOCUMENT_ROOT . '/compta/facture/class/facture.class.php';
+		require_once DOL_DOCUMENT_ROOT . '/core/class/extrafields.class.php';
+
+		$error = 0;
+		$this->output = '';
+		$this->error = '';
+
+		$transactionIds = [];
+
+		$object = new Facture($this->db);
+		$extrafields = new ExtraFields($this->db);
+		// Fetch optionals attributes and labels
+		$extrafields->fetch_name_optionals_label($object->table_element);
+
+		$sql = "SELECT fe.fk_object,f.type,f.entity FROM " . MAIN_DB_PREFIX . "facture f RIGHT JOIN " . MAIN_DB_PREFIX . "facture_extrafields fe ON f.rowid = fe.fk_object WHERE f.fk_statut = 2 AND type NOT IN(7,8) AND fe.nav_transaction_id IS NULL LIMIT " . (int)$limit . ";";
+
+		// echo $sql."\n";
+		$resql = $this->db->query($sql);
+		if (!empty($resql)) {
+			while ($obj = $this->db->fetch_object($resql)) {
+				if ($object->fetch($obj->fk_object)) {
+					// print_r($object);exit;
+					$object->fetch_thirdparty();
+
+					if ($xml = $this->invoiceXML($object)) {
+						try {
+							// Az $invoiceXml tartalmazza a számla (szakmai) SimpleXMLElement objektumot
+							//$invoice->type => 
+							// 0 számla
+							// 1 helyesbítő számla
+							// 2 sztornó számla
+							$action = "CREATE";
+							if ($object->type == 1) {
+								$action = "MODIFY";
+							} elseif ($object->type == 2) {
+								$action = "STORNO";
+							} else {
+							}
+							if (isset($this->NavReporter["e_" . $object->entity])) {
+								if ($transactionId = $this->NavReporter["e_" . $object->entity]->manageInvoice($xml, $action)) {
+									// print "Tranzakciós azonosító a státusz lekérdezéshez: " . $transactionId;
+									$sql = 'UPDATE ' . MAIN_DB_PREFIX . "facture_extrafields SET xml='" . $this->db->escape($xml->asXML()) . "', nav_transaction_id='" . $this->db->escape($transactionId) . "' WHERE fk_object = " . $this->db->escape($object->id) . ";";
+									// echo $sql."\n";
+									// exit;
+									$resql2 = $this->db->query($sql);
+									if (!$resql2) {
+										//...
+										$error++;
+										$this->error .= json_encode([
+											"sql" => $sql,
+											"transactionId" => $transactionId,
+											"fk_object" => $object->id
+										]);
+									}
+									$transactionIds[$transactionId] = $object->id;
+								}
+							} else {
+								$transactionIds["_error"][] = [$object->id, $object->entity];
+							}
+						} catch (Exception $ex) {
+							$this->error .= get_class($ex) . ": " . $ex->getMessage() . " - entity: " . $object->entity;
+							$error++;
+							return $error;
+							exit; //!!! valamit ki kell találni a tesztelésre!
+						}
+						// sleep(1);
+						// exit;
+					}
+				}
+			}
+		}
+		$this->output = json_encode($transactionIds);
+		return $error;
+		// return [
+		// "transactionId" => $transactionIds,
+		// "error" => $error
+		// ];
+
+	}
+
+	protected function navEntites()
+	{
+		$this->navEntity = [];
+		$sql = "SELECT name,entity,value FROM " . MAIN_DB_PREFIX . "const WHERE 
+		(name IN('MAIN_INFO_SOCIETE_NOM', 'MAIN_INFO_SOCIETE_ADDRESS', 'MAIN_INFO_SOCIETE_TOWN', 'MAIN_INFO_SOCIETE_ZIP')
+		OR name LIKE 'NAV_%');";
+		//print $sql;exit;
+		$resql = $this->db->query($sql);
+		if (!empty($resql)) {
+			while ($obj = $this->db->fetch_object($resql)) {
+				if (!isset($this->navEntity["e_" . $obj->entity])) {
+					$this->navEntity["e_" . $obj->entity] = [];
+				}
+				$this->navEntity["e_" . $obj->entity][$obj->name] = $obj->value;
+			}
+		}
+		// return $this->navEntity;
+	}
+}

+ 587 - 0
custom/nav/core/modules/modNav.class.php

@@ -0,0 +1,587 @@
+<?php
+/* Copyright (C) 2004-2018  Laurent Destailleur     <eldy@users.sourceforge.net>
+ * Copyright (C) 2018-2019  Nicolas ZABOURI         <info@inovea-conseil.com>
+ * Copyright (C) 2019-2020  Frédéric France         <frederic.france@netlogic.fr>
+ * Copyright (C) 2022 Deák Ferenc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ * 	\defgroup   nav     Module Nav
+ *  \brief      Nav module descriptor.
+ *
+ *  \file       htdocs/nav/core/modules/modNav.class.php
+ *  \ingroup    nav
+ *  \brief      Description and activation file for module Nav
+ */
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
+
+/**
+ *  Description and activation class for module Nav
+ */
+class modNav extends DolibarrModules
+{
+	/**
+	 * Constructor. Define names, constants, directories, boxes, permissions
+	 *
+	 * @param DoliDB $db Database handler
+	 */
+	public function __construct($db)
+	{
+		global $langs, $conf;
+		$this->db = $db;
+
+		// Id for module (must be unique).
+		// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
+		$this->numero = 500300; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module
+
+		// Key text used to identify module (for permissions, menus, etc...)
+		$this->rights_class = 'nav';
+
+		// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
+		// It is used to group modules by family in module setup page
+		$this->family = "other";
+
+		// Module position in the family on 2 digits ('01', '10', '20', ...)
+		$this->module_position = '90';
+
+		// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
+		//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
+		// Module label (no space allowed), used if translation string 'ModuleNavName' not found (Nav is name of module).
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
+
+		// Module description, used if translation string 'ModuleNavDesc' not found (Nav is name of module).
+		$this->description = "NavDescription";
+		// Used only if file README.md and README-LL.md not found.
+		$this->descriptionlong = "NavDescription";
+
+		// Author
+		$this->editor_name = 'Editor name';
+		$this->editor_url = 'https://www.example.com';
+
+		// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
+		$this->version = '1.0';
+		// Url to the file with your last numberversion of this module
+		//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
+
+		// Key used in llx_const table to save module status enabled/disabled (where NAV is value of property name of module in uppercase)
+		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
+
+		// Name of image file used for this module.
+		// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
+		// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
+		// To use a supported fa-xxx css style of font awesome, use this->picto='xxx'
+		$this->picto = 'generic';
+
+		// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
+		$this->module_parts = array(
+			// Set this to 1 if module has its own trigger directory (core/triggers)
+			'triggers' => 1,
+			// Set this to 1 if module has its own login method file (core/login)
+			'login' => 0,
+			// Set this to 1 if module has its own substitution function file (core/substitutions)
+			'substitutions' => 0,
+			// Set this to 1 if module has its own menus handler directory (core/menus)
+			'menus' => 0,
+			// Set this to 1 if module overwrite template dir (core/tpl)
+			'tpl' => 0,
+			// Set this to 1 if module has its own barcode directory (core/modules/barcode)
+			'barcode' => 0,
+			// Set this to 1 if module has its own models directory (core/modules/xxx)
+			'models' => 1,
+			// Set this to 1 if module has its own printing directory (core/modules/printing)
+			'printing' => 0,
+			// Set this to 1 if module has its own theme directory (theme)
+			'theme' => 0,
+			// Set this to relative path of css file if module has its own css file
+			'css' => array(
+				//    '/nav/css/nav.css.php',
+			),
+			// Set this to relative path of js file if module must load a js on all pages
+			'js' => array(
+				//   '/nav/js/nav.js.php',
+			),
+			// Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all'
+			'hooks' => array(
+				//   'data' => array(
+				//       'hookcontext1',
+				//       'hookcontext2',
+				//   ),
+				//   'entity' => '0',
+			),
+			// Set this to 1 if features of module are opened to external users
+			'moduleforexternal' => 0,
+		);
+
+		// Data directories to create when module is enabled.
+		// Example: this->dirs = array("/nav/temp","/nav/subdir");
+		$this->dirs = array("/nav/temp");
+
+		// Config pages. Put here list of php page, stored into nav/admin directory, to use to setup module.
+		$this->config_page_url = array("setup.php@nav");
+
+		// Dependencies
+		// A condition to hide module
+		$this->hidden = false;
+		// List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
+		$this->depends = array();
+		$this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
+		$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
+
+		// The language file dedicated to your module
+		$this->langfiles = array("nav@nav");
+
+		// Prerequisites
+		$this->phpmin = array(5, 6); // Minimum version of PHP required by module
+		$this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module
+
+		// Messages at activation
+		$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','MX'='textmx'...)
+		$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','MX'='textmx'...)
+		//$this->automatic_activation = array('FR'=>'NavWasAutomaticallyActivatedBecauseOfYourCountryChoice');
+		//$this->always_enabled = true;								// If true, can't be disabled
+
+		// Constants
+		// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
+		// Example: $this->const=array(1 => array('NAV_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
+		//                             2 => array('NAV_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
+		// );
+		$this->const = array();
+
+		// Some keys to add into the overwriting translation tables
+		/*$this->overwrite_translation = array(
+			'en_US:ParentCompany'=>'Parent company or reseller',
+			'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
+		)*/
+
+		if (!isset($conf->nav) || !isset($conf->nav->enabled)) {
+			$conf->nav = new stdClass();
+			$conf->nav->enabled = 0;
+		}
+
+		// Array to add new pages in new tabs
+		$this->tabs = array();
+		// Example:
+		// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@nav:$user->rights->nav->read:/nav/mynewtab1.php?id=__ID__');  					// To add a new tab identified by code tabname1
+		// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@nav:$user->rights->othermodule->read:/nav/mynewtab2.php?id=__ID__',  	// To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
+		// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove');                                                     										// To remove an existing tab identified by code tabname
+		//
+		// Where objecttype can be
+		// 'categories_x'	  to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
+		// 'contact'          to add a tab in contact view
+		// 'contract'         to add a tab in contract view
+		// 'group'            to add a tab in group view
+		// 'intervention'     to add a tab in intervention view
+		// 'invoice'          to add a tab in customer invoice view
+		// 'invoice_supplier' to add a tab in supplier invoice view
+		// 'member'           to add a tab in fundation member view
+		// 'opensurveypoll'	  to add a tab in opensurvey poll view
+		// 'order'            to add a tab in customer order view
+		// 'order_supplier'   to add a tab in supplier order view
+		// 'payment'		  to add a tab in payment view
+		// 'payment_supplier' to add a tab in supplier payment view
+		// 'product'          to add a tab in product view
+		// 'propal'           to add a tab in propal view
+		// 'project'          to add a tab in project view
+		// 'stock'            to add a tab in stock view
+		// 'thirdparty'       to add a tab in third party view
+		// 'user'             to add a tab in user view
+
+		// Dictionaries
+		$this->dictionaries = array();
+		/* Example:
+		$this->dictionaries=array(
+			'langs'=>'nav@nav',
+			// List of tables we want to see into dictonnary editor
+			'tabname'=>array("table1", "table2", "table3"),
+			// Label of tables
+			'tablib'=>array("Table1", "Table2", "Table3"),
+			// Request to select fields
+			'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'),
+			// Sort order
+			'tabsqlsort'=>array("label ASC", "label ASC", "label ASC"),
+			// List of fields (result of select to show dictionary)
+			'tabfield'=>array("code,label", "code,label", "code,label"),
+			// List of fields (list of fields to edit a record)
+			'tabfieldvalue'=>array("code,label", "code,label", "code,label"),
+			// List of fields (list of fields for insert)
+			'tabfieldinsert'=>array("code,label", "code,label", "code,label"),
+			// Name of columns with primary key (try to always name it 'rowid')
+			'tabrowid'=>array("rowid", "rowid", "rowid"),
+			// Condition to show each dictionary
+			'tabcond'=>array($conf->nav->enabled, $conf->nav->enabled, $conf->nav->enabled),
+			// Tooltip for every fields of dictionaries: DO NOT PUT AN EMPTY ARRAY
+			'tabhelp'=>array(array('code'=>$langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip'), array('code'=>$langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip'), ...),
+		);
+		*/
+
+		// Boxes/Widgets
+		// Add here list of php file(s) stored in nav/core/boxes that contains a class to show a widget.
+		$this->boxes = array(
+			//  0 => array(
+			//      'file' => 'navwidget1.php@nav',
+			//      'note' => 'Widget provided by Nav',
+			//      'enabledbydefaulton' => 'Home',
+			//  ),
+			//  ...
+		);
+
+		// Cronjobs (List of cron jobs entries to add when module is enabled)
+		// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
+		$this->cronjobs = array(
+			//  0 => array(
+			//      'label' => 'MyJob label',
+			//      'jobtype' => 'method',
+			//      'class' => '/nav/class/action.class.php',
+			//      'objectname' => 'Action',
+			//      'method' => 'doScheduledJob',
+			//      'parameters' => '',
+			//      'comment' => 'Comment',
+			//      'frequency' => 2,
+			//      'unitfrequency' => 3600,
+			//      'status' => 0,
+			//      'test' => '$conf->nav->enabled',
+			//      'priority' => 50,
+			//  ),
+		);
+		// Example: $this->cronjobs=array(
+		//    0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->nav->enabled', 'priority'=>50),
+		//    1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->nav->enabled', 'priority'=>50)
+		// );
+
+		// Permissions provided by this module
+		$this->rights = array();
+		$r = 0;
+		// Add here entries to declare new permissions
+		/* BEGIN MODULEBUILDER PERMISSIONS */
+		$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
+		$this->rights[$r][1] = 'Read objects of Nav'; // Permission label
+		$this->rights[$r][4] = 'action';
+		$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->nav->action->read)
+		$r++;
+		$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
+		$this->rights[$r][1] = 'Create/Update objects of Nav'; // Permission label
+		$this->rights[$r][4] = 'action';
+		$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->nav->action->write)
+		$r++;
+		$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
+		$this->rights[$r][1] = 'Delete objects of Nav'; // Permission label
+		$this->rights[$r][4] = 'action';
+		$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->nav->action->delete)
+		$r++;
+		/* END MODULEBUILDER PERMISSIONS */
+
+		// Main menu entries to add
+		$this->menu = array();
+		$r = 0;
+		// Add here entries to declare new menus
+		/* BEGIN MODULEBUILDER TOPMENU */
+		/* $this->menu[$r++] = array(
+			'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+			'type'=>'top', // This is a Top menu entry
+			'titre'=>'ModuleNavName',
+			'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth valignmiddle"'),
+			'mainmenu'=>'nav',
+			'leftmenu'=>'',
+			'url'=>'/nav/navindex.php',
+			'langs'=>'nav@nav', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+			'position'=>1000 + $r,
+			'enabled'=>'$conf->nav->enabled', // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled.
+			'perms'=>'1', // Use 'perms'=>'$user->rights->nav->action->read' if you want your menu with a permission rules
+			'target'=>'',
+			'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
+		);*/
+		/* END MODULEBUILDER TOPMENU */
+		/* BEGIN MODULEBUILDER LEFTMENU ACTION
+		$this->menu[$r++]=array(
+			'fk_menu'=>'fk_mainmenu=nav',      // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+			'type'=>'left',                          // This is a Left menu entry
+			'titre'=>'Action',
+			'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth valignmiddle"'),
+			'mainmenu'=>'nav',
+			'leftmenu'=>'action',
+			'url'=>'/nav/navindex.php',
+			'langs'=>'nav@nav',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+			'position'=>1000+$r,
+			'enabled'=>'$conf->nav->enabled',  // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled.
+			'perms'=>'$user->rights->nav->action->read',			                // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+			'target'=>'',
+			'user'=>2,				                // 0=Menu for internal users, 1=external users, 2=both
+		);
+		$this->menu[$r++]=array(
+			'fk_menu'=>'fk_mainmenu=nav,fk_leftmenu=action',	    // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+			'type'=>'left',			                // This is a Left menu entry
+			'titre'=>'List_Action',
+			'mainmenu'=>'nav',
+			'leftmenu'=>'nav_action_list',
+			'url'=>'/nav/action_list.php',
+			'langs'=>'nav@nav',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+			'position'=>1000+$r,
+			'enabled'=>'$conf->nav->enabled',  // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+			'perms'=>'$user->rights->nav->action->read',			                // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+			'target'=>'',
+			'user'=>2,				                // 0=Menu for internal users, 1=external users, 2=both
+		);
+		$this->menu[$r++]=array(
+			'fk_menu'=>'fk_mainmenu=nav,fk_leftmenu=action',	    // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+			'type'=>'left',			                // This is a Left menu entry
+			'titre'=>'New_Action',
+			'mainmenu'=>'nav',
+			'leftmenu'=>'nav_action_new',
+			'url'=>'/nav/action_card.php?action=create',
+			'langs'=>'nav@nav',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+			'position'=>1000+$r,
+			'enabled'=>'$conf->nav->enabled',  // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+			'perms'=>'$user->rights->nav->action->write',			                // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+			'target'=>'',
+			'user'=>2,				                // 0=Menu for internal users, 1=external users, 2=both
+		);
+		*/
+
+        $this->menu[$r++]=array(
+            // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+            'fk_menu'=>'fk_mainmenu=nav',
+            // This is a Left menu entry
+            'type'=>'left',
+            'titre'=>'List Action',
+            'mainmenu'=>'nav',
+            'leftmenu'=>'nav_action',
+            'url'=>'/nav/action_list.php',
+            // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+            'langs'=>'nav@nav',
+            'position'=>1100+$r,
+            // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+            'enabled'=>'$conf->nav->enabled',
+            // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+            'perms'=>'1',
+            'target'=>'',
+            // 0=Menu for internal users, 1=external users, 2=both
+            'user'=>2,
+        );
+        $this->menu[$r++]=array(
+            // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+            'fk_menu'=>'fk_mainmenu=nav,fk_leftmenu=nav_action',
+            // This is a Left menu entry
+            'type'=>'left',
+            'titre'=>'New Action',
+            'mainmenu'=>'nav',
+            'leftmenu'=>'nav_action',
+            'url'=>'/nav/action_card.php?action=create',
+            // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+            'langs'=>'nav@nav',
+            'position'=>1100+$r,
+            // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+            'enabled'=>'$conf->nav->enabled',
+            // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+            'perms'=>'1',
+            'target'=>'',
+            // 0=Menu for internal users, 1=external users, 2=both
+            'user'=>2
+        );
+
+		/* */
+
+        $this->menu[$r++]=array(
+            // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+            'fk_menu'=>'fk_mainmenu=nav',
+            // This is a Left menu entry
+            'type'=>'left',
+            'titre'=>'List Action',
+            'mainmenu'=>'nav',
+            'leftmenu'=>'nav_action',
+            'url'=>'/nav/action_list.php',
+            // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+            'langs'=>'nav@nav',
+            'position'=>1100+$r,
+            // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+            'enabled'=>'$conf->nav->enabled',
+            // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+            'perms'=>'1',
+            'target'=>'',
+            // 0=Menu for internal users, 1=external users, 2=both
+            'user'=>2,
+        );
+        $this->menu[$r++]=array(
+            // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+            'fk_menu'=>'fk_mainmenu=nav,fk_leftmenu=nav_action',
+            // This is a Left menu entry
+            'type'=>'left',
+            'titre'=>'New Action',
+            'mainmenu'=>'nav',
+            'leftmenu'=>'nav_action',
+            'url'=>'/nav/action_card.php?action=create',
+            // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+            'langs'=>'nav@nav',
+            'position'=>1100+$r,
+            // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+            'enabled'=>'$conf->nav->enabled',
+            // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+            'perms'=>'1',
+            'target'=>'',
+            // 0=Menu for internal users, 1=external users, 2=both
+            'user'=>2
+        );
+
+		/* END MODULEBUILDER LEFTMENU ACTION */
+		// Exports profiles provided by this module
+		$r = 1;
+		/* BEGIN MODULEBUILDER EXPORT ACTION */
+		/*
+		$langs->load("nav@nav");
+		$this->export_code[$r]=$this->rights_class.'_'.$r;
+		$this->export_label[$r]='ActionLines';	// Translation key (used only if key ExportDataset_xxx_z not found)
+		$this->export_icon[$r]='action@nav';
+		// Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
+		$keyforclass = 'Action'; $keyforclassfile='/nav/class/action.class.php'; $keyforelement='action@nav';
+		include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
+		//$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
+		//unset($this->export_fields_array[$r]['t.fieldtoremove']);
+		//$keyforclass = 'ActionLine'; $keyforclassfile='/nav/class/action.class.php'; $keyforelement='actionline@nav'; $keyforalias='tl';
+		//include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
+		$keyforselect='action'; $keyforaliasextra='extra'; $keyforelement='action@nav';
+		include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
+		//$keyforselect='actionline'; $keyforaliasextra='extraline'; $keyforelement='actionline@nav';
+		//include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
+		//$this->export_dependencies_array[$r] = array('actionline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
+		//$this->export_special_array[$r] = array('t.field'=>'...');
+		//$this->export_examplevalues_array[$r] = array('t.field'=>'Example');
+		//$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp');
+		$this->export_sql_start[$r]='SELECT DISTINCT ';
+		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'action as t';
+		//$this->export_sql_end[$r]  =' LEFT JOIN '.MAIN_DB_PREFIX.'action_line as tl ON tl.fk_action = t.rowid';
+		$this->export_sql_end[$r] .=' WHERE 1 = 1';
+		$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('action').')';
+		$r++; */
+		/* END MODULEBUILDER EXPORT ACTION */
+
+		// Imports profiles provided by this module
+		$r = 1;
+		/* BEGIN MODULEBUILDER IMPORT ACTION */
+		/*
+		$langs->load("nav@nav");
+		$this->import_code[$r]=$this->rights_class.'_'.$r;
+		$this->import_label[$r]='ActionLines';	// Translation key (used only if key ExportDataset_xxx_z not found)
+		$this->import_icon[$r]='action@nav';
+		$this->import_tables_array[$r] = array('t' => MAIN_DB_PREFIX.'nav_action', 'extra' => MAIN_DB_PREFIX.'nav_action_extrafields');
+		$this->import_tables_creator_array[$r] = array('t' => 'fk_user_author'); // Fields to store import user id
+		$import_sample = array();
+		$keyforclass = 'Action'; $keyforclassfile='/nav/class/action.class.php'; $keyforelement='action@nav';
+		include DOL_DOCUMENT_ROOT.'/core/commonfieldsinimport.inc.php';
+		$import_extrafield_sample = array();
+		$keyforselect='action'; $keyforaliasextra='extra'; $keyforelement='action@nav';
+		include DOL_DOCUMENT_ROOT.'/core/extrafieldsinimport.inc.php';
+		$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'nav_action');
+		$this->import_regex_array[$r] = array();
+		$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
+		$this->import_updatekeys_array[$r] = array('t.ref' => 'Ref');
+		$this->import_convertvalue_array[$r] = array(
+			't.ref' => array(
+				'rule'=>'getrefifauto',
+				'class'=>(empty($conf->global->NAV_ACTION_ADDON) ? 'mod_action_standard' : $conf->global->NAV_ACTION_ADDON),
+				'path'=>"/core/modules/commande/".(empty($conf->global->NAV_ACTION_ADDON) ? 'mod_action_standard' : $conf->global->NAV_ACTION_ADDON).'.php'
+				'classobject'=>'Action',
+				'pathobject'=>'/nav/class/action.class.php',
+			),
+			't.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'),
+			't.fk_user_valid' => array('rule' => 'fetchidfromref', 'file' => '/user/class/user.class.php', 'class' => 'User', 'method' => 'fetch', 'element' => 'user'),
+			't.fk_mode_reglement' => array('rule' => 'fetchidfromcodeorlabel', 'file' => '/compta/paiement/class/cpaiement.class.php', 'class' => 'Cpaiement', 'method' => 'fetch', 'element' => 'cpayment'),
+		);
+		$r++; */
+		/* END MODULEBUILDER IMPORT ACTION */
+	}
+
+	/**
+	 *  Function called when module is enabled.
+	 *  The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+	 *  It also creates data directories
+	 *
+	 *  @param      string  $options    Options when enabling module ('', 'noboxes')
+	 *  @return     int             	1 if OK, 0 if KO
+	 */
+	public function init($options = '')
+	{
+		global $conf, $langs;
+
+		//$result = $this->_load_tables('/install/mysql/', 'nav');
+		$result = $this->_load_tables('/nav/sql/');
+		if ($result < 0) {
+			return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
+		}
+
+		// Create extrafields during init
+		//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+		//$extrafields = new ExtraFields($this->db);
+		//$result1=$extrafields->addExtraField('nav_myattr1', "New Attr 1 label", 'boolean', 1,  3, 'thirdparty',   0, 0, '', '', 1, '', 0, 0, '', '', 'nav@nav', '$conf->nav->enabled');
+		//$result2=$extrafields->addExtraField('nav_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project',      0, 0, '', '', 1, '', 0, 0, '', '', 'nav@nav', '$conf->nav->enabled');
+		//$result3=$extrafields->addExtraField('nav_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'nav@nav', '$conf->nav->enabled');
+		//$result4=$extrafields->addExtraField('nav_myattr4', "New Attr 4 label", 'select',  1,  3, 'thirdparty',   0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'nav@nav', '$conf->nav->enabled');
+		//$result5=$extrafields->addExtraField('nav_myattr5', "New Attr 5 label", 'text',    1, 10, 'user',         0, 0, '', '', 1, '', 0, 0, '', '', 'nav@nav', '$conf->nav->enabled');
+
+		// Permissions
+		$this->remove($options);
+
+		$sql = array();
+
+		// Document templates
+		$moduledir = dol_sanitizeFileName('nav');
+		$myTmpObjects = array();
+		$myTmpObjects['Action'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
+
+		foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
+			if ($myTmpObjectKey == 'Action') {
+				continue;
+			}
+			if ($myTmpObjectArray['includerefgeneration']) {
+				$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_actions.odt';
+				$dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir;
+				$dest = $dirodt.'/template_actions.odt';
+
+				if (file_exists($src) && !file_exists($dest)) {
+					require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+					dol_mkdir($dirodt);
+					$result = dol_copy($src, $dest, 0, 0);
+					if ($result < 0) {
+						$langs->load("errors");
+						$this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
+						return 0;
+					}
+				}
+
+				$sql = array_merge($sql, array(
+					"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
+					"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."', '".$this->db->escape(strtolower($myTmpObjectKey))."', ".((int) $conf->entity).")",
+					"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
+					"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".$this->db->escape(strtolower($myTmpObjectKey))."', ".((int) $conf->entity).")"
+				));
+			}
+		}
+
+		return $this->_init($sql, $options);
+	}
+
+	/**
+	 *  Function called when module is disabled.
+	 *  Remove from database constants, boxes and permissions from Dolibarr database.
+	 *  Data directories are not deleted
+	 *
+	 *  @param      string	$options    Options when enabling module ('', 'noboxes')
+	 *  @return     int                 1 if OK, 0 if KO
+	 */
+	public function remove($options = '')
+	{
+		$sql = array();
+		return $this->_remove($sql, $options);
+	}
+}

+ 587 - 0
custom/nav/core/modules/modNav.class.php.back

@@ -0,0 +1,587 @@
+<?php
+/* Copyright (C) 2004-2018  Laurent Destailleur     <eldy@users.sourceforge.net>
+ * Copyright (C) 2018-2019  Nicolas ZABOURI         <info@inovea-conseil.com>
+ * Copyright (C) 2019-2020  Frédéric France         <frederic.france@netlogic.fr>
+ * Copyright (C) 2022 Deák Ferenc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ * 	\defgroup   nav     Module Nav
+ *  \brief      Nav module descriptor.
+ *
+ *  \file       htdocs/nav/core/modules/modNav.class.php
+ *  \ingroup    nav
+ *  \brief      Description and activation file for module Nav
+ */
+include_once DOL_DOCUMENT_ROOT.'/core/modules/DolibarrModules.class.php';
+
+/**
+ *  Description and activation class for module Nav
+ */
+class modNav extends DolibarrModules
+{
+	/**
+	 * Constructor. Define names, constants, directories, boxes, permissions
+	 *
+	 * @param DoliDB $db Database handler
+	 */
+	public function __construct($db)
+	{
+		global $langs, $conf;
+		$this->db = $db;
+
+		// Id for module (must be unique).
+		// Use here a free id (See in Home -> System information -> Dolibarr for list of used modules id).
+		$this->numero = 500000; // TODO Go on page https://wiki.dolibarr.org/index.php/List_of_modules_id to reserve an id number for your module
+
+		// Key text used to identify module (for permissions, menus, etc...)
+		$this->rights_class = 'nav';
+
+		// Family can be 'base' (core modules),'crm','financial','hr','projects','products','ecm','technic' (transverse modules),'interface' (link with external tools),'other','...'
+		// It is used to group modules by family in module setup page
+		$this->family = "other";
+
+		// Module position in the family on 2 digits ('01', '10', '20', ...)
+		$this->module_position = '90';
+
+		// Gives the possibility for the module, to provide his own family info and position of this family (Overwrite $this->family and $this->module_position. Avoid this)
+		//$this->familyinfo = array('myownfamily' => array('position' => '01', 'label' => $langs->trans("MyOwnFamily")));
+		// Module label (no space allowed), used if translation string 'ModuleNavName' not found (Nav is name of module).
+		$this->name = preg_replace('/^mod/i', '', get_class($this));
+
+		// Module description, used if translation string 'ModuleNavDesc' not found (Nav is name of module).
+		$this->description = "NavDescription";
+		// Used only if file README.md and README-LL.md not found.
+		$this->descriptionlong = "NavDescription";
+
+		// Author
+		$this->editor_name = 'Editor name';
+		$this->editor_url = 'https://www.example.com';
+
+		// Possible values for version are: 'development', 'experimental', 'dolibarr', 'dolibarr_deprecated' or a version string like 'x.y.z'
+		$this->version = '1.0';
+		// Url to the file with your last numberversion of this module
+		//$this->url_last_version = 'http://www.example.com/versionmodule.txt';
+
+		// Key used in llx_const table to save module status enabled/disabled (where NAV is value of property name of module in uppercase)
+		$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name);
+
+		// Name of image file used for this module.
+		// If file is in theme/yourtheme/img directory under name object_pictovalue.png, use this->picto='pictovalue'
+		// If file is in module/img directory under name object_pictovalue.png, use this->picto='pictovalue@module'
+		// To use a supported fa-xxx css style of font awesome, use this->picto='xxx'
+		$this->picto = 'generic';
+
+		// Define some features supported by module (triggers, login, substitutions, menus, css, etc...)
+		$this->module_parts = array(
+			// Set this to 1 if module has its own trigger directory (core/triggers)
+			'triggers' => 1,
+			// Set this to 1 if module has its own login method file (core/login)
+			'login' => 0,
+			// Set this to 1 if module has its own substitution function file (core/substitutions)
+			'substitutions' => 0,
+			// Set this to 1 if module has its own menus handler directory (core/menus)
+			'menus' => 0,
+			// Set this to 1 if module overwrite template dir (core/tpl)
+			'tpl' => 0,
+			// Set this to 1 if module has its own barcode directory (core/modules/barcode)
+			'barcode' => 0,
+			// Set this to 1 if module has its own models directory (core/modules/xxx)
+			'models' => 1,
+			// Set this to 1 if module has its own printing directory (core/modules/printing)
+			'printing' => 0,
+			// Set this to 1 if module has its own theme directory (theme)
+			'theme' => 0,
+			// Set this to relative path of css file if module has its own css file
+			'css' => array(
+				//    '/nav/css/nav.css.php',
+			),
+			// Set this to relative path of js file if module must load a js on all pages
+			'js' => array(
+				//   '/nav/js/nav.js.php',
+			),
+			// Set here all hooks context managed by module. To find available hook context, make a "grep -r '>initHooks(' *" on source code. You can also set hook context to 'all'
+			'hooks' => array(
+				//   'data' => array(
+				//       'hookcontext1',
+				//       'hookcontext2',
+				//   ),
+				//   'entity' => '0',
+			),
+			// Set this to 1 if features of module are opened to external users
+			'moduleforexternal' => 0,
+		);
+
+		// Data directories to create when module is enabled.
+		// Example: this->dirs = array("/nav/temp","/nav/subdir");
+		$this->dirs = array("/nav/temp");
+
+		// Config pages. Put here list of php page, stored into nav/admin directory, to use to setup module.
+		$this->config_page_url = array("setup.php@nav");
+
+		// Dependencies
+		// A condition to hide module
+		$this->hidden = false;
+		// List of module class names as string that must be enabled if this module is enabled. Example: array('always1'=>'modModuleToEnable1','always2'=>'modModuleToEnable2', 'FR1'=>'modModuleToEnableFR'...)
+		$this->depends = array();
+		$this->requiredby = array(); // List of module class names as string to disable if this one is disabled. Example: array('modModuleToDisable1', ...)
+		$this->conflictwith = array(); // List of module class names as string this module is in conflict with. Example: array('modModuleToDisable1', ...)
+
+		// The language file dedicated to your module
+		$this->langfiles = array("nav@nav");
+
+		// Prerequisites
+		$this->phpmin = array(5, 6); // Minimum version of PHP required by module
+		$this->need_dolibarr_version = array(11, -3); // Minimum version of Dolibarr required by module
+
+		// Messages at activation
+		$this->warnings_activation = array(); // Warning to show when we activate module. array('always'='text') or array('FR'='textfr','MX'='textmx'...)
+		$this->warnings_activation_ext = array(); // Warning to show when we activate an external module. array('always'='text') or array('FR'='textfr','MX'='textmx'...)
+		//$this->automatic_activation = array('FR'=>'NavWasAutomaticallyActivatedBecauseOfYourCountryChoice');
+		//$this->always_enabled = true;								// If true, can't be disabled
+
+		// Constants
+		// List of particular constants to add when module is enabled (key, 'chaine', value, desc, visible, 'current' or 'allentities', deleteonunactive)
+		// Example: $this->const=array(1 => array('NAV_MYNEWCONST1', 'chaine', 'myvalue', 'This is a constant to add', 1),
+		//                             2 => array('NAV_MYNEWCONST2', 'chaine', 'myvalue', 'This is another constant to add', 0, 'current', 1)
+		// );
+		$this->const = array();
+
+		// Some keys to add into the overwriting translation tables
+		/*$this->overwrite_translation = array(
+			'en_US:ParentCompany'=>'Parent company or reseller',
+			'fr_FR:ParentCompany'=>'Maison mère ou revendeur'
+		)*/
+
+		if (!isset($conf->nav) || !isset($conf->nav->enabled)) {
+			$conf->nav = new stdClass();
+			$conf->nav->enabled = 0;
+		}
+
+		// Array to add new pages in new tabs
+		$this->tabs = array();
+		// Example:
+		// $this->tabs[] = array('data'=>'objecttype:+tabname1:Title1:mylangfile@nav:$user->rights->nav->read:/nav/mynewtab1.php?id=__ID__');  					// To add a new tab identified by code tabname1
+		// $this->tabs[] = array('data'=>'objecttype:+tabname2:SUBSTITUTION_Title2:mylangfile@nav:$user->rights->othermodule->read:/nav/mynewtab2.php?id=__ID__',  	// To add another new tab identified by code tabname2. Label will be result of calling all substitution functions on 'Title2' key.
+		// $this->tabs[] = array('data'=>'objecttype:-tabname:NU:conditiontoremove');                                                     										// To remove an existing tab identified by code tabname
+		//
+		// Where objecttype can be
+		// 'categories_x'	  to add a tab in category view (replace 'x' by type of category (0=product, 1=supplier, 2=customer, 3=member)
+		// 'contact'          to add a tab in contact view
+		// 'contract'         to add a tab in contract view
+		// 'group'            to add a tab in group view
+		// 'intervention'     to add a tab in intervention view
+		// 'invoice'          to add a tab in customer invoice view
+		// 'invoice_supplier' to add a tab in supplier invoice view
+		// 'member'           to add a tab in fundation member view
+		// 'opensurveypoll'	  to add a tab in opensurvey poll view
+		// 'order'            to add a tab in customer order view
+		// 'order_supplier'   to add a tab in supplier order view
+		// 'payment'		  to add a tab in payment view
+		// 'payment_supplier' to add a tab in supplier payment view
+		// 'product'          to add a tab in product view
+		// 'propal'           to add a tab in propal view
+		// 'project'          to add a tab in project view
+		// 'stock'            to add a tab in stock view
+		// 'thirdparty'       to add a tab in third party view
+		// 'user'             to add a tab in user view
+
+		// Dictionaries
+		$this->dictionaries = array();
+		/* Example:
+		$this->dictionaries=array(
+			'langs'=>'nav@nav',
+			// List of tables we want to see into dictonnary editor
+			'tabname'=>array("table1", "table2", "table3"),
+			// Label of tables
+			'tablib'=>array("Table1", "Table2", "Table3"),
+			// Request to select fields
+			'tabsql'=>array('SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table1 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table2 as f', 'SELECT f.rowid as rowid, f.code, f.label, f.active FROM '.MAIN_DB_PREFIX.'table3 as f'),
+			// Sort order
+			'tabsqlsort'=>array("label ASC", "label ASC", "label ASC"),
+			// List of fields (result of select to show dictionary)
+			'tabfield'=>array("code,label", "code,label", "code,label"),
+			// List of fields (list of fields to edit a record)
+			'tabfieldvalue'=>array("code,label", "code,label", "code,label"),
+			// List of fields (list of fields for insert)
+			'tabfieldinsert'=>array("code,label", "code,label", "code,label"),
+			// Name of columns with primary key (try to always name it 'rowid')
+			'tabrowid'=>array("rowid", "rowid", "rowid"),
+			// Condition to show each dictionary
+			'tabcond'=>array($conf->nav->enabled, $conf->nav->enabled, $conf->nav->enabled),
+			// Tooltip for every fields of dictionaries: DO NOT PUT AN EMPTY ARRAY
+			'tabhelp'=>array(array('code'=>$langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip'), array('code'=>$langs->trans('CodeTooltipHelp'), 'field2' => 'field2tooltip'), ...),
+		);
+		*/
+
+		// Boxes/Widgets
+		// Add here list of php file(s) stored in nav/core/boxes that contains a class to show a widget.
+		$this->boxes = array(
+			//  0 => array(
+			//      'file' => 'navwidget1.php@nav',
+			//      'note' => 'Widget provided by Nav',
+			//      'enabledbydefaulton' => 'Home',
+			//  ),
+			//  ...
+		);
+
+		// Cronjobs (List of cron jobs entries to add when module is enabled)
+		// unit_frequency must be 60 for minute, 3600 for hour, 86400 for day, 604800 for week
+		$this->cronjobs = array(
+			//  0 => array(
+			//      'label' => 'MyJob label',
+			//      'jobtype' => 'method',
+			//      'class' => '/nav/class/action.class.php',
+			//      'objectname' => 'Action',
+			//      'method' => 'doScheduledJob',
+			//      'parameters' => '',
+			//      'comment' => 'Comment',
+			//      'frequency' => 2,
+			//      'unitfrequency' => 3600,
+			//      'status' => 0,
+			//      'test' => '$conf->nav->enabled',
+			//      'priority' => 50,
+			//  ),
+		);
+		// Example: $this->cronjobs=array(
+		//    0=>array('label'=>'My label', 'jobtype'=>'method', 'class'=>'/dir/class/file.class.php', 'objectname'=>'MyClass', 'method'=>'myMethod', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>2, 'unitfrequency'=>3600, 'status'=>0, 'test'=>'$conf->nav->enabled', 'priority'=>50),
+		//    1=>array('label'=>'My label', 'jobtype'=>'command', 'command'=>'', 'parameters'=>'param1, param2', 'comment'=>'Comment', 'frequency'=>1, 'unitfrequency'=>3600*24, 'status'=>0, 'test'=>'$conf->nav->enabled', 'priority'=>50)
+		// );
+
+		// Permissions provided by this module
+		$this->rights = array();
+		$r = 0;
+		// Add here entries to declare new permissions
+		/* BEGIN MODULEBUILDER PERMISSIONS */
+		$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
+		$this->rights[$r][1] = 'Read objects of Nav'; // Permission label
+		$this->rights[$r][4] = 'action';
+		$this->rights[$r][5] = 'read'; // In php code, permission will be checked by test if ($user->rights->nav->action->read)
+		$r++;
+		$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
+		$this->rights[$r][1] = 'Create/Update objects of Nav'; // Permission label
+		$this->rights[$r][4] = 'action';
+		$this->rights[$r][5] = 'write'; // In php code, permission will be checked by test if ($user->rights->nav->action->write)
+		$r++;
+		$this->rights[$r][0] = $this->numero . sprintf("%02d", $r + 1); // Permission id (must not be already used)
+		$this->rights[$r][1] = 'Delete objects of Nav'; // Permission label
+		$this->rights[$r][4] = 'action';
+		$this->rights[$r][5] = 'delete'; // In php code, permission will be checked by test if ($user->rights->nav->action->delete)
+		$r++;
+		/* END MODULEBUILDER PERMISSIONS */
+
+		// Main menu entries to add
+		$this->menu = array();
+		$r = 0;
+		// Add here entries to declare new menus
+		/* BEGIN MODULEBUILDER TOPMENU */
+		/* $this->menu[$r++] = array(
+			'fk_menu'=>'', // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+			'type'=>'top', // This is a Top menu entry
+			'titre'=>'ModuleNavName',
+			'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth valignmiddle"'),
+			'mainmenu'=>'nav',
+			'leftmenu'=>'',
+			'url'=>'/nav/navindex.php',
+			'langs'=>'nav@nav', // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+			'position'=>1000 + $r,
+			'enabled'=>'$conf->nav->enabled', // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled.
+			'perms'=>'1', // Use 'perms'=>'$user->rights->nav->action->read' if you want your menu with a permission rules
+			'target'=>'',
+			'user'=>2, // 0=Menu for internal users, 1=external users, 2=both
+		);*/
+		/* END MODULEBUILDER TOPMENU */
+		/* BEGIN MODULEBUILDER LEFTMENU ACTION
+		$this->menu[$r++]=array(
+			'fk_menu'=>'fk_mainmenu=nav',      // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+			'type'=>'left',                          // This is a Left menu entry
+			'titre'=>'Action',
+			'prefix' => img_picto('', $this->picto, 'class="paddingright pictofixedwidth valignmiddle"'),
+			'mainmenu'=>'nav',
+			'leftmenu'=>'action',
+			'url'=>'/nav/navindex.php',
+			'langs'=>'nav@nav',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+			'position'=>1000+$r,
+			'enabled'=>'$conf->nav->enabled',  // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled.
+			'perms'=>'$user->rights->nav->action->read',			                // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+			'target'=>'',
+			'user'=>2,				                // 0=Menu for internal users, 1=external users, 2=both
+		);
+		$this->menu[$r++]=array(
+			'fk_menu'=>'fk_mainmenu=nav,fk_leftmenu=action',	    // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+			'type'=>'left',			                // This is a Left menu entry
+			'titre'=>'List_Action',
+			'mainmenu'=>'nav',
+			'leftmenu'=>'nav_action_list',
+			'url'=>'/nav/action_list.php',
+			'langs'=>'nav@nav',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+			'position'=>1000+$r,
+			'enabled'=>'$conf->nav->enabled',  // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+			'perms'=>'$user->rights->nav->action->read',			                // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+			'target'=>'',
+			'user'=>2,				                // 0=Menu for internal users, 1=external users, 2=both
+		);
+		$this->menu[$r++]=array(
+			'fk_menu'=>'fk_mainmenu=nav,fk_leftmenu=action',	    // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+			'type'=>'left',			                // This is a Left menu entry
+			'titre'=>'New_Action',
+			'mainmenu'=>'nav',
+			'leftmenu'=>'nav_action_new',
+			'url'=>'/nav/action_card.php?action=create',
+			'langs'=>'nav@nav',	        // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+			'position'=>1000+$r,
+			'enabled'=>'$conf->nav->enabled',  // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+			'perms'=>'$user->rights->nav->action->write',			                // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+			'target'=>'',
+			'user'=>2,				                // 0=Menu for internal users, 1=external users, 2=both
+		);
+		*/
+
+        $this->menu[$r++]=array(
+            // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+            'fk_menu'=>'fk_mainmenu=nav',
+            // This is a Left menu entry
+            'type'=>'left',
+            'titre'=>'List Action',
+            'mainmenu'=>'nav',
+            'leftmenu'=>'nav_action',
+            'url'=>'/nav/action_list.php',
+            // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+            'langs'=>'nav@nav',
+            'position'=>1100+$r,
+            // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+            'enabled'=>'$conf->nav->enabled',
+            // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+            'perms'=>'1',
+            'target'=>'',
+            // 0=Menu for internal users, 1=external users, 2=both
+            'user'=>2,
+        );
+        $this->menu[$r++]=array(
+            // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+            'fk_menu'=>'fk_mainmenu=nav,fk_leftmenu=nav_action',
+            // This is a Left menu entry
+            'type'=>'left',
+            'titre'=>'New Action',
+            'mainmenu'=>'nav',
+            'leftmenu'=>'nav_action',
+            'url'=>'/nav/action_card.php?action=create',
+            // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+            'langs'=>'nav@nav',
+            'position'=>1100+$r,
+            // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+            'enabled'=>'$conf->nav->enabled',
+            // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+            'perms'=>'1',
+            'target'=>'',
+            // 0=Menu for internal users, 1=external users, 2=both
+            'user'=>2
+        );
+
+		/* */
+
+        $this->menu[$r++]=array(
+            // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+            'fk_menu'=>'fk_mainmenu=nav',
+            // This is a Left menu entry
+            'type'=>'left',
+            'titre'=>'List Action',
+            'mainmenu'=>'nav',
+            'leftmenu'=>'nav_action',
+            'url'=>'/nav/action_list.php',
+            // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+            'langs'=>'nav@nav',
+            'position'=>1100+$r,
+            // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+            'enabled'=>'$conf->nav->enabled',
+            // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+            'perms'=>'1',
+            'target'=>'',
+            // 0=Menu for internal users, 1=external users, 2=both
+            'user'=>2,
+        );
+        $this->menu[$r++]=array(
+            // '' if this is a top menu. For left menu, use 'fk_mainmenu=xxx' or 'fk_mainmenu=xxx,fk_leftmenu=yyy' where xxx is mainmenucode and yyy is a leftmenucode
+            'fk_menu'=>'fk_mainmenu=nav,fk_leftmenu=nav_action',
+            // This is a Left menu entry
+            'type'=>'left',
+            'titre'=>'New Action',
+            'mainmenu'=>'nav',
+            'leftmenu'=>'nav_action',
+            'url'=>'/nav/action_card.php?action=create',
+            // Lang file to use (without .lang) by module. File must be in langs/code_CODE/ directory.
+            'langs'=>'nav@nav',
+            'position'=>1100+$r,
+            // Define condition to show or hide menu entry. Use '$conf->nav->enabled' if entry must be visible if module is enabled. Use '$leftmenu==\'system\'' to show if leftmenu system is selected.
+            'enabled'=>'$conf->nav->enabled',
+            // Use 'perms'=>'$user->rights->nav->level1->level2' if you want your menu with a permission rules
+            'perms'=>'1',
+            'target'=>'',
+            // 0=Menu for internal users, 1=external users, 2=both
+            'user'=>2
+        );
+
+		/* END MODULEBUILDER LEFTMENU ACTION */
+		// Exports profiles provided by this module
+		$r = 1;
+		/* BEGIN MODULEBUILDER EXPORT ACTION */
+		/*
+		$langs->load("nav@nav");
+		$this->export_code[$r]=$this->rights_class.'_'.$r;
+		$this->export_label[$r]='ActionLines';	// Translation key (used only if key ExportDataset_xxx_z not found)
+		$this->export_icon[$r]='action@nav';
+		// Define $this->export_fields_array, $this->export_TypeFields_array and $this->export_entities_array
+		$keyforclass = 'Action'; $keyforclassfile='/nav/class/action.class.php'; $keyforelement='action@nav';
+		include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
+		//$this->export_fields_array[$r]['t.fieldtoadd']='FieldToAdd'; $this->export_TypeFields_array[$r]['t.fieldtoadd']='Text';
+		//unset($this->export_fields_array[$r]['t.fieldtoremove']);
+		//$keyforclass = 'ActionLine'; $keyforclassfile='/nav/class/action.class.php'; $keyforelement='actionline@nav'; $keyforalias='tl';
+		//include DOL_DOCUMENT_ROOT.'/core/commonfieldsinexport.inc.php';
+		$keyforselect='action'; $keyforaliasextra='extra'; $keyforelement='action@nav';
+		include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
+		//$keyforselect='actionline'; $keyforaliasextra='extraline'; $keyforelement='actionline@nav';
+		//include DOL_DOCUMENT_ROOT.'/core/extrafieldsinexport.inc.php';
+		//$this->export_dependencies_array[$r] = array('actionline'=>array('tl.rowid','tl.ref')); // To force to activate one or several fields if we select some fields that need same (like to select a unique key if we ask a field of a child to avoid the DISTINCT to discard them, or for computed field than need several other fields)
+		//$this->export_special_array[$r] = array('t.field'=>'...');
+		//$this->export_examplevalues_array[$r] = array('t.field'=>'Example');
+		//$this->export_help_array[$r] = array('t.field'=>'FieldDescHelp');
+		$this->export_sql_start[$r]='SELECT DISTINCT ';
+		$this->export_sql_end[$r]  =' FROM '.MAIN_DB_PREFIX.'action as t';
+		//$this->export_sql_end[$r]  =' LEFT JOIN '.MAIN_DB_PREFIX.'action_line as tl ON tl.fk_action = t.rowid';
+		$this->export_sql_end[$r] .=' WHERE 1 = 1';
+		$this->export_sql_end[$r] .=' AND t.entity IN ('.getEntity('action').')';
+		$r++; */
+		/* END MODULEBUILDER EXPORT ACTION */
+
+		// Imports profiles provided by this module
+		$r = 1;
+		/* BEGIN MODULEBUILDER IMPORT ACTION */
+		/*
+		$langs->load("nav@nav");
+		$this->import_code[$r]=$this->rights_class.'_'.$r;
+		$this->import_label[$r]='ActionLines';	// Translation key (used only if key ExportDataset_xxx_z not found)
+		$this->import_icon[$r]='action@nav';
+		$this->import_tables_array[$r] = array('t' => MAIN_DB_PREFIX.'nav_action', 'extra' => MAIN_DB_PREFIX.'nav_action_extrafields');
+		$this->import_tables_creator_array[$r] = array('t' => 'fk_user_author'); // Fields to store import user id
+		$import_sample = array();
+		$keyforclass = 'Action'; $keyforclassfile='/nav/class/action.class.php'; $keyforelement='action@nav';
+		include DOL_DOCUMENT_ROOT.'/core/commonfieldsinimport.inc.php';
+		$import_extrafield_sample = array();
+		$keyforselect='action'; $keyforaliasextra='extra'; $keyforelement='action@nav';
+		include DOL_DOCUMENT_ROOT.'/core/extrafieldsinimport.inc.php';
+		$this->import_fieldshidden_array[$r] = array('extra.fk_object' => 'lastrowid-'.MAIN_DB_PREFIX.'nav_action');
+		$this->import_regex_array[$r] = array();
+		$this->import_examplevalues_array[$r] = array_merge($import_sample, $import_extrafield_sample);
+		$this->import_updatekeys_array[$r] = array('t.ref' => 'Ref');
+		$this->import_convertvalue_array[$r] = array(
+			't.ref' => array(
+				'rule'=>'getrefifauto',
+				'class'=>(empty($conf->global->NAV_ACTION_ADDON) ? 'mod_action_standard' : $conf->global->NAV_ACTION_ADDON),
+				'path'=>"/core/modules/commande/".(empty($conf->global->NAV_ACTION_ADDON) ? 'mod_action_standard' : $conf->global->NAV_ACTION_ADDON).'.php'
+				'classobject'=>'Action',
+				'pathobject'=>'/nav/class/action.class.php',
+			),
+			't.fk_soc' => array('rule' => 'fetchidfromref', 'file' => '/societe/class/societe.class.php', 'class' => 'Societe', 'method' => 'fetch', 'element' => 'ThirdParty'),
+			't.fk_user_valid' => array('rule' => 'fetchidfromref', 'file' => '/user/class/user.class.php', 'class' => 'User', 'method' => 'fetch', 'element' => 'user'),
+			't.fk_mode_reglement' => array('rule' => 'fetchidfromcodeorlabel', 'file' => '/compta/paiement/class/cpaiement.class.php', 'class' => 'Cpaiement', 'method' => 'fetch', 'element' => 'cpayment'),
+		);
+		$r++; */
+		/* END MODULEBUILDER IMPORT ACTION */
+	}
+
+	/**
+	 *  Function called when module is enabled.
+	 *  The init function add constants, boxes, permissions and menus (defined in constructor) into Dolibarr database.
+	 *  It also creates data directories
+	 *
+	 *  @param      string  $options    Options when enabling module ('', 'noboxes')
+	 *  @return     int             	1 if OK, 0 if KO
+	 */
+	public function init($options = '')
+	{
+		global $conf, $langs;
+
+		//$result = $this->_load_tables('/install/mysql/', 'nav');
+		$result = $this->_load_tables('/nav/sql/');
+		if ($result < 0) {
+			return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
+		}
+
+		// Create extrafields during init
+		//include_once DOL_DOCUMENT_ROOT.'/core/class/extrafields.class.php';
+		//$extrafields = new ExtraFields($this->db);
+		//$result1=$extrafields->addExtraField('nav_myattr1', "New Attr 1 label", 'boolean', 1,  3, 'thirdparty',   0, 0, '', '', 1, '', 0, 0, '', '', 'nav@nav', '$conf->nav->enabled');
+		//$result2=$extrafields->addExtraField('nav_myattr2', "New Attr 2 label", 'varchar', 1, 10, 'project',      0, 0, '', '', 1, '', 0, 0, '', '', 'nav@nav', '$conf->nav->enabled');
+		//$result3=$extrafields->addExtraField('nav_myattr3', "New Attr 3 label", 'varchar', 1, 10, 'bank_account', 0, 0, '', '', 1, '', 0, 0, '', '', 'nav@nav', '$conf->nav->enabled');
+		//$result4=$extrafields->addExtraField('nav_myattr4', "New Attr 4 label", 'select',  1,  3, 'thirdparty',   0, 1, '', array('options'=>array('code1'=>'Val1','code2'=>'Val2','code3'=>'Val3')), 1,'', 0, 0, '', '', 'nav@nav', '$conf->nav->enabled');
+		//$result5=$extrafields->addExtraField('nav_myattr5', "New Attr 5 label", 'text',    1, 10, 'user',         0, 0, '', '', 1, '', 0, 0, '', '', 'nav@nav', '$conf->nav->enabled');
+
+		// Permissions
+		$this->remove($options);
+
+		$sql = array();
+
+		// Document templates
+		$moduledir = dol_sanitizeFileName('nav');
+		$myTmpObjects = array();
+		$myTmpObjects['Action'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
+
+		foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
+			if ($myTmpObjectKey == 'Action') {
+				continue;
+			}
+			if ($myTmpObjectArray['includerefgeneration']) {
+				$src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_actions.odt';
+				$dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir;
+				$dest = $dirodt.'/template_actions.odt';
+
+				if (file_exists($src) && !file_exists($dest)) {
+					require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+					dol_mkdir($dirodt);
+					$result = dol_copy($src, $dest, 0, 0);
+					if ($result < 0) {
+						$langs->load("errors");
+						$this->error = $langs->trans('ErrorFailToCopyFile', $src, $dest);
+						return 0;
+					}
+				}
+
+				$sql = array_merge($sql, array(
+					"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'standard_".strtolower($myTmpObjectKey)."' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
+					"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('standard_".strtolower($myTmpObjectKey)."', '".$this->db->escape(strtolower($myTmpObjectKey))."', ".((int) $conf->entity).")",
+					"DELETE FROM ".MAIN_DB_PREFIX."document_model WHERE nom = 'generic_".strtolower($myTmpObjectKey)."_odt' AND type = '".$this->db->escape(strtolower($myTmpObjectKey))."' AND entity = ".((int) $conf->entity),
+					"INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type, entity) VALUES('generic_".strtolower($myTmpObjectKey)."_odt', '".$this->db->escape(strtolower($myTmpObjectKey))."', ".((int) $conf->entity).")"
+				));
+			}
+		}
+
+		return $this->_init($sql, $options);
+	}
+
+	/**
+	 *  Function called when module is disabled.
+	 *  Remove from database constants, boxes and permissions from Dolibarr database.
+	 *  Data directories are not deleted
+	 *
+	 *  @param      string	$options    Options when enabling module ('', 'noboxes')
+	 *  @return     int                 1 if OK, 0 if KO
+	 */
+	public function remove($options = '')
+	{
+		$sql = array();
+		return $this->_remove($sql, $options);
+	}
+}

+ 146 - 0
custom/nav/core/modules/nav/mod_action_advanced.php

@@ -0,0 +1,146 @@
+<?php
+/* Copyright (C) 2003-2007  Rodolphe Quiedeville        <rodolphe@quiedeville.org>
+ * Copyright (C) 2004-2007  Laurent Destailleur         <eldy@users.sourceforge.net>
+ * Copyright (C) 2005-2009  Regis Houssin               <regis.houssin@inodbox.com>
+ * Copyright (C) 2008       Raphael Bertrand (Resultic) <raphael.bertrand@resultic.fr>
+ * Copyright (C) 2019       Frédéric France             <frederic.france@netlogic.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * or see https://www.gnu.org/
+ */
+
+/**
+ * \file       htdocs/core/modules/nav/mod_action_advanced.php
+ * \ingroup    nav
+ * \brief      File containing class for advanced numbering model of Action
+ */
+
+dol_include_once('/nav/core/modules/nav/modules_action.php');
+
+
+/**
+ *	Class to manage customer Bom numbering rules advanced
+ */
+class mod_action_advanced extends ModeleNumRefAction
+{
+	/**
+	 * Dolibarr version of the loaded document
+	 * @var string
+	 */
+	public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
+
+	/**
+	 * @var string Error message
+	 */
+	public $error = '';
+
+	/**
+	 * @var string name
+	 */
+	public $name = 'advanced';
+
+
+	/**
+	 *  Returns the description of the numbering model
+	 *
+	 *  @return     string      Texte descripif
+	 */
+	public function info()
+	{
+		global $conf, $langs, $db;
+
+		$langs->load("bills");
+
+		$form = new Form($db);
+
+		$texte = $langs->trans('GenericNumRefModelDesc')."<br>\n";
+		$texte .= '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
+		$texte .= '<input type="hidden" name="token" value="'.newToken().'">';
+		$texte .= '<input type="hidden" name="action" value="updateMask">';
+		$texte .= '<input type="hidden" name="maskconst" value="NAV_ACTION_ADVANCED_MASK">';
+		$texte .= '<table class="nobordernopadding centpercent">';
+
+		$tooltip = $langs->trans("GenericMaskCodes", $langs->transnoentities("Action"), $langs->transnoentities("Action"));
+		$tooltip .= $langs->trans("GenericMaskCodes2");
+		$tooltip .= $langs->trans("GenericMaskCodes3");
+		$tooltip .= $langs->trans("GenericMaskCodes4a", $langs->transnoentities("Action"), $langs->transnoentities("Action"));
+		$tooltip .= $langs->trans("GenericMaskCodes5");
+
+		// Parametrage du prefix
+		$texte .= '<tr><td>'.$langs->trans("Mask").':</td>';
+		$texte .= '<td class="right">'.$form->textwithpicto('<input type="text" class="flat minwidth175" name="maskvalue" value="'.getDolGlobalString('NAV_ACTION_ADVANCED_MASK').'">', $tooltip, 1, 1).'</td>';
+		$texte .= '<td class="left" rowspan="2">&nbsp; <input type="submit" class="button button-edit" value="'.$langs->trans("Modify").'" name="Button"></td>';
+		$texte .= '</tr>';
+
+		$texte .= '</table>';
+		$texte .= '</form>';
+
+		return $texte;
+	}
+
+	/**
+	 *  Return an example of numbering
+	 *
+	 *  @return     string      Example
+	 */
+	public function getExample()
+	{
+		global $conf, $db, $langs, $mysoc;
+
+		$object = new Action($db);
+		$object->initAsSpecimen();
+
+		/*$old_code_client = $mysoc->code_client;
+		$old_code_type = $mysoc->typent_code;
+		$mysoc->code_client = 'CCCCCCCCCC';
+		$mysoc->typent_code = 'TTTTTTTTTT';*/
+
+		$numExample = $this->getNextValue($object);
+
+		/*$mysoc->code_client = $old_code_client;
+		$mysoc->typent_code = $old_code_type;*/
+
+		if (!$numExample) {
+			$numExample = $langs->trans('NotConfigured');
+		}
+		return $numExample;
+	}
+
+	/**
+	 * 	Return next free value
+	 *
+	 *  @param  Object		$object		Object we need next value for
+	 *  @return string      			Value if KO, <0 if KO
+	 */
+	public function getNextValue($object)
+	{
+		global $db, $conf;
+
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+
+		// We get cursor rule
+		$mask = getDolGlobalString('NAV_ACTION_ADVANCED_MASK');
+
+		if (!$mask) {
+			$this->error = 'NotConfigured';
+			return 0;
+		}
+
+		$date = $object->date;
+
+		$numFinal = get_next_value($db, $mask, 'nav_action', 'ref', '', null, $date);
+
+		return  $numFinal;
+	}
+}

+ 161 - 0
custom/nav/core/modules/nav/mod_action_standard.php

@@ -0,0 +1,161 @@
+<?php
+/* Copyright (C) 2005-2010 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2005-2009 Regis Houssin        <regis.houssin@inodbox.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * or see https://www.gnu.org/
+ */
+
+/**
+ *  \file       htdocs/core/modules/nav/mod_action_standard.php
+ *  \ingroup    nav
+ *  \brief      File of class to manage Action numbering rules standard
+ */
+dol_include_once('/nav/core/modules/nav/modules_action.php');
+
+
+/**
+ *	Class to manage customer order numbering rules standard
+ */
+class mod_action_standard extends ModeleNumRefAction
+{
+	/**
+	 * Dolibarr version of the loaded document
+	 * @var string
+	 */
+	public $version = 'dolibarr'; // 'development', 'experimental', 'dolibarr'
+
+	public $prefix = 'ACTION';
+
+	/**
+	 * @var string Error code (or message)
+	 */
+	public $error = '';
+
+	/**
+	 * @var string name
+	 */
+	public $name = 'standard';
+
+
+	/**
+	 *  Return description of numbering module
+	 *
+	 *  @return     string      Text with description
+	 */
+	public function info()
+	{
+		global $langs;
+		return $langs->trans("SimpleNumRefModelDesc", $this->prefix);
+	}
+
+
+	/**
+	 *  Return an example of numbering
+	 *
+	 *  @return     string      Example
+	 */
+	public function getExample()
+	{
+		return $this->prefix."0501-0001";
+	}
+
+
+	/**
+	 *  Checks if the numbers already in the database do not
+	 *  cause conflicts that would prevent this numbering working.
+	 *
+	 *  @param  Object		$object		Object we need next value for
+	 *  @return boolean     			false if conflict, true if ok
+	 */
+	public function canBeActivated($object)
+	{
+		global $conf, $langs, $db;
+
+		$coyymm = ''; $max = '';
+
+		$posindice = strlen($this->prefix) + 6;
+		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
+		$sql .= " FROM ".MAIN_DB_PREFIX."nav_action";
+		$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
+		if ($object->ismultientitymanaged == 1) {
+			$sql .= " AND entity = ".$conf->entity;
+		} elseif ($object->ismultientitymanaged == 2) {
+			// TODO
+		}
+
+		$resql = $db->query($sql);
+		if ($resql) {
+			$row = $db->fetch_row($resql);
+			if ($row) {
+				$coyymm = substr($row[0], 0, 6); $max = $row[0];
+			}
+		}
+		if ($coyymm && !preg_match('/'.$this->prefix.'[0-9][0-9][0-9][0-9]/i', $coyymm)) {
+			$langs->load("errors");
+			$this->error = $langs->trans('ErrorNumRefModel', $max);
+			return false;
+		}
+
+		return true;
+	}
+
+	/**
+	 * 	Return next free value
+	 *
+	 *  @param  Object		$object		Object we need next value for
+	 *  @return string      			Value if KO, <0 if KO
+	 */
+	public function getNextValue($object)
+	{
+		global $db, $conf;
+
+		// first we get the max value
+		$posindice = strlen($this->prefix) + 6;
+		$sql = "SELECT MAX(CAST(SUBSTRING(ref FROM ".$posindice.") AS SIGNED)) as max";
+		$sql .= " FROM ".MAIN_DB_PREFIX."nav_action";
+		$sql .= " WHERE ref LIKE '".$db->escape($this->prefix)."____-%'";
+		if ($object->ismultientitymanaged == 1) {
+			$sql .= " AND entity = ".$conf->entity;
+		} elseif ($object->ismultientitymanaged == 2) {
+			// TODO
+		}
+
+		$resql = $db->query($sql);
+		if ($resql) {
+			$obj = $db->fetch_object($resql);
+			if ($obj) {
+				$max = intval($obj->max);
+			} else {
+				$max = 0;
+			}
+		} else {
+			dol_syslog("mod_action_standard::getNextValue", LOG_DEBUG);
+			return -1;
+		}
+
+		//$date=time();
+		$date = $object->date_creation;
+		$yymm = strftime("%y%m", $date);
+
+		if ($max >= (pow(10, 4) - 1)) {
+			$num = $max + 1; // If counter > 9999, we do not format on 4 chars, we take number as it is
+		} else {
+			$num = sprintf("%04s", $max + 1);
+		}
+
+		dol_syslog("mod_action_standard::getNextValue return ".$this->prefix.$yymm."-".$num);
+		return $this->prefix.$yymm."-".$num;
+	}
+}

+ 194 - 0
custom/nav/core/modules/nav/modules_action.php

@@ -0,0 +1,194 @@
+<?php
+/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ * Copyright (C) 2004-2011 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2004      Eric Seigne          <eric.seigne@ryxeo.com>
+ * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@inodbox.com>
+ * Copyright (C) 2006      Andre Cianfarani     <acianfa@free.fr>
+ * Copyright (C) 2012      Juanjo Menent	    <jmenent@2byte.es>
+ * Copyright (C) 2014      Marcos García        <marcosgdf@gmail.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ * or see https://www.gnu.org/
+ */
+
+/**
+ *  \file			htdocs/core/modules/nav/modules_action.php
+ *  \ingroup		nav
+ *  \brief			File that contains parent class for actions document models and parent class for actions numbering models
+ */
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/commondocgenerator.class.php';
+require_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // required for use by classes that inherit
+
+
+/**
+ *	Parent class for documents models
+ */
+abstract class ModelePDFAction extends CommonDocGenerator
+{
+
+	/**
+	 * @var int page_largeur
+	 */
+	public $page_largeur;
+
+	/**
+	 * @var int page_hauteur
+	 */
+	public $page_hauteur;
+
+	/**
+	 * @var array format
+	 */
+	public $format;
+
+	/**
+	 * @var int marge_gauche
+	 */
+	public $marge_gauche;
+
+	/**
+	 * @var int marge_droite
+	 */
+	public $marge_droite;
+
+	/**
+	 * @var int marge_haute
+	 */
+	public $marge_haute;
+
+	/**
+	 * @var int marge_basse
+	 */
+	public $marge_basse;
+
+
+	// phpcs:disable PEAR.NamingConventions.ValidFunctionName.ScopeNotCamelCaps
+	/**
+	 *  Return list of active generation modules
+	 *
+	 *  @param	DoliDB	$db     			Database handler
+	 *  @param  integer	$maxfilenamelength  Max length of value to show
+	 *  @return	array						List of templates
+	 */
+	public static function liste_modeles($db, $maxfilenamelength = 0)
+	{
+		// phpcs:enable
+		global $conf;
+
+		$type = 'action';
+		$list = array();
+
+		include_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
+		$list = getListOfModels($db, $type, $maxfilenamelength);
+
+		return $list;
+	}
+}
+
+
+
+/**
+ *  Parent class to manage numbering of Action
+ */
+abstract class ModeleNumRefAction
+{
+	/**
+	 * @var string Error code (or message)
+	 */
+	public $error = '';
+
+	/**
+	 *	Return if a module can be used or not
+	 *
+	 *	@return		boolean     true if module can be used
+	 */
+	public function isEnabled()
+	{
+		return true;
+	}
+
+	/**
+	 *	Returns the default description of the numbering template
+	 *
+	 *	@return     string      Texte descripif
+	 */
+	public function info()
+	{
+		global $langs;
+		$langs->load("nav@nav");
+		return $langs->trans("NoDescription");
+	}
+
+	/**
+	 *	Returns an example of numbering
+	 *
+	 *	@return     string      Example
+	 */
+	public function getExample()
+	{
+		global $langs;
+		$langs->load("nav@nav");
+		return $langs->trans("NoExample");
+	}
+
+	/**
+	 *  Checks if the numbers already in the database do not
+	 *  cause conflicts that would prevent this numbering working.
+	 *
+	 *	@param	Object		$object		Object we need next value for
+	 *	@return boolean     			false if conflict, true if ok
+	 */
+	public function canBeActivated($object)
+	{
+		return true;
+	}
+
+	/**
+	 *	Returns next assigned value
+	 *
+	 *	@param	Object		$object		Object we need next value for
+	 *	@return	string      Valeur
+	 */
+	public function getNextValue($object)
+	{
+		global $langs;
+		return $langs->trans("NotAvailable");
+	}
+
+	/**
+	 *	Returns version of numbering module
+	 *
+	 *	@return     string      Valeur
+	 */
+	public function getVersion()
+	{
+		global $langs;
+		$langs->load("admin");
+
+		if ($this->version == 'development') {
+			return $langs->trans("VersionDevelopment");
+		}
+		if ($this->version == 'experimental') {
+			return $langs->trans("VersionExperimental");
+		}
+		if ($this->version == 'dolibarr') {
+			return DOL_VERSION;
+		}
+		if ($this->version) {
+			return $this->version;
+		}
+		return $langs->trans("NotAvailable");
+	}
+}

+ 349 - 0
custom/nav/core/triggers/interface_99_modNav_NavTriggers.class.php

@@ -0,0 +1,349 @@
+<?php
+/* Copyright (C) 2022 Deák Ferenc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file    core/triggers/interface_99_modNav_NavTriggers.class.php
+ * \ingroup nav
+ * \brief   Example trigger.
+ *
+ * Put detailed description here.
+ *
+ * \remarks You can create other triggers by copying this one.
+ * - File name should be either:
+ *      - interface_99_modNav_MyTrigger.class.php
+ *      - interface_99_all_MyTrigger.class.php
+ * - The file must stay in core/triggers
+ * - The class name must be InterfaceMytrigger
+ */
+
+require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php';
+
+
+/**
+ *  Class of triggers for Nav module
+ */
+class InterfaceNavTriggers extends DolibarrTriggers
+{
+	/**
+	 * Constructor
+	 *
+	 * @param DoliDB $db Database handler
+	 */
+	public function __construct($db)
+	{
+		$this->db = $db;
+
+		$this->name = preg_replace('/^Interface/i', '', get_class($this));
+		$this->family = "demo";
+		$this->description = "Nav triggers.";
+		// 'development', 'experimental', 'dolibarr' or version
+		$this->version = 'development';
+		$this->picto = 'nav@nav';
+	}
+
+	/**
+	 * Trigger name
+	 *
+	 * @return string Name of trigger file
+	 */
+	public function getName()
+	{
+		return $this->name;
+	}
+
+	/**
+	 * Trigger description
+	 *
+	 * @return string Description of trigger file
+	 */
+	public function getDesc()
+	{
+		return $this->description;
+	}
+
+
+	/**
+	 * Function called when a Dolibarrr business event is done.
+	 * All functions "runTrigger" are triggered if file
+	 * is inside directory core/triggers
+	 *
+	 * @param string 		$action 	Event action code
+	 * @param CommonObject 	$object 	Object
+	 * @param User 			$user 		Object user
+	 * @param Translate 	$langs 		Object langs
+	 * @param Conf 			$conf 		Object conf
+	 * @return int              		<0 if KO, 0 if no triggered ran, >0 if OK
+	 */
+	public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
+	{
+		if (empty($conf->nav) || empty($conf->nav->enabled)) {
+			return 0; // If module is not enabled, we do nothing
+		}
+
+		// Put here code you want to execute when a Dolibarr business events occurs.
+		// Data and type of action are stored into $object and $action
+
+		// You can isolate code for each action in a separate method: this method should be named like the trigger in camelCase.
+		// For example : COMPANY_CREATE => public function companyCreate($action, $object, User $user, Translate $langs, Conf $conf)
+		$methodName = lcfirst(str_replace(' ', '', ucwords(str_replace('_', ' ', strtolower($action)))));
+		$callback = array($this, $methodName);
+		if (is_callable($callback)) {
+			dol_syslog(
+				"Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id
+			);
+
+			return call_user_func($callback, $action, $object, $user, $langs, $conf);
+		};
+
+		// Or you can execute some code here
+		switch ($action) {
+			// Users
+			//case 'USER_CREATE':
+			//case 'USER_MODIFY':
+			//case 'USER_NEW_PASSWORD':
+			//case 'USER_ENABLEDISABLE':
+			//case 'USER_DELETE':
+
+			// Actions
+			//case 'ACTION_MODIFY':
+			//case 'ACTION_CREATE':
+			//case 'ACTION_DELETE':
+
+			// Groups
+			//case 'USERGROUP_CREATE':
+			//case 'USERGROUP_MODIFY':
+			//case 'USERGROUP_DELETE':
+
+			// Companies
+			//case 'COMPANY_CREATE':
+			//case 'COMPANY_MODIFY':
+			//case 'COMPANY_DELETE':
+
+			// Contacts
+			//case 'CONTACT_CREATE':
+			//case 'CONTACT_MODIFY':
+			//case 'CONTACT_DELETE':
+			//case 'CONTACT_ENABLEDISABLE':
+
+			// Products
+			//case 'PRODUCT_CREATE':
+			//case 'PRODUCT_MODIFY':
+			//case 'PRODUCT_DELETE':
+			//case 'PRODUCT_PRICE_MODIFY':
+			//case 'PRODUCT_SET_MULTILANGS':
+			//case 'PRODUCT_DEL_MULTILANGS':
+
+			//Stock mouvement
+			//case 'STOCK_MOVEMENT':
+
+			//MYECMDIR
+			//case 'MYECMDIR_CREATE':
+			//case 'MYECMDIR_MODIFY':
+			//case 'MYECMDIR_DELETE':
+
+			// Customer orders
+			//case 'ORDER_CREATE':
+			//case 'ORDER_MODIFY':
+			//case 'ORDER_VALIDATE':
+			//case 'ORDER_DELETE':
+			//case 'ORDER_CANCEL':
+			//case 'ORDER_SENTBYMAIL':
+			//case 'ORDER_CLASSIFY_BILLED':
+			//case 'ORDER_SETDRAFT':
+			//case 'LINEORDER_INSERT':
+			//case 'LINEORDER_UPDATE':
+			//case 'LINEORDER_DELETE':
+
+			// Supplier orders
+			//case 'ORDER_SUPPLIER_CREATE':
+			//case 'ORDER_SUPPLIER_MODIFY':
+			//case 'ORDER_SUPPLIER_VALIDATE':
+			//case 'ORDER_SUPPLIER_DELETE':
+			//case 'ORDER_SUPPLIER_APPROVE':
+			//case 'ORDER_SUPPLIER_REFUSE':
+			//case 'ORDER_SUPPLIER_CANCEL':
+			//case 'ORDER_SUPPLIER_SENTBYMAIL':
+			//case 'ORDER_SUPPLIER_DISPATCH':
+			//case 'LINEORDER_SUPPLIER_DISPATCH':
+			//case 'LINEORDER_SUPPLIER_CREATE':
+			//case 'LINEORDER_SUPPLIER_UPDATE':
+			//case 'LINEORDER_SUPPLIER_DELETE':
+
+			// Proposals
+			//case 'PROPAL_CREATE':
+			//case 'PROPAL_MODIFY':
+			//case 'PROPAL_VALIDATE':
+			//case 'PROPAL_SENTBYMAIL':
+			//case 'PROPAL_CLOSE_SIGNED':
+			//case 'PROPAL_CLOSE_REFUSED':
+			//case 'PROPAL_DELETE':
+			//case 'LINEPROPAL_INSERT':
+			//case 'LINEPROPAL_UPDATE':
+			//case 'LINEPROPAL_DELETE':
+
+			// SupplierProposal
+			//case 'SUPPLIER_PROPOSAL_CREATE':
+			//case 'SUPPLIER_PROPOSAL_MODIFY':
+			//case 'SUPPLIER_PROPOSAL_VALIDATE':
+			//case 'SUPPLIER_PROPOSAL_SENTBYMAIL':
+			//case 'SUPPLIER_PROPOSAL_CLOSE_SIGNED':
+			//case 'SUPPLIER_PROPOSAL_CLOSE_REFUSED':
+			//case 'SUPPLIER_PROPOSAL_DELETE':
+			//case 'LINESUPPLIER_PROPOSAL_INSERT':
+			//case 'LINESUPPLIER_PROPOSAL_UPDATE':
+			//case 'LINESUPPLIER_PROPOSAL_DELETE':
+
+			// Contracts
+			//case 'CONTRACT_CREATE':
+			//case 'CONTRACT_MODIFY':
+			//case 'CONTRACT_ACTIVATE':
+			//case 'CONTRACT_CANCEL':
+			//case 'CONTRACT_CLOSE':
+			//case 'CONTRACT_DELETE':
+			//case 'LINECONTRACT_INSERT':
+			//case 'LINECONTRACT_UPDATE':
+			//case 'LINECONTRACT_DELETE':
+
+			// Bills
+			//case 'BILL_CREATE':
+			//case 'BILL_MODIFY':
+			
+			case 'BILL_VALIDATE':
+				if(false){
+					require_once(DOL_DOCUMENT_ROOT.'/custom/nav/class/nav.class.php');
+					$nav = new Nav($this->db);
+					if($xml = $nav->invoiceXML($object)){
+						// print_r($object);exit;
+						try {
+							// Az $invoiceXml tartalmazza a számla (szakmai) SimpleXMLElement objektumot
+
+							if($transactionId = $nav->NavReporter->manageInvoice($xml, "CREATE")){
+								// print "Tranzakciós azonosító a státusz lekérdezéshez: " . $transactionId;
+								$sql = 'UPDATE '.MAIN_DB_PREFIX."facture_extrafields SET xml='".$this->db->escape($xml->asXML())."', transaction_id='".$this->db->escape($transactionId)."' WHERE fk_object = ".$this->db->escape($object->id).";";
+								// echo $sql;exit;
+								$resql = $this->db->query($sql);
+								if (!$resql) {
+									//...
+								}
+							}
+						} catch(Exception $ex) {
+							print get_class($ex) . ": " . $ex->getMessage();
+							exit; //!!! valamit ki kell találni a tesztelésre!
+						}
+						// exit;
+					}
+				}
+			break;
+			//case 'BILL_UNVALIDATE':
+			//case 'BILL_SENTBYMAIL':
+			//case 'BILL_CANCEL':
+			//case 'BILL_DELETE':
+			//case 'BILL_PAYED':
+			//case 'LINEBILL_INSERT':
+			//case 'LINEBILL_UPDATE':
+			//case 'LINEBILL_DELETE':
+
+			//Supplier Bill
+			//case 'BILL_SUPPLIER_CREATE':
+			//case 'BILL_SUPPLIER_UPDATE':
+			//case 'BILL_SUPPLIER_DELETE':
+			//case 'BILL_SUPPLIER_PAYED':
+			//case 'BILL_SUPPLIER_UNPAYED':
+			//case 'BILL_SUPPLIER_VALIDATE':
+			//case 'BILL_SUPPLIER_UNVALIDATE':
+			//case 'LINEBILL_SUPPLIER_CREATE':
+			//case 'LINEBILL_SUPPLIER_UPDATE':
+			//case 'LINEBILL_SUPPLIER_DELETE':
+
+			// Payments
+			//case 'PAYMENT_CUSTOMER_CREATE':
+			//case 'PAYMENT_SUPPLIER_CREATE':
+			//case 'PAYMENT_ADD_TO_BANK':
+			//case 'PAYMENT_DELETE':
+
+			// Online
+			//case 'PAYMENT_PAYBOX_OK':
+			//case 'PAYMENT_PAYPAL_OK':
+			//case 'PAYMENT_STRIPE_OK':
+
+			// Donation
+			//case 'DON_CREATE':
+			//case 'DON_UPDATE':
+			//case 'DON_DELETE':
+
+			// Interventions
+			//case 'FICHINTER_CREATE':
+			//case 'FICHINTER_MODIFY':
+			//case 'FICHINTER_VALIDATE':
+			//case 'FICHINTER_DELETE':
+			//case 'LINEFICHINTER_CREATE':
+			//case 'LINEFICHINTER_UPDATE':
+			//case 'LINEFICHINTER_DELETE':
+
+			// Members
+			//case 'MEMBER_CREATE':
+			//case 'MEMBER_VALIDATE':
+			//case 'MEMBER_SUBSCRIPTION':
+			//case 'MEMBER_MODIFY':
+			//case 'MEMBER_NEW_PASSWORD':
+			//case 'MEMBER_RESILIATE':
+			//case 'MEMBER_DELETE':
+
+			// Categories
+			//case 'CATEGORY_CREATE':
+			//case 'CATEGORY_MODIFY':
+			//case 'CATEGORY_DELETE':
+			//case 'CATEGORY_SET_MULTILANGS':
+
+			// Projects
+			//case 'PROJECT_CREATE':
+			//case 'PROJECT_MODIFY':
+			//case 'PROJECT_DELETE':
+
+			// Project tasks
+			//case 'TASK_CREATE':
+			//case 'TASK_MODIFY':
+			//case 'TASK_DELETE':
+
+			// Task time spent
+			//case 'TASK_TIMESPENT_CREATE':
+			//case 'TASK_TIMESPENT_MODIFY':
+			//case 'TASK_TIMESPENT_DELETE':
+			//case 'PROJECT_ADD_CONTACT':
+			//case 'PROJECT_DELETE_CONTACT':
+			//case 'PROJECT_DELETE_RESOURCE':
+
+			// Shipping
+			//case 'SHIPPING_CREATE':
+			//case 'SHIPPING_MODIFY':
+			//case 'SHIPPING_VALIDATE':
+			//case 'SHIPPING_SENTBYMAIL':
+			//case 'SHIPPING_BILLED':
+			//case 'SHIPPING_CLOSED':
+			//case 'SHIPPING_REOPEN':
+			//case 'SHIPPING_DELETE':
+
+			// and more...
+
+			default:
+				dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
+				break;
+		}
+
+		return 0;
+	}
+}

BIN
custom/nav/img/object_action.png


BIN
custom/nav/img/object_nav.png


BIN
custom/nav/img/object_nav_over.png


+ 54 - 0
custom/nav/langs/en_US/nav.lang

@@ -0,0 +1,54 @@
+# Copyright (C) 2022 Deák Ferenc
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+#
+# Generic
+#
+
+# Module label 'ModuleNavName'
+ModuleNavName = Nav
+# Module description 'ModuleNavDesc'
+ModuleNavDesc = Nav description
+
+#
+# Admin page
+#
+NavSetup = Nav setup
+Settings = Settings
+NavSetupPage = Nav setup page
+NAV_MYPARAM1 = My param 1
+NAV_MYPARAM1Tooltip = My param 1 tooltip
+NAV_MYPARAM2=My param 2
+NAV_MYPARAM2Tooltip=My param 2 tooltip
+
+
+#
+# About page
+#
+About = About
+NavAbout = About Nav
+NavAboutPage = Nav about page
+
+#
+# Sample page
+#
+NavArea = Home Nav
+MyPageName = My page name
+
+#
+# Sample widget
+#
+MyWidget = My widget
+MyWidgetDescription = My widget description

+ 57 - 0
custom/nav/lib/NavOnlineInvoice/BaseExceptionResponse.php

@@ -0,0 +1,57 @@
+<?php
+
+namespace NavOnlineInvoice;
+use Exception;
+
+
+abstract class BaseExceptionResponse extends Exception {
+
+    protected $xml;
+
+
+    function __construct($xml) {
+        $this->xml = $xml;
+        $message = $this->getResultMessage();
+
+        parent::__construct($message);
+    }
+
+
+    public function getXml() {
+        return $this->xml;
+    }
+
+
+    /**
+     * Return the result field of the XML in array format
+     * @return array
+     */
+    abstract public function getResult();
+
+
+    public function getResultMessage() {
+        $result = $this->getResult();
+
+        if (empty($result["message"])) {
+            $message = $result["errorCode"];
+        } elseif (empty($result["errorCode"])) {
+            $message = $result["message"];
+        } else {
+            $message = "$result[message] ($result[errorCode])";
+        }
+
+        return $message;
+    }
+
+
+    public function getErrorCode() {
+        $result = $this->getResult();
+
+        if (isset($result["errorCode"])) {
+            return (string)$result["errorCode"];
+        }
+
+        return null;
+    }
+
+}

+ 183 - 0
custom/nav/lib/NavOnlineInvoice/BaseRequestXml.php

@@ -0,0 +1,183 @@
+<?php
+
+namespace NavOnlineInvoice;
+use Exception;
+
+
+abstract class BaseRequestXml {
+
+    protected $rootName;
+    protected $config;
+
+    /**
+     * @var \SimpleXMLElement
+     */
+    protected $xml;
+
+    protected $requestId;
+    protected $timestamp;
+
+    const API_NS = "http://schemas.nav.gov.hu/OSA/3.0/api";
+    const COMMON_NS = "http://schemas.nav.gov.hu/NTCA/1.0/common";
+
+
+    /**
+     * Request XML készítése
+     *
+     * @param Config $config    Konfigurációt tartalmazó objektum
+     */
+    function __construct($config) {
+        $this->config = $config;
+
+        $this->createXml();
+    }
+
+
+    protected function createXml() {
+        $this->requestId = $this->config->getRequestIdGenerator()->generate();
+        $this->timestamp = $this->getTimestamp();
+
+        $this->createXmlObject();
+        $this->addHeader();
+        $this->addUser();
+        $this->addSoftware();
+    }
+
+
+    /**
+     * A kérés kliens oldali időpontja UTC-ben, ezredmásodperccel
+     *
+     * @return string
+     */
+    protected function getTimestamp() {
+        $now = microtime(true);
+        $milliseconds = round(($now - floor($now)) * 1000);
+        $milliseconds = min($milliseconds, 999);
+
+        return gmdate("Y-m-d\TH:i:s", (int) $now) . sprintf(".%03dZ", $milliseconds);
+    }
+
+
+    protected function createXmlObject() {
+        $this->xml = new \SimpleXMLElement($this->getInitialXmlString());
+    }
+
+
+    protected function getInitialXmlString() {
+
+        if (empty($this->rootName)) {
+            throw new Exception("rootName has to be defined!");
+        }
+        return '<?xml version="1.0" encoding="UTF-8"?><' . $this->rootName . ' xmlns:common="' . self::COMMON_NS . '" xmlns="' . self::API_NS . '"></' . $this->rootName . '>';
+    }
+
+
+    protected function addHeader() {
+        $header = $this->xml->addChild("header", null, self::COMMON_NS);
+
+        $header->addChild("requestId", $this->requestId);
+        $header->addChild("timestamp", $this->timestamp);
+        $header->addChild("requestVersion", "3.0");
+        $header->addChild("headerVersion", "1.0");
+    }
+
+
+    protected function addUser() {
+        $user = $this->xml->addChild("user", null, self::COMMON_NS);
+
+        $passwordHash = isset($this->config->user["passwordHash"]) ? $this->config->user["passwordHash"] : Util::sha512($this->config->user["password"]);
+        $signature = $this->getRequestSignatureHash();
+
+        $user->addChild("login", $this->config->user["login"]);
+        $user->addChild("passwordHash", $passwordHash)->addAttribute("cryptoType", "SHA-512");
+        $user->addChild("taxNumber", $this->config->user["taxNumber"]);
+        $user->addChild("requestSignature", $signature)->addAttribute("cryptoType", "SHA3-512");
+    }
+
+
+    protected function addSoftware() {
+        if (!$this->config->software) {
+            return;
+        }
+
+        $software = $this->xml->addChild("software");
+
+        foreach ($this->config->software as $key => $value) {
+            $software->addChild($key, $value);
+        }
+    }
+
+
+    /**
+     * Aláírás generálása.
+     *
+     * manageInvoice esetén (ManageInvoiceRequestXml osztályban) ez a metódus felülírandó,
+     * mert máshogy kell számolni az értéket (más értékeket is össze kell fűzni).
+     *
+     * Kapcsolódó fejezet: 1.5 A requestSignature számítása
+     */
+    protected function getRequestSignatureHash() {
+        $string = $this->getRequestSignatureString();
+        $hash = Util::sha3_512($string);
+        return $hash;
+    }
+
+
+    /**
+     * Aláírás hash értékének számításához string-ek összefűzése és visszaadása
+     *
+     * manageInvoice esetén (ManageInvoiceRequestXml osztályban) ez a metódus felülírandó,
+     * mert további értékeket is hozzá kell fűzni még.
+     *
+     * Kapcsolódó fejezet: 1.5 A requestSignature számítása
+     */
+    protected function getRequestSignatureString() {
+        $string = "";
+
+        // requestId értéke
+        $string .= $this->requestId;
+
+        // timestamp tag értéke yyyyMMddHHmmss maszkkal, UTC időben (ezredmásodperc nélkül)
+        $string .= preg_replace("/\.\d{3}|\D+/", "", $this->timestamp);
+
+        // technikai felhasználó aláíró kulcsának literál értéke
+        $string .= $this->config->user["signKey"];
+
+        return $string;
+    }
+
+
+    /**
+     * XML objektum lekérése
+     *
+     * @return \SimpleXMLElement
+     */
+    public function getXML() {
+        return $this->xml;
+    }
+
+
+    /**
+     * XML adat lekérése string-ként
+     *
+     * @return string
+     */
+    public function asXML() {
+        return $this->xml->asXML();
+    }
+
+
+    /**
+     * A request XML-t validálja a NAV által biztosított 'invoiceApi.xsd'-vel.
+     * Hiba esetén XsdValidationError exception-t dob.
+     */
+    public function validateSchema() {
+        Xsd::validate($this->asXML(), Config::getApiXsdFilename());
+    }
+
+
+    public function getRequestId() {
+        return $this->requestId;
+    }
+
+}

+ 184 - 0
custom/nav/lib/NavOnlineInvoice/Config.php

@@ -0,0 +1,184 @@
+<?php
+
+namespace NavOnlineInvoice;
+use Exception;
+
+
+class Config {
+
+    const TEST_URL = 'https://api-test.onlineszamla.nav.gov.hu/invoiceService/v3';
+    const PROD_URL = 'https://api.onlineszamla.nav.gov.hu/invoiceService/v3';
+
+    public $user;
+    public $software;
+
+    public $baseUrl;
+    public $verifySSL = true;
+
+    public $validateApiSchema = true;
+
+    public $curlTimeout = null;
+
+    /** @var RequestIdGeneratorInterface */
+    public $requestIdGenerator;
+
+    /**
+     * NavOnlineInvoice Reporter osztály számára szükséges konfigurációs objektum készítése
+     *
+     * @param string       $baseUrl  NAV API URL
+     * @param array|string $user     User data array vagy json fájlnév
+     * @param array|string $software Software data array vagy json fájlnév
+     * @throws \Exception
+     */
+    function __construct($baseUrl, $user, $software) {
+
+        if (!$baseUrl) {
+            throw new Exception("A baseUrl paraméter megadása kötelező!");
+        }
+
+        if (!$software) {
+            throw new Exception("A 2.0-ás API-tól a Software adatok megadása kötelező!");
+        }
+
+        $this->setBaseUrl($baseUrl);
+
+        if (!$user) {
+            throw new Exception("A user paraméter megadása kötelező!");
+        }
+
+        if (is_string($user)) {
+            $this->loadUser($user);
+        } else {
+            $this->setUser($user);
+        }
+
+        if (is_string($software)) {
+            $this->loadSoftware($software);
+        } else {
+            $this->setSoftware($software);
+        }
+
+        $this->setRequestIdGenerator(new RequestIdGeneratorBasic());
+    }
+
+
+    function setRequestIdGenerator(RequestIdGeneratorInterface $obj) {
+        $this->requestIdGenerator = $obj;
+    }
+
+
+    function getRequestIdGenerator() {
+        return $this->requestIdGenerator;
+    }
+
+
+    /**
+     * NAV online számla API eléréséhez használt URL
+     *
+     * Teszt: https://api-test.onlineszamla.nav.gov.hu/invoiceService/v3
+     * Éles: https://api.onlineszamla.nav.gov.hu/invoiceService/v3
+     *
+     * @param string $baseUrl  NAV eléréséhez használt környezet
+     */
+    public function setBaseUrl($baseUrl) {
+        $this->baseUrl = $baseUrl;
+    }
+
+
+    /**
+     * NAV szerverrel való kommunikáció előtt ellenőrizze az XML adatot az API sémával szemben
+     *
+     * @param  boolean $flag
+     */
+    public function useApiSchemaValidation($flag = true) {
+        $this->validateApiSchema = $flag;
+    }
+
+
+    /**
+     *
+     * @param array $data
+     */
+    public function setSoftware($data) {
+        $this->software = $data;
+    }
+
+
+    /**
+     *
+     * @param  string $jsonFile JSON file name
+     */
+    public function loadSoftware($jsonFile) {
+        $data = $this->loadJsonFile($jsonFile);
+        $this->setSoftware($data);
+    }
+
+
+    /**
+     *
+     * @param array $data
+     */
+    public function setUser($data) {
+        $this->user = $data;
+    }
+
+
+    /**
+     *
+     * @param  string $jsonFile JSON file name
+     */
+    public function loadUser($jsonFile) {
+        $data = $this->loadJsonFile($jsonFile);
+        $this->setUser($data);
+    }
+
+
+    /**
+     * JSON fájl betöltése
+     *
+     * @param  string $jsonFile
+     * @return array
+     * @throws \Exception
+     */
+    protected function loadJsonFile($jsonFile) {
+        if (!file_exists($jsonFile)) {
+            throw new Exception("A megadott json fájl nem létezik: $jsonFile");
+        }
+
+        $content = file_get_contents($jsonFile);
+        $data = json_decode($content, true);
+
+        if ($data === null) {
+            throw new Exception("A megadott json fájlt nem sikerült dekódolni!");
+        }
+
+        return $data;
+    }
+
+
+    /**
+     * cURL hívásnál timeout beállítása másodpercekben.
+     * null vagy 0 esetén nincs explicit timeout beállítás
+     *
+     * @param null|int $timeoutSeconds
+     */
+    public function setCurlTimeout($timeoutSeconds) {
+        $this->curlTimeout = $timeoutSeconds;
+    }
+
+
+    public static function getDataXsdFilename() {
+        return __DIR__ . "/xsd/invoiceData.xsd";
+    }
+
+
+    public static function getAnnulmentXsdFilename() {
+        return __DIR__ . "/xsd/invoiceAnnulment.xsd";
+    }
+
+
+    public static function getApiXsdFilename() {
+        return __DIR__ . "/xsd/invoiceApi.xsd";
+    }
+
+}

+ 188 - 0
custom/nav/lib/NavOnlineInvoice/Connector.php

@@ -0,0 +1,188 @@
+<?php
+
+namespace NavOnlineInvoice;
+
+
+class Connector {
+
+    protected $config;
+
+    private $lastRequestUrl = null;
+    private $lastRequestHeader = null;
+    private $lastRequestBody = null;
+    private $lastResponseHeader = null;
+    private $lastResponseBody = null;
+    private $lastRequestId = null;
+    private $lastResponseXml = null;
+
+
+    /**
+     *
+     * @param Config  $config
+     */
+    function __construct($config) {
+        $this->config = $config;
+    }
+
+
+    private function resetDebugInfo() {
+        $this->lastRequestUrl = null;
+        $this->lastRequestHeader = null;
+        $this->lastRequestBody = null;
+        $this->lastResponseHeader = null;
+        $this->lastResponseBody = null;
+        $this->lastRequestId = null;
+        $this->lastResponseXml = null;
+    }
+
+
+    /**
+     * Utolsó REST hívás adatainak lekérdezése
+     *
+     * @return array
+     */
+    public function getLastRequestData() {
+        return array(
+            'requestUrl' => $this->lastRequestUrl,
+            'requestHeader' => $this->lastRequestHeader,
+            'requestBody' => $this->lastRequestBody,
+            'responseHeader' => $this->lastResponseHeader,
+            'responseBody' => $this->lastResponseBody,
+            'requestId' => $this->lastRequestId,
+            'responseXml' => $this->lastResponseXml,
+        );
+    }
+
+
+    public function getLastResponseXml() {
+        return $this->lastResponseXml;
+    }
+
+
+    /**
+     *
+     * @param  string                   $url
+     * @param  string|\SimpleXMLElement $requestXml
+     * @return \SimpleXMLElement
+     * @throws \NavOnlineInvoice\CurlError
+     * @throws \NavOnlineInvoice\HttpResponseError
+     * @throws \NavOnlineInvoice\GeneralExceptionResponse
+     * @throws \NavOnlineInvoice\GeneralErrorResponse
+     */
+    public function post($url, $requestXml) {
+        $this->resetDebugInfo();
+
+        $url = $this->config->baseUrl . $url;
+        $this->lastRequestUrl = $url;
+
+        $xmlString = is_string($requestXml) ? $requestXml : $requestXml->asXML();
+        $this->lastRequestBody = $xmlString;
+
+        $this->lastRequestId = $requestXml instanceof BaseRequestXml ? $requestXml->getRequestId() : null;
+
+        if ($this->config->validateApiSchema) {
+            Xsd::validate($xmlString, Config::getApiXsdFilename());
+        }
+
+        $ch = $this->getCurlHandle($url, $xmlString);
+
+        $response = curl_exec($ch);
+        $errno = curl_errno($ch);
+        $info = curl_getinfo($ch);
+        $header = substr($response, 0, $info["header_size"]);
+        $result = substr($response, $info["header_size"]);
+
+        $httpStatusCode = $info["http_code"];
+
+        $this->lastRequestHeader = isset($info["request_header"]) ? $info["request_header"] : null;
+        $this->lastResponseHeader = $header;
+        $this->lastResponseBody = $result;
+
+        curl_close($ch);
+
+        if ($errno) {
+            throw new CurlError($errno);
+        }
+
+        $responseXml = $this->parseResponse($result);
+
+        $this->lastResponseXml = $responseXml;
+
+        if (!$responseXml) {
+            throw new HttpResponseError($result, $httpStatusCode);
+        }
+
+        if ($responseXml->getName() === "GeneralExceptionResponse") {
+            throw new GeneralExceptionResponse($responseXml);
+        }
+
+        if ($responseXml->getName() === "GeneralErrorResponse") {
+            throw new GeneralErrorResponse($responseXml);
+        }
+
+        // TODO: felülvizsgálni, hogy ez minden esetben jó megoldás-e itt, illetve esetleg más típusú Exception dobása
+        // Ha a result->funcCode !== OK értékkel, akkor Exception dobása
+        if ((string)$responseXml->result->funcCode !== "OK") {
+            throw new GeneralErrorResponse($responseXml);
+        }
+
+        // Fejlesztés idő alatt előfordult, hogy funcCode === OK, de a service nem megy
+        if (!empty($responseXml->result->message) and preg_match("/endpoint is currently down/", $responseXml->result->message)) {
+            throw new GeneralErrorResponse($responseXml);
+        }
+
+        return $responseXml;
+    }
+
+
+    private function getCurlHandle($url, $requestBody) {
+        $ch = curl_init($url);
+
+        $headers = array(
+            "Content-Type: application/xml;charset=UTF-8",
+            "Accept: application/xml",
+        );
+
+        $curl_version = curl_version();
+
+        if (version_compare($curl_version['version'], '7.69') < 0) {
+            $headers[] = "Expect:";
+            //ha eredeti értékét megtartjuk, akkor NAV üres body-t add vissza nagy méretű válaszok esetén
+            //@see https://daniel.haxx.se/blog/2020/02/27/expect-tweaks-in-curl/
+            //(cURL <7.69)
+        }
+
+        if (!$this->config->verifySSL) {
+            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
+            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+        }
+
+        curl_setopt($ch, CURLOPT_POST, true);
+        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
+        curl_setopt($ch, CURLOPT_POSTFIELDS, $requestBody);
+        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+        curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);
+        curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
+        curl_setopt($ch, CURLOPT_HEADER, true);
+        curl_setopt($ch, CURLINFO_HEADER_OUT, true);
+
+        if ($this->config->curlTimeout) {
+            curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 0);
+            curl_setopt($ch, CURLOPT_TIMEOUT, $this->config->curlTimeout);
+        }
+
+        return $ch;
+    }
+
+
+    private function parseResponse($xmlString) {
+        if (substr($xmlString, 0, 5) !== "<?xml") {
+            return null;
+        }
+
+        $xmlString = XmlUtil::removeNamespacesFromXmlString($xmlString);
+
+        return simplexml_load_string($xmlString);
+    }
+
+}

+ 25 - 0
custom/nav/lib/NavOnlineInvoice/CurlError.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace NavOnlineInvoice;
+use Exception;
+
+
+class CurlError extends Exception {
+
+    protected $errno;
+
+
+    function __construct($errno) {
+        $this->errno = $errno;
+
+        $message = "Connection error. CURL error code: $errno";
+
+        parent::__construct($message);
+    }
+
+
+    public function getErrno() {
+        return $this->errno;
+    }
+
+}

+ 11 - 0
custom/nav/lib/NavOnlineInvoice/GeneralErrorResponse.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace NavOnlineInvoice;
+
+class GeneralErrorResponse extends BaseExceptionResponse {
+
+    public function getResult() {
+        return (array)$this->xml->result;
+    }
+
+}

+ 11 - 0
custom/nav/lib/NavOnlineInvoice/GeneralExceptionResponse.php

@@ -0,0 +1,11 @@
+<?php
+
+namespace NavOnlineInvoice;
+
+class GeneralExceptionResponse extends BaseExceptionResponse {
+
+    public function getResult() {
+        return (array)$this->xml;
+    }
+
+}

+ 32 - 0
custom/nav/lib/NavOnlineInvoice/HttpResponseError.php

@@ -0,0 +1,32 @@
+<?php
+
+namespace NavOnlineInvoice;
+use Exception;
+
+
+class HttpResponseError extends Exception {
+
+    protected $result;
+    protected $httpStatusCode;
+
+
+    function __construct($result, $httpStatusCode) {
+        $this->result = $result;
+        $this->httpStatusCode = $httpStatusCode;
+
+        $message = "$result (HTTP Status code: $httpStatusCode)";
+
+        parent::__construct($message);
+    }
+
+
+    public function getResult() {
+        return $this->result;
+    }
+
+
+    public function getHttpStatusCode() {
+        return $this->httpStatusCode;
+    }
+
+}

+ 216 - 0
custom/nav/lib/NavOnlineInvoice/InvoiceOperations.php

@@ -0,0 +1,216 @@
+<?php
+
+namespace NavOnlineInvoice;
+use Exception;
+
+
+class InvoiceOperations {
+
+    const MAX_INVOICE_COUNT = 100;
+    const COMPRESSION_LEVEL = 1;
+
+    protected $invoices;
+    protected $compression;
+
+    /**
+     * Az automatikusan felismert technicalAnnulment értéke az első hozzáadott számla alapján.
+     * `null` esetén még nincs számla hozzáadva
+     *
+     * @var bool|null
+     */
+    protected $detectedTechnicalAnnulment = null;
+    protected $index;
+    protected $schemaValidation = true;
+
+
+    /**
+     * Számlákat (számla műveleteket) összefogó objektum (collection) készítése
+     *
+     * @param boolean $compression    gzip tömörítés alkalmazása, részletek: NAV dokumentáció, 1.6.5 Tömörítés és méretkorlát
+     */
+    function __construct($compression = false) {
+        $this->invoices = array();
+        $this->index = 1;
+        $this->compression = $compression;
+    }
+
+
+    /**
+     * Számla hozzáadásakor ellenőrizze az XML adatot a DATA sémával szemben
+     *
+     * @param  boolean $flag
+     */
+    public function useDataSchemaValidation($flag = true) {
+        $this->schemaValidation = $flag;
+    }
+
+
+    /**
+     * Számla ('szakmai XML') hozzáadása
+     *
+     * @param \SimpleXMLElement $xml       Számla adatai (szakmai XML)
+     * @param string            [$operation = "CREATE"] Számlaművelet Enum(CREATE, MODIFY, STORNO, ANNUL)
+     * @param string            [$electronicInvoiceHash = null] Számla SHA3-512 hash értéke elektronikus számla esetén. Ha completenessIndicator=true, akkor itt null-t kell átadni.
+     * @return int                      A beszúrt művelet sorszáma (index)
+     * @throws \Exception
+     */
+    public function add(\SimpleXMLElement $xml, $operation = "CREATE", $electronicInvoiceHash = null) {
+
+        // XSD validálás
+        if ($this->schemaValidation) {
+            $xsdFile = $operation === "ANNUL" ? Config::getAnnulmentXsdFilename() : Config::getDataXsdFilename();
+            Xsd::validate($xml->asXML(), $xsdFile);
+        }
+
+        // Számlák maximum számának ellenőrzése
+        if (count($this->invoices) > self::MAX_INVOICE_COUNT) {
+            throw new Exception("Maximum " . self::MAX_INVOICE_COUNT . " számlát lehet egyszerre elküldeni!");
+        }
+
+        // Technical annulment flag beállítása és ellenőrzése
+        $this->detectTechnicalAnnulment($operation);
+
+        $completenessIndicator = $this->isComplete($xml);
+
+        if ($completenessIndicator and $electronicInvoiceHash) {
+            throw new Exception("completenessIndicator=true esetén az electronicInvoiceHash értékét a nav-online-invoice modul számolja automatikusan, így ezt a paramétert üresen kell hagyni!");
+        }
+
+        $invoiceBase64Data = $this->convertXml($xml);
+
+        if ($completenessIndicator) {
+            $electronicInvoiceHash = Util::sha3_512($invoiceBase64Data);
+        }
+
+        $idx = $this->index;
+        $this->index++;
+
+        $this->invoices[] = array(
+            "index" => $idx,
+            "operation" => $operation,
+            "invoice" => $invoiceBase64Data,
+            "electronicInvoiceHash" => $electronicInvoiceHash,
+        );
+
+        return $idx;
+    }
+
+
+    /**
+     * A felismert technicalAnnulment értékének lekérdezése.
+     * Ha még nem adtunk hozzá számlát, akkor hibát fog dobni.
+     *
+     * @return bool       technicalAnnulment
+     * @throws  Exception
+     */
+    public function isTechnicalAnnulment() {
+        if (!$this->invoices) {
+            throw new Exception("Még nincs számla hozzáadva, így a technicalAnnulment értéke nem megállapítható!");
+        }
+
+        return $this->detectedTechnicalAnnulment;
+    }
+
+
+    protected function detectTechnicalAnnulment($operation) {
+        $currentFlag = ($operation === 'ANNUL');
+
+        // Ha még nincs beállítva, akkor beállítjuk
+        if (is_null($this->detectedTechnicalAnnulment)) {
+            $this->detectedTechnicalAnnulment = $currentFlag;
+        }
+
+        // Ha a korábban beállított nem egyezik az aktuálissal, akkor hiba dobása (NAV nem fogadja el)
+        if ($this->detectedTechnicalAnnulment !== $currentFlag) {
+            throw new Exception("Az egyszerre feladott számlák nem tartalmazhatnak vegyesen ANNUL, illetve ettől eltérő operation értéket!");
+        }
+    }
+
+
+    public function getInvoices() {
+        return $this->invoices;
+    }
+
+
+    /**
+     * Utoljára hozzáadott számla electronicInvoiceHash értékét adja vissza.
+     * Ez lehet paraméterben átadott, vagy completenessIndicator=true esetén a modul által számolt hash.
+     *
+     * @return string
+     */
+    public function getLastInvoiceHash() {
+        if (!$this->invoices) {
+            return null;
+        }
+
+        $lastInvoice = $this->invoices[count($this->invoices) - 1];
+
+        return $lastInvoice['electronicInvoiceHash'];
+    }
+
+
+    public function isCompressed() {
+        return $this->compression;
+    }
+
+
+    /**
+     * XML objektum konvertálása base64-es szöveggé
+     * @param \SimpleXMLElement $xml
+     * @return string
+     */
+    protected function convertXml(\SimpleXMLElement $xml) {
+        $xml = $xml->asXML();
+
+        if ($this->compression) {
+            $xml = gzencode($xml, self::COMPRESSION_LEVEL);
+        }
+
+        return base64_encode($xml);
+    }
+
+
+    protected function isComplete(\SimpleXMLElement $xml) {
+        return (string)$xml->completenessIndicator === 'true';
+    }
+
+
+    /**
+     * Egy darab számla XML-t átadva visszaad egy InvoiceOperations példányt,
+     * amit a Reporter::manageInvoice metódusa fogad paraméterben
+     *
+     * @param  \SimpleXMLElement $xml
+     * @param  string           $operation
+     * @param  boolean $compression    gzip tömörítés alkalmazása, részletek: NAV dokumentáció, 1.6.5 Tömörítés és méretkorlát
+     * @return InvoiceOperations
+     */
+    public static function convertFromXml($xml, $operation, $compression = false) {
+        $invoiceOperations = new self($compression);
+        $invoiceOperations->useDataSchemaValidation();
+
+        $invoiceOperations->add($xml, $operation);
+
+        return $invoiceOperations;
+    }
+
+
+    /**
+     * Számla dekódolása (base64 és opcionálisan gzip)
+     *
+     * @param  string  $base64data
+     * @param  boolean $isCompressed
+     * @return \SimpleXMLElement
+     */
+    public static function convertToXml($base64data, $isCompressed = false) {
+        $isCompressed = ($isCompressed === true or (string)$isCompressed === 'true');
+
+        $data = base64_decode($base64data);
+
+        if ($isCompressed) {
+            $data = gzdecode($data);
+        }
+
+        return simplexml_load_string($data);
+    }
+
+}

+ 24 - 0
custom/nav/lib/NavOnlineInvoice/ManageAnnulmentRequestXml.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace NavOnlineInvoice;
+
+
+class ManageAnnulmentRequestXml extends ManageInvoiceRequestXml {
+
+    protected $rootName = "ManageAnnulmentRequest";
+
+
+    protected function addInvoiceOperations() {
+        $operationsXml = $this->xml->addChild("annulmentOperations");
+
+        // Számlák hozzáadása az XML-hez
+        foreach ($this->invoiceOperations->getInvoices() as $invoice) {
+            $invoiceXml = $operationsXml->addChild("annulmentOperation");
+
+            $invoiceXml->addChild("index", $invoice["index"]);
+            $invoiceXml->addChild("annulmentOperation", $invoice["operation"]);
+            $invoiceXml->addChild("invoiceAnnulment", $invoice["invoice"]);
+        }
+    }
+
+}

+ 74 - 0
custom/nav/lib/NavOnlineInvoice/ManageInvoiceRequestXml.php

@@ -0,0 +1,74 @@
+<?php
+
+namespace NavOnlineInvoice;
+
+
+class ManageInvoiceRequestXml extends BaseRequestXml {
+
+    protected $rootName = "ManageInvoiceRequest";
+    protected $invoiceOperations;
+    protected $token;
+
+
+    /**
+     * @param Config $config
+     * @param InvoiceOperations $invoiceOperations
+     * @param string $token
+     */
+    function __construct($config, $invoiceOperations, $token) {
+        $this->invoiceOperations = $invoiceOperations;
+        $this->token = $token;
+
+        parent::__construct($config);
+    }
+
+
+    protected function createXml() {
+        parent::createXml();
+        $this->addToken();
+        $this->addInvoiceOperations();
+    }
+
+
+    protected function addToken() {
+        $this->xml->addChild("exchangeToken", $this->token);
+    }
+
+
+    protected function addInvoiceOperations() {
+        $operationsXml = $this->xml->addChild("invoiceOperations");
+
+        $operationsXml->addChild("compressedContent", $this->invoiceOperations->isCompressed() ? "true" : "false");
+
+        // Számlák hozzáadása az XML-hez
+        foreach ($this->invoiceOperations->getInvoices() as $invoice) {
+            $invoiceXml = $operationsXml->addChild("invoiceOperation");
+
+            $invoiceXml->addChild("index", $invoice["index"]);
+            $invoiceXml->addChild("invoiceOperation", $invoice["operation"]);
+            $invoiceXml->addChild("invoiceData", $invoice["invoice"]);
+
+            if ($invoice['electronicInvoiceHash']) {
+                $invoiceXml->addChild("electronicInvoiceHash", $invoice['electronicInvoiceHash'])->addAttribute("cryptoType", "SHA3-512");
+            }
+        }
+    }
+
+
+    /**
+     * Aláírás hash értékének számításához string-ek összefűzése és visszaadása
+     *
+     * Kapcsolódó fejezet: 1.5 A requestSignature számítása
+     */
+    protected function getRequestSignatureString() {
+        $string = parent::getRequestSignatureString();
+
+        // A számlák hash értékének hozzáfűzése
+        foreach ($this->invoiceOperations->getInvoices() as $invoice) {
+            $string .= Util::sha3_512($invoice["operation"] . $invoice["invoice"]);
+        }
+
+        return $string;
+    }
+
+}

+ 24 - 0
custom/nav/lib/NavOnlineInvoice/QueryInvoiceChainDigestRequestXml.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace NavOnlineInvoice;
+
+
+class QueryInvoiceChainDigestRequestXml extends BaseRequestXml {
+
+    protected $rootName = "QueryInvoiceChainDigestRequest";
+
+
+    /**
+     * QueryInvoiceChainDigestRequestXml constructor.
+     * @param $config
+     * @param $page
+     */
+    function __construct($config, $invoiceChainQuery, $page) {
+        parent::__construct($config);
+
+        $this->xml->addChild("page", $page);
+
+        XmlUtil::addChildArray($this->xml, "invoiceChainQuery", $invoiceChainQuery);
+    }
+
+}

+ 24 - 0
custom/nav/lib/NavOnlineInvoice/QueryInvoiceDataRequestXml.php

@@ -0,0 +1,24 @@
+<?php
+
+namespace NavOnlineInvoice;
+use Exception;
+
+
+class QueryInvoiceDataRequestXml extends BaseRequestXml {
+
+    protected $rootName = "QueryInvoiceDataRequest";
+
+
+    /**
+     * QueryInvoiceDataRequestXml constructor.
+     * @param $config
+     * @param $invoiceNumberQuery
+     * @throws \Exception
+     */
+    function __construct($config, $invoiceNumberQuery) {
+        parent::__construct($config);
+
+        XmlUtil::addChildArray($this->xml, "invoiceNumberQuery", $invoiceNumberQuery);
+    }
+
+}

+ 29 - 0
custom/nav/lib/NavOnlineInvoice/QueryInvoiceDigestRequestXml.php

@@ -0,0 +1,29 @@
+<?php
+
+namespace NavOnlineInvoice;
+use Exception;
+
+
+class QueryInvoiceDigestRequestXml extends BaseRequestXml {
+
+    protected $rootName = "QueryInvoiceDigestRequest";
+
+
+    /**
+     * QueryInvoiceDigestRequestXml constructor.
+     * @param $config
+     * @param $invoiceQueryParams
+     * @param $page
+     * @param $direction
+     * @throws \Exception
+     */
+    function __construct($config, $invoiceQueryParams, $page, $direction) {
+        parent::__construct($config);
+
+        $this->xml->addChild("page", $page);
+        $this->xml->addChild("invoiceDirection", $direction);
+
+        XmlUtil::addChildArray($this->xml, "invoiceQueryParams", $invoiceQueryParams);
+    }
+
+}

+ 17 - 0
custom/nav/lib/NavOnlineInvoice/QueryTaxpayerRequestXml.php

@@ -0,0 +1,17 @@
+<?php
+
+namespace NavOnlineInvoice;
+
+
+class QueryTaxpayerRequestXml extends BaseRequestXml {
+
+    protected $rootName = "QueryTaxpayerRequest";
+
+
+    function __construct($config, $taxNumber) {
+        parent::__construct($config);
+
+        $this->xml->addChild("taxNumber", $taxNumber);
+    }
+
+}

+ 25 - 0
custom/nav/lib/NavOnlineInvoice/QueryTransactionListRequestXml.php

@@ -0,0 +1,25 @@
+<?php
+
+namespace NavOnlineInvoice;
+
+
+class QueryTransactionListRequestXml extends BaseRequestXml {
+
+    protected $rootName = "QueryTransactionListRequest";
+
+
+    /**
+     * QueryTransactionListRequestXml constructor.
+     * @param $config
+     * @param $insDate
+     * @param $page
+     */
+    function __construct($config, $insDate, $page) {
+        parent::__construct($config);
+
+        $this->xml->addChild("page", $page);
+
+        XmlUtil::addChildArray($this->xml, "insDate", $insDate);
+    }
+
+}

+ 20 - 0
custom/nav/lib/NavOnlineInvoice/QueryTransactionStatusRequestXml.php

@@ -0,0 +1,20 @@
+<?php
+
+namespace NavOnlineInvoice;
+
+
+class QueryTransactionStatusRequestXml extends BaseRequestXml {
+
+    protected $rootName = "QueryTransactionStatusRequest";
+
+    function __construct($config, $transactionId, $returnOriginalRequest = false) {
+        parent::__construct($config);
+
+        $this->xml->addChild("transactionId", $transactionId);
+
+        if ($returnOriginalRequest) {
+            $this->xml->addChild("returnOriginalRequest", $returnOriginalRequest);
+        }
+    }
+
+}

+ 304 - 0
custom/nav/lib/NavOnlineInvoice/Reporter.php

@@ -0,0 +1,304 @@
+<?php
+
+namespace NavOnlineInvoice;
+use Exception;
+
+
+class Reporter {
+
+    protected $connector;
+    protected $config;
+
+
+    /**
+     *
+     *
+     * @param Config $config    Config object (felhasználó adatok, szoftver adatok, URL, stb.)
+     */
+    function __construct($config) {
+        $this->config = $config;
+        $this->connector = new Connector($config);
+    }
+
+
+    /**
+     * manageAnnulment operáció (1.8.1 fejezet)
+     *
+     * A /manageAnnulment operáció a technikai érvénytelenítések beküldésére szolgáló operáció.
+     * Technikai érvénytelenítés csak olyan adatszolgáltatásra küldhető, amelynek a befogadása
+     * a NAV oldalon DONE státusszal megtörtént.
+     *
+     * Paraméterben a technikai érvénytelenítést leíró XML-t, vagy egy InvoiceOperations példányt
+     * kell átadni. Utóbbi esetben az InvoiceOperations példány több XML-t is tartalmazhat.
+     *
+     * A metódus visszaadja a transactionId-t, mellyel lekérdezhető a tranzakció eredménye.
+     *
+     * @param  [type] $invoiceOperationsOrXml $invoiceOperationsOrXml
+     * @return [type]                         $transactionId
+     */
+    public function manageAnnulment($invoiceOperationsOrXml) {
+
+        // Ha nem InvoiceOperations példányt adtak át, akkor azzá konvertáljuk
+        if ($invoiceOperationsOrXml instanceof InvoiceOperations) {
+            $invoiceOperations = $invoiceOperationsOrXml;
+        } else {
+            $invoiceOperations = InvoiceOperations::convertFromXml($invoiceOperationsOrXml, "ANNUL");
+        }
+
+        if (!$invoiceOperations->isTechnicalAnnulment()) {
+            throw new Exception("manageAnnulment() interfészen csak technikai érvénytelenítést lehet beküldeni.");
+        }
+
+        $token = $this->tokenExchange();
+
+        $requestXml = new ManageAnnulmentRequestXml($this->config, $invoiceOperations, $token);
+        $responseXml = $this->connector->post("/manageAnnulment", $requestXml);
+
+        return (string)$responseXml->transactionId;
+    }
+
+
+    /**
+     * manageInvoice operáció (1.8.2 fejezet)
+     *
+     * A /manageInvoice a számla adatszolgáltatás beküldésére szolgáló operáció, ezen keresztül van lehetőség számla,
+     * módosító vagy stornó számla adatszolgáltatást a NAV részére beküldeni.
+     *
+     * Paraméterben a beküldendő számla XML-t kell átadni, illetve a hozzá tartozó műveletet (ManageInvocieOperationType): CREATE, MODIFY, STORNO
+     *
+     * Átadható egyszerre több számla is, ilyenkor első paraméterben InvoiceOperations példányt kell átadni (második paraméternek nincs szerepe ilyenkor).
+     *
+     * A metódus visszaadja a transactionId-t, mellyel lekérdezhető a tranzakció eredménye.
+     *
+     * @param  InvoiceOperations|\SimpleXMLElement $invoiceOperationsOrXml
+     * @param  string                             $operation
+     * @return string                             $transactionId
+     */
+    public function manageInvoice($invoiceOperationsOrXml, $operation = "CREATE") {
+
+        // Ha nem InvoiceOperations példányt adtak át, akkor azzá konvertáljuk
+        if ($invoiceOperationsOrXml instanceof InvoiceOperations) {
+            $invoiceOperations = $invoiceOperationsOrXml;
+        } else {
+            $invoiceOperations = InvoiceOperations::convertFromXml($invoiceOperationsOrXml, $operation);
+        }
+
+        if ($invoiceOperations->isTechnicalAnnulment()) {
+            throw new Exception("Technikai érvénytelenítésre a manageAnnulment() metódust kell használni a 2.0-ás API-tól kezdődően!");
+        }
+
+        $token = $this->tokenExchange();
+
+        $requestXml = new ManageInvoiceRequestXml($this->config, $invoiceOperations, $token);
+        $responseXml = $this->connector->post("/manageInvoice", $requestXml);
+
+        return (string)$responseXml->transactionId;
+    }
+
+
+    /**
+     * queryInvoiceData operáció (1.8.5 fejezet)
+     *
+     * A /queryInvoiceData egy számlaszám alapján működő lekérdező operáció, amely a számlán szereplő kiállító és a vevő
+     * oldaláról is használható. Az operáció a megadott számlaszám teljes adattartalmát adja vissza a válaszban.
+     *
+     * @param  array             $invoiceNumberQuery     Az invoiceNumberQuery-nek megfelelően összeállított lekérdezési adatok
+     * @param  boolean           [$returnDecodedInvoiceData = false]  invoiceDataResult helyett a dekódolt számla XML-t adja vissza a metódus
+     * @return \SimpleXMLElement  $invoiceDataResultXml A válasz XML invoiceDataResult része vagy a dekódolt számla XML
+     */
+    public function queryInvoiceData($invoiceNumberQuery, $returnDecodedInvoiceData = false) {
+        $requestXml = new QueryInvoiceDataRequestXml($this->config, $invoiceNumberQuery);
+        $responseXml = $this->connector->post("/queryInvoiceData", $requestXml);
+
+        $result = $responseXml->invoiceDataResult;
+
+        if ($returnDecodedInvoiceData) {
+            if (empty($result->invoiceData)) {
+                return null;
+            }
+            $isCompressed = $result->compressedContentIndicator;
+            return InvoiceOperations::convertToXml($result->invoiceData, $isCompressed);
+        }
+
+        return $result;
+    }
+
+
+    /**
+     * queryInvoiceDigest operáció (1.8.6 fejezet)
+     *
+     * A /queryInvoiceDigest üzleti keresőparaméterek alapján működő lekérdező operáció, amely a számlán szereplő
+     * kiállító és a vevő oldaláról is használható. Az operáció a megadott keresőfeltételeknek megfelelő, lapozható
+     * számla listát ad vissza a válaszban. A válasz nem tartalmazza a számlák összes üzleti adatát, hanem csak egy
+     * kivonatot (digest-et). Amennyiben szükség van a listában szereplő valamely számla teljes adattartalmára, úgy
+     * azt a számlaszám birtokában a /queryInvoiceData operációban lehet lekérdezni.
+     *
+     * @param  array             $invoiceQueryParams     Az invoiceQueryParams-nak megfelelően összeállított lekérdezési adatok
+     * @param  Int               [$page=1]          Oldalszám (1-től kezdve a számozást)
+     * @param  string            [$direction=OUTBOUND]  A keresés iránya, a keresés elvégezhető kiállítóként és vevőként is [OUTBOUND, INBOUND]
+     * @return \SimpleXMLElement  $queryResultsXml A válasz XML invoiceDigestResult része
+     */
+    public function queryInvoiceDigest($invoiceQueryParams, $page = 1, $direction = "OUTBOUND") {
+        $requestXml = new QueryInvoiceDigestRequestXml($this->config, $invoiceQueryParams, $page, $direction);
+        $responseXml = $this->connector->post("/queryInvoiceDigest", $requestXml);
+
+        return $responseXml->invoiceDigestResult;
+    }
+
+
+    /**
+     * queryTransactionStatus operáció (1.8.8 fejezet)
+     *
+     * A /queryTransactionStatus a számla adatszolgáltatás feldolgozás aktuális állapotának és eredményének
+     * lekérdezésére szolgáló operáció
+     *
+     * @param  string  $transactionId
+     * @param  boolean $returnOriginalRequest
+     * @return \SimpleXMLElement  $responseXml    A teljes visszakapott XML, melyből a 'processingResults' elem releváns
+     */
+    public function queryTransactionStatus($transactionId, $returnOriginalRequest = false) {
+        $requestXml = new QueryTransactionStatusRequestXml($this->config, $transactionId, $returnOriginalRequest);
+        $responseXml = $this->connector->post("/queryTransactionStatus", $requestXml);
+
+        return $responseXml;
+    }
+
+
+    /**
+     * queryTransactionList operáció
+     *
+     * A /queryTransactionList a kérésben megadott időintervallumban, a technikai felhasználóhoz tartozó adószámhoz
+     * beküldött számlaadat-szolgáltatások listázására szolgál.
+     *
+     * @param  array   $insDate   DateTimeIntervalParamType-nak megfelelő mezők (lásd example)
+     * @param  integer $page
+     * @return \SimpleXMLElement  $transactionListResult A válasz XML transactionListResult része
+     */
+    public function queryTransactionList($insDate, $page = 1) {
+        $requestXml = new QueryTransactionListRequestXml($this->config, $insDate, $page);
+        $responseXml = $this->connector->post("/queryTransactionList", $requestXml);
+
+        return $responseXml->transactionListResult;
+    }
+
+
+    /**
+     * queryInvoiceChainDigest operáció
+     *
+     * A /queryInvoiceChainDigest egy számlaszám alapján működő lekérdező operáció, amely a számlán szereplő
+     * kiállító és a vevő oldaláról is használható. Az operáció a megadott keresőfeltételeknek megfelelő,
+     * lapozható számlalistát ad vissza a válaszban. A lista elemei a megadott alapszámlához tartozó számlalánc elemei.
+     * A válasz nem tartalmazza a számlák összes üzleti adatát, hanem csak egy kivonatot (digest-et), elsősorban a
+     * módosításra és tételsorok számára vonatkozóan
+     *
+     * @param  Array  $invoiceChainQuery
+     * @param  integer $page          Oldalszám
+     * @return \SimpleXMLElement  $invoiceChainDigestResult A válasz XML invoiceChainDigestResult része
+     */
+    public function queryInvoiceChainDigest($invoiceChainQuery, $page = 1) {
+        $requestXml = new QueryInvoiceChainDigestRequestXml($this->config, $invoiceChainQuery, $page);
+        $responseXml = $this->connector->post("/queryInvoiceChainDigest", $requestXml);
+
+        return $responseXml->invoiceChainDigestResult;
+    }
+
+
+    /**
+     * queryTaxpayer operáció (1.8.9 fejezet)
+     *
+     * A /queryTaxpayer belföldi adószám validáló operáció, mely a számlakiállítás folyamatába építve képes
+     * a megadott adószám valódiságáról és érvényességéről a NAV adatbázisa alapján adatot szolgáltatni.
+     *
+     * @param  string $taxNumber            Adószám, pattern: [0-9]{8}
+     * @return bool|\SimpleXMLElement     Nem létező adószám esetén `null`, érvénytelen adószám esetén `false` a visszatérési érték, valid adószám estén
+     *                                      pedig a válasz XML taxpayerData része (SimpleXMLElement), mely a nevet és címadatokat tartalmazza.
+     */
+    public function queryTaxpayer($taxNumber) {
+        $requestXml = new QueryTaxpayerRequestXml($this->config, $taxNumber);
+        $responseXml = $this->connector->post("/queryTaxpayer", $requestXml);
+
+        // 1.9.8.2 fejezet alapján (QueryTaxpayerResponse) a taxpayerValidity tag csak akkor kerül a válaszba, ha a lekérdezett adószám létezik.
+        // Nem létező adószámra csak egy <funcCode>OK</funcCode> kerül visszaadásra (funcCode===OK megléte a Connector-ban ellenőrizve van).
+        if (!isset($responseXml->taxpayerValidity)) {
+            return null;
+        }
+
+        // taxpayerValidity értéke lehet false is, ha az adószám létezik, de nem érvényes
+        if (empty($responseXml->taxpayerValidity) or (string)($responseXml->taxpayerValidity) === "false") {
+            return false;
+        }
+
+        // Az adószám valid, adózó adatainak visszaadása
+        return $responseXml->taxpayerData;
+    }
+
+
+    /**
+     * Token kérése manageInvoice művelethez.
+     *
+     * Ezt a metódust lehet használni tesztelésre is, hogy a megadott felhasználói adatok helyesek-e/a NAV szervere visszatér-e valami válasszal.
+     *
+     * Megjegyzés: csak a token kerül visszaadásra, az érvényességi idő nem. Ennek oka, hogy a tokent csak egy kéréshez (egyszer) lehet használni
+     * NAV fórumon elhangzottak alapján (megerősítés szükséges!), és ez az egyszeri felhasználás azonnal megtörténik a token lekérése után (manageInvoice hívás).
+     *
+     * @return string       Token
+     */
+    public function tokenExchange() {
+        $requestXml = new TokenExchangeRequestXml($this->config);
+        $responseXml = $this->connector->post("/tokenExchange", $requestXml);
+
+        $encodedToken = (string)$responseXml->encodedExchangeToken;
+        $token = $this->decodeToken($encodedToken);
+
+        return $token;
+    }
+
+
+    /**
+     * Utolsó REST hívás adatainak lekérdezése naplózási és hibakeresési céllal.
+     *
+     * A visszaadott array a következő elemeket tartalmazza: requestUrl, requestBody, responseBody, requestId, responseXml
+     *
+     * Megjegyzés: bizonyos műveletek (manageAnnulment és manageInvoice) kettő REST hívást is indítanak,
+     * a tokenExchange hívást, illetve magát az adatküldést. Sikeres hívás esetén csak a tényleges adatküldés
+     * eredménye érhető el, Exception esetén pedig mindig az utolsó hívás adata.
+     *
+     * @return array
+     */
+    public function getLastRequestData() {
+        return $this->connector->getLastRequestData();
+    }
+
+
+    /**
+     * Utolsó válasz XML lekérdezése (operáció hívása után)
+     *
+     * @return \SimpleXMLElement $xml
+     */
+    public function getLastResponseXml() {
+        return $this->connector->getLastResponseXml();
+    }
+
+
+    protected function decodeToken($encodedToken) {
+        return Util::aes128_decrypt($encodedToken, $this->config->user["exchangeKey"]);
+    }
+
+
+    /**
+     * Paraméterben átadott adat XML-t validálja az XSD-vel és hiba esetén string-ként visszaadja a hibát.
+     * Ha nincs hiba, akkor visszatérési érték `null`.
+     *
+     * @param  \SimpleXMLElement $xml   Számla XML
+     * @return null|string             Hibaüzenet, vagy `null`, ha helyes az XML
+     */
+    public static function getInvoiceValidationError($xml) {
+        try {
+            Xsd::validate($xml->asXML(), Config::getDataXsdFilename());
+        } catch(XsdValidationError $ex) {
+            return $ex->getMessage();
+        }
+        return null;
+    }
+
+}

+ 29 - 0
custom/nav/lib/NavOnlineInvoice/RequestIdGeneratorBasic.php

@@ -0,0 +1,29 @@
+<?php
+
+namespace NavOnlineInvoice;
+
+class RequestIdGeneratorBasic implements RequestIdGeneratorInterface {
+
+    /**
+     * Egyedi request ID generálása
+     *
+     * NAV specifikáció:
+     * A requestId a kérés azonosítója. Értéke bármi lehet, ami a pattern szerint érvényes és az
+     * egyediséget nem sérti. A requestId-nak - az adott adózó vonatkozásában - kérésenként
+     * egyedinek kell lennie. Az egyediségbe csak a sikeresen feldolgozott kérések számítanak bele, a
+     * sikertelen vagy a szerver által elutasított kérések azonosítói nem, azok az első sikeres
+     * tranzakcióig (HTTP 200-as válaszig) újra felhasználhatóak. A tag értéke beleszámít a
+     * requestSignature értékébe.
+     *
+     * Pattern: [+a-zA-Z0-9_]{1,30}
+     *
+     * @return string
+     */
+    function generate() {
+        $id = "RID" . microtime() . mt_rand(10000, 99999);
+        $id = preg_replace("/[^A-Z0-9]/", "", $id);
+        $id = substr($id, 0, 30);
+        return $id;
+    }
+
+}

+ 7 - 0
custom/nav/lib/NavOnlineInvoice/RequestIdGeneratorInterface.php

@@ -0,0 +1,7 @@
+<?php
+
+namespace NavOnlineInvoice;
+
+interface RequestIdGeneratorInterface {
+    function generate();
+}

+ 10 - 0
custom/nav/lib/NavOnlineInvoice/TokenExchangeRequestXml.php

@@ -0,0 +1,10 @@
+<?php
+
+namespace NavOnlineInvoice;
+
+
+class TokenExchangeRequestXml extends BaseRequestXml {
+
+    protected $rootName = "TokenExchangeRequest";
+
+}

+ 62 - 0
custom/nav/lib/NavOnlineInvoice/Util.php

@@ -0,0 +1,62 @@
+<?php
+
+namespace NavOnlineInvoice;
+use Exception;
+
+
+class Util {
+
+    public static $customSha3_512Function = null;
+
+
+    public static function isHashAlgoSupported($algo) {
+        $algos = hash_algos();
+
+        return in_array($algo, $algos);
+    }
+
+
+    private static function desktopdSHA3_512($string) {
+        $sponge = \desktopd\SHA3\Sponge::init(\desktopd\SHA3\Sponge::SHA3_512);
+        $sponge->absorb($string);
+
+        return strtoupper(bin2hex($sponge->squeeze()));
+    }
+
+
+    public static function sha3_512($string) {
+
+        // Built-in SHA3-512 from PHP 7.1.0
+        if (self::isHashAlgoSupported("sha3-512")) {
+            return strtoupper(hash("sha3-512", $string));
+        }
+
+        // User provided function
+        if (self::$customSha3_512Function and is_callable(self::$customSha3_512Function)) {
+            return call_user_func(self::$customSha3_512Function, $string);
+        }
+
+        // https://packagist.org/packages/n-other/php-sha3
+        if (class_exists("\\bb\Sha3\\Sha3")) {
+            return strtoupper(\bb\Sha3\Sha3::hash($string, 512));
+        }
+
+        // Desktopd SHA3 (https://notabug.org/desktopd/PHP-SHA3-Streamable)
+        if (class_exists("\\desktopd\\SHA3\\Sponge")) {
+            return self::desktopdSHA3_512($string);
+        }
+
+        throw new Exception("SHA3-512 nem támogatott! Kérlek,\n- frissíts PHP 7.1.0 vagy e feletti verzióra;\n- vagy állíts be egy egyedi SHA3-512 függvényt;\n- vagy hivatkozd be az n-other/php-sha3 vagy desktopd/SHA könyvtárat.\nRészletekért lásd a nav-online-invoice README-t.");
+    }
+
+
+    public static function sha512($string) {
+        return strtoupper(hash("sha512", $string));
+    }
+
+
+    public static function aes128_decrypt($string, $key) {
+        return openssl_decrypt($string, "AES-128-ECB", $key);
+    }
+
+}

+ 80 - 0
custom/nav/lib/NavOnlineInvoice/XmlUtil.php

@@ -0,0 +1,80 @@
+<?php
+
+namespace NavOnlineInvoice;
+
+
+class XmlUtil {
+
+    /**
+     * Add elements from array to XML node
+     *
+     * @param \SimpleXMLElement $xmlNode
+     * @param string            $name
+     * @param array             $data
+     */
+    public static function addChildArray(\SimpleXMLElement $xmlNode, $name, $data) {
+        $isSeqArray = self::isSequentialArray($data);
+        $node = $isSeqArray ? $xmlNode : $xmlNode->addChild($name);
+
+        foreach ($data as $key => $value) {
+
+            $childName = $isSeqArray ? $name : $key;
+
+            if (is_array($value)) {
+                self::addChildArray($node, $childName, $value);
+            } else {
+                // NOTE: addChild($childName, $value) does not escape the "&" sign,
+                // see: https://stackoverflow.com/questions/552957/rationale-behind-simplexmlelements-handling-of-text-values-in-addchild-and-adda
+                // and: https://github.com/pzs/nav-online-invoice/issues/34
+                // NOTE 2: This solution escape the "&" sing and allows multiple children with the same tag name, works from PHP 5.2
+                $node->addChild($childName)[0] = $value;
+            }
+        }
+    }
+
+
+    /**
+     * Returns true, if it's a sequantial array (keys are numeric)
+     *
+     * Source: https://stackoverflow.com/a/173479
+     *
+     * @param  array   $arr
+     * @return boolean
+     */
+    private static function isSequentialArray(array $arr) {
+        if (array() === $arr) {
+            return true;
+        }
+
+        return array_keys($arr) === range(0, count($arr) - 1);
+    }
+
+
+    /**
+     * Remove namespaces from XML elements
+     *
+     * @param  \SimpleXMLElement $xmlNode
+     * @return \SimpleXMLElement $xmlNode
+     */
+    public static function removeNamespaces(\SimpleXMLElement $xmlNode) {
+        $xmlString = $xmlNode->asXML();
+
+        $cleanedXmlString = self::removeNamespacesFromXmlString($xmlString);
+
+        $cleanedXmlNode = simplexml_load_string($cleanedXmlString);
+
+        return $cleanedXmlNode;
+    }
+
+
+    /**
+     * Remove namespaces from XML string
+     *
+     * @param  string $xmlString
+     * @return string $xmlString
+     */
+    public static function removeNamespacesFromXmlString($xmlString) {
+        return preg_replace('/(<\/|<)[a-z0-9]+:([a-z0-9]+[ =>])/i', '$1$2', $xmlString);
+    }
+
+}

+ 36 - 0
custom/nav/lib/NavOnlineInvoice/Xsd.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace NavOnlineInvoice;
+use DOMDocument;
+
+
+class Xsd {
+
+    /**
+     * A megadott XML-t (string) ellenőrzi a megadott XSD sémával.
+     * Hiba esetén XsdValidationError exception-t dob.
+     *
+     * @param  string $xmlString
+     * @param  string $xsdFilename
+     * @throws XsdValidationError
+     */
+    public static function validate($xmlString, $xsdFilename) {
+        $doc = new DOMDocument();
+        $doc->loadXML($xmlString);
+
+        $prevValue = libxml_use_internal_errors(true);
+        libxml_clear_errors();
+
+        $isValid = $doc->schemaValidate($xsdFilename);
+
+        if (!$isValid) {
+            $errors = libxml_get_errors();
+            libxml_clear_errors();
+            libxml_use_internal_errors($prevValue);
+            throw new XsdValidationError($errors);
+        }
+
+        libxml_use_internal_errors($prevValue);
+    }
+
+}

+ 40 - 0
custom/nav/lib/NavOnlineInvoice/XsdValidationError.php

@@ -0,0 +1,40 @@
+<?php
+
+namespace NavOnlineInvoice;
+use Exception;
+
+
+class XsdValidationError extends Exception {
+
+    protected $errors;
+
+    protected static $levelMap = array(
+        LIBXML_ERR_WARNING => "Warning",
+        LIBXML_ERR_ERROR => "Error",
+        LIBXML_ERR_FATAL => "Fatal Error"
+    );
+
+
+    function __construct($errors) {
+        $this->errors = $errors;
+        $message = $this->createErrorMessage();
+        parent::__construct($message);
+    }
+
+
+    public function getErrors() {
+        return $this->errors;
+    }
+
+
+    protected function createErrorMessage() {
+        $messages = array();
+
+        foreach ($this->errors as $error) {
+            $messages[] = self::$levelMap[$error->level] . ": " . $error->message;
+        }
+
+        return implode("\n", $messages);
+    }
+
+}

+ 20 - 0
custom/nav/lib/NavOnlineInvoice/autoload.php

@@ -0,0 +1,20 @@
+<?php
+
+spl_autoload_register(function($className) {
+	echo $className."\n";exit;
+    $className = ltrim($className, '\\');
+    $fileName  = '';
+    $namespace = '';
+    if ($lastNsPos = strrpos($className, '\\')) {
+        $namespace = substr($className, 0, $lastNsPos);
+        $className = substr($className, $lastNsPos + 1);
+        $fileName  = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
+    }
+    $fileName .= str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php';
+	
+	$fileName = DOL_DOCUMENT_ROOT . DIRECTORY_SEPARATOR.'custom' . DIRECTORY_SEPARATOR . 'nav' . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . $fileName;
+	
+	if (file_exists($fileName)) {
+        require($fileName);
+    }
+});

+ 727 - 0
custom/nav/lib/NavOnlineInvoice/xsd/common.xsd

@@ -0,0 +1,727 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+# Project: NAV NTCA Common XML séma
+# Author: NAV Informatikai Intézet
+
+# Version: v1.0 2020/11/23
+-->
+<xs:schema xmlns="http://schemas.nav.gov.hu/NTCA/1.0/common" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://schemas.nav.gov.hu/NTCA/1.0/common" elementFormDefault="qualified" attributeFormDefault="unqualified">
+	<!--Atomi típusok / Atomic types-->
+	<xs:simpleType name="AtomicStringType100">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 100 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 100 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="100"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType1024">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 1024 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 1024 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="1024"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType128">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 128 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 128 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="128"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType15">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 15 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 15 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="15"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType16">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 16 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 16 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="16"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType2">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 2 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 2 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="2"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType200">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 200 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 200 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="200"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType2048">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 2048 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 2048 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="2048"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType255">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 255 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 255 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="255"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType256">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 256 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 256 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="256"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType32">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 32 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 32 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="32"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType4">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 4 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 4 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="4"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType4000">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 4000 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 4000 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="4000"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType50">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 50 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 50 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="50"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType512">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 512 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 512 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="512"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType64">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 64 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 64 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="64"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="AtomicStringType8">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Atomi string típus 8 hosszra</xs:documentation>
+			<xs:documentation xml:lang="en">Atomic string type for 8 length</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:string">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="8"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="GenericDateType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Általános UTC dátum</xs:documentation>
+			<xs:documentation xml:lang="en">Generic UTC date</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:date">
+			<xs:pattern value="\d{4}-\d{2}-\d{2}Z"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="GenericDecimalType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Általános lebegőpontos érték</xs:documentation>
+			<xs:documentation xml:lang="en">Generic float point value</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:decimal"/>
+	</xs:simpleType>
+	<xs:simpleType name="GenericTimestampType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Általános UTC időbélyeg</xs:documentation>
+			<xs:documentation xml:lang="en">Generic UTC timestamp</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:dateTime">
+			<xs:pattern value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d{1,3})?Z"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="SHA256Type">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">SHA256 kód megadására szolgáló típus</xs:documentation>
+			<xs:documentation xml:lang="en">Field type for holding an SHA256 code</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType64">
+			<xs:pattern value="[0-9A-F]{64}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="SHA512Type">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">SHA512 kód megadására szolgáló típus</xs:documentation>
+			<xs:documentation xml:lang="en">Field type for holding an SHA512 code</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType128">
+			<xs:pattern value="[0-9A-F]{128}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="SimpleText100NotBlankType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Legfeljebb 100 karaktert tartalmazó szöveg típus</xs:documentation>
+			<xs:documentation xml:lang="en">String of maximum 100 characters</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType100">
+			<xs:pattern value=".*[^\s].*"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="SimpleText1024NotBlankType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Legfeljebb 1024 karaktert tartalmazó szöveg típus</xs:documentation>
+			<xs:documentation xml:lang="en">String of maximum 1024 characters</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType1024">
+			<xs:pattern value=".*[^\s].*"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="SimpleText15NotBlankType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Legfeljebb 15 karaktert tartalmazó szöveg típus</xs:documentation>
+			<xs:documentation xml:lang="en">String of maximum 15 characters</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType15">
+			<xs:pattern value=".*[^\s].*"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="SimpleText200NotBlankType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Legfeljebb 200 karaktert tartalmazó szöveg típus</xs:documentation>
+			<xs:documentation xml:lang="en">String of maximum 200 characters</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType200">
+			<xs:pattern value=".*[^\s].*"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="SimpleText255NotBlankType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Legfeljebb 255 karaktert tartalmazó szöveg típus</xs:documentation>
+			<xs:documentation xml:lang="en">String of maximum 255 characters</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType255">
+			<xs:pattern value=".*[^\s].*"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="SimpleText50NotBlankType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Legfeljebb 50 karaktert tartalmazó szöveg típus</xs:documentation>
+			<xs:documentation xml:lang="en">String of maximum 50 characters</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType50">
+			<xs:pattern value=".*[^\s].*"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="SimpleText512NotBlankType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Legfeljebb 512 karaktert tartalmazó szöveg típus</xs:documentation>
+			<xs:documentation xml:lang="en">String of maximum 512 characters</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType512">
+			<xs:pattern value=".*[^\s].*"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<!--Üzleti katalógus elemek / Business catalog elements-->
+	<xs:simpleType name="BankAccountNumberType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Bankszámla megadására szolgáló típus</xs:documentation>
+			<xs:documentation xml:lang="en">Type of bank account number</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType50">
+			<xs:minLength value="15"/>
+			<xs:maxLength value="34"/>
+			<xs:pattern value="[0-9]{8}[-][0-9]{8}[-][0-9]{8}|[0-9]{8}[-][0-9]{8}|[A-Z]{2}[0-9]{2}[0-9A-Za-z]{11,30}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="CommunityVatNumberType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Közösségi adószám típus</xs:documentation>
+			<xs:documentation xml:lang="en">Community VAT registration number</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType15">
+			<xs:minLength value="4"/>
+			<xs:maxLength value="15"/>
+			<xs:pattern value="[A-Z]{2}[0-9A-Z]{2,13}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="CountryCodeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Országkód típus ISO 3166 alpha-2 szabvány szerint</xs:documentation>
+			<xs:documentation xml:lang="en">Country code type (ISO 3166 alpha-2)</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType2">
+			<xs:length value="2"/>
+			<xs:pattern value="[A-Z]{2}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="CountyCodeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Megyekód</xs:documentation>
+			<xs:documentation xml:lang="en">County code</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType2">
+			<xs:length value="2"/>
+			<xs:pattern value="[0-9]{2}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="CurrencyType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Pénznem típus (ISO 4217 szabvány szerinti 3 hosszú pénznem kód)</xs:documentation>
+			<xs:documentation xml:lang="en">Currency type (three digit ISO 4217 currency code)</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType4">
+			<xs:length value="3"/>
+			<xs:pattern value="[A-Z]{3}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="PlateNumberType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Kereskedelmi gépjármű forgalmi rendszáma (csak betűk és számok)</xs:documentation>
+			<xs:documentation xml:lang="en">Registration number of commercial motor vehicle (letters and numbers only)</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType32">
+			<xs:minLength value="2"/>
+			<xs:maxLength value="30"/>
+			<xs:pattern value="[A-Z0-9ÖŐÜŰ]{2,30}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="PostalCodeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Irányítószám típus</xs:documentation>
+			<xs:documentation xml:lang="en">ZIP code type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType15">
+			<xs:minLength value="3"/>
+			<xs:maxLength value="10"/>
+			<xs:pattern value="[A-Z0-9][A-Z0-9\s\-]{1,8}[A-Z0-9]"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="TaxpayerIdType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Az adószám nyolc jegyű törzsszám része</xs:documentation>
+			<xs:documentation xml:lang="en">The 8-digit core number section of the tax number</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType8">
+			<xs:length value="8"/>
+			<xs:pattern value="[0-9]{8}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="VatCodeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">ÁFA kód</xs:documentation>
+			<xs:documentation xml:lang="en">VAT code</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType2">
+			<xs:length value="1"/>
+			<xs:pattern value="[1-5]{1}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<!--Közös API típusok / Common API types-->
+	<xs:simpleType name="BusinessResultCodeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Üzleti eredmény kód típus</xs:documentation>
+			<xs:documentation xml:lang="en">Business result code type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType8">
+			<xs:enumeration value="ERROR">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Hiba</xs:documentation>
+					<xs:documentation xml:lang="en">Error</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="WARN">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Figyelmeztetés</xs:documentation>
+					<xs:documentation xml:lang="en">Warn</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="INFO">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tájékoztatás</xs:documentation>
+					<xs:documentation xml:lang="en">Information</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="EntityIdType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Generált azonosító típus</xs:documentation>
+			<xs:documentation xml:lang="en">Generated ID type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType32">
+			<xs:maxLength value="30"/>
+			<xs:minLength value="1"/>
+			<xs:pattern value="[+a-zA-Z0-9_]{1,30}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="FunctionCodeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Funkciókód típus</xs:documentation>
+			<xs:documentation xml:lang="en">Function code type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType8">
+			<xs:enumeration value="OK">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Sikeres művelet</xs:documentation>
+					<xs:documentation xml:lang="en">Successful operation</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="ERROR">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Hiba</xs:documentation>
+					<xs:documentation xml:lang="en">Error</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="LoginType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Felhasználónév típus</xs:documentation>
+			<xs:documentation xml:lang="en">Login type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType15">
+			<xs:minLength value="6"/>
+			<xs:maxLength value="15"/>
+			<xs:pattern value="[a-zA-Z0-9]{6,15}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="RequestPageType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Lapozó paraméter típus kérések számára</xs:documentation>
+			<xs:documentation xml:lang="en">Page parameter type for requests</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:int">
+			<xs:minInclusive value="1"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="ResponsePageType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Lapozó paraméter típus válaszok számára</xs:documentation>
+			<xs:documentation xml:lang="en">Page parameter type for responses</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:int">
+			<xs:minInclusive value="0"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="TechnicalResultCodeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Technikai eredmény kód típus</xs:documentation>
+			<xs:documentation xml:lang="en">Technical result code type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="AtomicStringType8">
+			<xs:enumeration value="CRITICAL">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kritikus hiba</xs:documentation>
+					<xs:documentation xml:lang="en">Critical error</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="ERROR">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Hiba</xs:documentation>
+					<xs:documentation xml:lang="en">Error</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:complexType name="BasicHeaderType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A kérés tranzakcionális adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Transactional data of the request</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="requestId" type="EntityIdType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kérés/válasz azonosítója, minden üzenetváltásnál - adószámonként - egyedi</xs:documentation>
+					<xs:documentation xml:lang="en">Identifier of the request/response, unique with the taxnumber in every data exchange transaction</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="timestamp" type="GenericTimestampType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kérés/válasz keletkezésének UTC ideje</xs:documentation>
+					<xs:documentation xml:lang="en">UTC time of the request/response</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="requestVersion" type="AtomicStringType15">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kérés/válasz verziószáma, hogy a hívó melyik interfész verzió szerint küld adatot és várja a választ</xs:documentation>
+					<xs:documentation xml:lang="en">Request version number, indicating which datastructure the client sends data in, and in which the response is expected</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="headerVersion" type="AtomicStringType15" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A header verziószáma</xs:documentation>
+					<xs:documentation xml:lang="en">Header version number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="BasicRequestType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Alap kérés adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Basic request data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="header" type="BasicHeaderType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kérés tranzakcionális adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Transactional data of the request</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="user" type="UserHeaderType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kérés authentikációs adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Authentication data of the request</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="BasicResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Alap válasz adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Basic response data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="header" type="BasicHeaderType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A válasz tranzakcionális adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Transactional data of the response</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="result" type="BasicResultType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Alap válaszeredmény adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Basic result data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="BasicResultType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Alap válaszeredmény adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Basic result data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="funcCode" type="FunctionCodeType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Feldolgozási eredmény</xs:documentation>
+					<xs:documentation xml:lang="en">Processing result</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="errorCode" type="SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A feldolgozási hibakód</xs:documentation>
+					<xs:documentation xml:lang="en">Processing error code</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="message" type="SimpleText1024NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Feldolgozási üzenet</xs:documentation>
+					<xs:documentation xml:lang="en">Processing message</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="notifications" type="NotificationsType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egyéb értesítések</xs:documentation>
+					<xs:documentation xml:lang="en">Miscellaneous notifications</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="CryptoType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Kriptográfiai metódust leíró típus</xs:documentation>
+			<xs:documentation xml:lang="en">Denoting type of cryptographic method</xs:documentation>
+		</xs:annotation>
+		<xs:simpleContent>
+			<xs:extension base="SimpleText512NotBlankType">
+				<xs:attribute name="cryptoType" type="SimpleText50NotBlankType" use="required"/>
+			</xs:extension>
+		</xs:simpleContent>
+	</xs:complexType>
+	<xs:complexType name="GeneralErrorHeaderResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Általános hibatípus minden REST operációra</xs:documentation>
+			<xs:documentation xml:lang="en">Generic fault type for every REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicResponseType"/>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="NotificationsType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Egyéb értesítések</xs:documentation>
+			<xs:documentation xml:lang="en">Miscellaneous notifications</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="notification" type="NotificationType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Értesítés</xs:documentation>
+					<xs:documentation xml:lang="en">Notification</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="NotificationType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Értesítés</xs:documentation>
+			<xs:documentation xml:lang="en">Notification</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="notificationCode" type="SimpleText100NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Értesítés kód</xs:documentation>
+					<xs:documentation xml:lang="en">Notification code</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="notificationText" type="SimpleText1024NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Értesítés szöveg</xs:documentation>
+					<xs:documentation xml:lang="en">Notification text</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="TechnicalValidationResultType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Technikai validációs választípus</xs:documentation>
+			<xs:documentation xml:lang="en">Technical validation response type</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="validationResultCode" type="TechnicalResultCodeType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Validációs eredmény</xs:documentation>
+					<xs:documentation xml:lang="en">Validation result</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="validationErrorCode" type="SimpleText100NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Validációs hibakód</xs:documentation>
+					<xs:documentation xml:lang="en">Validation error code</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="message" type="SimpleText1024NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Feldolgozási üzenet</xs:documentation>
+					<xs:documentation xml:lang="en">Processing message</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="UserHeaderType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A kérés authentikációs adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Authentication data of the request</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="login" type="LoginType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A technikai felhasználó login neve</xs:documentation>
+					<xs:documentation xml:lang="en">Login name of the technical user</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="passwordHash" type="CryptoType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A technikai felhasználó jelszavának hash értéke</xs:documentation>
+					<xs:documentation xml:lang="en">Hash value of the technical user's password</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="taxNumber" type="TaxpayerIdType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A rendszerben regisztrált adózó adószáma, aki nevében a technikai felhasználó tevékenykedik</xs:documentation>
+					<xs:documentation xml:lang="en">The taxpayer's tax number, whose name the technical user operates in</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="requestSignature" type="CryptoType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kérés aláírásának hash értéke</xs:documentation>
+					<xs:documentation xml:lang="en">Hash value of the request's signature</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<!--Általános API hiba válaszok / Generic API error responses-->
+	<xs:element name="GeneralErrorHeaderResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Az összes REST operációra vonatkozó hibaválasz generikus elementje</xs:documentation>
+			<xs:documentation xml:lang="en">General error response of every REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="GeneralErrorHeaderResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="GeneralExceptionResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Az összes REST operációra vonatkozó kivétel válasz generikus elementje</xs:documentation>
+			<xs:documentation xml:lang="en">General exception response of every REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="BasicResultType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>

+ 86 - 0
custom/nav/lib/NavOnlineInvoice/xsd/invoiceAnnulment.xsd

@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+# Project: Magyar Online Számla Rendszer invoiceAnnulment XML séma
+# Author: NAV Informatikai Intézet
+
+# Version: v3.0 2020/07/31
+-->
+<xs:schema xmlns="http://schemas.nav.gov.hu/OSA/3.0/annul" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:common="http://schemas.nav.gov.hu/NTCA/1.0/common" xmlns:base="http://schemas.nav.gov.hu/OSA/3.0/base" targetNamespace="http://schemas.nav.gov.hu/OSA/3.0/annul" elementFormDefault="qualified" attributeFormDefault="unqualified">
+	<xs:import namespace="http://schemas.nav.gov.hu/NTCA/1.0/common" schemaLocation="common.xsd"/>
+	<xs:import namespace="http://schemas.nav.gov.hu/OSA/3.0/base" schemaLocation="invoiceBase.xsd"/>
+	<xs:simpleType name="AnnulmentCodeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Technikai érvénytelenítés kód típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Technical annulment code type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType32">
+			<xs:enumeration value="ERRATIC_DATA">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Hibás adattartalom miatti technikai érvénytelenítés</xs:documentation>
+					<xs:documentation xml:lang="en">Technical annulment due to erratic data content</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="ERRATIC_INVOICE_NUMBER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Hibás számlaszám miatti technikai érvénytelenítés</xs:documentation>
+					<xs:documentation xml:lang="en">Technical annulment due to erratic invoice number</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="ERRATIC_INVOICE_ISSUE_DATE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Hibás számla kiállítási dátum miatti technikai érvénytelenítés</xs:documentation>
+					<xs:documentation xml:lang="en">Technical annulment due to erratic invoice issue date</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="ERRATIC_ELECTRONIC_HASH_VALUE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Hibás elektronikus számla hash érték miatti technikai érvénytelenítés</xs:documentation>
+					<xs:documentation xml:lang="en">Technical annulment due to erratic electronic invoice hash value</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:complexType name="InvoiceAnnulmentType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Korábbi adatszolgáltatás technikai érvénytelenítésének adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Data of technical annulment concerning previous data exchange</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="annulmentReference" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A technikai érvénytelenítéssel érintett számla vagy módosító okirat sorszáma</xs:documentation>
+					<xs:documentation xml:lang="en">Sequential number of the invoice or modification document to be annuled</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="annulmentTimestamp" type="base:InvoiceTimestampType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A technikai érvénytelenítés időbélyege a forrásrendszerben UTC idő szerint</xs:documentation>
+					<xs:documentation xml:lang="en">Timestamp of the technical annulment in UTC time</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="annulmentCode" type="AnnulmentCodeType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A technikai érvénytelenítés kódja</xs:documentation>
+					<xs:documentation xml:lang="en">Technical annulment code</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="annulmentReason" type="common:SimpleText1024NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A technikai érvénytelenítés oka</xs:documentation>
+					<xs:documentation xml:lang="en">Technical annulment reason</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:element name="InvoiceAnnulment">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">XML root element, a technikai érvénytelenítés adatait leíró típus, amelyet BASE64 kódoltan tartalmaz az invoiceApi sémaleíró invoiceAnnulment elementje</xs:documentation>
+			<xs:documentation xml:lang="en">XML root element, technical annulment data type in BASE64 encoding, equivalent with the invoiceApi schema definition's invoiceAnnulment element</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="InvoiceAnnulmentType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>

+ 2277 - 0
custom/nav/lib/NavOnlineInvoice/xsd/invoiceApi.xsd

@@ -0,0 +1,2277 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+# Project: Magyar Online Számla Rendszer invoiceApi XML séma
+# Author: NAV Informatikai Intézet
+
+# Version: v3.0 2020/11/09
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.nav.gov.hu/OSA/3.0/api" xmlns:data="http://schemas.nav.gov.hu/OSA/3.0/data" xmlns:common="http://schemas.nav.gov.hu/NTCA/1.0/common" xmlns:base="http://schemas.nav.gov.hu/OSA/3.0/base" targetNamespace="http://schemas.nav.gov.hu/OSA/3.0/api" elementFormDefault="qualified" attributeFormDefault="unqualified">
+	<xs:import namespace="http://schemas.nav.gov.hu/NTCA/1.0/common" schemaLocation="common.xsd"/>
+	<xs:import namespace="http://schemas.nav.gov.hu/OSA/3.0/base" schemaLocation="invoiceBase.xsd"/>
+	<xs:simpleType name="AnnulmentVerificationStatusType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Technikai érvénytelenítő kérések jóváhagyási státusza</xs:documentation>
+			<xs:documentation xml:lang="en">Verification status of technical annulment requests</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType32">
+			<xs:enumeration value="NOT_VERIFIABLE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A technikai érvénytelenítés kliens hiba miatt nem hagyható jóvá</xs:documentation>
+					<xs:documentation xml:lang="en">The technical annulment is not verifiable due to client error</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="VERIFICATION_PENDING">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A technikai érvénytelenítés jóváhagyásra vár</xs:documentation>
+					<xs:documentation xml:lang="en">The technical annulment is awaiting verification</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="VERIFICATION_DONE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A technikai érvénytelenítés jóváhagyásra került</xs:documentation>
+					<xs:documentation xml:lang="en">The technical annulment has been verified</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="VERIFICATION_REJECTED">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A technikai érvénytelenítés elutasításra került</xs:documentation>
+					<xs:documentation xml:lang="en">The technical annulment has been rejected</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="IncorporationType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Gazdasági típus</xs:documentation>
+			<xs:documentation xml:lang="en">Incorporation type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="ORGANIZATION">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Gazdasági társaság</xs:documentation>
+					<xs:documentation xml:lang="en">Economical company</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="SELF_EMPLOYED">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egyéni vállalkozó</xs:documentation>
+					<xs:documentation xml:lang="en">Self employed private entrepreneur</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="TAXABLE_PERSON">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adószámos magánszemély</xs:documentation>
+					<xs:documentation xml:lang="en">Private person with tax number</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="InvoiceDirectionType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Kimenő vagy bejövő számla keresési paramétere</xs:documentation>
+			<xs:documentation xml:lang="en">Inbound or outbound invoice query parameter</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="INBOUND">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Bejövő (vevő oldali) számla keresési paramétere</xs:documentation>
+					<xs:documentation xml:lang="en">Inbound (customer side) invoice query parameter</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="OUTBOUND">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kimenő (kiállító oldali) számla keresési paramétere</xs:documentation>
+					<xs:documentation xml:lang="en">Outbound (supplier side) invoice query parameter</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="InvoiceStatusType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számla feldolgozási státusza</xs:documentation>
+			<xs:documentation xml:lang="en">Processing status of the invoice</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="RECEIVED">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Befogadva</xs:documentation>
+					<xs:documentation xml:lang="en">Received</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="PROCESSING">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Feldolgozás alatt</xs:documentation>
+					<xs:documentation xml:lang="en">Processing</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="SAVED">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Elmentve</xs:documentation>
+					<xs:documentation xml:lang="en">Saved</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="DONE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kész</xs:documentation>
+					<xs:documentation xml:lang="en">Done</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="ABORTED">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kihagyva</xs:documentation>
+					<xs:documentation xml:lang="en">Aborted</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="ManageAnnulmentOperationType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Technikai érvénytelenítés műveleti típus</xs:documentation>
+			<xs:documentation xml:lang="en">Technical annulment operation type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType8">
+			<xs:enumeration value="ANNUL">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Korábbi adatszolgáltatás technikai érvénytelenítése</xs:documentation>
+					<xs:documentation xml:lang="en">Technical annulment of previous exchange</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="ManageInvoiceOperationType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számlaművelet típus</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice operation type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType8">
+			<xs:enumeration value="CREATE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adatszolgáltatás eredeti számláról</xs:documentation>
+					<xs:documentation xml:lang="en">Original invoice exchange</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="MODIFY">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adatszolgáltatás az eredeti számlát módosító okiratról</xs:documentation>
+					<xs:documentation xml:lang="en">Modification invoice exchange</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="STORNO">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adatszolgáltatás az eredeti számla érvénytelenítéséről</xs:documentation>
+					<xs:documentation xml:lang="en">Exchange concerning invoice invalidation</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="OriginalRequestVersionType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A lekérdezett számla requestVersion értéke</xs:documentation>
+			<xs:documentation xml:lang="en">Request version value of the queried invoice</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType8">
+			<xs:enumeration value="1.0"/>
+			<xs:enumeration value="1.1"/>
+			<xs:enumeration value="2.0"/>
+			<xs:enumeration value="3.0"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="QueryNameType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Név kereső paraméter típus</xs:documentation>
+			<xs:documentation xml:lang="en">Name query parameter type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:SimpleText512NotBlankType">
+			<xs:minLength value="5"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="QueryOperatorType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Relációs művelet típus</xs:documentation>
+			<xs:documentation xml:lang="en">Relational operator type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType8">
+			<xs:enumeration value="EQ">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egyenlőség</xs:documentation>
+					<xs:documentation xml:lang="en">Equals</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="GT">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Nagyobb mint reláció</xs:documentation>
+					<xs:documentation xml:lang="en">Greater than relation</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="GTE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Nagyobb vagy egyenlő reláció</xs:documentation>
+					<xs:documentation xml:lang="en">Greater or equals relation</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="LT">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kisebb mint reláció</xs:documentation>
+					<xs:documentation xml:lang="en">Less than relation</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="LTE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kisebb vagy egyenlő reláció</xs:documentation>
+					<xs:documentation xml:lang="en">Less or equals relation</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="RequestStatusType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A kérés feldolgozási státusza</xs:documentation>
+			<xs:documentation xml:lang="en">Processing status of the request</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="RECEIVED">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Befogadva</xs:documentation>
+					<xs:documentation xml:lang="en">Received</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="PROCESSING">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Feldolgozás alatt</xs:documentation>
+					<xs:documentation xml:lang="en">Processing</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="SAVED">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Elmentve</xs:documentation>
+					<xs:documentation xml:lang="en">Saved</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="FINISHED">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Feldolgozás befejezve</xs:documentation>
+					<xs:documentation xml:lang="en">Finished processing</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="NOTIFIED">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Lekérdezve</xs:documentation>
+					<xs:documentation xml:lang="en">Notified</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="SoftwareIdType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számlázóprogram azonosítója</xs:documentation>
+			<xs:documentation xml:lang="en">Billing software ID</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType32">
+			<xs:length value="18"/>
+			<xs:pattern value="[0-9A-Z\-]{18}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="SoftwareOperationType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számlázóprogram működési típusa (lokális program vagy online számlázó szolgáltatás)</xs:documentation>
+			<xs:documentation xml:lang="en">Billing operation type (local program or online billing service)</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="LOCAL_SOFTWARE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Lokális program</xs:documentation>
+					<xs:documentation xml:lang="en">Local program</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="ONLINE_SERVICE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Online számlázó szolgáltatás</xs:documentation>
+					<xs:documentation xml:lang="en">Online billing service</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="SourceType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Az adatszolgáltatás forrása</xs:documentation>
+			<xs:documentation xml:lang="en">Data exchange source</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType8">
+			<xs:enumeration value="WEB">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Webes adatszolgáltatás</xs:documentation>
+					<xs:documentation xml:lang="en">Web exchange</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="XML">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kézi XML feltöltés</xs:documentation>
+					<xs:documentation xml:lang="en">Manual XML upload</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="MGM">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Gép-gép adatkapcsolati adatszolgáltatás</xs:documentation>
+					<xs:documentation xml:lang="en">Machine-to-machine exchange</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="OPG">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Online pénztárgépes adatszolgáltatás</xs:documentation>
+					<xs:documentation xml:lang="en">Online cash register exchange</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="OSZ">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">NAV online számlázó</xs:documentation>
+					<xs:documentation xml:lang="en">NTCA online invoicing</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="TaxpayerAddressTypeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Adózói cím típus</xs:documentation>
+			<xs:documentation xml:lang="en">Taxpayer address type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType8">
+			<xs:enumeration value="HQ">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Székhely</xs:documentation>
+					<xs:documentation xml:lang="en">Headquarter</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="SITE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Telephely</xs:documentation>
+					<xs:documentation xml:lang="en">Site office</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="BRANCH">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Fióktelep</xs:documentation>
+					<xs:documentation xml:lang="en">Branch office</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:complexType name="AdditionalQueryParamsType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számla lekérdezés kiegészítő paraméterei</xs:documentation>
+			<xs:documentation xml:lang="en">Additional params of the invoice query</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="taxNumber" type="common:TaxpayerIdType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla kiállítójának vagy vevőjének adószáma (a keresési feltétel az invoiceDirection tag értékétől függ)</xs:documentation>
+					<xs:documentation xml:lang="en">Tax number of the supplier or the customer of the invoice (the search criteria depends on the value of the invoiceDirection tag)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="groupMemberTaxNumber" type="common:TaxpayerIdType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla kiállítójának vagy vevőjének csoport tag adószáma (a keresési feltétel az invoiceDirection tag értékétől függ)</xs:documentation>
+					<xs:documentation xml:lang="en">Tax number of group member of the supplier or the customer of the invoice (the search criteria depends on the value of the invoiceDirection tag)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="name" type="QueryNameType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla kiállítójának vagy vevőjének keresőparamétere szó eleji egyezőségre (a keresési feltétel az invoiceDirection tag értékétől függ)</xs:documentation>
+					<xs:documentation xml:lang="en">Query param of the supplier or the customer of the invoice for leading match pattern (the search criteria depends on the value of the invoiceDirection tag)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceCategory" type="base:InvoiceCategoryType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla típusa</xs:documentation>
+					<xs:documentation xml:lang="en">Type of invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="paymentMethod" type="base:PaymentMethodType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Fizetés módja</xs:documentation>
+					<xs:documentation xml:lang="en">Method of payment</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceAppearance" type="base:InvoiceAppearanceType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla megjelenési formája</xs:documentation>
+					<xs:documentation xml:lang="en">Form of appearance of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="source" type="SourceType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adatszolgáltatás forrása</xs:documentation>
+					<xs:documentation xml:lang="en">Data exchange source</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="currency" type="common:CurrencyType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla pénzneme</xs:documentation>
+					<xs:documentation xml:lang="en">Currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="AnnulmentDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Technikai érvénytelenítés státusz adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Status data of technical annulment</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="annulmentVerificationStatus" type="AnnulmentVerificationStatusType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Technikai érvénytelenítő kérések jóváhagyási státusza</xs:documentation>
+					<xs:documentation xml:lang="en">Verification status of technical annulment requests</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="annulmentDecisionDate" type="base:InvoiceTimestampType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A technikai érvénytelenítés jóváhagyásának vagy elutasításának időpontja UTC időben</xs:documentation>
+					<xs:documentation xml:lang="en">Date of verification or rejection of the technical annulment in UTC time</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="annulmentDecisionUser" type="common:LoginType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A technikai érvénytelenítést jóváhagyó vagy elutasító felhasználó neve</xs:documentation>
+					<xs:documentation xml:lang="en">Login name of the user deciding over the technical annulment's verification or rejection</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="AnnulmentOperationListType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A kéréshez tartozó kötegelt technikai érvénytelenítések</xs:documentation>
+			<xs:documentation xml:lang="en">Batch technical annulment operations of the request</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="annulmentOperation" type="AnnulmentOperationType" maxOccurs="100">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kéréshez tartozó technikai érvénytelenítő művelet</xs:documentation>
+					<xs:documentation xml:lang="en">Technical annulment operation of the request</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="AnnulmentOperationType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A kéréshez tartozó technikai érvénytelenítő művelet</xs:documentation>
+			<xs:documentation xml:lang="en">Technical annulment operation of the request</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="index" type="base:InvoiceIndexType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A technikai érvénytelenítés sorszáma a kérésen belül</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the technical annulment within the request</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="annulmentOperation" type="ManageAnnulmentOperationType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kért technikai érvénytelenítés művelet típusa</xs:documentation>
+					<xs:documentation xml:lang="en">Type of the desired technical annulment operation</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceAnnulment" type="xs:base64Binary">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Technikai érvénytelenítés adatok BASE64-ben kódolt tartalma</xs:documentation>
+					<xs:documentation xml:lang="en">Technical annulment data in BASE64 encoded form</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="AuditDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számla audit adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice audit data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="insdate" type="base:InvoiceTimestampType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A beszúrás időpontja UTC időben</xs:documentation>
+					<xs:documentation xml:lang="en">Insert date in UTC time</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="insCusUser" type="common:LoginType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A beszúrást végző technikai felhasználó</xs:documentation>
+					<xs:documentation xml:lang="en">Inserting technical user name</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="source" type="SourceType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adatszolgáltatás forrása</xs:documentation>
+					<xs:documentation xml:lang="en">Data exchange source</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="transactionId" type="common:EntityIdType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla tranzakció azonosítója, ha az gépi interfészen került beküldésre</xs:documentation>
+					<xs:documentation xml:lang="en">Transaction ID of the invoice if it was exchanged via M2M interface</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="index" type="base:InvoiceIndexType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla sorszáma a kérésen belül</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the invoice within the request</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="batchIndex" type="base:InvoiceUnboundedIndexType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A módosító okirat sorszáma a kötegen belül</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the modification document within the batch</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="originalRequestVersion" type="OriginalRequestVersionType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adatszolgáltatás requestVersion értéke</xs:documentation>
+					<xs:documentation xml:lang="en">requestVersion value of the invoice exchange</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="BasicOnlineInvoiceRequestType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Online Számla rendszerre specifikus általános kérés adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Online Invoice specific basic request data</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="common:BasicRequestType">
+				<xs:sequence>
+					<xs:element name="software" type="SoftwareType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A számlázóprogram adatai</xs:documentation>
+							<xs:documentation xml:lang="en">Billing software data</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="BasicOnlineInvoiceResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Online Számla rendszerre specifikus általános válasz adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Online Invoice specific basic response data</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="common:BasicResponseType">
+				<xs:sequence>
+					<xs:element name="software" type="SoftwareType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A számlázóprogram adatai</xs:documentation>
+							<xs:documentation xml:lang="en">Billing software data</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="BusinessValidationResultType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Üzleti validációs választípus</xs:documentation>
+			<xs:documentation xml:lang="en">Business validation response type</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="validationResultCode" type="common:BusinessResultCodeType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Validációs eredmény</xs:documentation>
+					<xs:documentation xml:lang="en">Validation result</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="validationErrorCode" type="common:SimpleText100NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Validációs hibakód</xs:documentation>
+					<xs:documentation xml:lang="en">Validation error code</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="message" type="common:SimpleText512NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Feldolgozási üzenet</xs:documentation>
+					<xs:documentation xml:lang="en">Processing message</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="pointer" type="PointerType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Feldolgozási kurzor adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Processing cursor data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="DateIntervalParamType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Dátumos számla kereső paraméter</xs:documentation>
+			<xs:documentation xml:lang="en">Date query params of invoice</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="dateFrom" type="base:InvoiceDateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Dátum intervallum nagyobb vagy egyenlő paramétere</xs:documentation>
+					<xs:documentation xml:lang="en">Date interval greater or equals parameter</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="dateTo" type="base:InvoiceDateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Dátum intervallum kisebb vagy egyenlő paramétere</xs:documentation>
+					<xs:documentation xml:lang="en">Date interval less or equals parameter</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="DateTimeIntervalParamType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Időpontos számla kereső paraméter</xs:documentation>
+			<xs:documentation xml:lang="en">Datestamp query params of invoice</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="dateTimeFrom" type="base:InvoiceTimestampType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Időpontos intervallum nagyobb vagy egyenlő paramétere UTC idő szerint</xs:documentation>
+					<xs:documentation xml:lang="en">Datetime interval greater or equals parameter</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="dateTimeTo" type="base:InvoiceTimestampType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Időpontos intervallum kisebb vagy egyenlő paramétere UTC idő szerint</xs:documentation>
+					<xs:documentation xml:lang="en">Datetime interval less or equals parameter</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="GeneralErrorResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Online Számla rendszerre specifikus általános hibaválasz típus</xs:documentation>
+			<xs:documentation xml:lang="en">Online Invoice specific general error response type</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="common:GeneralErrorHeaderResponseType">
+				<xs:sequence>
+					<xs:element name="software" type="SoftwareType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A számlázóprogram adatai</xs:documentation>
+							<xs:documentation xml:lang="en">Billing software data</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="technicalValidationMessages" type="common:TechnicalValidationResultType" minOccurs="0" maxOccurs="unbounded">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Technikai validációs üzenetek</xs:documentation>
+							<xs:documentation xml:lang="en">Technical validation messages</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="InvoiceChainDigestResultType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számlalánc kivonat lekérdezés eredményei</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice chain digest query result</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="currentPage" type="common:ResponsePageType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A jelenleg lekérdezett lapszám</xs:documentation>
+					<xs:documentation xml:lang="en">The currently queried page count</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="availablePage" type="common:ResponsePageType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A lekérdezés eredménye szerint elérhető utolsó lapszám</xs:documentation>
+					<xs:documentation xml:lang="en">The highest available page count matching the query</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceChainElement" type="InvoiceChainElementType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számlalánc elem</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice chain element</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceChainDigestType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számlalánc kivonat adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice chain digest data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="invoiceNumber" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla vagy módosító okirat sorszáma - ÁFA tv. 169. § b) vagy 170. § (1) bek. b) pont</xs:documentation>
+					<xs:documentation xml:lang="en">Sequential number of the original invoice or modification document - section 169 (b) or section 170 (1) b) of the VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="batchIndex" type="base:InvoiceUnboundedIndexType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A módosító okirat sorszáma a kötegen belül</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the modification document within the batch</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceOperation" type="ManageInvoiceOperationType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számlaművelet típus</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice operation type</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="supplierTaxNumber" type="common:TaxpayerIdType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kibocsátó adószáma</xs:documentation>
+					<xs:documentation xml:lang="en">The supplier's tax number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="customerTaxNumber" type="common:TaxpayerIdType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A vevő adószáma</xs:documentation>
+					<xs:documentation xml:lang="en">The buyer's tax number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="insDate" type="base:InvoiceTimestampType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A beszúrás időpontja UTC időben</xs:documentation>
+					<xs:documentation xml:lang="en">Insert date in UTC time</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="originalRequestVersion" type="OriginalRequestVersionType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adatszolgáltatás requestVersion értéke</xs:documentation>
+					<xs:documentation xml:lang="en">requestVersion value of the invoice exchange</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceChainElementType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számlalánc elem</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice chain element</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="invoiceChainDigest" type="InvoiceChainDigestType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számlalánc kivonat adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice chain digest data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceLines" type="InvoiceLinesType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlán vagy módosító okiraton szereplő tételek kivonatos adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Product/service digest data appearing on the invoice or the modification document</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceReferenceData" type="InvoiceReferenceDataType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A módosítás vagy érvénytelenítés adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Modification or cancellation data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceChainQueryType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számlalánc kivonat lekérdezés számlaszám paramétere</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice number param of the invoice chain digest query</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="invoiceNumber" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla vagy módosító okirat sorszáma</xs:documentation>
+					<xs:documentation xml:lang="en">Sequential number of the original or modification invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceDirection" type="InvoiceDirectionType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kimenő vagy bejövő számla keresési paramétere</xs:documentation>
+					<xs:documentation xml:lang="en">Inbound or outbound invoice query parameter</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="taxNumber" type="common:TaxpayerIdType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla kiállítójának vagy vevőjének adószáma (a keresési feltétel az invoiceDirection tag értékétől függ)</xs:documentation>
+					<xs:documentation xml:lang="en">Tax number of the supplier or the customer of the invoice (the search criteria depends on the value of the invoiceDirection tag)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceDataResultType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számlaszámra történő lekérdezés eredménye</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice number based query result</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="invoiceData" type="xs:base64Binary">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla adatok BASE64-ben kódolt tartalma</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice data in BASE64 encoded form</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="auditData" type="AuditDataType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla audit adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice audit data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="compressedContentIndicator" type="xs:boolean">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Jelöli, ha az invoice tartalmát a BASE64 dekódolást követően még ki kell tömöríteni az olvasáshoz</xs:documentation>
+					<xs:documentation xml:lang="en">Indicates if the content of the invoice needs to be decompressed to be read following the BASE64 decoding</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="electronicInvoiceHash" type="common:CryptoType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Elektronikus számla vagy módosító okirat állomány hash lenyomata</xs:documentation>
+					<xs:documentation xml:lang="en">Electronic invoice or modification document file hash value</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceDigestResultType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számla lekérdezési eredmények</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice query results</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="currentPage" type="common:ResponsePageType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A jelenleg lekérdezett lapszám</xs:documentation>
+					<xs:documentation xml:lang="en">The currently queried page count</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="availablePage" type="common:ResponsePageType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A lekérdezés eredménye szerint elérhető utolsó lapszám</xs:documentation>
+					<xs:documentation xml:lang="en">The highest available page count matching the query</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceDigest" type="InvoiceDigestType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla kivonat lekérdezési eredmény</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice digest query result</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceDigestType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Kivonatos lekérdezési eredmény</xs:documentation>
+			<xs:documentation xml:lang="en">Digest query result</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="invoiceNumber" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla vagy módosító okirat sorszáma - ÁFA tv. 169. § b) vagy 170. § (1) bek. b) pont</xs:documentation>
+					<xs:documentation xml:lang="en">Sequential number of the original invoice or modification document - section 169 (b) or section 170 (1) b) of the VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="batchIndex" type="base:InvoiceUnboundedIndexType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A módosító okirat sorszáma a kötegen belül</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the modification document within the batch</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceOperation" type="ManageInvoiceOperationType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számlaművelet típus</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice operation type</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceCategory" type="base:InvoiceCategoryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla típusa</xs:documentation>
+					<xs:documentation xml:lang="en">Type of invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceIssueDate" type="base:InvoiceDateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla vagy módosító okirat kiállításának dátuma</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice or modification document issue date</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="supplierTaxNumber" type="common:TaxpayerIdType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kibocsátó adószáma</xs:documentation>
+					<xs:documentation xml:lang="en">The supplier's tax number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="supplierGroupMemberTaxNumber" type="common:TaxpayerIdType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kibocsátó csoporttag száma</xs:documentation>
+					<xs:documentation xml:lang="en">The supplier's group tax number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="supplierName" type="common:SimpleText512NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eladó (szállító) neve</xs:documentation>
+					<xs:documentation xml:lang="en">Name of the seller (supplier)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="customerTaxNumber" type="common:TaxpayerIdType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A vevő adószáma</xs:documentation>
+					<xs:documentation xml:lang="en">The buyer's tax number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="customerGroupMemberTaxNumber" type="common:TaxpayerIdType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A vevő csoporttag száma</xs:documentation>
+					<xs:documentation xml:lang="en">The buyer's group tax number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="customerName" type="common:SimpleText512NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A vevő neve</xs:documentation>
+					<xs:documentation xml:lang="en">Name of the customer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="paymentMethod" type="base:PaymentMethodType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Fizetés módja</xs:documentation>
+					<xs:documentation xml:lang="en">Method of payment</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="paymentDate" type="base:InvoiceDateType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Fizetési határidő</xs:documentation>
+					<xs:documentation xml:lang="en">Deadline for payment</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceAppearance" type="base:InvoiceAppearanceType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla megjelenési formája</xs:documentation>
+					<xs:documentation xml:lang="en">Form of appearance of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="source" type="SourceType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adatszolgáltatás forrása</xs:documentation>
+					<xs:documentation xml:lang="en">Data exchange source</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceDeliveryDate" type="base:InvoiceDateType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla teljesítési dátuma</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice delivery date</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="currency" type="common:CurrencyType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla pénzneme</xs:documentation>
+					<xs:documentation xml:lang="en">Currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceNetAmount" type="base:MonetaryType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla nettó összege a számla pénznemében</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice net amount expressed in the currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceNetAmountHUF" type="base:MonetaryType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla nettó összege forintban</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice net amount expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceVatAmount" type="base:MonetaryType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla ÁFA összege a számla pénznemében</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice VAT amount expressed in the currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceVatAmountHUF" type="base:MonetaryType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla ÁFA összege forintban</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice VAT amount expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="transactionId" type="common:EntityIdType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adatszolgáltatás tranzakció azonosítója</xs:documentation>
+					<xs:documentation xml:lang="en">Transaction identifier of the data exchange</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="index" type="base:InvoiceIndexType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla sorszáma a kérésen belül</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the invoice within the request</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="originalInvoiceNumber" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eredeti számla sorszáma, melyre a módosítás vonatkozik</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the original invoice, on which the modification occurs</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="modificationIndex" type="base:InvoiceUnboundedIndexType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlára vonatkozó módosító okirat egyedi sorszáma</xs:documentation>
+					<xs:documentation xml:lang="en">The unique sequence number referring to the original invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="insDate" type="base:InvoiceTimestampType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A beszúrás időpontja UTC időben</xs:documentation>
+					<xs:documentation xml:lang="en">Insert date in UTC time</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="completenessIndicator" type="xs:boolean" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Jelöli, ha az adatszolgáltatás maga a számla (a számlán nem szerepel több adat)</xs:documentation>
+					<xs:documentation xml:lang="en">Indicates whether the data exchange is identical with the invoice (the invoice does not contain any more data)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceLinesType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számlán vagy módosító okiraton szereplő tételek kivonatos adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Product/service digest data appearing on the invoice or the modification document</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="maxLineNumber" type="base:LineNumberType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A sorok száma közül a legmagasabb, amit a számla tartalmaz</xs:documentation>
+					<xs:documentation xml:lang="en">The highest line number value the invoice contains</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="newCreatedLines" type="NewCreatedLinesType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A módosító okirat által újként létrehozott számlasorok</xs:documentation>
+					<xs:documentation xml:lang="en">New invoice lines created by the modification document</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceNumberQueryType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számla lekérdezés számlaszám paramétere</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice number param of the Invoice query</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="invoiceNumber" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla vagy módosító okirat sorszáma</xs:documentation>
+					<xs:documentation xml:lang="en">Sequential number of the original or modification invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceDirection" type="InvoiceDirectionType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kimenő vagy bejövő számla keresési paramétere</xs:documentation>
+					<xs:documentation xml:lang="en">Inbound or outbound invoice query parameter</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="batchIndex" type="base:InvoiceUnboundedIndexType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A módosító okirat sorszáma a kötegen belül</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the modification document within the batch</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="supplierTaxNumber" type="common:TaxpayerIdType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Vevő oldali lekérdezés esetén a számla kiállítójának adószáma, ha több érvényes számla is megtalálható azonos sorszámmal</xs:documentation>
+					<xs:documentation xml:lang="en">The supplier's tax number in case of querying as customer, if the query result found more than one valid invoices with the same invoice number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceOperationListType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A kéréshez tartozó kötegelt számlaműveletek</xs:documentation>
+			<xs:documentation xml:lang="en">Batch invoice operations of the request</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="compressedContent" type="xs:boolean">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tömörített tartalom jelzése a feldolgozási folyamat számára</xs:documentation>
+					<xs:documentation xml:lang="en">Compressed content indicator for the processing flow</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceOperation" type="InvoiceOperationType" maxOccurs="100">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kéréshez tartozó számlaművelet</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice operation of the request</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceOperationType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A kéréshez tartozó számlaművelet</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice operation of the request</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="index" type="base:InvoiceIndexType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla sorszáma a kérésen belül</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the invoice within the request</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceOperation" type="ManageInvoiceOperationType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kért számla művelet típusa</xs:documentation>
+					<xs:documentation xml:lang="en">Type of the desired invoice operation</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceData" type="xs:base64Binary">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla adatok BASE64-ben kódolt tartalma</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice data in BASE64 encoded form</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="electronicInvoiceHash" type="common:CryptoType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Elektronikus számla vagy módosító okirat állomány hash lenyomata</xs:documentation>
+					<xs:documentation xml:lang="en">Electronic invoice or modification document file hash value</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceQueryParamsType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számla lekérdezési paraméterek</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice query parameters</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="mandatoryQueryParams" type="MandatoryQueryParamsType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla lekérdezés kötelező paraméterei</xs:documentation>
+					<xs:documentation xml:lang="en">Mandatory params of the invoice query</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="additionalQueryParams" type="AdditionalQueryParamsType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla lekérdezés kiegészítő paraméterei</xs:documentation>
+					<xs:documentation xml:lang="en">Additional params of the invoice query</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="relationalQueryParams" type="RelationalQueryParamsType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla lekérdezés relációs paraméterei</xs:documentation>
+					<xs:documentation xml:lang="en">Relational params of the invoice query</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="transactionQueryParams" type="TransactionQueryParamsType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla lekérdezés tranzakciós paraméterei</xs:documentation>
+					<xs:documentation xml:lang="en">Transactional params of the invoice query</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceReferenceDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A módosítás vagy érvénytelenítés adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Modification or cancellation data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="originalInvoiceNumber" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eredeti számla sorszáma, melyre a módosítás vonatkozik  - ÁFA tv. 170. § (1) c)</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the original invoice, on which the modification occurs - section 170 (1) c) of the VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="modifyWithoutMaster" type="xs:boolean">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Annak jelzése, hogy a módosítás olyan alapszámlára hivatkozik, amelyről nem történt és nem is fog történni adatszolgáltatás</xs:documentation>
+					<xs:documentation xml:lang="en">Indicates whether the modification references to an original invoice which is not and will not be exchanged</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:choice>
+				<xs:element name="modificationTimestamp" type="base:InvoiceTimestampType">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">A módosító okirat készítésének időbélyege a forrásrendszerben UTC időben</xs:documentation>
+						<xs:documentation xml:lang="en">Creation date timestamp of the modification document in UTC time</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:element name="modificationIndex" type="base:InvoiceUnboundedIndexType">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">A számlára vonatkozó módosító okirat egyedi sorszáma</xs:documentation>
+						<xs:documentation xml:lang="en">The unique sequence number referring to the original invoice</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+			</xs:choice>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ManageAnnulmentRequestType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /manageAnnulment REST operáció kérés típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Request type of the POST /manageAnnulment REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceRequestType">
+				<xs:sequence>
+					<xs:element name="exchangeToken" type="common:SimpleText50NotBlankType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A tranzakcióhoz kiadott egyedi és dekódolt token</xs:documentation>
+							<xs:documentation xml:lang="en">The decoded unique token issued for the current transaction</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="annulmentOperations" type="AnnulmentOperationListType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A kéréshez tartozó kötegelt technikai érvénytelenítések</xs:documentation>
+							<xs:documentation xml:lang="en">Batch technical annulment operations of the request</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="ManageInvoiceRequestType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /manageInvoice REST operáció kérés típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Request type of the POST /manageInvoice REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceRequestType">
+				<xs:sequence>
+					<xs:element name="exchangeToken" type="common:SimpleText50NotBlankType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A tranzakcióhoz kiadott egyedi és dekódolt token</xs:documentation>
+							<xs:documentation xml:lang="en">The decoded unique token issued for the current transaction</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="invoiceOperations" type="InvoiceOperationListType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A kéréshez tartozó kötegelt számlaműveletek</xs:documentation>
+							<xs:documentation xml:lang="en">Batch invoice operations of the request</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="MandatoryQueryParamsType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számla lekérdezés kötelező paraméterei</xs:documentation>
+			<xs:documentation xml:lang="en">Mandatory params of the invoice query</xs:documentation>
+		</xs:annotation>
+		<xs:choice>
+			<xs:element name="invoiceIssueDate" type="DateIntervalParamType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla kiállításának dátumtartománya</xs:documentation>
+					<xs:documentation xml:lang="en">Date range of the invoice issue date</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="insDate" type="DateTimeIntervalParamType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla adatszolgáltatás feldolgozásának időpont tartománya UTC idő szerint</xs:documentation>
+					<xs:documentation xml:lang="en">Datetime range of processing data exchange in UTC time</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="originalInvoiceNumber" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eredeti számla sorszáma, melyre a módosítás vonatkozik</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the original invoice, on which the modification occurs</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:choice>
+	</xs:complexType>
+	<xs:complexType name="NewCreatedLinesType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A módosító okirat által újként létrehozott számlasorok</xs:documentation>
+			<xs:documentation xml:lang="en">New invoice lines created by the modification document</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="lineNumberIntervalStart" type="base:LineNumberType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla sor intervallum kezdete</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice line interval start</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineNumberIntervalEnd" type="base:LineNumberType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla sor intervallum vége (inkluzív)</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice line interval end (inclusive)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="PointerType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Feldolgozási kurzor adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Processing cursor data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="tag" type="common:SimpleText1024NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tag hivatkozás</xs:documentation>
+					<xs:documentation xml:lang="en">Tag reference</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="value" type="common:SimpleText1024NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Érték hivatkozás</xs:documentation>
+					<xs:documentation xml:lang="en">Value reference</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="line" type="base:LineNumberType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Sorhivatkozás</xs:documentation>
+					<xs:documentation xml:lang="en">Line reference</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="originalInvoiceNumber" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kötegelt számla művelet esetén az eredeti számla sorszáma, melyre a módosítás vonatkozik</xs:documentation>
+					<xs:documentation xml:lang="en">In case of a batch operation, the sequence number of the original invoice, on which the modification occurs</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ProcessingResultListType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A kéréshez tartozó feldolgozási eredmények</xs:documentation>
+			<xs:documentation xml:lang="en">Processing results of the request</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="processingResult" type="ProcessingResultType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla feldolgozási eredmény</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice processing result</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="originalRequestVersion" type="OriginalRequestVersionType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adatszolgáltatás requestVersion értéke</xs:documentation>
+					<xs:documentation xml:lang="en">requestVersion value of the invoice exchange</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="annulmentData" type="AnnulmentDataType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Technikai érvénytelenítés státusz adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Status data of technical annulment</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ProcessingResultType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számla feldolgozási eredmény</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice processing result</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="index" type="base:InvoiceIndexType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla sorszáma a kérésen belül</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the invoice within the request</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="batchIndex" type="base:InvoiceUnboundedIndexType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A módosító okirat sorszáma a kötegen belül</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the modification document within the batch</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceStatus" type="InvoiceStatusType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla feldolgozási státusza</xs:documentation>
+					<xs:documentation xml:lang="en">Processing status of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="technicalValidationMessages" type="common:TechnicalValidationResultType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Technikai validációs üzenetek</xs:documentation>
+					<xs:documentation xml:lang="en">Technical validation messages</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="businessValidationMessages" type="BusinessValidationResultType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Üzleti validációs üzenetek</xs:documentation>
+					<xs:documentation xml:lang="en">Business validation messages</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="compressedContentIndicator" type="xs:boolean">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Jelöli, ha az originalRequest tartalmát a BASE64 dekódolást követően még ki kell tömöríteni az olvasáshoz</xs:documentation>
+					<xs:documentation xml:lang="en">Indicates if the content of the originalRequest needs to be decompressed to be read following the BASE64 decoding</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="originalRequest" type="xs:base64Binary" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla adatok BASE64-ben kódolt tartalma</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice data in BASE64 encoded form</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="QueryInvoiceChainDigestRequestType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceChainDigest REST operáció kérés típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Request type of the POST /queryInvoiceChainDigest REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceRequestType">
+				<xs:sequence>
+					<xs:element name="page" type="common:RequestPageType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A lekérdezni kívánt lap száma</xs:documentation>
+							<xs:documentation xml:lang="en">The queried page count</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="invoiceChainQuery" type="InvoiceChainQueryType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Számlalánc kivonat lekérdezés számlaszám paramétere</xs:documentation>
+							<xs:documentation xml:lang="en">Invoice number param of the invoice chain digest query</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="QueryInvoiceChainDigestResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceChainDigest REST operáció válasz típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Response type of the POST /queryInvoiceChainDigest REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceResponseType">
+				<xs:sequence>
+					<xs:element name="invoiceChainDigestResult" type="InvoiceChainDigestResultType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Számlalánc kivonat lekérdezés eredményei</xs:documentation>
+							<xs:documentation xml:lang="en">Invoice chain digest query result</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="QueryInvoiceCheckResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceCheck REST operáció válasz típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Response type of the POST /queryInvoiceCheck REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceResponseType">
+				<xs:sequence>
+					<xs:element name="invoiceCheckResult" type="xs:boolean">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Jelöli, ha a lekérdezett számlaszám érvényesként szerepel a rendszerben és a lekérdező adószáma kiállítóként vagy eladóként szerepel a számlán</xs:documentation>
+							<xs:documentation xml:lang="en">Indicates whether the queried invoice number exists in the system as a valid invoice, if the tax number of the querying entity is present on the invoice either as supplier or customer</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="QueryInvoiceDataRequestType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceData REST operáció kérés típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Request type of the POST /queryInvoiceData REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceRequestType">
+				<xs:sequence>
+					<xs:element name="invoiceNumberQuery" type="InvoiceNumberQueryType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Számla lekérdezés számlaszám paramétere</xs:documentation>
+							<xs:documentation xml:lang="en">Invoice number param of the Invoice query</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="QueryInvoiceDataResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceData REST operáció válasz típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Response type of the POST /queryInvoiceData REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceResponseType">
+				<xs:sequence>
+					<xs:element name="invoiceDataResult" type="InvoiceDataResultType" minOccurs="0">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A számla lekérdezés eredménye</xs:documentation>
+							<xs:documentation xml:lang="en">Invoice data query result</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="QueryInvoiceDigestRequestType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceDigest REST operáció kérés típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Request type of the POST /queryInvoiceDigest REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceRequestType">
+				<xs:sequence>
+					<xs:element name="page" type="common:RequestPageType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A lekérdezni kívánt lap száma</xs:documentation>
+							<xs:documentation xml:lang="en">The queried page count</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="invoiceDirection" type="InvoiceDirectionType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Kimenő vagy bejövő számla keresési paramétere</xs:documentation>
+							<xs:documentation xml:lang="en">Inbound or outbound invoice query parameter</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="invoiceQueryParams" type="InvoiceQueryParamsType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Számla lekérdezési paraméterek</xs:documentation>
+							<xs:documentation xml:lang="en">Invoice query parameters</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="QueryInvoiceDigestResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceDigest REST operáció válasz típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Response type of the POST /queryInvoiceDigest REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceResponseType">
+				<xs:sequence>
+					<xs:element name="invoiceDigestResult" type="InvoiceDigestResultType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A számla kivonat lekérdezés eredményei</xs:documentation>
+							<xs:documentation xml:lang="en">Invoice digest query results</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="QueryTaxpayerRequestType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryTaxpayer REST operáció kérés típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Request type of the POST /queryTaxpayer REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceRequestType">
+				<xs:sequence>
+					<xs:element name="taxNumber" type="common:TaxpayerIdType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A lekérdezett adózó adószáma</xs:documentation>
+							<xs:documentation xml:lang="en">Tax number of the queried taxpayer</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="QueryTaxpayerResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryTaxpayer REST operáció válasz típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Response type of the POST /queryTaxpayer REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceResponseType">
+				<xs:sequence>
+					<xs:element name="infoDate" type="xs:dateTime" minOccurs="0">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Az adatok utolsó változásának időpontja</xs:documentation>
+							<xs:documentation xml:lang="en">Last date on which the data was changed</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="taxpayerValidity" type="xs:boolean" minOccurs="0">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Jelzi, hogy a lekérdezett adózó létezik és érvényes-e</xs:documentation>
+							<xs:documentation xml:lang="en">Indicates whether the queried taxpayer is existing and valid</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="taxpayerData" type="TaxpayerDataType" minOccurs="0">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Az adózó lekérdezés válasz adatai</xs:documentation>
+							<xs:documentation xml:lang="en">Response data of the taxpayer query</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="QueryTransactionListRequestType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryTransactionList REST operáció kérés típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Request type of the POST /queryTransactionList REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceRequestType">
+				<xs:sequence>
+					<xs:element name="page" type="common:RequestPageType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A lekérdezni kívánt lap száma</xs:documentation>
+							<xs:documentation xml:lang="en">The queried page count</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="insDate" type="DateTimeIntervalParamType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A lekérdezni kívánt tranzakciók kiadásának szerver oldali ideje UTC időben</xs:documentation>
+							<xs:documentation xml:lang="en">The queried transaction's insert date on server side in UTC time</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="requestStatus" type="RequestStatusType" minOccurs="0">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A kérés feldolgozási státusza</xs:documentation>
+                            <xs:documentation xml:lang="en">Processing status of the request</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="QueryTransactionListResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryTransactionList REST operáció válasz típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Response type of the POST /queryTransactionList REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceResponseType">
+				<xs:sequence>
+					<xs:element name="transactionListResult" type="TransactionListResultType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Tranzakció lekérdezési eredményei</xs:documentation>
+							<xs:documentation xml:lang="en">Transaction query results</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="QueryTransactionStatusRequestType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryTransactionStatus REST operáció kérés típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Request type of the POST /queryTransactionStatus REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceRequestType">
+				<xs:sequence>
+					<xs:element name="transactionId" type="common:EntityIdType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Az adatszolgáltatás tranzakció azonosítója</xs:documentation>
+							<xs:documentation xml:lang="en">Transaction identifier of the data exchange</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="returnOriginalRequest" type="xs:boolean" minOccurs="0">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Jelöli, ha a kliens által beküldött eredeti tartalmat is vissza kell adni a válaszban</xs:documentation>
+							<xs:documentation xml:lang="en">Indicates if the original client data should also be returned in the response</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="QueryTransactionStatusResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryTransactionStatus REST operáció válasz típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Response type of the POST /queryTransactionStatus REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceResponseType">
+				<xs:sequence>
+					<xs:element name="processingResults" type="ProcessingResultListType" minOccurs="0">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A kérésben szereplő számlák feldolgozási státusza</xs:documentation>
+							<xs:documentation xml:lang="en">Processing status of the invoices in the request</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="RelationalQueryParamsType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számla lekérdezés relációs paraméterei</xs:documentation>
+			<xs:documentation xml:lang="en">Relational params of the invoice query</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="invoiceDelivery" type="RelationQueryDateType" minOccurs="0" maxOccurs="2">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla teljesítési dátumának kereső paramétere</xs:documentation>
+					<xs:documentation xml:lang="en">Query parameter of the invoice delivery date</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="paymentDate" type="RelationQueryDateType" minOccurs="0" maxOccurs="2">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla fizetési határidejének kereső paramétere</xs:documentation>
+					<xs:documentation xml:lang="en">Query parameter of the invoice payment date</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceNetAmount" type="RelationQueryMonetaryType" minOccurs="0" maxOccurs="2">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla nettó összeg kereső paramétere a számla pénznemében</xs:documentation>
+					<xs:documentation xml:lang="en">Query parameter of the invoice net amount expressed in the currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceNetAmountHUF" type="RelationQueryMonetaryType" minOccurs="0" maxOccurs="2">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla nettó összegének kereső paramétere forintban</xs:documentation>
+					<xs:documentation xml:lang="en">Query parameter of the invoice net amount expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceVatAmount" type="RelationQueryMonetaryType" minOccurs="0" maxOccurs="2">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla ÁFA összegének kereső paramétere a számla pénznemében</xs:documentation>
+					<xs:documentation xml:lang="en">Query parameter of the invoice VAT amount expressed in the currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceVatAmountHUF" type="RelationQueryMonetaryType" minOccurs="0" maxOccurs="2">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla ÁFA összegének kereső paramétere forintban</xs:documentation>
+					<xs:documentation xml:lang="en">Query parameter of the invoice VAT amount expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="RelationQueryDateType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Kereső paraméter dátum értékekhez</xs:documentation>
+			<xs:documentation xml:lang="en">Query parameter for date values</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="queryOperator" type="QueryOperatorType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kereső operátor</xs:documentation>
+					<xs:documentation xml:lang="en">Query operator</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="queryValue" type="base:InvoiceDateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kereső érték</xs:documentation>
+					<xs:documentation xml:lang="en">Query value</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="RelationQueryMonetaryType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Kereső paraméter monetáris értékekhez</xs:documentation>
+			<xs:documentation xml:lang="en">Query parameter for monetary values</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="queryOperator" type="QueryOperatorType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kereső operátor</xs:documentation>
+					<xs:documentation xml:lang="en">Query operator</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="queryValue" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kereső érték</xs:documentation>
+					<xs:documentation xml:lang="en">Query value</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="SoftwareType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számlázóprogram adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Billing software data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="softwareId" type="SoftwareIdType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlázóprogram azonosítója</xs:documentation>
+					<xs:documentation xml:lang="en">Billing software ID</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="softwareName" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlázóprogram neve</xs:documentation>
+					<xs:documentation xml:lang="en">Billing software name</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="softwareOperation" type="SoftwareOperationType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlázóprogram működési típusa (lokális program vagy online számlázó szolgáltatás)</xs:documentation>
+					<xs:documentation xml:lang="en">Billing software operation type (local program or online billing service)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="softwareMainVersion" type="common:SimpleText15NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlázóprogram főverziója</xs:documentation>
+					<xs:documentation xml:lang="en">Billing software main version</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="softwareDevName" type="common:SimpleText512NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlázóprogram fejlesztőjének neve</xs:documentation>
+					<xs:documentation xml:lang="en">Name of the billing software's developer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="softwareDevContact" type="common:SimpleText200NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlázóprogram fejlesztőjének elektronikus elérhetősége</xs:documentation>
+					<xs:documentation xml:lang="en">Electronic contact of the billing software's developer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="softwareDevCountryCode" type="common:CountryCodeType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlázóprogram fejlesztőjének ISO-3166 alpha2 országkódja</xs:documentation>
+					<xs:documentation xml:lang="en">ISO-3166 alpha2 country code of the billing software's developer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="softwareDevTaxNumber" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlázóprogram fejlesztőjének adószáma</xs:documentation>
+					<xs:documentation xml:lang="en">Tax number of the billing software's developer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="TaxpayerAddressItemType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Adózói címsor adat</xs:documentation>
+			<xs:documentation xml:lang="en">Taxpayer address item</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="taxpayerAddressType" type="TaxpayerAddressTypeType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adózói cím típus</xs:documentation>
+					<xs:documentation xml:lang="en">Taxpayer address type</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="taxpayerAddress" type="base:DetailedAddressType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adózó címadatai</xs:documentation>
+					<xs:documentation xml:lang="en">Address data of the taxpayer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="TaxpayerAddressListType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Adózói cím lista típus</xs:documentation>
+			<xs:documentation xml:lang="en">Taxpayer address list type</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="taxpayerAddressItem" type="TaxpayerAddressItemType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adózói címsor adat</xs:documentation>
+					<xs:documentation xml:lang="en">Taxpayer address item</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="TaxpayerDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Az adózó lekérdezés válasz adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Response data of the taxpayer query</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="taxpayerName" type="common:SimpleText512NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adózó neve</xs:documentation>
+					<xs:documentation xml:lang="en">Name of the taxpayer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="taxpayerShortName" type="common:SimpleText200NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adózó rövidített neve</xs:documentation>
+					<xs:documentation xml:lang="en">Shortened name of the taxpayer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="taxNumberDetail" type="base:TaxNumberType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adószám részletes adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Detailed data of the tax number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="incorporation" type="IncorporationType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Gazdasági típus</xs:documentation>
+					<xs:documentation xml:lang="en">Incorporation type</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatGroupMembership" type="common:TaxpayerIdType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adózó ÁFA csoport tagsága</xs:documentation>
+					<xs:documentation xml:lang="en">VAT group membership of the taxpayer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="taxpayerAddressList" type="TaxpayerAddressListType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adózói cím lista típus</xs:documentation>
+					<xs:documentation xml:lang="en">Taxpayer address list type</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="TokenExchangeResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /tokenExchange REST operáció válasz típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Response type of the POST /tokenExchange REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceResponseType">
+				<xs:sequence>
+					<xs:element name="encodedExchangeToken" type="xs:base64Binary">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A kiadott exchange token AES-128 ECB algoritmussal kódolt alakja</xs:documentation>
+							<xs:documentation xml:lang="en">The issued exchange token in AES-128 ECB encoded form</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="tokenValidityFrom" type="base:InvoiceTimestampType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A kiadott token érvényességének kezdete</xs:documentation>
+							<xs:documentation xml:lang="en">Validity start of the issued exchange token</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+					<xs:element name="tokenValidityTo" type="base:InvoiceTimestampType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A kiadott token érvényességének vége</xs:documentation>
+							<xs:documentation xml:lang="en">Validity end of the issued exchange token</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="TransactionListResultType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Tranzakció lekérdezési eredményei</xs:documentation>
+			<xs:documentation xml:lang="en">Transaction query results</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="currentPage" type="common:ResponsePageType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A jelenleg lekérdezett lapszám</xs:documentation>
+					<xs:documentation xml:lang="en">The currently queried page count</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="availablePage" type="common:ResponsePageType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A lekérdezés eredménye szerint elérhető utolsó lapszám</xs:documentation>
+					<xs:documentation xml:lang="en">The highest available page count matching the query</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="transaction" type="TransactionType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tranzakció lekérdezési eredmény</xs:documentation>
+					<xs:documentation xml:lang="en">Transaction query result</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="TransactionQueryParamsType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számla lekérdezés tranzakciós paraméterei</xs:documentation>
+			<xs:documentation xml:lang="en">Transactional params of the invoice query</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="transactionId" type="common:EntityIdType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adatszolgáltatás tranzakció azonosítója</xs:documentation>
+					<xs:documentation xml:lang="en">Transaction identifier of the data exchange</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="index" type="base:InvoiceIndexType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla sorszáma a kérésen belül</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the invoice within the request</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceOperation" type="ManageInvoiceOperationType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számlaművelet típus</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice operation type</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="TransactionResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /manageInvoice és a POST /manageAnnulment REST operáció közös válasz típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Common response type of the POST /manageInvoice and the POST /manageAnnulment REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="BasicOnlineInvoiceResponseType">
+				<xs:sequence>
+					<xs:element name="transactionId" type="common:EntityIdType">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">A kért operáció tranzakció azonosítója</xs:documentation>
+							<xs:documentation xml:lang="en">Transaction identifier of the requested operation</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="TransactionType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Tranzakció lekérdezési eredmény</xs:documentation>
+			<xs:documentation xml:lang="en">Transaction query result</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="insDate" type="base:InvoiceTimestampType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A beszúrás időpontja UTC időben</xs:documentation>
+					<xs:documentation xml:lang="en">Insert date in UTC time</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="insCusUser" type="common:LoginType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A beszúrást végző felhasználó</xs:documentation>
+					<xs:documentation xml:lang="en">Inserting user name</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="source" type="SourceType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adatszolgáltatás forrása</xs:documentation>
+					<xs:documentation xml:lang="en">Data exchange source</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="transactionId" type="common:EntityIdType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla tranzakció azonosítója</xs:documentation>
+					<xs:documentation xml:lang="en">Transaction ID of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="requestStatus" type="RequestStatusType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kérés feldolgozási státusza</xs:documentation>
+					<xs:documentation xml:lang="en">Processing status of the request</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="technicalAnnulment" type="xs:boolean">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Jelöli ha a tranzakció technikai érvénytelenítést tartalmaz</xs:documentation>
+					<xs:documentation xml:lang="en">Indicates whether the transaction contains technical annulment</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="originalRequestVersion" type="OriginalRequestVersionType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adatszolgáltatás requestVersion értéke</xs:documentation>
+					<xs:documentation xml:lang="en">requestVersion value of the invoice exchange</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="itemCount" type="base:InvoiceIndexType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adatszolgáltatás tételeinek száma</xs:documentation>
+					<xs:documentation xml:lang="en">Item count of the invoiceExchange</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:element name="GeneralErrorResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Online Számla rendszerre specifikus általános hibaválasz</xs:documentation>
+			<xs:documentation xml:lang="en">Online Invoice specific general error response</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="GeneralErrorResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="ManageAnnulmentRequest">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /manageAnnulment REST operáció kérésének root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Request root element of the POST /manageAnnulment REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="ManageAnnulmentRequestType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="ManageAnnulmentResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /manageAnnulment REST operáció válaszának root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Response root element of the POST /manageAnnulment REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="TransactionResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="ManageInvoiceRequest">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /manageInvoice REST operáció kérésének root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Request root element of the POST /manageInvoice REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="ManageInvoiceRequestType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="ManageInvoiceResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /manageInvoice REST operáció válaszának root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Response root element of the POST /manageInvoice REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="TransactionResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryInvoiceChainDigestRequest">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceChainDigest REST operáció kérésének root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Request root element of the POST /queryInvoiceChainDigest REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryInvoiceChainDigestRequestType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryInvoiceChainDigestResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceChainDigest REST operáció válaszának root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Response root element of the POST /queryInvoiceChainDigest REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryInvoiceChainDigestResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryInvoiceCheckRequest">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceCheck REST operáció kérésének root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Request root element of the POST /queryInvoiceCheck REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryInvoiceDataRequestType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryInvoiceCheckResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceCheck REST operáció válaszának root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Response root element of the POST /queryInvoiceCheck REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryInvoiceCheckResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryInvoiceDataRequest">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceData REST operáció kérésének root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Request root element of the POST /queryInvoiceData REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryInvoiceDataRequestType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryInvoiceDataResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceData REST operáció válaszának root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Response root element of the POST /queryInvoiceData REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryInvoiceDataResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryInvoiceDigestRequest">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceDigest REST operáció válaszának root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Response root element of the POST /queryInvoiceDigest REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryInvoiceDigestRequestType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryInvoiceDigestResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryInvoiceDigest REST operáció válaszának root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Response root element of the POST /queryInvoiceDigest REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryInvoiceDigestResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryTaxpayerRequest">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryTaxpayer REST operáció kérésének root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Request root element of the POST /queryTaxpayer REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryTaxpayerRequestType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryTaxpayerResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryTaxpayer REST operáció válaszának root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Response root element of the POST /queryTaxpayer REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryTaxpayerResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryTransactionListRequest">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryTransactionList REST operáció kérésének root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Request root element of the POST /queryTransactionList REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryTransactionListRequestType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryTransactionListResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryTransactionList REST operáció válaszának root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Response root element of the POST /queryTransactionList REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryTransactionListResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryTransactionStatusRequest">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryTransactionStatus REST operáció kérésének root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Request root element of the POST /queryTransactionStatus REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryTransactionStatusRequestType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryTransactionStatusResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /queryTransactionStatus REST operáció válaszának root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Response root element of the POST /queryTransactionStatus REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryTransactionStatusResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="TokenExchangeRequest">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /tokenExchange REST operáció kérésének root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Request root element of the POST /tokenExchange REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="BasicOnlineInvoiceRequestType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="TokenExchangeResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A POST /tokenExchange REST operáció válaszának root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Response root element of the POST /tokenExchange REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="TokenExchangeResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>

+ 329 - 0
custom/nav/lib/NavOnlineInvoice/xsd/invoiceBase.xsd

@@ -0,0 +1,329 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+# Project: Magyar Online Számla Rendszer invoiceBase XML séma
+# Author: NAV Informatikai Intézet
+
+# Version: v3.0 2020/07/31
+-->
+<xs:schema xmlns="http://schemas.nav.gov.hu/OSA/3.0/base" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:common="http://schemas.nav.gov.hu/NTCA/1.0/common" targetNamespace="http://schemas.nav.gov.hu/OSA/3.0/base" elementFormDefault="qualified" attributeFormDefault="unqualified">
+	<xs:import namespace="http://schemas.nav.gov.hu/NTCA/1.0/common"/>
+	<xs:simpleType name="InvoiceAppearanceType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számla megjelenési formája típus</xs:documentation>
+			<xs:documentation xml:lang="en">Form of appearance of the invoice type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="PAPER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Papír alapú számla</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice issued on paper</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="ELECTRONIC">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Elektronikus formában előállított, nem EDI számla</xs:documentation>
+					<xs:documentation xml:lang="en">Electronic invoice (non-EDI)</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="EDI">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">EDI számla</xs:documentation>
+					<xs:documentation xml:lang="en">EDI invoice</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="UNKNOWN">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A szoftver nem képes azonosítani vagy a kiállításkor nem ismert</xs:documentation>
+					<xs:documentation xml:lang="en">The software cannot be identify the form of appearance of the invoice or it is unknown at the time of issue</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="InvoiceCategoryType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számla típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Type of invoice</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="NORMAL">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Normál (nem egyszerűsített és nem gyűjtő) számla</xs:documentation>
+					<xs:documentation xml:lang="en">Normal (not simplified and not aggregate) invoice</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="SIMPLIFIED">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egyszerűsített számla</xs:documentation>
+					<xs:documentation xml:lang="en">Simplified invoice</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="AGGREGATE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Gyűjtőszámla</xs:documentation>
+					<xs:documentation xml:lang="en">Aggregate invoice</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="InvoiceDateType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Dátum típus az Online Számla rendszerben</xs:documentation>
+			<xs:documentation xml:lang="en">Date type in the Online Invoice system</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:date">
+			<xs:minInclusive value="2010-01-01"/>
+			<xs:pattern value="\d{4}-\d{2}-\d{2}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="InvoiceIndexType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Sorszám típus az Online Számla rendszerben</xs:documentation>
+			<xs:documentation xml:lang="en">Index type in the Online Invoice system</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:int">
+			<xs:minInclusive value="1"/>
+			<xs:maxInclusive value="100"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="InvoiceTimestampType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Időbélyeg típus az Online Számla rendszerben</xs:documentation>
+			<xs:documentation xml:lang="en">Timestamp type in the Online Invoice system</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:dateTime">
+			<xs:minInclusive value="2010-01-01T00:00:00Z"/>
+			<xs:pattern value="\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(.\d{1,3})?Z"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="InvoiceUnboundedIndexType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Sorszám típus kötegelt számlaművelethez az Online Számla rendszerben</xs:documentation>
+			<xs:documentation xml:lang="en">Index type for batch invoice operation in the Online Invoice system</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:int">
+			<xs:minInclusive value="1"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="LineNumberType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Tételszám típus</xs:documentation>
+			<xs:documentation xml:lang="en">Line number type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:nonNegativeInteger">
+			<xs:minInclusive value="1"/>
+			<xs:totalDigits value="20"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="MonetaryType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Pénzérték típus. Maximum 18 számjegy, ami 2 tizedesjegyet tartalmazhat</xs:documentation>
+			<xs:documentation xml:lang="en">Field type for money value input. Maximum 18 digits that may include 2 decimal places</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:GenericDecimalType">
+			<xs:totalDigits value="18"/>
+			<xs:fractionDigits value="2"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="PaymentMethodType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Fizetés módja</xs:documentation>
+			<xs:documentation xml:lang="en">Method of payment</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="TRANSFER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Banki átutalás</xs:documentation>
+					<xs:documentation xml:lang="en">Bank transfer</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="CASH">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Készpénz</xs:documentation>
+					<xs:documentation xml:lang="en">Cash</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="CARD">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Bankkártya, hitelkártya, egyéb készpénz helyettesítő eszköz</xs:documentation>
+					<xs:documentation xml:lang="en">Debit card, credit card, other cash-substitute payment instrument</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="VOUCHER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Utalvány, váltó, egyéb pénzhelyettesítő eszköz</xs:documentation>
+					<xs:documentation xml:lang="en">Voucher, bill of exchange, other non-cash payment instrument</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="OTHER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egyéb</xs:documentation>
+					<xs:documentation xml:lang="en">Other</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:complexType name="AddressType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Cím típus, amely vagy egyszerű, vagy részletes címet tartalmaz</xs:documentation>
+			<xs:documentation xml:lang="en">Format of address that includes either a simple or a detailed address</xs:documentation>
+		</xs:annotation>
+		<xs:choice>
+			<xs:element name="simpleAddress" type="SimpleAddressType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egyszerű cím</xs:documentation>
+					<xs:documentation xml:lang="en">Simple address</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="detailedAddress" type="DetailedAddressType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Részletes cím</xs:documentation>
+					<xs:documentation xml:lang="en">Detailed address</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:choice>
+	</xs:complexType>
+	<xs:complexType name="DetailedAddressType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Részletes címadatok</xs:documentation>
+			<xs:documentation xml:lang="en">Detailed address data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="countryCode" type="common:CountryCodeType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az országkód ISO 3166 alpha-2 szabvány szerint</xs:documentation>
+					<xs:documentation xml:lang="en">ISO 3166 alpha-2 country code</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="region" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tartomány kódja (amennyiben értelmezhető az adott országban) az ISO 3166-2 alpha 2 szabvány szerint</xs:documentation>
+					<xs:documentation xml:lang="en">ISO 3166 alpha-2 province code (if appropriate in a given country)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="postalCode" type="common:PostalCodeType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Irányítószám (amennyiben nem értelmezhető, 0000 értékkel kell kitölteni)</xs:documentation>
+					<xs:documentation xml:lang="en">ZIP code (If can not be interpreted, need to be filled "0000")</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="city" type="common:SimpleText255NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Település</xs:documentation>
+					<xs:documentation xml:lang="en">Settlement</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="streetName" type="common:SimpleText255NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Közterület neve</xs:documentation>
+					<xs:documentation xml:lang="en">Name of public place</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="publicPlaceCategory" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Közterület jellege</xs:documentation>
+					<xs:documentation xml:lang="en">Category of public place</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="number" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Házszám</xs:documentation>
+					<xs:documentation xml:lang="en">House number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="building" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Épület</xs:documentation>
+					<xs:documentation xml:lang="en">Building</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="staircase" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Lépcsőház</xs:documentation>
+					<xs:documentation xml:lang="en">Staircase</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="floor" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Emelet</xs:documentation>
+					<xs:documentation xml:lang="en">Floor</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="door" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Ajtó</xs:documentation>
+					<xs:documentation xml:lang="en">Door number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lotNumber" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Helyrajzi szám</xs:documentation>
+					<xs:documentation xml:lang="en">Lot number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="SimpleAddressType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Egyszerű címtípus</xs:documentation>
+			<xs:documentation xml:lang="en">Simple address type</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="countryCode" type="common:CountryCodeType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az országkód az ISO 3166 alpha-2 szabvány szerint</xs:documentation>
+					<xs:documentation xml:lang="en">ISO 3166 alpha-2 country code</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="region" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tartomány kódja (amennyiben értelmezhető az adott országban) az ISO 3166-2 alpha 2 szabvány szerint</xs:documentation>
+					<xs:documentation xml:lang="en">ISO 3166 alpha-2 province code (if appropriate in a given country)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="postalCode" type="common:PostalCodeType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Irányítószám (amennyiben nem értelmezhető, 0000 értékkel kell kitölteni)</xs:documentation>
+					<xs:documentation xml:lang="en">ZIP code (If can not be interpreted, need to be filled "0000")</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="city" type="common:SimpleText255NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Település</xs:documentation>
+					<xs:documentation xml:lang="en">Settlement</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="additionalAddressDetail" type="common:SimpleText255NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">További címadatok (pl. közterület neve és jellege, házszám, emelet, ajtó, helyrajzi szám, stb.)</xs:documentation>
+					<xs:documentation xml:lang="en">Further address data (name and type of public place, house number, floor, door, lot number, etc.)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="TaxNumberType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Adószám típus</xs:documentation>
+			<xs:documentation xml:lang="en">Tax number type</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="taxpayerId" type="common:TaxpayerIdType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adóalany adó törzsszáma. Csoportos adóalany esetén csoportazonosító szám</xs:documentation>
+					<xs:documentation xml:lang="en">Core tax number of the taxable person. In case of group taxation arrangement the group identification number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatCode" type="common:VatCodeType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">ÁFA kód az adóalanyiság típusának jelzésére. Egy számjegy</xs:documentation>
+					<xs:documentation xml:lang="en">VAT code to indicate taxation type of the taxpayer. One digit</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="countyCode" type="common:CountyCodeType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Megyekód, két számjegy</xs:documentation>
+					<xs:documentation xml:lang="en">County code, two digits</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+</xs:schema>

+ 2368 - 0
custom/nav/lib/NavOnlineInvoice/xsd/invoiceData.xsd

@@ -0,0 +1,2368 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+# Project: Magyar Online Számla Rendszer invoiceData XML séma
+# Author: NAV Informatikai Intézet
+
+# Version: v3.0 2020/11/23
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.nav.gov.hu/OSA/3.0/data" xmlns:common="http://schemas.nav.gov.hu/NTCA/1.0/common" xmlns:base="http://schemas.nav.gov.hu/OSA/3.0/base" targetNamespace="http://schemas.nav.gov.hu/OSA/3.0/data" elementFormDefault="qualified" attributeFormDefault="unqualified">
+	<xs:import namespace="http://schemas.nav.gov.hu/NTCA/1.0/common" schemaLocation="common.xsd"/>
+	<xs:import namespace="http://schemas.nav.gov.hu/OSA/3.0/base" schemaLocation="invoiceBase.xsd"/>
+	<xs:simpleType name="CustomerVatStatusType">
+			<xs:annotation>
+				<xs:documentation xml:lang="hu">Vevő ÁFA szerinti státusz típusa</xs:documentation>
+				<xs:documentation xml:lang="en">Customers status type by VAT</xs:documentation>
+			</xs:annotation>
+			<xs:restriction base="common:AtomicStringType15">
+				<xs:enumeration value="DOMESTIC">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">Belföldi ÁFA alany</xs:documentation>
+						<xs:documentation xml:lang="en">Domestic VAT subject</xs:documentation>
+					</xs:annotation>
+				</xs:enumeration>
+				<xs:enumeration value="OTHER">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">Egyéb (belföldi nem ÁFA alany, nem természetes személy, külföldi ÁFA alany és külföldi nem ÁFA alany, nem természetes személy)</xs:documentation>
+						<xs:documentation xml:lang="en">Other (domestic non-VAT subject, non-natural person, foreign VAT subject and foreign non-VAT subject, non-natural person)</xs:documentation>
+					</xs:annotation>
+				</xs:enumeration>
+				<xs:enumeration value="PRIVATE_PERSON">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">Nem ÁFA alany (belföldi vagy külföldi) természetes személy</xs:documentation>
+						<xs:documentation xml:lang="en">Non-VAT subject (domestic or foreign) natural person</xs:documentation>
+					</xs:annotation>
+				</xs:enumeration>
+			</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="DataNameType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Az adatmező egyedi azonosító típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Unique identification type of the data field</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType255">
+			<xs:minLength value="1"/>
+			<xs:maxLength value="255"/>
+			<xs:pattern value="[A-Z][0-9]{5}[_][_A-Z0-9]{1,249}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="EkaerIdType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">EKÁER szám azonosító típus</xs:documentation>
+			<xs:documentation xml:lang="en">EKÁER number identifier type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:pattern value="[E]{1}[0-9]{6}[0-9A-F]{8}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="ExchangeRateType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Árfolyam adat típus</xs:documentation>
+			<xs:documentation xml:lang="en">Exchange rate data type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="xs:decimal">
+			<xs:totalDigits value="14"/>
+			<xs:fractionDigits value="6"/>
+			<xs:minExclusive value="0"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="LineNatureIndicatorType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Adott tételsor termékértékesítés vagy szolgáltatás nyújtás jellegének jelzése</xs:documentation>
+			<xs:documentation xml:lang="en">Indication of the nature of the supply of goods or services on a given line</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="PRODUCT">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Termékértékesítés</xs:documentation>
+					<xs:documentation xml:lang="en">Supply of goods</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="SERVICE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Szolgáltatás nyújtás</xs:documentation>
+					<xs:documentation xml:lang="en">Supply of services</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="OTHER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egyéb, nem besorolható</xs:documentation>
+					<xs:documentation xml:lang="en">Other, non-qualifiable</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="LineOperationType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számlatétel módosítás típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice line modification type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="CREATE"/>
+			<xs:enumeration value="MODIFY"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="MarginSchemeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Különbözet szerinti szabályozás típus</xs:documentation>
+			<xs:documentation xml:lang="en">Field type for inputting margin-scheme taxation</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="TRAVEL_AGENCY">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Utazási irodák</xs:documentation>
+					<xs:documentation xml:lang="en">Travel agencies</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="SECOND_HAND">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Használt cikkek</xs:documentation>
+					<xs:documentation xml:lang="en">Second-hand goods</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="ARTWORK">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Műalkotások</xs:documentation>
+					<xs:documentation xml:lang="en">Works of art</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="ANTIQUES">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Gyűjteménydarabok és régiségek</xs:documentation>
+					<xs:documentation xml:lang="en">Collector’s items and antiques</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="ProductCodeCategoryType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A termékkód fajtájának jelölésére szolgáló típus</xs:documentation>
+			<xs:documentation xml:lang="en">The type used to mark the kind of product code</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType8">
+			<xs:minLength value="2"/>
+			<xs:maxLength value="6"/>
+			<xs:enumeration value="VTSZ">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Vámtarifa szám VTSZ</xs:documentation>
+					<xs:documentation xml:lang="en">Customs tariff number CTN</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="SZJ">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Szolgáltatás jegyzék szám SZJ</xs:documentation>
+					<xs:documentation xml:lang="en">Business service list number BSL</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="KN">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">KN kód (Kombinált Nómenklatúra, 2658/87/EGK rendelet I. melléklete)</xs:documentation>
+					<xs:documentation xml:lang="en">CN code (Combined Nomenclature, 2658/87/ECC Annex I)</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="AHK">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A Jövedéki törvény (2016. évi LXVIII. tv) szerinti e-TKO adminisztratív hivatkozási kódja AHK</xs:documentation>
+					<xs:documentation xml:lang="en">Administrative reference code of e-TKO defined in the Act LXVIII of 2016 on Excise Duties</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="CSK">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A termék 343/2011. (XII. 29) Korm. rendelet 1. sz. melléklet A) cím szerinti csomagolószer-katalógus kódja (CsK kód)</xs:documentation>
+					<xs:documentation xml:lang="en">Packaging product catalogue code of the product according to the Title A) in the Schedule No.1 of the Government Decree No. 343/2011. (XII. 29.)</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="KT">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A termék 343/2011. (XII. 29) Korm. rendelet 1. sz. melléklet B) cím szerinti környezetvédelmi termékkódja (Kt kód)</xs:documentation>
+					<xs:documentation xml:lang="en">Environmental protection product code of the product according to the Title B) in the Schedule No.1 of the Government Decree No. 343/2011. (XII. 29.)</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="EJ">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Építményjegyzék szám</xs:documentation>
+					<xs:documentation xml:lang="en">Classification of Inventory of Construction</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="TESZOR">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A Termékek és Szolgáltatások Osztályozási Rendszere (TESZOR) szerinti termékkód - 451/2008/EK rendelet</xs:documentation>
+					<xs:documentation xml:lang="en">Product code according to the TESZOR (Hungarian Classification of Goods and Services), Classification of Product by Activity, CPA - regulation 451/2008/EC</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="OWN">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A vállalkozás által képzett termékkód</xs:documentation>
+					<xs:documentation xml:lang="en">The own product code of the enterprise</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="OTHER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egyéb termékkód</xs:documentation>
+					<xs:documentation xml:lang="en">Other product code</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="ProductCodeValueType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Termékkód típus</xs:documentation>
+			<xs:documentation xml:lang="en">Field type for inputting product codes</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType32">
+			<xs:minLength value="2"/>
+			<xs:maxLength value="30"/>
+			<xs:pattern value="[A-Z0-9]{2,30}"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="ProductFeeMeasuringUnitType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Díjtétel egység típus</xs:documentation>
+			<xs:documentation xml:lang="en">Unit of the rate type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType8">
+			<xs:enumeration value="DARAB">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Darab</xs:documentation>
+					<xs:documentation xml:lang="en">Piece</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="KG">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kilogramm</xs:documentation>
+					<xs:documentation xml:lang="en">Kilogram</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="ProductFeeOperationType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Termékdíj összesítés típus</xs:documentation>
+			<xs:documentation xml:lang="en">Product fee summary type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType8">
+			<xs:enumeration value="REFUND">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Visszaigénylés</xs:documentation>
+					<xs:documentation xml:lang="en">Refund</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="DEPOSIT">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Raktárba szállítás</xs:documentation>
+					<xs:documentation xml:lang="en">Deposit</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="ProductStreamType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Termékáram típus</xs:documentation>
+			<xs:documentation xml:lang="en">Product stream</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="BATTERY">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Akkumulátor</xs:documentation>
+					<xs:documentation xml:lang="en">Battery</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="PACKAGING">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Csomagolószer</xs:documentation>
+					<xs:documentation xml:lang="en">Packaging products</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="OTHER_PETROL">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egyéb kőolajtermék</xs:documentation>
+					<xs:documentation xml:lang="en">Other petroleum product</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="ELECTRONIC">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az elektromos, elektronikai berendezés</xs:documentation>
+					<xs:documentation xml:lang="en">The electric appliance, electronic equipment</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="TIRE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Gumiabroncs</xs:documentation>
+					<xs:documentation xml:lang="en">Tire</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="COMMERCIAL">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Reklámhordozó papír</xs:documentation>
+					<xs:documentation xml:lang="en">Commercial printing paper</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="PLASTIC">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az egyéb műanyag termék</xs:documentation>
+					<xs:documentation xml:lang="en">Other plastic product</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="OTHER_CHEMICAL">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egyéb vegyipari termék</xs:documentation>
+					<xs:documentation xml:lang="en">Other chemical product</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="PAPER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Irodai papír</xs:documentation>
+					<xs:documentation xml:lang="en">Paper stationery</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="QuantityType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Mennyiségi érték típus. Maximum 22 számjegy, ami 10 tizedesjegyet tartalmazhat</xs:documentation>
+			<xs:documentation xml:lang="en">Field type for quantity values. Maximum 22 digits that may include 10 decimal places</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:GenericDecimalType">
+			<xs:totalDigits value="22"/>
+			<xs:fractionDigits value="10"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="RateType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Arány megadására szolgáló típus. 0 és 1 közötti szám, legfeljebb 4 tizedesjegy pontossággal</xs:documentation>
+			<xs:documentation xml:lang="en">Rate type. A number between 0 and 1, may include maximum 4 decimal places</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:GenericDecimalType">
+			<xs:minInclusive value="0"/>
+			<xs:maxInclusive value="1"/>
+			<xs:totalDigits value="5"/>
+			<xs:fractionDigits value="4"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="TakeoverType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Az átvállalás adatait tartalmazó típus</xs:documentation>
+			<xs:documentation xml:lang="en">Field type for data of takeover</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType8">
+			<xs:enumeration value="01">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A 2011. évi LXXXV. tv. 14. § (4) bekezdés szerint az eladó (első belföldi forgalomba hozó) vállalja át a vevő termékdíj-kötelezettségét</xs:documentation>
+					<xs:documentation xml:lang="en">The supplier takes over buyer’s product fee liability on the basis of Paragraph (4), Section 14 of the Act LXXXV of 2011</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="02_aa">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A 2011. évi LXXXV. tv. 14. § (5) aa) alpontja szerint a vevő szerződés alapján átvállalja az eladó termékdíj-kötelezettségét</xs:documentation>
+					<xs:documentation xml:lang="en">On the basis of contract, the buyer takes over supplier’s product fee liability on the basis of sub-point aa), Paragraph (5), Section 14 of the Act LXXXV of 2011</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="02_ab"/>
+			<xs:enumeration value="02_b"/>
+			<xs:enumeration value="02_c"/>
+			<xs:enumeration value="02_d"/>
+			<xs:enumeration value="02_ea"/>
+			<xs:enumeration value="02_eb"/>
+			<xs:enumeration value="02_fa"/>
+			<xs:enumeration value="02_fb"/>
+			<xs:enumeration value="02_ga"/>
+			<xs:enumeration value="02_gb"/>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="UnitOfMeasureType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Mennyiség egység típus</xs:documentation>
+			<xs:documentation xml:lang="en">Unit of measure type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="PIECE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Darab</xs:documentation>
+					<xs:documentation xml:lang="en">Piece</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="KILOGRAM">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kilogramm</xs:documentation>
+					<xs:documentation xml:lang="en">Kilogram</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="TON">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Metrikus tonna</xs:documentation>
+					<xs:documentation xml:lang="en">Metric ton</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="KWH">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kilowatt óra</xs:documentation>
+					<xs:documentation xml:lang="en">Kilowatt hour</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="DAY">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Nap</xs:documentation>
+					<xs:documentation xml:lang="en">Day</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="HOUR">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Óra</xs:documentation>
+					<xs:documentation xml:lang="en">Hour</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="MINUTE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Perc</xs:documentation>
+					<xs:documentation xml:lang="en">Minute</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="MONTH">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Hónap</xs:documentation>
+					<xs:documentation xml:lang="en">Month</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="LITER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Liter</xs:documentation>
+					<xs:documentation xml:lang="en">Liter</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="KILOMETER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kilométer</xs:documentation>
+					<xs:documentation xml:lang="en">Kilometer</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="CUBIC_METER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Köbméter</xs:documentation>
+					<xs:documentation xml:lang="en">Cubic meter</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="METER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Méter</xs:documentation>
+					<xs:documentation xml:lang="en">Meter</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="LINEAR_METER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Folyóméter</xs:documentation>
+					<xs:documentation xml:lang="en">Linear meter</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="CARTON">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Karton</xs:documentation>
+					<xs:documentation xml:lang="en">Carton</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="PACK">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Csomag</xs:documentation>
+					<xs:documentation xml:lang="en">Pack</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="OWN">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Saját mennyiségi egység megnevezés</xs:documentation>
+					<xs:documentation xml:lang="en">Own unit of measure</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:complexType name="AdditionalDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">További adat leírására szolgáló típus</xs:documentation>
+			<xs:documentation xml:lang="en">Type for additional data description</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="dataName" type="DataNameType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adatmező egyedi azonosítója</xs:documentation>
+					<xs:documentation xml:lang="en">Unique identification of the data field</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="dataDescription" type="common:SimpleText255NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adatmező tartalmának szöveges leírása</xs:documentation>
+					<xs:documentation xml:lang="en">Description of content of the data field</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="dataValue" type="common:SimpleText512NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adat értéke</xs:documentation>
+					<xs:documentation xml:lang="en">Value of the data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="AdvanceDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Előleghez kapcsolódó adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Advance related data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="advanceIndicator" type="xs:boolean">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Értéke true, ha a számla tétel előleg jellegű</xs:documentation>
+					<xs:documentation xml:lang="en">The value is true if the invoice item is a kind of advance charge</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="advancePaymentData" type="AdvancePaymentDataType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Előleg fizetéshez kapcsolódó adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Advance payment related data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="AdvancePaymentDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Előlegfizetéshez kapcsolódó adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Advance payment related data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="advanceOriginalInvoice" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az előlegszámlának a sorszáma, amelyben az előlegfizetés történt</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice number containing the advance payment</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="advancePaymentDate" type="base:InvoiceDateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az előleg fizetésének dátuma</xs:documentation>
+					<xs:documentation xml:lang="en">Payment date of the advance</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="advanceExchangeRate" type="ExchangeRateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az előlegfizetés során alkalmazott árfolyam</xs:documentation>
+					<xs:documentation xml:lang="en">Applied exchange rate of the advance</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="AggregateInvoiceLineDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A gyűjtő számlára vonatkozó speciális adatokat tartalmazó típus</xs:documentation>
+			<xs:documentation xml:lang="en">Field type including aggregate invoice special data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="lineExchangeRate" type="ExchangeRateType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A tételhez tartozó árfolyam, 1 (egy) egységre vonatkoztatva. Csak külföldi pénznemben kiállított gyűjtő számla esetén kitöltendő</xs:documentation>
+					<xs:documentation xml:lang="en">The exchange rate applied to the item, pertaining to 1 (one) unit. This should be filled in only if an aggregate invoice in foreign currency is issued</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineDeliveryDate" type="base:InvoiceDateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Gyűjtőszámla esetén az adott tétel teljesítési dátuma</xs:documentation>
+					<xs:documentation xml:lang="en">Delivery date of the given item in the case of an aggregate invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="AircraftType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Légi közlekedési eszköz</xs:documentation>
+			<xs:documentation xml:lang="en">Aircraft</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="takeOffWeight" type="QuantityType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Felszállási tömeg kilogrammban</xs:documentation>
+					<xs:documentation xml:lang="en">Take-off weight in kilogram</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="airCargo" type="xs:boolean">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Értéke true ha a jármű az ÁFA tv. 259.§ 25. c) szerinti kivétel alá tartozik</xs:documentation>
+					<xs:documentation xml:lang="en">The value is true if the means of transport is exempt from VAT as per section 259 [25] (c)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="operationHours" type="QuantityType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Repült órák száma</xs:documentation>
+					<xs:documentation xml:lang="en">Number of aviated hours</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="BatchInvoiceType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Kötegelt módosító okirat adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Data of a batch of modification documents</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="batchIndex" type="base:InvoiceUnboundedIndexType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A módosító okirat sorszáma a kötegen belül</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the modification document within the batch</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoice" type="InvoiceType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egy számla vagy módosító okirat adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Data of a single invoice or modification document</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ContractNumbersType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Szerződésszámok</xs:documentation>
+			<xs:documentation xml:lang="en">Contract numbers</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="contractNumber" type="common:SimpleText100NotBlankType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Szerződésszám</xs:documentation>
+					<xs:documentation xml:lang="en">Contract number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ConventionalInvoiceInfoType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számlafeldolgozást segítő, egyezményesen nevesített egyéb adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Other conventionally named data to assist in invoice processing</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="orderNumbers" type="OrderNumbersType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Megrendelésszám(ok)</xs:documentation>
+					<xs:documentation xml:lang="en">Order numbers</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="deliveryNotes" type="DeliveryNotesType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Szállítólevél szám(ok)</xs:documentation>
+					<xs:documentation xml:lang="en">Delivery notes</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="shippingDates" type="ShippingDatesType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Szállítási dátum(ok)</xs:documentation>
+					<xs:documentation xml:lang="en">Shipping dates</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="contractNumbers" type="ContractNumbersType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Szerződésszám(ok)</xs:documentation>
+					<xs:documentation xml:lang="en">Contract numbers</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="supplierCompanyCodes" type="SupplierCompanyCodesType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eladó vállalati kódja(i)</xs:documentation>
+					<xs:documentation xml:lang="en">Company codes of the supplier</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="customerCompanyCodes" type="CustomerCompanyCodesType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A vevő vállalati kódja(i)</xs:documentation>
+					<xs:documentation xml:lang="en">Company codes of the customer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="dealerCodes" type="DealerCodesType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Beszállító kód(ok)</xs:documentation>
+					<xs:documentation xml:lang="en">Dealer codes</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="costCenters" type="CostCentersType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Költséghely(ek)</xs:documentation>
+					<xs:documentation xml:lang="en">Cost centers</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="projectNumbers" type="ProjectNumbersType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Projektszám(ok)</xs:documentation>
+					<xs:documentation xml:lang="en">Project numbers</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="generalLedgerAccountNumbers" type="GeneralLedgerAccountNumbersType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Főkönyvi számlaszám(ok)</xs:documentation>
+					<xs:documentation xml:lang="en">General ledger account numbers</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="glnNumbersSupplier" type="GlnNumbersType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kiállítói globális helyazonosító szám(ok)</xs:documentation>
+					<xs:documentation xml:lang="en">Supplier's global location numbers</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="glnNumbersCustomer" type="GlnNumbersType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Vevői globális helyazonosító szám(ok)</xs:documentation>
+					<xs:documentation xml:lang="en">Customer's global location numbers</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="materialNumbers" type="MaterialNumbersType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Anyagszám(ok)</xs:documentation>
+					<xs:documentation xml:lang="en">Material numbers</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="itemNumbers" type="ItemNumbersType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Cikkszám(ok)</xs:documentation>
+					<xs:documentation xml:lang="en">Item number(s)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="ekaerIds" type="EkaerIdsType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">EKÁER azonosító(k)</xs:documentation>
+					<xs:documentation xml:lang="en">EKAER ID-s</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="CostCentersType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Költséghelyek</xs:documentation>
+			<xs:documentation xml:lang="en">Cost centers</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="costCenter" type="common:SimpleText100NotBlankType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Költséghely</xs:documentation>
+					<xs:documentation xml:lang="en">Cost center</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="CustomerCompanyCodesType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A vevő vállalati kódjai</xs:documentation>
+			<xs:documentation xml:lang="en">Company codes of the customer</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="customerCompanyCode" type="common:SimpleText100NotBlankType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A vevő vállalati kódja</xs:documentation>
+					<xs:documentation xml:lang="en">Company code of the customer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="CustomerDeclarationType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Ha az eladó a vevő nyilatkozata alapján mentesül a termékdíj megfizetése alól, akkor az érintett termékáram</xs:documentation>
+			<xs:documentation xml:lang="en">Should the supplier, based on statement given by the purchaser, be exempted from paying product fee, then the product stream affected</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="productStream" type="ProductStreamType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Termékáram</xs:documentation>
+					<xs:documentation xml:lang="en">Product stream</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="productFeeWeight" type="QuantityType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Termékdíj köteles termék tömege kilogrammban</xs:documentation>
+					<xs:documentation xml:lang="en">Weight of product fee obliged product in kilogram</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="CustomerInfoType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A vevő adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Customer data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="customerVatStatus" type="CustomerVatStatusType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Vevő ÁFA szerinti státusza</xs:documentation>
+					<xs:documentation xml:lang="en">Customers status by VAT</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="customerVatData" type="CustomerVatDataType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A vevő ÁFA alanyisági adatai</xs:documentation>
+					<xs:documentation xml:lang="en">VAT subjectivity data of the customer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="customerName" type="common:SimpleText512NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A vevő neve</xs:documentation>
+					<xs:documentation xml:lang="en">Name of the customer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="customerAddress" type="base:AddressType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A vevő címe</xs:documentation>
+					<xs:documentation xml:lang="en">Address of the customer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="customerBankAccountNumber" type="common:BankAccountNumberType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Vevő bankszámlaszáma</xs:documentation>
+					<xs:documentation xml:lang="en">Bank account number of the customer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="CustomerTaxNumberType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Adószám, amely alatt a számlán szereplő termékbeszerzés vagy szolgáltatás igénybevétele történt. Lehet csoportazonosító szám is</xs:documentation>
+			<xs:documentation xml:lang="en">Tax number or group identification number, under which the purchase of goods or services is done</xs:documentation>
+		</xs:annotation>
+		<xs:complexContent>
+			<xs:extension base="base:TaxNumberType">
+				<xs:sequence>
+					<xs:element name="groupMemberTaxNumber" type="base:TaxNumberType" minOccurs="0">
+						<xs:annotation>
+							<xs:documentation xml:lang="hu">Csoport tag adószáma, ha a termékbeszerzés vagy szolgáltatás igénybevétele csoportazonosító szám alatt történt</xs:documentation>
+							<xs:documentation xml:lang="en">Tax number of group member, when the purchase of goods or services is done under group identification number</xs:documentation>
+						</xs:annotation>
+					</xs:element>
+				</xs:sequence>
+			</xs:extension>
+		</xs:complexContent>
+	</xs:complexType>
+	<xs:complexType name="CustomerVatDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A vevő ÁFA alanyisági adatai</xs:documentation>
+			<xs:documentation xml:lang="en">VAT subjectivity data of the customer</xs:documentation>
+		</xs:annotation>
+		<xs:choice>
+			<xs:element name="customerTaxNumber" type="CustomerTaxNumberType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Belföldi adószám, amely alatt a számlán szereplő termékbeszerzés vagy szolgáltatás igénybevétele történt. Lehet csoportazonosító szám is</xs:documentation>
+					<xs:documentation xml:lang="en">Domestic tax number or group identification number, under which the purchase of goods or services is done</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="communityVatNumber" type="common:CommunityVatNumberType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Közösségi adószám</xs:documentation>
+					<xs:documentation xml:lang="en">Community tax number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="thirdStateTaxId" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Harmadik országbeli adóazonosító</xs:documentation>
+					<xs:documentation xml:lang="en">Third state tax identification number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:choice>
+	</xs:complexType>
+	<xs:complexType name="DealerCodesType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Beszállító kódok</xs:documentation>
+			<xs:documentation xml:lang="en">Dealer codes</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="dealerCode" type="common:SimpleText100NotBlankType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Beszállító kód</xs:documentation>
+					<xs:documentation xml:lang="en">Dealer code</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="DeliveryNotesType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Szállítólevél számok</xs:documentation>
+			<xs:documentation xml:lang="en">Delivery notes</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="deliveryNote" type="common:SimpleText100NotBlankType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Szállítólevél szám</xs:documentation>
+					<xs:documentation xml:lang="en">Delivery note</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="DetailedReasonType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Mentesség, kivétel részletes indokolása</xs:documentation>
+			<xs:documentation xml:lang="en">Detailed justification of exemption</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="case" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eset leírása kóddal</xs:documentation>
+					<xs:documentation xml:lang="en">Case notation with code</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="reason" type="common:SimpleText200NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eset leírása szöveggel</xs:documentation>
+					<xs:documentation xml:lang="en">Case notation with text</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="DieselOilPurchaseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Gázolaj adózottan történő beszerzésének adatai – 45/2016 (XI. 29.) NGM rendelet 75. § (1) a)</xs:documentation>
+			<xs:documentation xml:lang="en">Data of gas oil acquisition after taxation – point a), paragraph (1) of Section 75 of the NGM Decree No. 45/2016. (XI. 29.)</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="purchaseLocation" type="base:SimpleAddressType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Gázolaj beszerzés helye</xs:documentation>
+					<xs:documentation xml:lang="en">Place of purchase of the gas oil</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="purchaseDate" type="base:InvoiceDateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Gázolaj beszerzés dátuma</xs:documentation>
+					<xs:documentation xml:lang="en">Date of purchase of gas oil</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vehicleRegistrationNumber" type="common:PlateNumberType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kereskedelmi jármű forgalmi rendszáma (csak betűk és számok)</xs:documentation>
+					<xs:documentation xml:lang="en">Registration number of vehicle (letters and numbers only)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="dieselOilQuantity" type="QuantityType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Gépi bérmunka-szolgáltatás során felhasznált gázolaj mennyisége literben – Jöt. 117. § (2)</xs:documentation>
+					<xs:documentation xml:lang="en">Fordítandó helyett: Quantity of diesel oil used for contract work and machinery hire service in liter – Act LXVIII of 2016 on Excise Tax section 117 (2)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="DiscountDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Árengedmény adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Discount data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="discountDescription" type="common:SimpleText255NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az árengedmény leírása</xs:documentation>
+					<xs:documentation xml:lang="en">Description of the discount</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="discountValue" type="base:MonetaryType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tételhez tartozó árengedmény összege a számla pénznemében, ha az egységár nem tartalmazza</xs:documentation>
+					<xs:documentation xml:lang="en">Total amount of discount per item expressed in the currency of the invoice if not included in the unit price</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="discountRate" type="RateType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tételhez tartozó árengedmény aránya, ha az egységár nem tartalmazza</xs:documentation>
+					<xs:documentation xml:lang="en">Rate of discount per item expressed in the currency of the invoice if not included in the unit price</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="EkaerIdsType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">EKÁER azonosító(k)</xs:documentation>
+			<xs:documentation xml:lang="en">EKAER ID-s</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="ekaerId" type="EkaerIdType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">EKÁER azonosító</xs:documentation>
+					<xs:documentation xml:lang="en">EKAER numbers; EKAER stands for Electronic Trade and Transport Control System</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="FiscalRepresentativeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A pénzügyi képviselő adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Fiscal representative data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="fiscalRepresentativeTaxNumber" type="base:TaxNumberType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A pénzügyi képviselő adószáma</xs:documentation>
+					<xs:documentation xml:lang="en">Tax number of the fiscal representative</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="fiscalRepresentativeName" type="common:SimpleText512NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A pénzügyi képviselő neve</xs:documentation>
+					<xs:documentation xml:lang="en">Name of the fiscal representative</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="fiscalRepresentativeAddress" type="base:AddressType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Pénzügyi képviselő címe</xs:documentation>
+					<xs:documentation xml:lang="en">Address of the fiscal representative</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="fiscalRepresentativeBankAccountNumber" type="common:BankAccountNumberType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Pénzügyi képviselő által a számla kibocsátó (eladó) számára megnyitott bankszámla bankszámlaszáma</xs:documentation>
+					<xs:documentation xml:lang="en">Bank account number opened by the fiscal representative for the issuer of the invoice (supplier)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="GeneralLedgerAccountNumbersType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Főkönyvi számlaszámok</xs:documentation>
+			<xs:documentation xml:lang="en">General ledger account numbers</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="generalLedgerAccountNumber" type="common:SimpleText100NotBlankType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Főkönyvi számlaszám</xs:documentation>
+					<xs:documentation xml:lang="en">General ledger account number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="GlnNumbersType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Globális helyazonosító számok</xs:documentation>
+			<xs:documentation xml:lang="en">Global location numbers</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="glnNumber" type="common:SimpleText100NotBlankType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Globális helyazonosító szám</xs:documentation>
+					<xs:documentation xml:lang="en">Global location number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceDetailType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számla részletező adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice detail data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="invoiceCategory" type="base:InvoiceCategoryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla típusa, módosító okirat esetén az eredeti számla típusa</xs:documentation>
+					<xs:documentation xml:lang="en">Type of invoice. In case of modification document the type of original invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceDeliveryDate" type="base:InvoiceDateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Teljesítés dátuma (ha nem szerepel a számlán, akkor azonos a számla keltével) - ÁFA tv. 169. § g)</xs:documentation>
+					<xs:documentation xml:lang="en">Delivery date (if this field does not exist on the invoice, the date of the invoice should be considered as such) - section 169 (g) of the VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceDeliveryPeriodStart" type="base:InvoiceDateType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Amennyiben a számla egy időszakra vonatkozik, akkor az időszak első napja</xs:documentation>
+					<xs:documentation xml:lang="en">The first day of the delivery, if the invoice delivery is a period</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceDeliveryPeriodEnd" type="base:InvoiceDateType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Amennyiben a számla egy időszakra vonatkozik, akkor az időszak utolsó napja</xs:documentation>
+					<xs:documentation xml:lang="en">The last day of the delivery, if the invoice delivery is a period</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceAccountingDeliveryDate" type="base:InvoiceDateType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számviteli teljesítés dátuma. Időszak esetén az időszak utolsó napja</xs:documentation>
+					<xs:documentation xml:lang="en">Date of accounting accomplishment. In the event of a period, the last day of the period</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="periodicalSettlement" type="xs:boolean" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Annak jelzése, ha a felek a termékértékesítés, szolgáltatás nyújtás során időszakonkénti elszámolásban vagy fizetésben állapodnak meg, vagy a termékértékesítés, szolgáltatás nyújtás ellenértékét meghatározott időpontra állapítják meg.</xs:documentation>
+					<xs:documentation xml:lang="en">Indicates where by agreement of the parties it gives rise to successive statements of account or successive payments relating to the supply of goods, or the supply of services, or if the consideration agreed upon for such goods and/or services applies to specific periods.</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="smallBusinessIndicator" type="xs:boolean" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kisadózó jelzése</xs:documentation>
+					<xs:documentation xml:lang="en">Marking of low tax-bracket enterprise</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="currencyCode" type="common:CurrencyType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla pénzneme az ISO 4217 szabvány szerint</xs:documentation>
+					<xs:documentation xml:lang="en">ISO 4217 currency code on the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="exchangeRate" type="ExchangeRateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">HUF-tól különböző pénznem esetén az alkalmazott árfolyam: egy egység értéke HUF-ban</xs:documentation>
+					<xs:documentation xml:lang="en">In case any currency is used other than HUF, the applied exchange rate should be mentioned: 1 unit of the foreign currency expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="utilitySettlementIndicator" type="xs:boolean" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Közmű elszámoló számla jelölése (2013.évi CLXXXVIII törvény szerinti elszámoló számla)</xs:documentation>
+					<xs:documentation xml:lang="en">Marking the fact of utility settlement invoice (invoice according to Act CLXXXVIII of 2013)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="selfBillingIndicator" type="xs:boolean" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Önszámlázás jelölése (önszámlázás esetén true)</xs:documentation>
+					<xs:documentation xml:lang="en">Marking the fact of self-billing (in the case of self-billing the value is true)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="paymentMethod" type="base:PaymentMethodType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Fizetés módja</xs:documentation>
+					<xs:documentation xml:lang="en">Method of payment</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="paymentDate" type="base:InvoiceDateType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Fizetési határidő</xs:documentation>
+					<xs:documentation xml:lang="en">Deadline for payment</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="cashAccountingIndicator" type="xs:boolean" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Pénzforgalmi elszámolás jelölése, ha az szerepel a számlán - ÁFA tv. 169. § h). Értéke true pénzforgalmi elszámolás esetén</xs:documentation>
+					<xs:documentation xml:lang="en">Marking the fact of cash accounting if this is indicated on the invoice - section 169 (h) of the VAT law. The value is true in case of cash accounting</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceAppearance" type="base:InvoiceAppearanceType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla vagy módosító okirat megjelenési formája</xs:documentation>
+					<xs:documentation xml:lang="en">Form of appearance of the invoice or modification document</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="conventionalInvoiceInfo" type="ConventionalInvoiceInfoType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlafeldolgozást segítő, egyezményesen nevesített egyéb adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Other conventionally named data to assist in invoice processing</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="additionalInvoiceData" type="AdditionalDataType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlára vonatkozó egyéb adat</xs:documentation>
+					<xs:documentation xml:lang="en">Other data in relation to the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számla adatszolgáltatás adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice exchange data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="invoiceNumber" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla vagy módosító okirat sorszáma - ÁFA tv. 169. § b) vagy 170. § (1) bek. b) pont</xs:documentation>
+					<xs:documentation xml:lang="en">Sequential number of the original invoice or modification document - section 169 (b) or section 170 (1) b) of the VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceIssueDate" type="base:InvoiceDateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla vagy módosító okirat kelte - ÁFA tv. 169. § a), ÁFA tv. 170. § (1) bek. a)</xs:documentation>
+					<xs:documentation xml:lang="en">Date of issue of the invoice or the modification document - section 169 (a) of the VAT law, section 170 (1) a) of the VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="completenessIndicator" type="xs:boolean">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Jelöli, ha az adatszolgáltatás maga a számla (a számlán nem szerepel több adat)</xs:documentation>
+					<xs:documentation xml:lang="en">Indicates whether the data exchange is identical with the invoice (the invoice does not contain any more data)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceMain" type="InvoiceMainType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számlaadatok leírására szolgáló közös típus</xs:documentation>
+					<xs:documentation xml:lang="en">A common type to describe invoice information</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceHeadType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számla fejléc adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Data in header of invoice</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="supplierInfo" type="SupplierInfoType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla kibocsátó (eladó) adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Data related to the issuer of the invoice (supplier)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="customerInfo" type="CustomerInfoType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Vevő adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Data related to the customer</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="fiscalRepresentativeInfo" type="FiscalRepresentativeType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Pénzügyi képviselő adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Data related to the fiscal representative</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceDetail" type="InvoiceDetailType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla részletező adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Invoice detail adata</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceMainType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számlaadatok leírására szolgáló közös típus</xs:documentation>
+			<xs:documentation xml:lang="en">A common type to describe invoice information</xs:documentation>
+		</xs:annotation>
+		<xs:choice>
+			<xs:element name="invoice" type="InvoiceType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egy számla vagy módosító okirat adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Data of a single invoice or modification document</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="batchInvoice" type="BatchInvoiceType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kötegelt módosító okirat adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Data of a batch of modification documents</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:choice>
+	</xs:complexType>
+	<xs:complexType name="InvoiceReferenceType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A módosítás vagy érvénytelenítés hivatkozási adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Modification or cancellation reference data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="originalInvoiceNumber" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eredeti számla sorszáma, melyre a módosítás vonatkozik  - ÁFA tv. 170. § (1) c)</xs:documentation>
+					<xs:documentation xml:lang="en">Sequence number of the original invoice, on which the modification occurs - section 170 (1) c) of the VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="modifyWithoutMaster" type="xs:boolean">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Annak jelzése, hogy a módosítás olyan alapszámlára hivatkozik, amelyről nem történt és nem is fog történni adatszolgáltatás</xs:documentation>
+					<xs:documentation xml:lang="en">Indicates whether the modification references to an original invoice which is not and will not be exchanged</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="modificationIndex" type="base:InvoiceUnboundedIndexType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlára vonatkozó módosító okirat egyedi sorszáma</xs:documentation>
+					<xs:documentation xml:lang="en">The unique sequence number referring to the original invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="InvoiceType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Egy számla vagy módosító okirat adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Data of a single invoice or modification document</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="invoiceReference" type="InvoiceReferenceType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A módosítás vagy érvénytelenítés adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Modification or cancellation data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceHead" type="InvoiceHeadType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla egészét jellemző adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Data concerning the whole invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceLines" type="LinesType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlán szereplő tételek adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Product/service data appearing on the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="productFeeSummary" type="ProductFeeSummaryType" minOccurs="0" maxOccurs="2">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Termékdíjjal kapcsolatos összesítő adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Summary data of product charges</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceSummary" type="SummaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az ÁFA törvény szerinti összesítő adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Summary data according to VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ItemNumbersType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Cikkszámok</xs:documentation>
+			<xs:documentation xml:lang="en">Item numbers</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="itemNumber" type="common:SimpleText100NotBlankType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Cikkszám</xs:documentation>
+					<xs:documentation xml:lang="en">Item number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="LineAmountsNormalType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Normál vagy gyűjtő számla esetén kitöltendő tétel érték adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Item value data to be completed in case of normal or aggregate invoice</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="lineNetAmountData" type="LineNetAmountDataType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tétel nettó adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Line net data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineVatRate" type="VatRateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adómérték vagy adómentesség jelölése</xs:documentation>
+					<xs:documentation xml:lang="en">Tax rate or tax exemption marking</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineVatData" type="LineVatDataType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tétel ÁFA adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Line VAT data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineGrossAmountData" type="LineGrossAmountDataType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tétel bruttó adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Line gross data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="LineAmountsSimplifiedType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Egyszerűsített számla esetén kitöltendő tétel érték adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Item value data to be completed in case of simplified invoice</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="lineVatRate" type="VatRateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adómérték vagy adómentesség jelölése</xs:documentation>
+					<xs:documentation xml:lang="en">Tax rate or tax exemption marking</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineGrossAmountSimplified" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tétel bruttó értéke a számla pénznemében</xs:documentation>
+					<xs:documentation xml:lang="en">Gross amount of the item expressed in the currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineGrossAmountSimplifiedHUF" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tétel bruttó értéke forintban</xs:documentation>
+					<xs:documentation xml:lang="en">Gross amount of the item expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="LineGrossAmountDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Tétel bruttó adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Line gross data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="lineGrossAmountNormal" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tétel bruttó értéke a számla pénznemében. ÁFA tartalmú különbözeti adózás esetén az ellenérték.</xs:documentation>
+					<xs:documentation xml:lang="en">Gross amount of the item expressed in the currency of the invoice. In case of margin scheme taxation containing VAT, the amount of consideration expressed in the currency of the invoice.</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineGrossAmountNormalHUF" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tétel bruttó értéke forintban</xs:documentation>
+					<xs:documentation xml:lang="en">Gross amount of the item expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="LineModificationReferenceType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Módosításról történő adatszolgáltatás esetén a tételsor módosítás jellegének jelölése</xs:documentation>
+			<xs:documentation xml:lang="en">Marking the goal of modification of the line (in the case of data supply about changes/updates only)</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="lineNumberReference" type="base:LineNumberType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eredeti számla módosítással érintett tételének sorszáma (lineNumber). Új tétel létrehozása esetén az új tétel sorszáma, a meglévő tételsorok számozásának folytatásaként</xs:documentation>
+					<xs:documentation xml:lang="en">Line number of the original invoice, which the modification occurs with. In case of create operation the tag shall contain the new line number, as a sequential increment of the the existing lines set</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineOperation" type="LineOperationType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlatétel módosításának jellege</xs:documentation>
+					<xs:documentation xml:lang="en">Line modification type</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="LineNetAmountDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Tétel nettó adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Line net data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="lineNetAmount" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tétel nettó összege a számla pénznemében. ÁFA tartalmú különbözeti adózás esetén az ellenérték áfa összegével csökkentett értéke a számla pénznemében.</xs:documentation>
+					<xs:documentation xml:lang="en">Net amount of the item expressed in the currency of the invoice. In case of margin scheme taxation containing VAT, the amount of consideration reduced with the amount of VAT, expressed in the currency of the invoice.</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineNetAmountHUF" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tétel nettó összege forintban. ÁFA tartalmú különbözeti adózás esetén az ellenérték áfa összegével csökkentett értéke forintban.</xs:documentation>
+					<xs:documentation xml:lang="en">Net amount of the item expressed in HUF. Net amount of the item expressed in the currency of the invoice. In case of margin scheme taxation containing VAT, the amount of consideration reduced with the amount of VAT, expressed in HUF.</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="LinesType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Termék/szolgáltatás tételek</xs:documentation>
+			<xs:documentation xml:lang="en">Product / service items</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="mergedItemIndicator" type="xs:boolean">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Jelöli, ha az adatszolgáltatás méretcsökkentés miatt összevont soradatokat tartalmaz</xs:documentation>
+					<xs:documentation xml:lang="en">Indicates whether the data exchange contains merged line data due to size reduction</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="line" type="LineType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Termék/szolgáltatás tétel</xs:documentation>
+					<xs:documentation xml:lang="en">Product / service item</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="LineType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számla tételek (termék vagy szolgáltatás) adatait tartalmazó típus</xs:documentation>
+			<xs:documentation xml:lang="en">Field type including data of invoice items (product or service)</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="lineNumber" type="base:LineNumberType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A tétel sorszáma</xs:documentation>
+					<xs:documentation xml:lang="en">Sequential number of the item</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineModificationReference" type="LineModificationReferenceType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Módosításról történő adatszolgáltatás esetén a tételsor módosítás jellegének jelölése</xs:documentation>
+					<xs:documentation xml:lang="en">Marking the goal of modification of the line (in the case of data supply about changes/updates only)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="referencesToOtherLines" type="ReferencesToOtherLinesType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Hivatkozások kapcsolódó tételekre, ha ez az ÁFA törvény alapján szükséges</xs:documentation>
+					<xs:documentation xml:lang="en">References to connected items if it is necessary according to VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="advanceData" type="AdvanceDataType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Előleghez kapcsolódó adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Advance related data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="productCodes" type="ProductCodesType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Termékkódok</xs:documentation>
+					<xs:documentation xml:lang="en">Product codes</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineExpressionIndicator" type="xs:boolean">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Értéke true, ha a tétel mennyiségi egysége természetes mértékegységben kifejezhető</xs:documentation>
+					<xs:documentation xml:lang="en">The value is true if the unit of measure of the invoice item is expressible in natural unit</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineNatureIndicator" type="LineNatureIndicatorType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adott tételsor termékértékesítés vagy szolgáltatás nyújtás jellegének jelzése</xs:documentation>
+					<xs:documentation xml:lang="en">Indication of the nature of the supply of goods or services on a given line</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineDescription" type="common:SimpleText512NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A termék vagy szolgáltatás megnevezése</xs:documentation>
+					<xs:documentation xml:lang="en">Name / description of the product or service</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="quantity" type="QuantityType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Mennyiség</xs:documentation>
+					<xs:documentation xml:lang="en">Quantity</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="unitOfMeasure" type="UnitOfMeasureType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlán szereplő mennyiségi egység kanonikus kifejezése az interfész specifikáció szerint</xs:documentation>
+					<xs:documentation xml:lang="en">Canonical representation of the unit of measure of the invoice, according to the interface specification</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="unitOfMeasureOwn" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlán szereplő mennyiségi egység literális kifejezése</xs:documentation>
+					<xs:documentation xml:lang="en">Literal unit of measure of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="unitPrice" type="QuantityType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egységár a számla pénznemében. Egyszerűsített számla esetén bruttó, egyéb esetben nettó egységár</xs:documentation>
+					<xs:documentation xml:lang="en">Unit price expressed in the currency of the invoice In the event of simplified invoices gross unit price, in other cases net unit price</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="unitPriceHUF" type="QuantityType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Egységár forintban</xs:documentation>
+					<xs:documentation xml:lang="en">Unit price expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineDiscountData" type="DiscountDataType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A tételhez tartozó árengedmény adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Discount data in relation to the item</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:choice>
+				<xs:element name="lineAmountsNormal" type="LineAmountsNormalType" minOccurs="0">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">Normál (nem egyszerűsített) számla esetén (beleértve a gyűjtőszámlát) kitöltendő tétel érték adatok.</xs:documentation>
+						<xs:documentation xml:lang="en">Item value data to be completed in case of normal (not simplified, but including aggregated) invoice</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:element name="lineAmountsSimplified" type="LineAmountsSimplifiedType" minOccurs="0">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">Egyszerűsített számla esetén kitöltendő tétel érték adatok</xs:documentation>
+						<xs:documentation xml:lang="en">Item value data to be completed in case of simplified invoice</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+			</xs:choice>
+			<xs:element name="intermediatedService" type="xs:boolean" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Értéke true ha a tétel közvetített szolgáltatás - Számviteli tv. 3.§ (4) 1</xs:documentation>
+					<xs:documentation xml:lang="en">The value is true if the item is an intermediated service - paragraph (4) 1 of the Article 3 of Accounting Act</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="aggregateInvoiceLineData" type="AggregateInvoiceLineDataType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Gyűjtő számla adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Aggregate invoice data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="newTransportMean" type="NewTransportMeanType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Új közlekedési eszköz értékesítés ÁFA tv. 89 § ill. 169 § o)</xs:documentation>
+					<xs:documentation xml:lang="en">Supply of new means of transport - section 89 § and 169 (o) of the VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="depositIndicator" type="xs:boolean" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Értéke true, ha a tétel betétdíj jellegű</xs:documentation>
+					<xs:documentation xml:lang="en">The value is true if the item is bottle/container deposit</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="obligatedForProductFee" type="xs:boolean" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Értéke true ha a tételt termékdíj fizetési kötelezettség terheli</xs:documentation>
+					<xs:documentation xml:lang="en">The value is true if the item is liable to product fee</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="GPCExcise" type="base:MonetaryType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Földgáz, villamos energia, szén jövedéki adója forintban - Jöt. 118. § (2)</xs:documentation>
+					<xs:documentation xml:lang="en">Excise duty on natural gas, electricity and coal in Hungarian forints – paragraph (2), Section 118 of the Act on Excise Duties</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="dieselOilPurchase" type="DieselOilPurchaseType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Gázolaj adózottan történő beszerzésének adatai – 45/2016 (XI. 29.) NGM rendelet 75. § (1) a)</xs:documentation>
+					<xs:documentation xml:lang="en">Data of gas oil acquisition after taxation – point a), paragraph (1) of Section 75 of the NGM Decree No. 45/2016. (XI. 29.)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="netaDeclaration" type="xs:boolean" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Értéke true, ha a Neta tv-ben meghatározott adókötelezettség az adó alanyát terheli. 2011. évi CIII. tv. 3.§(2)</xs:documentation>
+					<xs:documentation xml:lang="en">Value is true, if the taxable person is liable for tax obligation determined in the Act on Public Health Product Tax (Neta tv.). Paragraph (2), Section 3 of the Act CIII of 2011</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="productFeeClause" type="ProductFeeClauseType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A környezetvédelmi termékdíjról szóló 2011. évi LXXXV. tv. szerinti, tételre vonatkozó záradékok</xs:documentation>
+					<xs:documentation xml:lang="en">Clauses according to the Act LXXXV of 2011 on Environmental Protection Product Fee (related to the item)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineProductFeeContent" type="ProductFeeDataType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A tétel termékdíj tartalmára vonatkozó adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Data on the content of the line's product charge</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="conventionalLineInfo" type="ConventionalInvoiceInfoType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számlafeldolgozást segítő, egyezményesen nevesített egyéb adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Other conventionally named data to assist in invoice processing</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="additionalLineData" type="AdditionalDataType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A termék/szolgáltatás tételhez kapcsolódó, további adat</xs:documentation>
+					<xs:documentation xml:lang="en">Other data in relation to the product / service item</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="LineVatDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Tétel ÁFA adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Line VAT data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="lineVatAmount" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tétel ÁFA összege a számla pénznemében</xs:documentation>
+					<xs:documentation xml:lang="en">VAT amount of the item expressed in the currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="lineVatAmountHUF" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Tétel ÁFA összege forintban</xs:documentation>
+					<xs:documentation xml:lang="en">VAT amount of the item expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="MaterialNumbersType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Anyagszámok</xs:documentation>
+			<xs:documentation xml:lang="en">Material numbers</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="materialNumber" type="common:SimpleText100NotBlankType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Anyagszám</xs:documentation>
+					<xs:documentation xml:lang="en">Material number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="NewTransportMeanType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Új közlekedési eszköz értékesítés ÁFA tv. 89 § ill. 169 § o)</xs:documentation>
+			<xs:documentation xml:lang="en">Supply of new means of transport - section 89 § and 169 (o) of the VAT law</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="brand" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Gyártmány/típus</xs:documentation>
+					<xs:documentation xml:lang="en">Product / type</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="serialNum" type="common:SimpleText255NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Alvázszám/gyári szám/Gyártási szám</xs:documentation>
+					<xs:documentation xml:lang="en">Chassis number / serial number / product number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="engineNum" type="common:SimpleText255NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Motorszám</xs:documentation>
+					<xs:documentation xml:lang="en">Engine number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="firstEntryIntoService" type="base:InvoiceDateType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Első forgalomba helyezés időpontja</xs:documentation>
+					<xs:documentation xml:lang="en">First entry into service</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:choice>
+				<xs:element name="vehicle" type="VehicleType">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">Szárazföldi közlekedési eszköz további adatai</xs:documentation>
+						<xs:documentation xml:lang="en">Other data in relation to motorised land vehicle</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:element name="vessel" type="VesselType">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">Vízi jármű adatai</xs:documentation>
+						<xs:documentation xml:lang="en">Data of vessel</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:element name="aircraft" type="AircraftType">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">Légi közlekedési eszköz</xs:documentation>
+						<xs:documentation xml:lang="en">Aircraft</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+			</xs:choice>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="OrderNumbersType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Megrendelésszámok</xs:documentation>
+			<xs:documentation xml:lang="en">Order numbers</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="orderNumber" type="common:SimpleText100NotBlankType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Megrendelésszám</xs:documentation>
+					<xs:documentation xml:lang="en">Order number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="PaymentEvidenceDocumentDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A termékdíj bevallását igazoló dokumentum adatai a 2011. évi LXXXV. tv. 13. § (3) szerint és a 25. § (3) szerint</xs:documentation>
+			<xs:documentation xml:lang="en">Data of the document verifying the declaration submitted on the product fee according to the Paragraph (3), Section 13 and the Paragraph (3) Section 25 of the Act LXXXV of 2011</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="evidenceDocumentNo" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla sorszáma vagy egyéb okirat azonosító száma</xs:documentation>
+					<xs:documentation xml:lang="en">Sequential number of the invoice, or other document considered as such</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="evidenceDocumentDate" type="base:InvoiceDateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Számla kelte</xs:documentation>
+					<xs:documentation xml:lang="en">Date of issue of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="obligatedName" type="common:SimpleText255NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kötelezett neve</xs:documentation>
+					<xs:documentation xml:lang="en">Name of obligator</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="obligatedAddress" type="base:AddressType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kötelezett címe</xs:documentation>
+					<xs:documentation xml:lang="en">Address of obligator</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="obligatedTaxNumber" type="base:TaxNumberType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A kötelezett adószáma</xs:documentation>
+					<xs:documentation xml:lang="en">Tax number of obligated</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ProductCodesType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Termékkódok</xs:documentation>
+			<xs:documentation xml:lang="en">Product codes</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="productCode" type="ProductCodeType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Termékkód</xs:documentation>
+					<xs:documentation xml:lang="en">Product code</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ProductCodeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Különböző termék- vagy szolgáltatáskódokat tartalmazó típus</xs:documentation>
+			<xs:documentation xml:lang="en">Field type including the different product and service codes</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="productCodeCategory" type="ProductCodeCategoryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A termékkód fajtájának (pl. VTSZ, CsK, stb.) jelölése</xs:documentation>
+					<xs:documentation xml:lang="en">The kind of product code (f. ex. VTSZ, CsK, etc.)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:choice>
+				<xs:element name="productCodeValue" type="ProductCodeValueType">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">A termékkód értéke nem saját termékkód esetén</xs:documentation>
+						<xs:documentation xml:lang="en">The value of (not own) product code</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:element name="productCodeOwnValue" type="common:SimpleText255NotBlankType">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">Saját termékkód értéke</xs:documentation>
+						<xs:documentation xml:lang="en">Own product code value</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+			</xs:choice>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ProductFeeClauseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A környezetvédelmi termékdíjról szóló 2011. évi LXXXV. tv. szerinti, tételre vonatkozó záradékok</xs:documentation>
+			<xs:documentation xml:lang="en">Clauses according to the Act LXXXV of 2011 on Environmental Protection Product Fee (related to the item)</xs:documentation>
+		</xs:annotation>
+		<xs:choice>
+			<xs:element name="productFeeTakeoverData" type="ProductFeeTakeoverDataType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A környezetvédelmi termékdíj kötelezettség átvállalásával kapcsolatos adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Data in connection with takeover of environmental protection product fee</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="customerDeclaration" type="CustomerDeclarationType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Ha az eladó a vevő nyilatkozata alapján mentesül a termékdíj megfizetése alól, akkor az érintett termékáram</xs:documentation>
+					<xs:documentation xml:lang="en">Should the supplier, based on statement given by the purchaser, be exempted from paying product fee, then the product stream affected</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:choice>
+	</xs:complexType>
+	<xs:complexType name="ProductFeeDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Termékdíj adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Product charges data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="productFeeCode" type="ProductCodeType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Termékdíj kód (Kt vagy Csk)</xs:documentation>
+					<xs:documentation xml:lang="en">Product charges code (Kt or Csk code)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="productFeeQuantity" type="QuantityType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A termékdíjjal érintett termék mennyisége</xs:documentation>
+					<xs:documentation xml:lang="en">Quantity of product, according to product charge</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="productFeeMeasuringUnit" type="ProductFeeMeasuringUnitType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A díjtétel egysége (kg vagy darab)</xs:documentation>
+					<xs:documentation xml:lang="en">Unit of the rate (kg or piece)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="productFeeRate" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A termékdíj díjtétele (HUF/egység)</xs:documentation>
+					<xs:documentation xml:lang="en">Product fee rate (HUF/unit)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="productFeeAmount" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Termékdíj összege forintban</xs:documentation>
+					<xs:documentation xml:lang="en">Amount in Hungarian forints of the product fee</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ProductFeeSummaryType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Termékdíj összegzés adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Summary of product charges</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="productFeeOperation" type="ProductFeeOperationType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Annak jelzése, hogy a termékdíj összesítés visszaigénylésre (REFUND) vagy raktárba történő beszállításra (DEPOSIT) vonatkozik</xs:documentation>
+					<xs:documentation xml:lang="en">Indicating whether the the product fee summary concerns refund or deposit</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="productFeeData" type="ProductFeeDataType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Termékdíj adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Product charges data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="productChargeSum" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Termékdíj összesen</xs:documentation>
+					<xs:documentation xml:lang="en">Aggregate product charges</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="paymentEvidenceDocumentData" type="PaymentEvidenceDocumentDataType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A termékdíj bevallását igazoló dokumentum adatai a 2011. évi LXXXV. tv. 13. § (3) szerint és a 25. § (3) szerint</xs:documentation>
+					<xs:documentation xml:lang="en">Data of the document verifying the declaration submitted on the product fee according to the Paragraph (3), Section 13 and the Paragraph (3) Section 25 of the Act LXXXV of 2011</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ProductFeeTakeoverDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A környezetvédelmi termékdíj kötelezettség átvállalásával kapcsolatos adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Data in connection with takeover of environmental protection product fee</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="takeoverReason" type="TakeoverType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az átvállalás iránya és jogszabályi alapja</xs:documentation>
+					<xs:documentation xml:lang="en">Direction and legal base of takeover</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="takeoverAmount" type="base:MonetaryType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az átvállalt termékdíj összege forintban, ha a vevő vállalja át az eladó termékdíj-kötelezettségét</xs:documentation>
+					<xs:documentation xml:lang="en">Amount in Hungarian forints of the product fee taken over if the purchaser takes over the supplier’s product fee liability</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ProjectNumbersType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Projektszámok</xs:documentation>
+			<xs:documentation xml:lang="en">Project numbers</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="projectNumber" type="common:SimpleText100NotBlankType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Projektszám</xs:documentation>
+					<xs:documentation xml:lang="en">Project number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ReferencesToOtherLinesType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Hivatkozások kapcsolódó tételekre, ha ez az ÁFA törvény alapján szükséges</xs:documentation>
+			<xs:documentation xml:lang="en">References to connected items if it is necessary according to VAT law</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="referenceToOtherLine" type="base:LineNumberType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Hivatkozások kapcsolódó tételekre, ha ez az ÁFA törvény alapján szükséges</xs:documentation>
+					<xs:documentation xml:lang="en">References to connected items if it is necessary according to VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="ShippingDatesType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Szállítási dátumok</xs:documentation>
+			<xs:documentation xml:lang="en">Shipping dates</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="shippingDate" type="common:SimpleText100NotBlankType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Szállítási dátum</xs:documentation>
+					<xs:documentation xml:lang="en">Shipping date</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="SummaryByVatRateType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">ÁFA mértékek szerinti összesítés</xs:documentation>
+			<xs:documentation xml:lang="en">Summary according to VAT rates</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="vatRate" type="VatRateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adómérték vagy adómentesség jelölése</xs:documentation>
+					<xs:documentation xml:lang="en">Marking the tax rate or the fact of tax exemption</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatRateNetData" type="VatRateNetDataType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adott adómértékhez tartozó nettó adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Net data of given tax rate</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatRateVatData" type="VatRateVatDataType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adott adómértékhez tartozó ÁFA adatok</xs:documentation>
+					<xs:documentation xml:lang="en">VAT data of given tax rate</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatRateGrossData" type="VatRateGrossDataType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adott adómértékhez tartozó bruttó adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Gross data of given tax rate</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="SummaryGrossDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A számla összesítő bruttó adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Gross data of the invoice summary</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="invoiceGrossAmount" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla bruttó összege a számla pénznemében</xs:documentation>
+					<xs:documentation xml:lang="en">Gross amount of the invoice expressed in the currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceGrossAmountHUF" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla bruttó összege forintban</xs:documentation>
+					<xs:documentation xml:lang="en">Gross amount of the invoice expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="SummaryNormalType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számla összesítés (nem egyszerűsített számla esetén)</xs:documentation>
+			<xs:documentation xml:lang="en">Calculation of invoice totals (not simplified invoice)</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="summaryByVatRate" type="SummaryByVatRateType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Összesítés ÁFA-mérték szerint</xs:documentation>
+					<xs:documentation xml:lang="en">Calculation of invoice totals per VAT rates</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceNetAmount" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla nettó összege a számla pénznemében</xs:documentation>
+					<xs:documentation xml:lang="en">Net amount of the invoice expressed in the currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceNetAmountHUF" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla nettó összege forintban</xs:documentation>
+					<xs:documentation xml:lang="en">Net amount of the invoice expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceVatAmount" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla ÁFA összege a számla pénznemében</xs:documentation>
+					<xs:documentation xml:lang="en">VAT amount of the invoice expressed in the currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="invoiceVatAmountHUF" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla ÁFA összege forintban</xs:documentation>
+					<xs:documentation xml:lang="en">VAT amount of the invoice expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="SummarySimplifiedType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Egyszerűsített számla összesítés</xs:documentation>
+			<xs:documentation xml:lang="en">Calculation of simplified invoice totals</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="vatRate" type="VatRateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adómérték vagy adómentesség jelölése</xs:documentation>
+					<xs:documentation xml:lang="en">Marking the tax rate or the fact of tax exemption</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatContentGrossAmount" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adott adótartalomhoz tartozó értékesítés vagy szolgáltatásnyújtás bruttó összege a számla pénznemében</xs:documentation>
+					<xs:documentation xml:lang="en">The gross amount of the sale or service for the given tax amount in the currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatContentGrossAmountHUF" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adott adótartalomhoz tartozó értékesítés vagy szolgáltatásnyújtás bruttó összege forintban</xs:documentation>
+					<xs:documentation xml:lang="en">The gross amount of the sale or service for the given tax amount in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="SummaryType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Számla összesítés adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Data of calculation of invoice totals</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:choice>
+				<xs:element name="summaryNormal" type="SummaryNormalType">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">Számla összesítés (nem egyszerűsített számla esetén)</xs:documentation>
+						<xs:documentation xml:lang="en">Calculation of invoice totals (not simplified invoice)</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+				<xs:element name="summarySimplified" type="SummarySimplifiedType" maxOccurs="unbounded">
+					<xs:annotation>
+						<xs:documentation xml:lang="hu">Egyszerűsített számla összesítés</xs:documentation>
+						<xs:documentation xml:lang="en">Calculation of simplified invoice totals</xs:documentation>
+					</xs:annotation>
+				</xs:element>
+			</xs:choice>
+			<xs:element name="summaryGrossData" type="SummaryGrossDataType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A számla összesítő bruttó adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Gross data of the invoice summary</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="SupplierCompanyCodesType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Az eladó vállalati kódjai</xs:documentation>
+			<xs:documentation xml:lang="en">Company codes of the supplier</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="supplierCompanyCode" type="common:SimpleText100NotBlankType" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eladó vállalati kódja</xs:documentation>
+					<xs:documentation xml:lang="en">Company code of the supplier</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="SupplierInfoType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A szállító (eladó) adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Invoice supplier (seller) data</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="supplierTaxNumber" type="base:TaxNumberType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Belföldi adószám vagy csoportazonosító szám</xs:documentation>
+					<xs:documentation xml:lang="en">Tax number or group identification number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="groupMemberTaxNumber" type="base:TaxNumberType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Csoport tag adószáma, ha a termékbeszerzés vagy szolgáltatás nyújtása csoportazonosító szám alatt történt</xs:documentation>
+					<xs:documentation xml:lang="en">Tax number of group member, when the supply of goods or services is done under group identification number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="communityVatNumber" type="common:CommunityVatNumberType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Közösségi adószám</xs:documentation>
+					<xs:documentation xml:lang="en">Community tax number</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="supplierName" type="common:SimpleText512NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eladó (szállító) neve</xs:documentation>
+					<xs:documentation xml:lang="en">Name of the seller (supplier)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="supplierAddress" type="base:AddressType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eladó (szállító) címe</xs:documentation>
+					<xs:documentation xml:lang="en">Address of the seller (supplier)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="supplierBankAccountNumber" type="common:BankAccountNumberType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eladó (szállító) bankszámlaszáma</xs:documentation>
+					<xs:documentation xml:lang="en">Bank account number of the seller (supplier)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="individualExemption" type="xs:boolean" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Értéke true, amennyiben az eladó (szállító) alanyi ÁFA mentes</xs:documentation>
+					<xs:documentation xml:lang="en">Value is true if the seller (supplier) is individually exempted from VAT</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="exciseLicenceNum" type="common:SimpleText50NotBlankType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eladó adóraktári engedélyének vagy jövedéki engedélyének száma (2016. évi LXVIII. tv.)</xs:documentation>
+					<xs:documentation xml:lang="en">Number of supplier’s tax warehouse license or excise license (Act LXVIII of 2016)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="VatAmountMismatchType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Adóalap és felszámított adó eltérésének adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Data of mismatching tax base and levied tax</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="vatRate" type="RateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adómérték, adótartalom</xs:documentation>
+					<xs:documentation xml:lang="en">VAT rate, VAT content</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="case" type="common:SimpleText50NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az eset leírása kóddal</xs:documentation>
+					<xs:documentation xml:lang="en">Case notation with code</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="VatRateGrossDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Adott adómértékhez tartozó bruttó adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Gross data of given tax rate</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="vatRateGrossAmount" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adott adómértékhez tartozó értékesítés vagy szolgáltatásnyújtás bruttó összege a számla pénznemében</xs:documentation>
+					<xs:documentation xml:lang="en">Gross amount of sales or service delivery under a given tax rate expressed in the currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatRateGrossAmountHUF" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adott adómértékhez tartozó értékesítés vagy szolgáltatásnyújtás bruttó összege forintban</xs:documentation>
+					<xs:documentation xml:lang="en">Gross amount of sales or service delivery under a given tax rate expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="VatRateNetDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Adott adómértékhez tartozó nettó adatok</xs:documentation>
+			<xs:documentation xml:lang="en">Net data of given tax rate</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="vatRateNetAmount" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adott adómértékhez tartozó értékesítés vagy szolgáltatásnyújtás nettó összege a számla pénznemében</xs:documentation>
+					<xs:documentation xml:lang="en">Net amount of sales or service delivery under a given tax rate expressed in the currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatRateNetAmountHUF" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adott adómértékhez tartozó értékesítés vagy szolgáltatásnyújtás nettó összege forintban</xs:documentation>
+					<xs:documentation xml:lang="en">Net amount of sales or service delivery under a given tax rate expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="VatRateType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Az adómérték vagy az adómentes értékesítés jelölése</xs:documentation>
+			<xs:documentation xml:lang="en">Marking tax rate or tax exempt supply</xs:documentation>
+		</xs:annotation>
+		<xs:choice>
+			<xs:element name="vatPercentage" type="RateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az alkalmazott adó mértéke - ÁFA tv. 169. § j)</xs:documentation>
+					<xs:documentation xml:lang="en">Applied tax rate - section 169 (j) of the VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatContent" type="RateType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">ÁFA tartalom egyszerűsített számla esetén</xs:documentation>
+					<xs:documentation xml:lang="en">VAT content in case of simplified invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatExemption" type="DetailedReasonType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adómentesség jelölése - ÁFA tv. 169. § m)</xs:documentation>
+					<xs:documentation xml:lang="en">Marking tax exemption -  section 169 (m) of the VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatOutOfScope" type="DetailedReasonType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az ÁFA törvény hatályán kívüli</xs:documentation>
+					<xs:documentation xml:lang="en">Out of scope of the VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatDomesticReverseCharge" type="xs:boolean" fixed="true">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A belföldi fordított adózás jelölése - ÁFA tv. 142. §</xs:documentation>
+					<xs:documentation xml:lang="en">Marking the national is reverse charge taxation - section 142 of the VAT law</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="marginSchemeIndicator" type="MarginSchemeType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Különbözet szerinti szabályozás jelölése - ÁFA tv. 169. § p) q)</xs:documentation>
+					<xs:documentation xml:lang="en">Marking the margin-scheme taxation as per section 169 (p)(q)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatAmountMismatch" type="VatAmountMismatchType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Adóalap és felszámított adó eltérésének esetei</xs:documentation>
+					<xs:documentation xml:lang="en">Different cases of mismatching tax base and levied tax</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="noVatCharge" type="xs:boolean" fixed="true">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Nincs felszámított áfa a 17. § alapján</xs:documentation>
+					<xs:documentation xml:lang="en">No VAT charged under Section 17</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:choice>
+	</xs:complexType>
+	<xs:complexType name="VatRateVatDataType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Adott adómértékhez tartozó ÁFA adatok</xs:documentation>
+			<xs:documentation xml:lang="en">VAT data of given tax rate</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="vatRateVatAmount" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adott adómértékhez tartozó értékesítés vagy szolgáltatásnyújtás ÁFA összege a számla pénznemében</xs:documentation>
+					<xs:documentation xml:lang="en">VAT amount of sales or service delivery under a given tax rate expressed in the currency of the invoice</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="vatRateVatAmountHUF" type="base:MonetaryType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Az adott adómértékhez tartozó értékesítés vagy szolgáltatásnyújtás ÁFA összege forintban</xs:documentation>
+					<xs:documentation xml:lang="en">VAT amount of sales or service delivery under a given tax rate expressed in HUF</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="VehicleType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Szárazföldi közlekedési eszköz további adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Other data in relation to motorised land vehicle</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="engineCapacity" type="QuantityType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Hengerűrtartalom köbcentiméterben</xs:documentation>
+					<xs:documentation xml:lang="en">Engine capacity in cubic centimetre</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="enginePower" type="QuantityType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Teljesítmény kW-ban</xs:documentation>
+					<xs:documentation xml:lang="en">Engine power in kW</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="kms" type="QuantityType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Futott kilométerek száma</xs:documentation>
+					<xs:documentation xml:lang="en">Travelled distance in km</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="VesselType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Vízi jármű adatai</xs:documentation>
+			<xs:documentation xml:lang="en">Data of vessel</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="length" type="QuantityType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Hajó hossza méterben</xs:documentation>
+					<xs:documentation xml:lang="en">Length of hull in metre</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="activityReferred" type="xs:boolean">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Értéke true, ha a jármű az ÁFA tv. 259.§ 25. b) szerinti kivétel alá tartozik</xs:documentation>
+					<xs:documentation xml:lang="en">The value is true if the means of transport is exempt from VAT as per section 259 [25] (b)</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="sailedHours" type="QuantityType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Hajózott órák száma</xs:documentation>
+					<xs:documentation xml:lang="en">Number of sailed hours</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:element name="InvoiceData">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">XML root element, számla vagy módosítás adatait leíró típus, amelyet BASE64 kódoltan tartalmaz az invoiceApi sémaleíró invoiceData elementje</xs:documentation>
+			<xs:documentation xml:lang="en">XML root element, invoice or modification data type in BASE64 encoding, equivalent with the invoiceApi schema definition's invoiceData element</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="InvoiceDataType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>

+ 217 - 0
custom/nav/lib/NavOnlineInvoice/xsd/serviceMetrics.xsd

@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+# Project: Magyar Online Számla Rendszer serviceMetrics XML séma
+# Author: NAV Informatikai Intézet
+
+# Version: v3.0 2020/07/31
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.nav.gov.hu/OSA/3.0/metrics" xmlns:common="http://schemas.nav.gov.hu/NTCA/1.0/common" xmlns:base="http://schemas.nav.gov.hu/OSA/3.0/base" targetNamespace="http://schemas.nav.gov.hu/OSA/3.0/metrics" elementFormDefault="qualified" attributeFormDefault="unqualified">
+	<xs:import namespace="http://schemas.nav.gov.hu/NTCA/1.0/common"/>
+	<xs:import namespace="http://schemas.nav.gov.hu/OSA/3.0/base"/>
+	<xs:simpleType name="LanguageType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Nyelv megnevezés típus</xs:documentation>
+			<xs:documentation xml:lang="en">Language naming type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType2">
+			<xs:enumeration value="HU">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Magyar nyelv</xs:documentation>
+					<xs:documentation xml:lang="en">Hungarian language</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="EN">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Angol nyelv</xs:documentation>
+					<xs:documentation xml:lang="en">English language</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="DE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Német nyelv</xs:documentation>
+					<xs:documentation xml:lang="en">German language</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:simpleType name="MetricTypeType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Metrika típusának leírója</xs:documentation>
+			<xs:documentation xml:lang="en">Metric's descriptor type</xs:documentation>
+		</xs:annotation>
+		<xs:restriction base="common:AtomicStringType15">
+			<xs:enumeration value="COUNTER">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Növekmény típusú metrika</xs:documentation>
+					<xs:documentation xml:lang="en">Incremental type metric</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="GAUGE">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Pillanatkép típusú metrika</xs:documentation>
+					<xs:documentation xml:lang="en">Snapshot type metric</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="HISTOGRAM">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Kvantilis típusú, eloszlást mérő metrika</xs:documentation>
+					<xs:documentation xml:lang="en">Quantile type, dispersion sampler metric</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+			<xs:enumeration value="SUMMARY">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Összegző érték típusú metrika</xs:documentation>
+					<xs:documentation xml:lang="en">Sum value type metric</xs:documentation>
+				</xs:annotation>
+			</xs:enumeration>
+		</xs:restriction>
+	</xs:simpleType>
+	<xs:complexType name="MetricDefinitionType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Metrika definíció típus</xs:documentation>
+			<xs:documentation xml:lang="en">Metric definition type</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="metricName" type="common:SimpleText200NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Metrika neve</xs:documentation>
+					<xs:documentation xml:lang="en">Metric's name</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="metricType" type="MetricTypeType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Metrika típusa</xs:documentation>
+					<xs:documentation xml:lang="hu">Metric's type</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="metricDescription" type="MetricDescriptionType" minOccurs="3" maxOccurs="3">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Metrika leírása</xs:documentation>
+					<xs:documentation xml:lang="en">Metric's description</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="MetricDescriptionType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Metrika leírás típus</xs:documentation>
+			<xs:documentation xml:lang="en">Metric description type</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="language" type="LanguageType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Nyelv megnevezés</xs:documentation>
+					<xs:documentation xml:lang="en">Language naming</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="localizedDescription" type="common:SimpleText512NotBlankType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Lokalizált leírás</xs:documentation>
+					<xs:documentation xml:lang="en">Localized description</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="MetricType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Metrika típus</xs:documentation>
+			<xs:documentation xml:lang="en">Metric data type</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="metricDefinition" type="MetricDefinitionType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Metrika definíció</xs:documentation>
+					<xs:documentation xml:lang="en">Metric definition</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="metricValues" type="MetricValueType" minOccurs="0" maxOccurs="60">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Metrika értékek</xs:documentation>
+					<xs:documentation xml:lang="en">Metric values</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="MetricValueType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">Metrika érték típus</xs:documentation>
+			<xs:documentation xml:lang="en">Metric value type</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="value" type="common:GenericDecimalType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Metrika értéke</xs:documentation>
+					<xs:documentation xml:lang="en">Metric's value</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="timestamp" type="base:InvoiceTimestampType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Metrika értékének időpontja UTC időben</xs:documentation>
+					<xs:documentation xml:lang="en">Time of metric value in UTC time</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="QueryServiceMetricsListResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A GET /queryServiceMetrics/list REST operáció válasz típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Response type of the GET /queryServiceMetrics/list REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="metricDefinition" type="MetricDefinitionType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Metrika definíciói</xs:documentation>
+					<xs:documentation xml:lang="en">Metric definitions</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:complexType name="QueryServiceMetricsResponseType">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A GET /queryServiceMetrics REST operáció válasz típusa</xs:documentation>
+			<xs:documentation xml:lang="en">Response type of the GET /queryServiceMetrics REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:sequence>
+			<xs:element name="result" type="common:BasicResultType">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Alap válaszeredmény adatok</xs:documentation>
+					<xs:documentation xml:lang="en">Basic result data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="metricsLastUpdateTime" type="base:InvoiceTimestampType" minOccurs="0">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">A metrikák utolsó frissítésének időpontja UTC időben</xs:documentation>
+					<xs:documentation xml:lang="en">Last update time of metrics in UTC time</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+			<xs:element name="metric" type="MetricType" minOccurs="0" maxOccurs="unbounded">
+				<xs:annotation>
+					<xs:documentation xml:lang="hu">Metrika adatai</xs:documentation>
+					<xs:documentation xml:lang="en">Metric data</xs:documentation>
+				</xs:annotation>
+			</xs:element>
+		</xs:sequence>
+	</xs:complexType>
+	<xs:element name="QueryServiceMetricsListResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A GET /queryServiceMetrics/list REST operáció válaszának root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Response root element of the GET /queryServiceMetrics/list REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryServiceMetricsListResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="QueryServiceMetricsResponse">
+		<xs:annotation>
+			<xs:documentation xml:lang="hu">A GET /queryServiceMetrics REST operáció válaszának root elementje</xs:documentation>
+			<xs:documentation xml:lang="en">Response root element of the GET /queryServiceMetrics REST operation</xs:documentation>
+		</xs:annotation>
+		<xs:complexType>
+			<xs:complexContent>
+				<xs:extension base="QueryServiceMetricsResponseType"/>
+			</xs:complexContent>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>

+ 68 - 0
custom/nav/lib/nav.lib.php

@@ -0,0 +1,68 @@
+<?php
+/* Copyright (C) 2022 Deák Ferenc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file    nav/lib/nav.lib.php
+ * \ingroup nav
+ * \brief   Library files with common functions for Nav
+ */
+
+/**
+ * Prepare admin pages header
+ *
+ * @return array
+ */
+function navAdminPrepareHead()
+{
+	global $langs, $conf;
+
+	$langs->load("nav@nav");
+
+	$h = 0;
+	$head = array();
+
+	$head[$h][0] = dol_buildpath("/nav/admin/setup.php", 1);
+	$head[$h][1] = $langs->trans("Settings");
+	$head[$h][2] = 'settings';
+	$h++;
+
+	/*
+	$head[$h][0] = dol_buildpath("/nav/admin/myobject_extrafields.php", 1);
+	$head[$h][1] = $langs->trans("ExtraFields");
+	$head[$h][2] = 'myobject_extrafields';
+	$h++;
+	*/
+
+	$head[$h][0] = dol_buildpath("/nav/admin/about.php", 1);
+	$head[$h][1] = $langs->trans("About");
+	$head[$h][2] = 'about';
+	$h++;
+
+	// Show more tabs from modules
+	// Entries must be declared in modules descriptor with line
+	//$this->tabs = array(
+	//	'entity:+tabname:Title:@nav:/nav/mypage.php?id=__ID__'
+	//); // to add new tab
+	//$this->tabs = array(
+	//	'entity:-tabname:Title:@nav:/nav/mypage.php?id=__ID__'
+	//); // to remove a tab
+	complete_head_from_modules($conf, $langs, null, $head, $h, 'nav@nav');
+
+	complete_head_from_modules($conf, $langs, null, $head, $h, 'nav@nav', 'remove');
+
+	return $head;
+}

+ 110 - 0
custom/nav/lib/nav_action.lib.php

@@ -0,0 +1,110 @@
+<?php
+/* Copyright (C) 2023 Deák Ferenc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file    lib/nav_action.lib.php
+ * \ingroup nav
+ * \brief   Library files with common functions for Action
+ */
+
+/**
+ * Prepare array of tabs for Action
+ *
+ * @param	Action	$object		Action
+ * @return 	array					Array of tabs
+ */
+function actionPrepareHead($object)
+{
+	global $db, $langs, $conf;
+
+	$langs->load("nav@nav");
+
+	$showtabofpagecontact = 1;
+	$showtabofpagenote = 1;
+	$showtabofpagedocument = 1;
+	$showtabofpageagenda = 1;
+
+	$h = 0;
+	$head = array();
+
+	$head[$h][0] = dol_buildpath("/nav/action_card.php", 1).'?id='.$object->id;
+	$head[$h][1] = $langs->trans("Card");
+	$head[$h][2] = 'card';
+	$h++;
+
+	if ($showtabofpagecontact) {
+		$head[$h][0] = dol_buildpath("/nav/action_contact.php", 1).'?id='.$object->id;
+		$head[$h][1] = $langs->trans("Contacts");
+		$head[$h][2] = 'contact';
+		$h++;
+	}
+
+	if ($showtabofpagenote) {
+		if (isset($object->fields['note_public']) || isset($object->fields['note_private'])) {
+			$nbNote = 0;
+			if (!empty($object->note_private)) {
+				$nbNote++;
+			}
+			if (!empty($object->note_public)) {
+				$nbNote++;
+			}
+			$head[$h][0] = dol_buildpath('/nav/action_note.php', 1).'?id='.$object->id;
+			$head[$h][1] = $langs->trans('Notes');
+			if ($nbNote > 0) {
+				$head[$h][1] .= (empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER) ? '<span class="badge marginleftonlyshort">'.$nbNote.'</span>' : '');
+			}
+			$head[$h][2] = 'note';
+			$h++;
+		}
+	}
+
+	if ($showtabofpagedocument) {
+		require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
+		require_once DOL_DOCUMENT_ROOT.'/core/class/link.class.php';
+		$upload_dir = $conf->nav->dir_output."/action/".dol_sanitizeFileName($object->ref);
+		$nbFiles = count(dol_dir_list($upload_dir, 'files', 0, '', '(\.meta|_preview.*\.png)$'));
+		$nbLinks = Link::count($db, $object->element, $object->id);
+		$head[$h][0] = dol_buildpath("/nav/action_document.php", 1).'?id='.$object->id;
+		$head[$h][1] = $langs->trans('Documents');
+		if (($nbFiles + $nbLinks) > 0) {
+			$head[$h][1] .= '<span class="badge marginleftonlyshort">'.($nbFiles + $nbLinks).'</span>';
+		}
+		$head[$h][2] = 'document';
+		$h++;
+	}
+
+	if ($showtabofpageagenda) {
+		$head[$h][0] = dol_buildpath("/nav/action_agenda.php", 1).'?id='.$object->id;
+		$head[$h][1] = $langs->trans("Events");
+		$head[$h][2] = 'agenda';
+		$h++;
+	}
+
+	// Show more tabs from modules
+	// Entries must be declared in modules descriptor with line
+	//$this->tabs = array(
+	//	'entity:+tabname:Title:@nav:/nav/mypage.php?id=__ID__'
+	//); // to add new tab
+	//$this->tabs = array(
+	//	'entity:-tabname:Title:@nav:/nav/mypage.php?id=__ID__'
+	//); // to remove a tab
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'action@nav');
+
+	complete_head_from_modules($conf, $langs, $object, $head, $h, 'action@nav', 'remove');
+
+	return $head;
+}

+ 3 - 0
custom/nav/modulebuilder.txt

@@ -0,0 +1,3 @@
+# DO NOT DELETE THIS FILE MANUALLY
+# File to flag module built using official module template.
+# When this file is present into a module directory, you can edit it with the module builder tool. 

+ 262 - 0
custom/nav/navindex.php

@@ -0,0 +1,262 @@
+<?php
+/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
+ * Copyright (C) 2004-2015 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2005-2012 Regis Houssin        <regis.houssin@inodbox.com>
+ * Copyright (C) 2015      Jean-François Ferry	<jfefe@aternatik.fr>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ *	\file       nav/navindex.php
+ *	\ingroup    nav
+ *	\brief      Home page of nav top menu
+ */
+
+// Load Dolibarr environment
+$res = 0;
+// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
+if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
+	$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
+}
+// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
+$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
+while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
+	$i--; $j--;
+}
+if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
+	$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
+}
+if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
+	$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
+}
+// Try main.inc.php using relative path
+if (!$res && file_exists("../main.inc.php")) {
+	$res = @include "../main.inc.php";
+}
+if (!$res && file_exists("../../main.inc.php")) {
+	$res = @include "../../main.inc.php";
+}
+if (!$res && file_exists("../../../main.inc.php")) {
+	$res = @include "../../../main.inc.php";
+}
+if (!$res) {
+	die("Include of main fails");
+}
+
+require_once DOL_DOCUMENT_ROOT.'/core/class/html.formfile.class.php';
+require_once DOL_DOCUMENT_ROOT.'/custom/nav/class/nav.class.php';
+
+// Load translation files required by the page
+$langs->loadLangs(array("nav@nav"));
+
+$action = GETPOST('action', 'aZ09');
+
+
+// Security check
+// if (! $user->rights->nav->myobject->read) {
+// 	accessforbidden();
+// }
+$socid = GETPOST('socid', 'int');
+if (isset($user->socid) && $user->socid > 0) {
+	$action = '';
+	$socid = $user->socid;
+}
+
+$max = 5;
+$now = dol_now();
+
+
+/*
+ * Actions
+ */
+
+$nav = new Nav($db);
+if(isset($_GET['que'])){
+	try {
+		$insDate = [
+			"dateTimeFrom" => "2022-11-01T06:00:00Z",
+			"dateTimeTo" => "2022-12-01T18:00:00Z",
+		];
+		$page = 1;
+
+		$transactionListResult = $nav->NavReporter->queryTransactionList($insDate, $page);
+
+		print "Result:\n";
+		print_r($transactionListResult);
+		exit;
+	} catch(Exception $ex) {
+		print get_class($ex) . ": " . $ex->getMessage();
+	}
+}
+// $number = '66333775';
+$number = '26646970';
+$nav->vat($number);
+// $nav->test();
+exit;
+/*
+ * View
+ */
+
+$form = new Form($db);
+$formfile = new FormFile($db);
+
+llxHeader("", $langs->trans("NavArea"));
+
+print load_fiche_titre($langs->trans("NavArea"), '', 'nav.png@nav');
+
+print '<div class="fichecenter"><div class="fichethirdleft">';
+
+
+/* BEGIN MODULEBUILDER DRAFT MYOBJECT
+// Draft MyObject
+if (! empty($conf->nav->enabled) && $user->rights->nav->read)
+{
+	$langs->load("orders");
+
+	$sql = "SELECT c.rowid, c.ref, c.ref_client, c.total_ht, c.tva as total_tva, c.total_ttc, s.rowid as socid, s.nom as name, s.client, s.canvas";
+	$sql.= ", s.code_client";
+	$sql.= " FROM ".MAIN_DB_PREFIX."commande as c";
+	$sql.= ", ".MAIN_DB_PREFIX."societe as s";
+	if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+	$sql.= " WHERE c.fk_soc = s.rowid";
+	$sql.= " AND c.fk_statut = 0";
+	$sql.= " AND c.entity IN (".getEntity('commande').")";
+	if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
+	if ($socid)	$sql.= " AND c.fk_soc = ".((int) $socid);
+
+	$resql = $db->query($sql);
+	if ($resql)
+	{
+		$total = 0;
+		$num = $db->num_rows($resql);
+
+		print '<table class="noborder centpercent">';
+		print '<tr class="liste_titre">';
+		print '<th colspan="3">'.$langs->trans("DraftMyObjects").($num?'<span class="badge marginleftonlyshort">'.$num.'</span>':'').'</th></tr>';
+
+		$var = true;
+		if ($num > 0)
+		{
+			$i = 0;
+			while ($i < $num)
+			{
+
+				$obj = $db->fetch_object($resql);
+				print '<tr class="oddeven"><td class="nowrap">';
+
+				$myobjectstatic->id=$obj->rowid;
+				$myobjectstatic->ref=$obj->ref;
+				$myobjectstatic->ref_client=$obj->ref_client;
+				$myobjectstatic->total_ht = $obj->total_ht;
+				$myobjectstatic->total_tva = $obj->total_tva;
+				$myobjectstatic->total_ttc = $obj->total_ttc;
+
+				print $myobjectstatic->getNomUrl(1);
+				print '</td>';
+				print '<td class="nowrap">';
+				print '</td>';
+				print '<td class="right" class="nowrap">'.price($obj->total_ttc).'</td></tr>';
+				$i++;
+				$total += $obj->total_ttc;
+			}
+			if ($total>0)
+			{
+
+				print '<tr class="liste_total"><td>'.$langs->trans("Total").'</td><td colspan="2" class="right">'.price($total)."</td></tr>";
+			}
+		}
+		else
+		{
+
+			print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("NoOrder").'</td></tr>';
+		}
+		print "</table><br>";
+
+		$db->free($resql);
+	}
+	else
+	{
+		dol_print_error($db);
+	}
+}
+END MODULEBUILDER DRAFT MYOBJECT */
+
+
+print '</div><div class="fichetwothirdright">';
+
+
+$NBMAX = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
+$max = $conf->global->MAIN_SIZE_SHORTLIST_LIMIT;
+
+/* BEGIN MODULEBUILDER LASTMODIFIED MYOBJECT
+// Last modified myobject
+if (! empty($conf->nav->enabled) && $user->rights->nav->read)
+{
+	$sql = "SELECT s.rowid, s.ref, s.label, s.date_creation, s.tms";
+	$sql.= " FROM ".MAIN_DB_PREFIX."nav_myobject as s";
+	//if (! $user->rights->societe->client->voir && ! $socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
+	$sql.= " WHERE s.entity IN (".getEntity($myobjectstatic->element).")";
+	//if (! $user->rights->societe->client->voir && ! $socid) $sql.= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
+	//if ($socid)	$sql.= " AND s.rowid = $socid";
+	$sql .= " ORDER BY s.tms DESC";
+	$sql .= $db->plimit($max, 0);
+
+	$resql = $db->query($sql);
+	if ($resql)
+	{
+		$num = $db->num_rows($resql);
+		$i = 0;
+
+		print '<table class="noborder centpercent">';
+		print '<tr class="liste_titre">';
+		print '<th colspan="2">';
+		print $langs->trans("BoxTitleLatestModifiedMyObjects", $max);
+		print '</th>';
+		print '<th class="right">'.$langs->trans("DateModificationShort").'</th>';
+		print '</tr>';
+		if ($num)
+		{
+			while ($i < $num)
+			{
+				$objp = $db->fetch_object($resql);
+
+				$myobjectstatic->id=$objp->rowid;
+				$myobjectstatic->ref=$objp->ref;
+				$myobjectstatic->label=$objp->label;
+				$myobjectstatic->status = $objp->status;
+
+				print '<tr class="oddeven">';
+				print '<td class="nowrap">'.$myobjectstatic->getNomUrl(1).'</td>';
+				print '<td class="right nowrap">';
+				print "</td>";
+				print '<td class="right nowrap">'.dol_print_date($db->jdate($objp->tms), 'day')."</td>";
+				print '</tr>';
+				$i++;
+			}
+
+			$db->free($resql);
+		} else {
+			print '<tr class="oddeven"><td colspan="3" class="opacitymedium">'.$langs->trans("None").'</td></tr>';
+		}
+		print "</table><br>";
+	}
+}
+*/
+
+print '</div></div>';
+
+// End of page
+llxFooter();
+$db->close();

+ 3 - 0
custom/nav/sql/dolibarr_allversions.sql

@@ -0,0 +1,3 @@
+--
+-- Script run when an upgrade of Dolibarr is done. Whatever is the Dolibarr version.
+--

+ 30 - 0
custom/nav/sql/llx_nav_action.key.sql

@@ -0,0 +1,30 @@
+-- Copyright (C) 2023 Deák Ferenc
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program.  If not, see https://www.gnu.org/licenses/.
+
+
+-- BEGIN MODULEBUILDER INDEXES
+ALTER TABLE llx_nav_action ADD INDEX idx_nav_action_rowid (rowid);
+ALTER TABLE llx_nav_action ADD INDEX idx_nav_action_entity (entity);
+ALTER TABLE llx_nav_action ADD INDEX idx_nav_action_ref (ref);
+ALTER TABLE llx_nav_action ADD INDEX idx_nav_action_fk_soc (fk_soc);
+ALTER TABLE llx_nav_action ADD INDEX idx_nav_action_fk_project (fk_project);
+ALTER TABLE llx_nav_action ADD CONSTRAINT llx_nav_action_fk_user_creat FOREIGN KEY (fk_user_creat) REFERENCES llx_user(rowid);
+ALTER TABLE llx_nav_action ADD INDEX idx_nav_action_status (status);
+-- END MODULEBUILDER INDEXES
+
+--ALTER TABLE llx_nav_action ADD UNIQUE INDEX uk_nav_action_fieldxy(fieldx, fieldy);
+
+--ALTER TABLE llx_nav_action ADD CONSTRAINT llx_nav_action_fk_field FOREIGN KEY (fk_field) REFERENCES llx_nav_myotherobject(rowid);
+

+ 39 - 0
custom/nav/sql/llx_nav_action.sql

@@ -0,0 +1,39 @@
+-- Copyright (C) 2023 Deák Ferenc
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program.  If not, see https://www.gnu.org/licenses/.
+
+
+CREATE TABLE llx_nav_action(
+	-- BEGIN MODULEBUILDER FIELDS
+	rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, 
+	entity integer DEFAULT 1 NOT NULL, 
+	ref varchar(128) DEFAULT '(PROV)' NOT NULL, 
+	label varchar(255), 
+	amount double DEFAULT NULL, 
+	qty real, 
+	fk_soc integer, 
+	fk_project integer, 
+	description text, 
+	note_public text, 
+	note_private text, 
+	date_creation datetime NOT NULL, 
+	tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 
+	fk_user_creat integer NOT NULL, 
+	fk_user_modif integer, 
+	last_main_doc varchar(255), 
+	import_key varchar(14), 
+	model_pdf varchar(255), 
+	status integer NOT NULL
+	-- END MODULEBUILDER FIELDS
+) ENGINE=innodb;

+ 39 - 0
custom/nav/sql/llx_nav_action.sql.back

@@ -0,0 +1,39 @@
+-- Copyright (C) 2023 Deák Ferenc
+--
+-- This program is free software: you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation, either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program.  If not, see https://www.gnu.org/licenses/.
+
+
+CREATE TABLE llx_nav_action(
+	-- BEGIN MODULEBUILDER FIELDS
+	rowid integer AUTO_INCREMENT PRIMARY KEY NOT NULL, 
+	entity integer DEFAULT 1 NOT NULL, 
+	ref varchar(128) DEFAULT '(PROV)' NOT NULL, 
+	label varchar(255), 
+	amount double DEFAULT NULL, 
+	qty real, 
+	fk_soc integer, 
+	fk_project integer, 
+	description text, 
+	note_public text, 
+	note_private text, 
+	date_creation datetime NOT NULL, 
+	tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, 
+	fk_user_creat integer NOT NULL, 
+	fk_user_modif integer, 
+	last_main_doc varchar(255), 
+	import_key varchar(14), 
+	model_pdf varchar(255), 
+	status integer NOT NULL
+	-- END MODULEBUILDER FIELDS
+) ENGINE=innodb;

+ 19 - 0
custom/nav/sql/llx_nav_action_extrafields.key.sql

@@ -0,0 +1,19 @@
+-- Copyright (C) 2023 Deák Ferenc
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+
+
+-- BEGIN MODULEBUILDER INDEXES
+ALTER TABLE llx_nav_action_extrafields ADD INDEX idx_action_fk_object(fk_object);
+-- END MODULEBUILDER INDEXES

+ 23 - 0
custom/nav/sql/llx_nav_action_extrafields.sql

@@ -0,0 +1,23 @@
+-- Copyright (C) 2023 Deák Ferenc
+--
+-- This program is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU General Public License as published by
+-- the Free Software Foundation; either version 3 of the License, or
+-- (at your option) any later version.
+--
+-- This program is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+-- GNU General Public License for more details.
+--
+-- You should have received a copy of the GNU General Public License
+-- along with this program. If not, see https://www.gnu.org/licenses/.
+
+create table llx_nav_action_extrafields
+(
+  rowid                     integer AUTO_INCREMENT PRIMARY KEY,
+  tms                       timestamp,
+  fk_object                 integer NOT NULL,
+  import_key                varchar(14)                          		-- import key
+) ENGINE=innodb;
+

+ 304 - 0
custom/nav/test/phpunit/NavFunctionalTest.php

@@ -0,0 +1,304 @@
+<?php
+/* Copyright (C) 2007-2017 Laurent Destailleur  <eldy@users.sourceforge.net>
+ * Copyright (C) 2022 Deák Ferenc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ */
+
+/**
+ * \file    test/phpunit/NavFunctionalTest.php
+ * \ingroup nav
+ * \brief   Example Selenium test.
+ *
+ * Put detailed description here.
+ */
+
+namespace test\functional;
+
+use PHPUnit_Extensions_Selenium2TestCase_WebDriverException;
+
+/**
+ * Class NavFunctionalTest
+ *
+ * Requires chromedriver for Google Chrome
+ * Requires geckodriver for Mozilla Firefox
+ *
+ * @fixme Firefox (Geckodriver/Marionette) support
+ * @todo Opera linux support
+ * @todo Windows support (IE, Google Chrome, Mozilla Firefox, Safari)
+ * @todo OSX support (Safari, Google Chrome, Mozilla Firefox)
+ *
+ * @package Testnav
+ */
+class NavFunctionalTest extends \PHPUnit_Extensions_Selenium2TestCase
+{
+	// TODO: move to a global configuration file?
+	/** @var string Base URL of the webserver under test */
+	protected static $base_url = 'http://dev.zenfusion.fr';
+	/**
+	 * @var string Dolibarr admin username
+	 * @see authenticate
+	 */
+	protected static $dol_admin_user = 'admin';
+	/**
+	 * @var string Dolibarr admin password
+	 * @see authenticate
+	 */
+	protected static $dol_admin_pass = 'admin';
+	/** @var int Dolibarr module ID */
+	private static $module_id = 500000; // TODO: autodetect?
+
+	/** @var array Browsers to test with */
+	public static $browsers = array(
+		array(
+			'browser' => 'Google Chrome on Linux',
+			'browserName' => 'chrome',
+			'sessionStrategy' => 'shared',
+			'desiredCapabilities' => array()
+		),
+		// Geckodriver does not keep the session at the moment?!
+		// XPath selectors also don't seem to work
+		//array(
+		//    'browser' => 'Mozilla Firefox on Linux',
+		//    'browserName' => 'firefox',
+		//    'sessionStrategy' => 'shared',
+		//    'desiredCapabilities' => array(
+		//        'marionette' => true,
+		//    ),
+		//)
+	);
+
+	/**
+	 * Helper function to select links by href
+	 *
+	 * @param  string  $value      Href
+	 * @return mixed               Helper string
+	 */
+	protected function byHref($value)
+	{
+		$anchor = null;
+		$anchors = $this->elements($this->using('tag name')->value('a'));
+		foreach ($anchors as $anchor) {
+			if (strstr($anchor->attribute('href'), $value)) {
+				break;
+			}
+		}
+		return $anchor;
+	}
+
+	/**
+	 * Global test setup
+	 * @return void
+	 */
+	public static function setUpBeforeClass()
+	{
+	}
+
+	/**
+	 * Unit test setup
+	 * @return void
+	 */
+	public function setUp()
+	{
+		$this->setSeleniumServerRequestsTimeout(3600);
+		$this->setBrowserUrl(self::$base_url);
+	}
+
+	/**
+	 * Verify pre conditions
+	 * @return void
+	 */
+	protected function assertPreConditions()
+	{
+	}
+
+	/**
+	 * Handle Dolibarr authentication
+	 * @return void
+	 */
+	private function authenticate()
+	{
+		try {
+			if ($this->byId('login')) {
+				$login = $this->byId('username');
+				$login->clear();
+				$login->value('admin');
+				$password = $this->byId('password');
+				$password->clear();
+				$password->value('admin');
+				$this->byId('login')->submit();
+			}
+		} catch (PHPUnit_Extensions_Selenium2TestCase_WebDriverException $e) {
+			// Login does not exist. Assume we are already authenticated
+		}
+	}
+
+	/**
+	 * Test enabling developer mode
+	 * @return bool
+	 */
+	public function testEnableDeveloperMode()
+	{
+		$this->url('/admin/const.php');
+		$this->authenticate();
+		$main_features_level_path = '//input[@value="MAIN_FEATURES_LEVEL"]/following::input[@type="text"]';
+		$main_features_level = $this->byXPath($main_features_level_path);
+		$main_features_level->clear();
+		$main_features_level->value('2');
+		$this->byName('update')->click();
+		// Page reloaded, we need a new XPath
+		$main_features_level = $this->byXPath($main_features_level_path);
+		return $this->assertEquals('2', $main_features_level->value(), "MAIN_FEATURES_LEVEL value is 2");
+	}
+
+	/**
+	 * Test enabling the module
+	 *
+	 * @depends testEnableDeveloperMode
+	 * @return bool
+	 */
+	public function testModuleEnabled()
+	{
+		$this->url('/admin/modules.php');
+		$this->authenticate();
+		$module_status_image_path = '//a[contains(@href, "'.self::$module_id.'")]/img';
+		$module_status_image = $this->byXPath($module_status_image_path);
+		if (strstr($module_status_image->attribute('src'), 'switch_off.png')) {
+			// Enable the module
+			$this->byHref('modNav')->click();
+		} else {
+			// Disable the module
+			$this->byHref('modNav')->click();
+			// Reenable the module
+			$this->byHref('modNav')->click();
+		}
+		// Page reloaded, we need a new Xpath
+		$module_status_image = $this->byXPath($module_status_image_path);
+		return $this->assertContains('switch_on.png', $module_status_image->attribute('src'), "Module enabled");
+	}
+
+	/**
+	 * Test access to the configuration page
+	 *
+	 * @depends testModuleEnabled
+	 * @return bool
+	 */
+	public function testConfigurationPage()
+	{
+		$this->url('/custom/nav/admin/setup.php');
+		$this->authenticate();
+		return $this->assertContains('nav/admin/setup.php', $this->url(), 'Configuration page');
+	}
+
+	/**
+	 * Test access to the about page
+	 *
+	 * @depends testConfigurationPage
+	 * @return bool
+	 */
+	public function testAboutPage()
+	{
+		$this->url('/custom/nav/admin/about.php');
+		$this->authenticate();
+		return $this->assertContains('nav/admin/about.php', $this->url(), 'About page');
+	}
+
+	/**
+	 * Test about page is rendering Markdown
+	 *
+	 * @depends testAboutPage
+	 * @return bool
+	 */
+	public function testAboutPageRendersMarkdownReadme()
+	{
+		$this->url('/custom/nav/admin/about.php');
+		$this->authenticate();
+		return $this->assertEquals(
+			'Dolibarr Module Template (aka My Module)',
+			$this->byTag('h1')->text(),
+			"Readme title"
+		);
+	}
+
+	/**
+	 * Test box is properly declared
+	 *
+	 * @depends testModuleEnabled
+	 * @return bool
+	 */
+	public function testBoxDeclared()
+	{
+		$this->url('/admin/boxes.php');
+		$this->authenticate();
+		return $this->assertContains('navwidget1', $this->source(), "Box enabled");
+	}
+
+	/**
+	 * Test trigger is properly enabled
+	 *
+	 * @depends testModuleEnabled
+	 * @return bool
+	 */
+	public function testTriggerDeclared()
+	{
+		$this->url('/admin/triggers.php');
+		$this->authenticate();
+		return $this->assertContains(
+			'interface_99_modNav_NavTriggers.class.php',
+			$this->byTag('body')->text(),
+			"Trigger declared"
+		);
+	}
+
+	/**
+	 * Test trigger is properly declared
+	 *
+	 * @depends testTriggerDeclared
+	 * @return bool
+	 */
+	public function testTriggerEnabled()
+	{
+		$this->url('/admin/triggers.php');
+		$this->authenticate();
+		return $this->assertContains(
+			'tick.png',
+			$this->byXPath('//td[text()="interface_99_modNav_MyTrigger.class.php"]/following::img')->attribute('src'),
+			"Trigger enabled"
+		);
+	}
+
+	/**
+	 * Verify post conditions
+	 * @return void
+	 */
+	protected function assertPostConditions()
+	{
+	}
+
+	/**
+	 * Unit test teardown
+	 * @return void
+	 */
+	public function tearDown()
+	{
+	}
+
+	/**
+	 * Global test teardown
+	 * @return void
+	 */
+	public static function tearDownAfterClass()
+	{
+	}
+}